Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HandleUSBEvents:
- ld a, (ModelID)
- cp 2
- jp nc, ResumeInterrupt ; Leave if we don't have the hardware
- in a, (55h) ; Read USB status
- bit 0, a
- jr z, UnknownUSBEvent
- bit 2, a
- jr z, USBLineInterrupt
- bit 4, a
- jp z, USBProtocolInterrupt
- jp ResumeInterrupt
- UnknownUSBEvent:
- halt
- xor a
- out (5Bh), a ; Unknown event, WikiTI claims you should zero port 5B to acknowledge
- jp ResumeInterrupt
- USBLineInterrupt:
- in a, (56h)
- ld c, a
- xor 0FFh
- ld b, a
- in a, (57h)
- ld c, a
- and b
- out (57h), a
- ld a, c
- out (57h), a ; Ack the interrupt without doing anything special
- jp ResumeInterrupt
- USBProtocolInterrupt:
- in a, (86h)
- ld c, a
- in a, (84h)
- ld b, a
- in a, (82h) ; Just ack and leave, and hope that it doesn't get angry
- jp ResumeInterrupt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement