Commit Graph

230 Commits

Author SHA1 Message Date
Byron Lathi
851c26e4dd Print out filenames as we read them 2023-08-21 20:02:57 -07:00
Byron Lathi
de9353a009 Find kernel in second stage bootloader 2023-08-21 19:33:52 -07:00
Byron Lathi
906516c4b5 Add comments and use less magic 2023-08-15 23:06:10 -07:00
Byron Lathi
68ff523b10 Use actual values from sd card 2023-08-15 19:30:11 -07:00
Byron Lathi
dfdb41a875 Automatically copy rom image and warn about rebuild 2023-08-14 23:44:51 -07:00
Byron Lathi
a657957ae2 Load a multi-sector file and execute it 2023-08-14 20:44:27 -07:00
Byron Lathi
3bd022107e Read start cluster 2023-08-14 20:21:03 -07:00
Byron Lathi
937a04c891 Remove some debug info 2023-08-12 19:16:46 -07:00
Byron Lathi
053b0d7e3e Find bootloader in FAT 2023-08-12 19:03:24 -07:00
Byron Lathi
fd9389268a Load root directory from sd card 2023-08-12 16:09:03 -07:00
Byron Lathi
7039e649bb Update cc65 2023-08-12 12:28:16 -07:00
Byron Lathi
7ad1079289 Restart kernel 2023-08-12 11:59:45 -07:00
Byron Lathi
069ae5db4b Update format script
I think there may still be some issues with a drive that is formatted
wrong, but it works consistently right now.

When modifying the boot sector, it now leaves alone the partition tables
and the bios parameter block. This does reduce the amount of code from
510 bytes to 380, but this is find as it only takes about 29 bytes to
load a sector into memory.
2023-08-09 22:46:18 -07:00
Byron Lathi
d191c1da5b Modify disk script to leave partition table intact 2023-08-08 23:52:57 -07:00
Byron Lathi
6b0caea84c Link bootloader with bios to get access to symbols
By doing this we don't need to call bios functions, we can just jsr
directly to the addresses. This does mean that everytime the bios
changes the bootloader has to change, but ideally all the bootloader
does is load the bios and then get remapped out of memory. Any important
drivers like file system can be loaded from the bootloader.

This also means that the runtime functions are located in the bios for
the bootloader, so the rom will have to stay mapped in until the kernel
is started, at which point it will have its own runtime and the rom and
bootloader are no longer needed.
2023-08-08 22:16:42 -07:00
Byron Lathi
e73c4e1d08 Rewrite readblock in assembly 2023-08-08 19:28:10 -07:00
Byron Lathi
446f4e7539 Get bios calls starting to work 2023-08-06 21:41:15 -07:00
Byron Lathi
6b42843f4b remote testing code 2023-07-31 20:03:59 -07:00
Byron Lathi
18b8ac7ccf Rename bootloader to bios, add actual bootloader 2023-07-31 19:58:32 -07:00
Byron Lathi
096472e084 Get SD card reads working 2023-07-23 22:44:19 -07:00
Byron Lathi
d16675ed3c Consolidate resp3 and resp7, fix stack issue
wasn't pushing res to stack, which makes stack pointer wrong
2023-07-23 21:45:54 -07:00
Byron Lathi
7e958c8a11 powerupseq assembly rewrite 2023-07-23 19:00:39 -07:00
Byron Lathi
8f3a1a5968 res1_cmd assembly rewrite 2023-07-23 18:43:39 -07:00
Byron Lathi
1c693b029d readres3 assembly rewrite 2023-07-23 18:25:29 -07:00
Byron Lathi
028a431189 readres2 and readbytes assembly rewrite 2023-07-23 18:00:22 -07:00
Byron Lathi
2ef463846f Consolidate another res1 function 2023-07-23 17:30:05 -07:00
Byron Lathi
60072603d9 Rewrite readRes1, consolidate res1 commands 2023-07-23 17:26:40 -07:00
Byron Lathi
709c60cf36 SD_command assembly rewrite 2023-07-23 16:25:13 -07:00
Byron Lathi
5ca5fca29b Get SD card working in SPI 2023-07-23 14:55:14 -07:00
Byron Lathi
6706cc502e Update software to match efinix hw 2023-07-19 21:07:17 -07:00
Byron Lathi
fcae23785e Throw everything up
I think that previously, I had not actually commited any of this to git.
This adds all of the new effinix stuff that I had been working on for
months.

