Compare commits

...

4 Commits

Author SHA1 Message Date
Bobbi Webber-Manners 24669a7ce0 Moved SHR cursor code to mainmem 2023-01-16 22:47:04 -05:00
Bobbi Webber-Manners 93588a6a8d Tiny tweak to SHRCLR24 2023-01-16 19:43:44 -05:00
Bobbi Webber-Manners 6016c59eeb Fix #267 - clear line 25 on starting MODE0 or 1 2023-01-16 19:29:55 -05:00
Bobbi Webber-Manners 4c8deecbf8 Removed commented out code 2023-01-16 19:25:30 -05:00
3 changed files with 102 additions and 78 deletions

Binary file not shown.

View File

@ -119,70 +119,25 @@ SHRPRCHAR LDX VDUPIXELS ; Pixels per byte
* VS read cursor / VC write cursor
* The read and write cursors have separate save-unders in :SAVEBYTES
SHRCURSOR PHP ; Preserve flags
PHA ; Preserve character
PHA ; Preserve A
LDA VDUSTATUS ; If VDU5 mode, bail
AND #$20
BNE :BAIL
LDA VDUPIXELS ; Pixels per byte
CMP #$02 ; 2 is 320-mode (MODE 1)
BNE :MODE0
LDA #$04 ; 4 bytes in 320 mode
LDX #$71 ; White/red
BRA :S1
:MODE0 LDA #$02 ; 2 bytes in 640 mode
LDX #%11011101 ; White/red/white/red
:S1 STA :BYTES ; Bytes per char
STX :CURSBYTE
LDA #$E1
STA VDUBANK2
BNE SHRCURSBAIL
JSR SHRCHARADDR ; Screen addr in VDUADDR
LDA VDUADDR+0 ; LSB
CLC
ADC #<$460 ; $460 is seven rows
STA VDUADDR+0
LDA VDUADDR+1 ; MSB
ADC #>$460 ; $460 is seven rows
STA VDUADDR+1
LDY #$00
LDX #$00
PLA ; Recover character
PLP ; Recover flags
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 ; Cursor shown already, skip
:L1 LDAL [VDUADDR],Y
STA :SAVEBYTES,X ; Preserve bytes under cursor
LDA :CURSBYTE ; Byte of cursor data
STAL [VDUADDR],Y
INX
INY
CPY :BYTES
BNE :L1
>>> WRTMAIN
LDA VDUADDR+0 ; Copy addr to SHRVDUQ
STA SHRVDUQ+0
LDA VDUADDR+1
STA SHRVDUQ+1
>>> WRTAUX
PLA ; Recover A
PLY ; Flags -> Y
>>> XF2MAIN,SHRCURSM
SHRCURSRET >>> ENTAUX
RTS
:CURSOROFF
LDA [VDUADDR],Y ; See if cursor shown
CMP :CURSBYTE
BNE :DONE ; Cursor not shown, skip
:L2 LDA :SAVEBYTES,X ; Restore bytes under cursor
STAL [VDUADDR],Y
INX
INY
CPY :BYTES
BNE :L2
:DONE RTS
:BAIL PLA ; Fix stack
PLA
SHRCURSBAIL PLA
PLP
RTS
:BYTES DB $00 ; 2 for 640-mode, 4 for 320-mode
:CURSBYTE DB $00 ; Cursor byte for mode
:SAVEBYTES DS 8 ; Bytes under cursors
* Write character to SHR screen in 320 pixel mode
@ -689,6 +644,7 @@ SHRSETGCOL PHA
>>> WRTAUX
RTS
* Wrapper to call SHRDEFPALM (which sets up default palette)
SHRDEFPAL >>> XF2MAIN,SHRDEFPALM
SHRDEFPALRET >>> ENTAUX

View File

