cardiograph-computer/javascript-old/test-programs/keypad.asm

30 lines
684 B
NASM

;; Test keypad input
;; 2023-08-16
; The latest keypress is shown in the top left corner of the display.
; A loop counter is shown in the top right corner; the program ends when it reaches zero.
; (For a 4x4 display.)
#LOOPCOUNT $80
#Z 1 ; the zero flag is #1
#keypad $20 ; magic memory location containing latest key pressed
#loopIter $FF ; address of loop iterator
#iterPx $03 ; where to display iterator
#keyPx $00 ; where to display key
LDA #LOOPCOUNT
STO #loopIter
@loop
LDA (#loopIter)
STO #iterPx ; display loop iterator
LDA (#keypad)
STO #keyPx ; display latest keypress
LDA (#loopIter)
SUB 1
STO #loopIter
FTG #Z
FHP #Z
END
JMP @loop