collapseos/kernel/zxspectrum/kbd.asm
devisn 0576d2dfa1
a recipe for the ZX Spectrum (#105)
* Add files via upload

* a monolithic build recipe for ZX Spectrum

* emulation and emulated tapes in README.md
2020-06-11 13:34:34 -04:00

16 lines
306 B
NASM

; the ZX Spectrum BASIC firmware scans the keyboard for ASCII codes on clock interrupts
; this routine just waits for a key and reads its value
k_getc:
;ei
push hl
ld hl, 23611 ; ZXS_FLAGS
res 5, (hl)
.loop:
bit 5, (hl) ; pressed?
jr z, .loop
ld hl, 23560 ; ZXS_LASTK
ld a, (hl)
pop hl
ret