Use actual values from sd card

This commit is contained in:
Byron Lathi
2023-08-15 19:30:11 -07:00
parent dfdb41a875
commit 68ff523b10
4 changed files with 84 additions and 66 deletions

View File

@@ -5,12 +5,18 @@
.feature string_escapes
.MACPACK generic
.MACPACK longbranch
_console_clear = $0
_console_read_char = $2
_console_write_char = $4
_sd_readblock = $6
sectors_per_cluster = $800D
reserved_sectors = $800E
fat_count = $8010
sectors_per_fat = $8024
buf = $8200
addrh = $0000
addrl = $0000
@@ -34,15 +40,26 @@ _main:
ldx #>str
jsr _cputs
; we need to read from data segment 0, that will be the first directory entry
; that has sector offset $00ef_e000
lda #<_addr
ldx #>_addr
jsr pushax
lda #$00
sta sreg
lda #$00
sta sreg+1
lda #$f0
ldx #$77
lda fat_count
cmp #$2
jne @fail
lda sectors_per_fat
asl
pha
lda sectors_per_fat + 1
rol
tax
pla
adc reserved_sectors
bcc @a
inx
@a: jsr pushax
stz sreg
stz sreg+1
jsr pusheax
lda #<buf
ldx #>buf
@@ -167,6 +184,7 @@ _boot2_str: .asciiz "BOOT2 BIN"
_fail: .asciiz "not bootloader\r\n"
_good: .asciiz "found bootloader!\r\n"
_cluster: .asciiz "cluster: %lx\r\n"
_addr: .asciiz "addr: %x\r\n"
_end:
.res (440+_start-_end)

View File

@@ -2,7 +2,7 @@ MEMORY
{
ZP: start = $0, size = $100, type = rw, define = yes;
KERNEL: start = $1000, size = $7000, type = rw, define = yes;
SDRAM: start = $9000, size = $5000, type = rw, define = yes;
SDRAM: start = $9200, size = $4d00, type = rw, define = yes;
BOOTSECTOR: start = $8000, size = $200, type = rw, define = yes, file = "bootloader.bin";
BOOTLOADER: start = $8200, size = $1000, type = rw, define = yes, file = "boot2.bin";
ROM: start = $F000, size = $1000, file = %O;