Files
super6502/sw/bios/bootloader.s
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

73 lines
959 B
ArmAsm

.importzp sp, ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, sreg
.autoimport on
.feature string_escapes
.MACPACK generic
_console_clear = $0
_console_read_char = $2
_console_write_char = $4
_sd_readblock = $6
buf = $8200
addrh = $0000
addrl = $0001
.segment "BOOTSECTOR"
_start:
jmp _main
.byte "SUPR6502"
_preamble:
.res (11+_start-_preamble)
_bpb: .res 60
_main:
lda #<str
ldx #>str
jsr _cputs
lda #<addrh
sta sreg
lda #>addrh
sta sreg + 1
lda #<addrl
ldx #>addrl
jsr pusheax
lda #<buf
ldx #>buf
jsr pushax
lda #<ptr1
ldx #>ptr1
jsr _SD_readSingleBlock
lda #<buf
ldx #>buf
jsr _SD_printBuf
@end: bra @end
str: .asciiz "Hello from the bootloader!\r\n"
_end:
.res (440+_start-_end)
.res 6
.res 16
.res 16
.res 16
.res 16
.byte $55
.byte $AA