Change to 16-bit card ID register

This commit is contained in:
pjht 2022-11-23 10:49:31 -06:00
parent 787be520e9
commit bea0c3979f

16
rom.68k
View File

@ -1,6 +1,6 @@
.long fakestack, start
start:
move.b #0x1, d0 | Find the ROM card
move.w #0x1, d0 | Find the ROM card
bra.b find_first_card
romfindret:
move.l a0, a6 | Save the ROM card IO base in a6 for later
@ -8,7 +8,7 @@ romfindret:
bsr.b find_largest_ram | Find the largest RAM card and put the IO base in a5
move.l a0, a5
move.l d0, d7
move.b #0x4, d0 | Find a storage card and put the IO base in a4
move.w #0x4, d0 | Find a storage card and put the IO base in a4
bsr.b find_first_card
move.l a0, a4
| Transfer the bootsector load code to the ROM's
@ -22,7 +22,7 @@ romfindret:
jmp (a6) | Jump to the ramcode
ramcode:
move.b #0x0, (0xFE, a6) | Disable the ROM
move.b #0x0, (0xF2, a6) | Disable the ROM
move.l #0x1, (a5) | Enable the RAM at base 0x0
move.l d7, a7
| Load sector 0 to 0x0
@ -35,15 +35,15 @@ ramcode_end:
nop | Padding to make sure ramcode_end and find_first_card are different
| Finds the first card with the type in d0.b, and returns it's IO base address in a0, or 0 if not found
| Finds the first card with the type in d0.w, and returns it's IO base address in a0, or 0 if not found
| Clobbers d1
find_first_card:
move.l #0xff0000, a0 | a0 holds the address of the current card
ffc_loop:
lea (0x100,a0), a0 | adda.l #$100,a0 ; Move to the next card
move.b (0xff, a0), d1 | Load the type of the card into d1
move.w (0xfe, a0), d1 | Load the type of the card into d1
beq.b ffc_done | If the type is 0 (empty slot), we have scanned all cards, so exit the loop
cmp.b d0, d1 | If the card is the type we want, return with the address in a0
cmp.w d0, d1 | If the card is the type we want, return with the address in a0
beq.b ffc_done
bra.b ffc_loop | Loop back and check the next card
ffc_done:
@ -57,9 +57,9 @@ find_largest_ram:
move.l #0xff0000, a1 | a1 holds the address of the current card
flr_loop:
lea (0x100,a1), a1 | adda.l #$100,a0 ; Move to the next card
move.b (0xff, a1), d1 | Load the type of the card into d1
move.w (0xfe, a1), d1 | Load the type of the card into d1
beq.b flr_done | If the type is 0 (empty slot), we have scanned all cards, so exit the loop
cmp.b #0x2, d1 | If the card isn't a RAM card, skip it
cmp.w #0x2, d1 | If the card isn't a RAM card, skip it
bne.b flr_loop
move.l (0x4, a1), d1 | Load the card's size into d1
cmp.l d0, d1 | If the current size is less than the largest size found, go back to the start of the loop