mirror of
https://github.com/bobbimanners/Applecorn.git
synced 2025-02-08 00:30:37 +00:00
RDCH/INKEY exits correctly with already set Escape state
This fixes the Pascal *Help/Press Escape bug. It was caused by RDCH/INKEY exiting with the flags wrong if Escape already set on entry.
This commit is contained in:
parent
29a688c5f3
commit
412408ce81
@ -29,6 +29,9 @@
|
|||||||
* 30-Nov-2021 With *FX4,<>0 TAB returns $09, allows eg VIEW to work.
|
* 30-Nov-2021 With *FX4,<>0 TAB returns $09, allows eg VIEW to work.
|
||||||
* 15-Oct-2022 Replace calling KBDCHKESC with ESCPOLL, does translations, etc.
|
* 15-Oct-2022 Replace calling KBDCHKESC with ESCPOLL, does translations, etc.
|
||||||
* Fixed bug with cursor keys after *FX4,2. OSRDCH enables IRQs.
|
* Fixed bug with cursor keys after *FX4,2. OSRDCH enables IRQs.
|
||||||
|
* 23-Oct-2022 Escape: BYTE7E needed to ESCPOLL, INKEYESC unbalanced stack.
|
||||||
|
* 03-Nov-2022 Escape: Fixed INKEY loop failing if entering with previous Escape,
|
||||||
|
* combined with EscAck clearing keyboard.
|
||||||
|
|
||||||
|
|
||||||
* Hardware locations
|
* Hardware locations
|
||||||
@ -162,8 +165,10 @@ INKEY1 LDA CURSOR ; Add cursor
|
|||||||
BVC INKEY2
|
BVC INKEY2
|
||||||
LDA CURSORCP
|
LDA CURSORCP
|
||||||
INKEY2 JSR PUTCHRC ; Toggle cursor
|
INKEY2 JSR PUTCHRC ; Toggle cursor
|
||||||
INKEY3 LDA ESCFLAG
|
INKEY3 LDA #$27 ; Prepare to return CHR$27 if Escape state
|
||||||
BMI INKEYOK ; Escape pending, return it
|
CLC
|
||||||
|
BIT ESCFLAG ; Check Escape state
|
||||||
|
BMI INKEYESC ; Escape pending, return it with A=27
|
||||||
INKEY4 JSR KEYREAD ; Test for input, all can be trashed
|
INKEY4 JSR KEYREAD ; Test for input, all can be trashed
|
||||||
PLY
|
PLY
|
||||||
BCC INKEYOK ; Char returned, return it
|
BCC INKEYOK ; Char returned, return it
|
||||||
@ -186,8 +191,8 @@ INKEY8 BIT KBDDATA
|
|||||||
BPL INKEY8 ; Wait for VBLK change
|
BPL INKEY8 ; Wait for VBLK change
|
||||||
BMI INKEYLP ; Loop back to key test
|
BMI INKEYLP ; Loop back to key test
|
||||||
|
|
||||||
INKEYOUT PLA ; Drop stacked Y
|
INKEYOUT LDA #$FF ; Prepare to stack $FF
|
||||||
LDA #$FF ; Prepare to stack $FF
|
INKEYESC PLY ; Drop stacked Y
|
||||||
INKEYOK PHA ; Save key or timeout
|
INKEYOK PHA ; Save key or timeout
|
||||||
PHP ; Save CC=key, CS=timeout
|
PHP ; Save CC=key, CS=timeout
|
||||||
LDA OLDCHAR ; Prepare for main cursor
|
LDA OLDCHAR ; Prepare for main cursor
|
||||||
@ -197,7 +202,6 @@ INKEYOK PHA ; Save key or timeout
|
|||||||
JSR COPYSWAP1 ; Swap cursor back
|
JSR COPYSWAP1 ; Swap cursor back
|
||||||
LDA COPYCHAR ; Remove main cursor
|
LDA COPYCHAR ; Remove main cursor
|
||||||
INKEYOFF2 JSR PUTCHRC ; Remove cursor
|
INKEYOFF2 JSR PUTCHRC ; Remove cursor
|
||||||
*
|
|
||||||
PLP
|
PLP
|
||||||
BCS INKEYOK3 ; Timeout
|
BCS INKEYOK3 ; Timeout
|
||||||
LDA ESCFLAG ; Keypress, test for Escape
|
LDA ESCFLAG ; Keypress, test for Escape
|
||||||
@ -427,21 +431,22 @@ KBDDONE RTS
|
|||||||
|
|
||||||
* Poll the keyboard to update Escape state
|
* Poll the keyboard to update Escape state
|
||||||
* On exit, MI=Escape state pending
|
* On exit, MI=Escape state pending
|
||||||
* A,X,Y=preserved
|
* CC=key pressed, CS=no key pressed
|
||||||
|
* A=character
|
||||||
|
* X,Y=preserved
|
||||||
*
|
*
|
||||||
ESCPOLL PHA ; KBDTEST corrupts A
|
ESCPOLL BIT SETV ; Set V
|
||||||
BIT SETV ; Set V
|
|
||||||
JSR KBDTEST ; VS - test keyboard
|
JSR KBDTEST ; VS - test keyboard
|
||||||
BCS ESCPOLL9 ; No keypress pending
|
BCS ESCPOLL9 ; No keypress pending
|
||||||
PHX ; KBDREAD corrupts A,X
|
PHX ; KBDREAD corrupts A,X
|
||||||
JSR KBDREAD2 ; Read key and check for Escape
|
JSR KBDREAD2 ; Read key and check for Escape, returns CC
|
||||||
PLX
|
PLX
|
||||||
ESCPOLL9 PLA
|
ESCPOLL9 BIT ESCFLAG ; Return with Escape state
|
||||||
BIT ESCFLAG ; Return with Escape state
|
|
||||||
RTS
|
RTS
|
||||||
|
|
||||||
* Process pending Escape state
|
* Process pending Escape state
|
||||||
BYTE7E LDX #$00 ; $7E = ack detection of ESC
|
BYTE7E STA KBDACK ; Flush keyboard
|
||||||
|
LDX #$00 ; $7E = ack detection of ESC
|
||||||
BIT ESCFLAG
|
BIT ESCFLAG
|
||||||
BPL BYTE7DOK ; No Escape pending
|
BPL BYTE7DOK ; No Escape pending
|
||||||
LDA FXESCEFFECT ; Process Escape effects
|
LDA FXESCEFFECT ; Process Escape effects
|
||||||
|
17
auxmem.vdu.s
17
auxmem.vdu.s
@ -321,6 +321,23 @@ VDU127 JSR VDU08 ; Move cursor back
|
|||||||
|
|
||||||
* Display character at current (TEXTX,TEXTY)
|
* Display character at current (TEXTX,TEXTY)
|
||||||
PRCHRC PHA ; Save character
|
PRCHRC PHA ; Save character
|
||||||
|
BIT ESCFLAG
|
||||||
|
BMI :RESUME
|
||||||
|
JSR ESCPOLL
|
||||||
|
* BRA :RESUME
|
||||||
|
|
||||||
|
BCS :RESUME
|
||||||
|
BMI :RESUME
|
||||||
|
CMP #$13
|
||||||
|
BNE :RESUME
|
||||||
|
:PAUSE0
|
||||||
|
JSR ESCPOLL
|
||||||
|
BMI :RESUME
|
||||||
|
BCS :PAUSE0
|
||||||
|
CMP #$11
|
||||||
|
BNE :PAUSE0
|
||||||
|
BRA :RESUME
|
||||||
|
|
||||||
LDA KEYBOARD
|
LDA KEYBOARD
|
||||||
BPL :RESUME ; No key pressed
|
BPL :RESUME ; No key pressed
|
||||||
EOR #$80
|
EOR #$80
|
||||||
|
Loading…
x
Reference in New Issue
Block a user