mirror of
https://github.com/cc65/cc65.git
synced 2025-04-04 21:33:30 +00:00
kbhit checks KBEDG and getc resets KBEDG
This commit is contained in:
parent
43f24afe29
commit
78d660da55
@ -20,6 +20,7 @@
|
||||
; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'.
|
||||
|
||||
_cgetc:
|
||||
lda KBEDG
|
||||
bne _start
|
||||
jsr _kbhit ; Check for char available
|
||||
beq _cgetc
|
||||
@ -39,19 +40,19 @@ _start:
|
||||
bit #$08
|
||||
beq @L4 ; Pause + Opt 2 = Flip
|
||||
lda #'?' ; All buttons pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L2:
|
||||
lda KBSTL ; Pause alone was the last placed button
|
||||
and #$0c
|
||||
bne @L1
|
||||
lda #'P' ; Pause pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L3:
|
||||
lda #'R' ; Reset pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L4:
|
||||
lda #'F' ; Flip pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L5:
|
||||
lda KBEDG ; No Pause pressed
|
||||
stz KBEDG
|
||||
@ -61,10 +62,13 @@ _start:
|
||||
bit #$04
|
||||
beq @L6
|
||||
lda #'3' ; opt 1 + opt 2 pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L6:
|
||||
lda #'1' ; opt 1 pressed
|
||||
rts
|
||||
bra reset_and_exit
|
||||
@L7:
|
||||
lda #'2' ; opt 2 pressed
|
||||
|
||||
reset_and_exit:
|
||||
stz KBEDG
|
||||
rts
|
||||
|
@ -29,6 +29,8 @@ KBNPR: .byte 0
|
||||
|
||||
.code
|
||||
_kbhit:
|
||||
lda KBEDG
|
||||
bne L1
|
||||
lda $FCB0 ; Read the Opt buttons
|
||||
and #$0c
|
||||
sta KBTMP
|
||||
@ -49,6 +51,6 @@ _kbhit:
|
||||
sta KBNPR ; inverted previous ones pressed
|
||||
stx KBPRV
|
||||
lda KBEDG
|
||||
@L1: tax ; No new keys hit
|
||||
L1: ldx #$00
|
||||
rts
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user