Another cursor refactoring/fix. I *think* it is okay now.

This commit is contained in:
Bobbi Webber-Manners 2023-01-10 16:45:18 -05:00
parent 7dd1e4ec28
commit aa7272a1cf
5 changed files with 67 additions and 26 deletions

Binary file not shown.

View File

@ -157,7 +157,7 @@ INKEYGO CLI ; Enable IRQs
JSR GETCHRC ; Get character under cursor
STA COPYCHAR ; Save char under edit cursor
LDA CURSORED
JSR SHOWCURSOR ; Display edit cursor [ON]
JSR SHOWWTCURSOR ; Show write cursor
JSR COPYSWAP1 ; Swap to copy cursor
INKEYGO2 JSR GETCHRC ; Get character under cursor
STA OLDCHAR
@ -175,13 +175,13 @@ INKEY0 ADC FLASHER
LDA OLDCHAR ; Prepare to remove cursor
BIT FLASHER
BPL INKEY1 ; Do not remove cursor
JSR REMCURSOR ; Cursor off [OFF]
JSR REMRDCURSOR ; Remove read cursor
BRA INKEY3
INKEY1 LDA CURSOR ; Add cursor
BIT VDUSTATUS
BVC INKEY2
LDA CURSORCP
INKEY2 JSR SHOWCURSOR ; Cursor on [ON]
INKEY2 JSR SHOWRDCURSOR ; Show read cursor
INKEY3 LDA #$27 ; Prepare to return CHR$27 if Escape state
CLC
BIT ESCFLAG ; Check Escape state
@ -215,10 +215,10 @@ INKEYOK PHA ; Save key or timeout
LDA OLDCHAR ; Prepare for main cursor
BIT VDUSTATUS
BVC INKEYOFF2 ; No editing cursor
JSR REMCURSOR ; Remove cursor [OFF]
JSR REMRDCURSOR ; Remove read cursor
JSR COPYSWAP1 ; Swap cursor back
LDA COPYCHAR ; Remove main cursor
INKEYOFF2 JSR REMCURSOR ; Remove cursor [OFF]
INKEYOFF2 JSR REMWTCURSOR ; Remove write cursor
PLP
BCS INKEYOK3 ; Timeout
LDA ESCFLAG ; Keypress, test for Escape
@ -542,7 +542,7 @@ KEYCURSOR CMP #$C9
BEQ KEYCOPY
PHA
LDA OLDCHAR
JSR REMCURSOR ; Remove cursor [OFF]
JSR REMRDCURSOR ; Remove read cursor
PLA
JSR COPYMOVE ; Move copy cursor
JSR GETCHRC ; Save char under cursor
@ -555,7 +555,7 @@ KEYCOPYTAB LDA FXTABCHAR ; Prepare TAB if no copy cursor
BVC KEYREADOK1 ; No copy cursor, return TAB
LDA OLDCHAR ; Get the char under cursor
PHA
JSR PUTCOPYCURS ; Output it to restore and move cursor [OFF]
JSR PUTCOPYCURS ; Restore and move read cursor [OFF]
JSR GETCHRC ; Save char under cursor
STA OLDCHAR
PLA

View File

@ -224,5 +224,5 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error
RTS ; %000x1xxx host type, 'A'pple
BYTE00A BRK
DB $F7
HELLO ASC 'Applecorn MOS 2022-01-09'
HELLO ASC 'Applecorn MOS 2022-01-10'
DB $00 ; Unify MOS messages

View File

