os/kernel/cards.68k
pjht 11084131f6 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.
2022-10-10 15:47:06 -05:00

16 lines
621 B
Plaintext

.global find_first_card
| 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