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.
This commit is contained in:
Byron Lathi
2023-08-08 22:16:42 -07:00
parent e73c4e1d08
commit 6b0caea84c
13 changed files with 46 additions and 501 deletions

41
sw/bios/bootloader.s Normal file
View File

@@ -0,0 +1,41 @@
.importzp sp, ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3
.autoimport on
.feature string_escapes
.MACPACK generic
_console_clear = $0
_console_read_char = $2
_console_write_char = $4
_sd_readblock = $6
.segment "BOOTSECTOR"
_start:
jmp _main
.byte "SUPR6502"
_main:
lda #<str
ldx #>str
jsr _cputs
@end: bra @end
str: .asciiz "Hello from the bootloader!\r\n"
_end:
.res (446+_start-_end)
.res 16
.res 16
.res 16
.res 16
.byte $55
.byte $AA