@ -155,7 +155,9 @@ SHRPRCHAR LDX VDUPIXELS ; Pixels per byte
* Plot or unplot a cursor on SHR screen
* On entry: A - character to plot, CS show cursor/CC remove cursor
* On entry: A - character to plot,
* CS show cursor / CC remove cursor
* VS read cursor / VC write cursor
SHRCURSOR PHP ; Preserve flags
PHA ; Preserve character
LDA VDUSTATUS ; If VDU5 mode, bail
@ -182,18 +184,24 @@ SHRCURSOR PHP ; Preserve flags
ADC #>$460 ; $460 is seven rows
STA VDUADDR+1
LDY #$00
LDX #$00
PLA ; Recover character
PLP ; Recover flags
BCC :CURSOROFF
BVC :S2 ; VC: Write cursor
INX ; Advance to 2nd half of :SAVEBYTES
INX
INX
INX
:S2 BCC :CURSOROFF ; CC: Remove cursor
:CURSORON
LDA [VDUADDR],Y ; See if cursor shown
CMP :CURSBYTE
BEQ :DONE
LDX :CURSBYTE
BEQ :DONE ; Cursor shown already, skip
:L1 LDAL [VDUADDR],Y
STA :SAVEBYTES,Y ; Preserve bytes under cursor
TXA ; Byte of cursor data
STA :SAVEBYTES,X ; Preserve bytes under cursor
LDA :CURSBYTE ; Byte of cursor data
STAL [VDUADDR],Y
INX
INY
CPY :BYTES
BNE :L1
@ -201,9 +209,10 @@ SHRCURSOR PHP ; Preserve flags
:CURSOROFF
LDA [VDUADDR],Y ; See if cursor shown
CMP :CURSBYTE
BNE :DONE
:L2 LDA :SAVEBYTES,Y ; Restore bytes under cursor
BNE :DONE ; Cursor not shown, skip
:L2 LDA :SAVEBYTES,X ; Restore bytes under cursor
STAL [VDUADDR],Y
INX
INY
CPY :BYTES
BNE :L2
@ -213,7 +222,7 @@ SHRCURSOR PHP ; Preserve flags
RTS
:BYTES DB $00 ; 2 for 640-mode, 4 for 320-mode
:CURSBYTE DB $00 ; Cursor byte for mode
:SAVEBYTES DS 4 ; Bytes under cursor
:SAVEBYTES DS 8 ; Bytes under cursors
* Write character to SHR screen in 320 pixel mode

View File

@ -280,7 +280,7 @@ COPYMOVE PHA
JSR GETCHRC
STA COPYCHAR
LDA CURSORED
JSR SHOWCURSOR ; Edit cursor [ON]
JSR SHOWWTCURSOR ; Show write cursor
SEC
JSR COPYSWAP2 ; Initialise copy cursor
ROR FLASHER
@ -390,36 +390,68 @@ PRCHR7 PLA
:NOTSHR RTS
* Wrapper around PUTCHRC used when showing cursor
SHOWCURSOR TAX ; Preserve character
* Wrapper around PUTCHRC used when showing the read cursor
* On entry: A - character used for cursor
SHOWRDCURSOR TAX ; Preserve character
BIT VDUSCREEN
BVS :SHR
TXA
JMP PUTCHRC
:SHR TXA ; Recover character
SEC ; Show cursor
SEC ; CS: Show cursor
CLV ; VC: Read cursor
JMP SHRCURSOR
* Wrapper around PUTCHRC used when removing cursor
REMCURSOR TAX ; Preserve character
* Wrapper around PUTCHRC used when showing the write cursor
* On entry: A - character used for cursor
SHOWWTCURSOR TAX ; Preserve character
BIT VDUSCREEN
BVS :SHR
TXA
JMP PUTCHRC
:SHR TXA ; Recover character
CLC ; Remove cursor
SEC ; CS: Show cursor
BIT SETV ; VS: Write cursor
JMP SHRCURSOR
* Wrapper around OUTCHARCP used when drawing copy cursor
* Wrapper around PUTCHRC used when removing the read cursor
* On entry: A - character which was obscured by cursor
REMRDCURSOR TAX ; Preserve character
BIT VDUSCREEN
BVS :SHR
TXA
JMP PUTCHRC
:SHR TXA ; Recover character
CLC ; CC: Remove cursor
CLV ; VC: Read cursor
JMP SHRCURSOR
* Wrapper around PUTCHRC used when removing the write cursor
* On entry: A - character which was obscured by cursor
REMWTCURSOR TAX ; Preserve character
BIT VDUSCREEN
BVS :SHR
TXA
JMP PUTCHRC
:SHR TXA ; Recover character
CLC ; CC: Remove cursor
BIT SETV ; VS: Write cursor
JMP SHRCURSOR
* Wrapper around OUTCHARCP used when drawing the read cursor
* On entry: A - character which was obscured by cursor
PUTCOPYCURS TAX ; Preserve character
BIT VDUSCREEN
BVS :SHR
TXA
JMP OUTCHARCP
:SHR TXA ; Recover character
CLC ; Remove cursor
CLC ; CC: Remove cursor
CLV ; VC: Read cursor
JSR SHRCURSOR
JMP OUTCHARCP2