@ -90,6 +90,7 @@ SHRXPLDFONT >>> ENTMAIN
INC A
CMP #128 ; 96 chars in FONT8
BNE :L1
JSR SHRCLR24 ; Clear row 24
>>> XF2AUX,SHRV22RET
RTS
@ -198,6 +199,24 @@ SHRXPLDROW LDX SHRPIXELS ; Pixels per byte
:S4 RTS
* Clear text row 24 (0-based index)
SHRCLR24 CLC ; 65816 native mode
XCE
REP #$30 ; 16 bit M & X
MX %00 ; Tell Merlin
LDX #$00
LDA #$00
:L1 STAL $E19800,X
INX
INX
CPX #$0500
BNE :L1
SEC ; 65816 emulation mode
XCE
MX %11 ; Tell Merlin
RTS
* Explode one pixel row of font in 320 mode
* 4 bytes per char, 4 bits per pixel
* On entry: A contains row of font data
@ -256,10 +275,76 @@ SHRCHAR640 PHY ; Preserve Y
RTS
* Handle plotting & unplotting cursors
* On entry: character in A, flags in Y
* pointer to screen address in SHRVDUQ+0..1
SHRCURSM >>> ENTMAIN
PHY ; Preserve flags
PHA ; Preserve character
LDA SHRVDUQ+0 ; Copy pointer to A3L/H
STA A3L
LDA SHRVDUQ+1
STA A3H
LDA #$E1 ; Bank $E1
STA A4L
LDA SHRPIXELS ; Pixels per byte
CMP #$02 ; 2 is 320-mode (MODE 1)
BNE :MODE0
LDA #$04 ; 4 bytes in 320 mode
LDX #$71 ; White/red
BRA :S1
:MODE0 LDA #$02 ; 2 bytes in 640 mode
LDX #%11011101 ; White/red/white/red
:S1 STA :BYTES ; Bytes per char
STX :CURSBYTE
LDA A3L ; LSB
CLC
ADC #<$460 ; $460 is seven rows
STA A3L
LDA A3H ; MSB
ADC #>$460 ; $460 is seven rows
STA A3H
LDY #$00
LDX #$00
PLA ; Recover character
PLP ; Recover flags
BVC :S2 ; VC: Write cursor
INX ; Advance to 2nd half of :SAVEBYTES
INX
INX
INX
:S2 BCC :CURSOROFF ; CC: Remove cursor
:CURSORON
LDAL [A3L],Y ; See if cursor shown
CMP :CURSBYTE
BEQ :DONE ; Cursor shown already, skip
:L1 LDAL [A3L],Y
STA :SAVEBYTES,X ; Preserve bytes under cursor
LDA :CURSBYTE ; Byte of cursor data
STAL [A3L],Y
INX
INY
CPY :BYTES
BNE :L1
>>> XF2AUX,SHRCURSRET
:CURSOROFF
LDAL [A3L],Y ; See if cursor shown
CMP :CURSBYTE
BNE :DONE ; Cursor not shown, skip
:L2 LDA :SAVEBYTES,X ; Restore bytes under cursor
STAL [A3L],Y
INX
INY
CPY :BYTES
BNE :L2
:DONE >>> XF2AUX,SHRCURSRET
:BYTES DB $00 ; 2 for 640-mode, 4 for 320-mode
:CURSBYTE DB $00 ; Cursor byte for mode
:SAVEBYTES DS 8 ; Bytes under cursors
* VDU5 plot char at graphics cursor position
SHRVDU5CH >>> ENTMAIN
* PHP ; Disable interrupts
* SEI
CLC ; 65816 native mode
XCE
REP #$30 ; 16 bit M & X
@ -385,7 +470,6 @@ SHRVDU5CH >>> ENTMAIN
:DONE SEC ; 65816 emulation mode
XCE
MX %11 ; Tell Merlin
* PLP
>>> XF2AUX,SHRPRCH320RET
* Zero page
:COLCTR EQU TMPZP+0
@ -685,8 +769,6 @@ SHRPLOT >>> ENTMAIN
:S1 CMP #$40 ; Plot point
BNE :BAIL ; Other? Bail out
* PHP ; Disable interrupts
* SEI
CLC ; 65816 native mode
XCE
SEP #$30 ; 8 bit M & X
@ -695,7 +777,6 @@ SHRPLOT >>> ENTMAIN
SEC ; 65816 emulation mode
XCE
MX %11 ; Tell Merlin
* PLP ; Resume normal service
BRA :S2
:S2 PLA ; Store prev pt in screen coords
@ -906,8 +987,6 @@ SHRLINE LDA A2L ; y1
INC A
:S1 STA TMPZP+0 ; abs(y1 - y0)
STZ TMPZP+1 ; Pad to 16 bit
* PHP ; Disable interrupts
* SEI
CLC ; 65816 native mode
XCE
REP #$30 ; 16 bit M & X
@ -1019,7 +1098,6 @@ SHRLINELO MX %00 ; Tell merlin 16 bit M & X
SEC ; 65816 emulation mode
XCE
MX %11 ; Tell Merlin
* PLP ; Resume normal service
RTS
* Zero page
:DX EQU TMPZP+0 ; dx initially, then (2 * (dy - dx))
@ -1111,8 +1189,6 @@ SHRLINEHI MX %00 ; Tell Merlin 16 bit M & X
* from 1280x1024 to 640x200 or 320x200
* On return: X-coordinate in A1L/H, Y-coordinate in A2L (A2H=0)
SHRCOORD MAC
* PHP ; Disable interrupts
* SEI
CLC ; 65816 native mode
XCE
REP #$30 ; 16 bit M & X
@ -1160,7 +1236,6 @@ SHRCOORDM0 LDA SHRVDUQ+5
SEC ; Back to emulation mode
XCE
MX %11 ; Tell Merlin
* PLP ; Normal service resumed
BRA SHRCOORDEND
SHRCOORDNEG MX %00 ; Tell Merlin we are 16 bit
@ -1235,8 +1310,6 @@ SHRCOORD2M0 LDA SHRVDUQ,X
* Clear the graphics window
SHRVDU16 >>> ENTMAIN
* PHP ; Disable interrupts
* SEI
CLC ; 816 native mode
XCE
REP #$30 ; 16 bit M & X
@ -1333,7 +1406,6 @@ SHRVDU16 >>> ENTMAIN
SEC ; Back to 6502 emu mode
XCE
MX %11 ; Tell Merlin
* PLP ; Normal service resumed
>>> XF2AUX,SHRCLRRET
:LEFT320 DB %11111111
DB %00001111
@ -1386,8 +1458,6 @@ SHRVDU16V PHA
* Validate graphics window parms & store if okay
* First 8 bytes of SHRVDUQ: left, bottom, right, top
SHRVDU24 >>> ENTMAIN
* PHP ; Disable interrupts
* SEI
CLC ; 65816 native mode
XCE
REP #$30 ; 16 bit M & X
@ -1418,11 +1488,9 @@ SHRVDU24 >>> ENTMAIN
SEC ; 65816 emulation mode
XCE
* PLP
>>> XF2AUX,VDU24RET
:BAD SEC ; 65816 emulation mode
XCE
* PLP
>>> XF2AUX,VDUXXRET