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