Implemented plotting points in colour on SHR (GCOL).

This commit is contained in:
Bobbi Webber-Manners 2022-12-30 01:56:18 -05:00
parent ea17972ee8
commit 6a0c91c1e2
3 changed files with 51 additions and 27 deletions

Binary file not shown.

View File

@ -50,6 +50,30 @@ PALETTE640 DB $00, $00 ; BLACK
DB $F0, $0F ; YELLOW
DB $FF, $0F ; WHITE
* Pixel masks for colours in 640 mode
SHRCMASK640 DB %00000000
DB %01010101
DB %10101010
DB %11111111
* Pixel masks for colours in 320 mode
SHRCMASK320 DB $00
DB $11
DB $22
DB $33
DB $44
DB $55
DB $66
DB $77
DB $88
DB $99
DB $AA
DB $BB
DB $CC
DB $DD
DB $EE
DB $FF
* Addresses of start of text rows in SHR
* LS byte is always zero
@ -565,7 +589,7 @@ SHRSETTCOL PHA
PLA
AND #$0F
TAX
LDA :MASKS320,X ; Lookup mask in table
LDA SHRCMASK320,X ; Lookup mask in table
STAL SHRBGMASKL ; Set colour mask (BG)
STAL SHRBGMASKL+1
STA SHRBGMASKA
@ -573,7 +597,7 @@ SHRSETTCOL PHA
:FORE320 PLA
AND #$0F
TAX
LDA :MASKS320,X ; Lookup mask in table
LDA SHRCMASK320,X ; Lookup mask in table
STAL SHRCOLMASKL ; Set colour mask (FG)
STAL SHRCOLMASKL+1
RTS
@ -582,7 +606,7 @@ SHRSETTCOL PHA
PLA
AND #$03
TAX
LDA :MASKS640,X ; Lookup mask in table
LDA SHRCMASK640,X ; Lookup mask in table
STAL SHRBGMASKL ; Set colour mask (BG)
STAL SHRBGMASKL+1
STA SHRBGMASKA
@ -590,30 +614,10 @@ SHRSETTCOL PHA
:FORE640 PLA
AND #$03
TAX
LDA :MASKS640,X ; Lookup mask in table
LDA SHRCMASK640,X ; Lookup mask in table
STAL SHRCOLMASKL ; Set colour mask (FG)
STAL SHRCOLMASKL+1
RTS
:MASKS640 DB %00000000
DB %01010101
DB %10101010
DB %11111111
:MASKS320 DB $00
DB $11
DB $22
DB $33
DB $44
DB $55
DB $66
DB $77
DB $88
DB $99
DB $AA
DB $BB
DB $CC
DB $DD
DB $EE
DB $FF
* Set graphics colour
@ -627,7 +631,18 @@ SHRSETTCOL PHA
* 5 = NUL no change to pixel
* 6 = CLR clear pixel to background
* 7 = UND undefined
SHRSETGCOL
SHRSETGCOL LDX VDUPIXELS ; Pixels per byte
CPX #$02 ; 2 is 320-mode (MODE 1)
BNE :MODE0
TAY
LDA SHRCMASK320,Y
BRA :S1
:MODE0 TAY
LDA SHRCMASK640,Y
:S1 >>> WRTMAIN
STA SHRGFXMASK
STX SHRGFXACTION
>>> WRTAUX
RTS

View File

@ -17,6 +17,8 @@ SHRFONTXPLD EQU $A000 ; Explode SHR font to $E1:A000
SHRPIXELS DB $00 ; Main memory copy of VDUPIXELS
SHRVDUQ DS 16 ; Main memory copy of VDUQ
SHRGFXMASK DB $00 ; Colour mask for point plotting
SHRGFXACTION DB $00 ; GCOL action for point plotting
* Explode font to generate SHRFONTXPLD table
@ -238,8 +240,15 @@ SHRPLOT >>> ENTMAIN
AND #$03 ; Keep LSB two bits only
TAX ; Index into :BITS640
LDA [A3L],Y ; Write to screen
ORA :BITS640,X ; OR with bit pattern for pixels
LDA :BITS640,X ; Get bit pattern for pixel to set
EOR #$FF ; Invert bits
AND [A3L],Y ; Load existing byte, clearing pixel
STA A1L
LDA :BITS640,X ; Get bit pattern for pixel to set
AND SHRGFXMASK ; Mask to set colour
ORA A1L ; OR into existing byte
* TODO: Apple SHRGFXACTION GCOL action
STA [A3L],Y ; Write to screen
>>> XF2AUX,GFXPLOTRET