Skip to content

Instantly share code, notes, and snippets.

@dekuNukem
Created March 29, 2016 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekuNukem/fb2a38c1fa13a0aae4d8 to your computer and use it in GitHub Desktop.
Save dekuNukem/fb2a38c1fa13a0aae4d8 to your computer and use it in GitHub Desktop.
keyboard interrupt demo for FAP Z80 computer
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