Please note that joystick will work too if you use theses primitives because telemon traps joystick too.
Waiting to key
.include "telestrat.inc"
; set the header
@loop:
BRK_TELEMON XRD0
bcc key_pressed
jmp loop
@key_pressed:
; At this step A contains ASCII Key pressed
Trying to find key pressed
.include "telestrat.inc"
; set the header
@loop:
BRK_TELEMON XRD0 ; Reads keyboard
bcc key_pressed ; waiting for a key pressed
jmp @loop ; no key pressed, loop
@key_pressed:
; At this step A contains ASCII Key pressed
cmp #27 ; is it ESC
bne @not_esc ; it's not key pressed