Remove scan_cards and add find_first_card

scan_cards is unnecessary for the 68k, as it makes more sense to return
the IO base address instead of a card index.
This commit is contained in:
pjht 2022-10-10 15:47:06 -05:00
parent 1d5e061a6c
commit 11084131f6
2 changed files with 14 additions and 18 deletions

View File

@ -1,18 +1,15 @@
.global scan_cards
.global find_first_card
scan_cards:
move.l #(card_types + 255), a0
move.w #0xFF, d0
move.l #0xFFFFFF, a1
1:
move.b (a1), d1
move.b d1, (a0)
lea (-0x100, a1), a1
lea (-0x1, a0), a0
dbra d0, 1b
rts
.bss
card_types:
.ds.b 256
| Finds the first card with the type in d0.b, 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
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
beq.b ffc_done
bra.b ffc_loop | Loop back and check the next card
ffc_done:
rts

View File

@ -1,4 +1,3 @@
.global _start
_start:
bsr.b scan_cards
stop #0x2700