.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