This allows you to find the cluster number of a file in the root
directory by name. The main program is a simple demo where you can type
in a filename and it will tell you the cluster number.
Eventually I want the kernel to be loaded from the SD card as well, but
it still needs to separate from user programs.
At some point there should be a folder just for the BIOS, which should
read from the boot block of the SD card and start executing, and thats
it.
All of the SD card commands are moved into their own file, with
functions sd_init, sd_get_rca, sd_select_card, sd_get_status, and
sd_readblock.
The FAT functions are movied into fat.c and give functions fat_init and
fat_read. Note that the filename is ignored for now, it always reads the
first file in the root directory.
The loading of o65 files is done in o65.c, and executing is done in
exec.c
This cleans up the main file signifigantly and leaves the project open
to expansion.
This will read the data from the sd card, copy it to the originally
linked address (no relocation), then execute it.
I am lazy and wrote it in C using weird function pointer casting but
this would probably be more efficient if it were to be written in
assembly instead.
The test program simply returns 'A', but that is enough to prove that it
is actually running.
This adds a test program which can be loaded and executed by the host.
It simply returns a value in the `a` register.
The linker script is modified so that it will output an o65 file, and
the memory sgments are changed as well. There is no STARTUP segment
defined, so it uses the default `none` crt0, which sets up the stack
and does initialization and deconstruction.
The Makefile is modified to not turn the output into an intel hex file,
and instead keep it as the o65 file.
Prints out information about the drive, now inside its own function.
Also changes the read function to take in a 32 bit address instead of a
16 bit one.
Attempts to read the first file on the disk
Polls the sd controller until the read flag is set, at which point it
reads 32 bits of data from the controller.
long response codes (such as CID) are not supported in hw or sw.
These series of commands are enough to read the first 512b block off of
the sd card. The RCA is hard coded to the sd card that I have on hand,
since response codes are not supported
This code creates a shared mapping in high ram, makes sure that that
works, and also makes sure that the memory which is mapped over is left
unchanged.
Replace RAM section with SDRAM.
Really this makes no difference than before we added SDRAM except the
name is different. In hardware, the SDRAM acts the same way and is
located in the same space as the RAM was previously.
Currently an interrupt is triggered any time there is any activity on
the UART_RXD line, but later it will only trigger once there is data
ready to be read.