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.
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.
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.
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
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.
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.
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.
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.