1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00
cc65/libsrc/telestrat/cgetc.s

43 lines
1.2 KiB
ArmAsm
Raw Normal View History

2017-10-01 21:23:03 +00:00
;
; jede jede@oric.org 2017-10-01
;
.export _cgetc
2019-02-05 22:27:52 +00:00
2017-10-08 16:11:09 +00:00
.import cursor
2019-02-05 22:27:52 +00:00
2022-04-25 22:40:16 +00:00
.export store_char
2017-10-01 21:23:03 +00:00
.include "telestrat.inc"
.proc _cgetc
2022-04-25 22:40:16 +00:00
; This routine could be quicker if we wrote in page 2 variables,
; But it's better to use telemon routine in that case, because telemon can manage 4 I/O
ldx cursor ; If cursor equal to 0, then switch off cursor
2017-10-08 16:11:09 +00:00
beq switchoff_cursor
2019-02-05 22:27:52 +00:00
2017-10-08 16:11:09 +00:00
ldx #$00 ; x is the first screen
2022-04-25 22:40:16 +00:00
BRK_TELEMON(XCSSCR) ; Display cursor
jmp start ; Could be replaced by a bne/beq but 'jmp' is cleaner than a bne/beq which could expect some matters
2019-02-05 22:27:52 +00:00
switchoff_cursor:
2022-04-25 22:40:16 +00:00
; At this step X is equal to $00, X must be set, because it's the id of the screen (telestrat can handle 4 virtuals screen)
BRK_TELEMON(XCOSCR) ; Switch off cursor
2019-02-05 22:27:52 +00:00
2022-04-25 22:40:16 +00:00
start:
lda store_char ; Does kbhit store a value in store_char ?
bne @out ; Yes, we returns A and we reset store_char
@wait_key:
BRK_TELEMON XRD0 ; Waits until key is pressed
bcs @wait_key
ldx #$00
rts
@out:
ldx #$00
stx store_char
2017-10-01 21:23:03 +00:00
rts
2019-02-05 22:27:52 +00:00
.endproc
2022-04-26 12:14:27 +00:00
.bss
2022-04-25 22:40:16 +00:00
store_char:
.byte 0