1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00
cc65/libsrc/telestrat/kbhit.s

30 lines
610 B
ArmAsm
Raw Normal View History

2021-02-01 16:53:07 +00:00
;
; Jede, 2021-02-01
;
; int kbhit (void);
;
.export _kbhit
2022-04-25 22:40:16 +00:00
.import store_char
2021-02-01 16:53:07 +00:00
.include "telestrat.inc"
_kbhit:
2022-04-26 08:23:38 +00:00
lda store_char ; Check if a key has been detected previously
2022-04-25 22:40:16 +00:00
beq @call_telemon ; No, calls Telemon routine
lda #$01 ; There is a key pressed previously, return 1
ldx #$00
rts
2022-04-26 09:10:07 +00:00
@call_telemon:
2021-02-01 16:53:07 +00:00
BRK_TELEMON XRD0
2022-04-25 22:40:16 +00:00
ldx #$00
2022-04-25 22:40:16 +00:00
bcs @no_char_action
sta store_char
lda #$01
rts
@no_char_action:
tax
2021-02-01 16:53:07 +00:00
rts