The gist of all of this is that the intel fpga is expensive and does not
exist, whereas the effinix ones are not as expensive and more existant.
This redoes the project to use the dev board, as well as a custom board
that I may or may not make.
2022-10-04 17:15:49 -05:00
Byron Lathi
5c72c574e5 Change link file to output flat binary 2022-04-21 17:37:12 -05:00
Byron Lathi
1a64fa4d62 Change kernel format to bin for merge
We don't have the bootloader reading o65 files right now, so we need to
keep the kernel as a bin file until that is added.
2022-04-20 13:54:07 -05:00
Byron Lathi
1b08d25ce1 Update makefile for tests
use the local sim65 instead of the installed one which doesn't exist
2022-04-20 12:59:32 -05:00
Byron Lathi
aa717685e3 Use our own toolchain instead of the one in the image
Now that we are adding our own target we can compile our own toolchain
instead of using the stock one. This does mean that there isn't really a
purpose to using the alpine cc65 image though
2022-04-20 12:41:20 -05:00
Byron Lathi
686630e79f Remove unused code to make code smaller
These might need to be added back eventually.
2022-04-19 15:35:22 -05:00
Byron Lathi
f3c7ac9696 Replace bios with bootloader, don't use bootsector
Instead of using the bootsector to load a bootloader, just put the
bootloader in the ROM and call it a day. It looks for a file on the SD
card in the root directory named `kernel.bin` and loads it into memory.

This is not a perfect solution, as the kernel will grow larger and the
kernel load address will have to change. At this point I could add back
the bootloader, but that is for later.

Also the bootloader is just a copy of the kernel, so that can be trimmed
down a lot.
2022-04-19 10:34:19 -05:00
Byron Lathi
f664d59497 Copy kernel into root folder after build
This way it gets copied over to the SD card when installing.
2022-04-19 10:33:27 -05:00
Byron Lathi
15a0917bb4 Change kernel to use none target
I forgot that the CI still uses the stock cc65 which doesn't support my
target. The kernel doesn't really need this target though, only the user
programs.
2022-04-18 20:31:11 -05:00
Byron Lathi
4e2e030e52 Add scripts
automates the process of overwriting the boot sector of the SD card and
copying over the filesystem.
2022-04-18 20:29:10 -05:00
Byron Lathi
24d5a8c8ac Add fsdir 2022-04-18 20:29:00 -05:00
Byron Lathi
9f1d527a7c Change kernel link type
Kernel is now compiled and linked into a raw binary instead of intel
hex. This raw binary can be loaded into the correct address by the
bootloader.

I wanted this to be an o65 file, but ld65 kept complaining about it.
Honestly though having this be a straight binary makes it easier to
load, but we can't relocate it.
2022-04-18 20:27:48 -05:00
Byron Lathi
0fadc6a80f Add sw makefile which compiles all subtargets
Usefull now that we have like 4 different folders that need to be
compiled slightly differently
2022-04-18 20:27:05 -05:00
Byron Lathi
72b83d739d Remove unused define 2022-04-18 20:26:59 -05:00
Byron Lathi
9dd460a47f Add preliminary bootloader
This bootloader right now just prints the letter A, but should be
capable of reading blocks from the SD card into memory.
2022-04-18 20:25:08 -05:00
Byron Lathi
54328722ab Rename boot to bios, add sd call
Adds a call that you can make to the BIOS to read sd blocks. Useful for
the bootloader where there is not much space
2022-04-18 20:24:29 -05:00
Byron Lathi
64f6f0b397 Add top level makefile for sw 2022-04-18 12:50:19 -05:00
Byron Lathi
12284d19a9 Create boot environment
The boot environment will read the boot sector from the sd card, verify
that it has the boot signature at the end, then jump to the start of it.

From there, there should be a bootloader written to the boot segment
that can handle the rest.

It might be tight to fit everything into the boot sector but do remember
that you do not have to initialize or select the sd card, and those
functions take up a lot of space.
2022-04-18 12:43:29 -05:00
Byron Lathi
2ff3caccc6 Change user programs to use super6502 target
The target library is a copy of `none` right now but will be built out
later.
2022-04-18 12:12:43 -05:00
Byron Lathi
a9d9bc0619 Allow subdirectories
Can now break apart a filepath into the parent directories and search
for each one of them (not recursively!).
2022-04-17 20:18:43 -05:00