Created
March 29, 2016 14:17
-
-
Save dekuNukem/fb2a38c1fa13a0aae4d8 to your computer and use it in GitHub Desktop.
keyboard interrupt demo for FAP Z80 computer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include helper.z80 | |
org 0x0 | |
jmp program_start | |
org 0x10 ; interrupt vector table | |
.dw 0x3000 ; keyboard interrupt at 0x3000 | |
org 0x100 | |
program_start: | |
ld a, 0 | |
ld i, a ; load interrupt register | |
ld sp, 0x7fff ; set up stack | |
im 2 ; select interupt mode 2 | |
call enable_vram_copy | |
ei ; enable interrupt | |
ld d, 0 | |
ld e, 0 | |
ld b, 0x39 ; set text color to orange | |
end: jp end ; do nothing | |
kb_isr: ; keyboard ISR at 0x3000 | |
org 0x3000 | |
di ; disable interrupt first | |
in a, (0) ; read keyboard port | |
ld c, a ; print it on screen | |
call print | |
ei ; enable interrupt again | |
reti |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment