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:
parent
1d5e061a6c
commit
11084131f6
@ -1,18 +1,15 @@
|
|||||||
.global scan_cards
|
.global find_first_card
|
||||||
|
|
||||||
scan_cards:
|
| Finds the first card with the type in d0.b, and returns it's IO base address in a0, or 0 if not found
|
||||||
move.l #(card_types + 255), a0
|
| Clobbers d1
|
||||||
move.w #0xFF, d0
|
find_first_card:
|
||||||
move.l #0xFFFFFF, a1
|
move.l #0xff0000, a0 | a0 holds the address of the current card
|
||||||
1:
|
ffc_loop:
|
||||||
move.b (a1), d1
|
lea (0x100, a0), a0 | adda.l #$100, a0 | Move to the next card
|
||||||
move.b d1, (a0)
|
move.b (0xff, a0), d1 | Load the type of the card into d1
|
||||||
lea (-0x100, a1), a1
|
beq.b ffc_done | If the type is 0 (empty slot), we have scanned all cards, so exit the loop
|
||||||
lea (-0x1, a0), a0
|
cmp.b d0, d1 | If the card is the type we want, return with the address in a0
|
||||||
dbra d0, 1b
|
beq.b ffc_done
|
||||||
rts
|
bra.b ffc_loop | Loop back and check the next card
|
||||||
|
ffc_done:
|
||||||
|
rts
|
||||||
.bss
|
|
||||||
card_types:
|
|
||||||
.ds.b 256
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
.global _start
|
.global _start
|
||||||
_start:
|
_start:
|
||||||
bsr.b scan_cards
|
|
||||||
stop #0x2700
|
stop #0x2700
|
||||||
|
Loading…
Reference in New Issue
Block a user