fixed gfx2.plot in mode 1+5 with certain combinations of color and stipple

This commit is contained in:
Irmen de Jong 2023-08-07 23:56:57 +02:00
parent 0bf8378fcb
commit a82d21ac05
2 changed files with 91 additions and 52 deletions

View File

@ -580,6 +580,8 @@ _done
when active_mode { when active_mode {
1 -> { 1 -> {
; lores monochrome ; lores monochrome
if color {
; solid color or perhaps stipple
%asm {{ %asm {{
lda x lda x
eor y eor y
@ -587,28 +589,16 @@ _done
and #1 and #1
}} }}
if_nz { if_nz {
mode_1_prepare()
%asm {{ %asm {{
lda x
and #7
pha ; xbits
}}
x /= 8
x += y*(320/8)
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda x+1
sta cx16.VERA_ADDR_M
lda x
sta cx16.VERA_ADDR_L
ply ; xbits
lda bits,y
ldy color
beq +
tsb cx16.VERA_DATA0 tsb cx16.VERA_DATA0
bra ++ }}
+ trb cx16.VERA_DATA0 }
+ } else {
; only erase
mode_1_prepare()
%asm {{
trb cx16.VERA_DATA0
}} }}
} }
} }
@ -631,6 +621,8 @@ _done
} }
5 -> { 5 -> {
; highres monochrome ; highres monochrome
if color {
; solid color or perhaps stipple
%asm {{ %asm {{
lda x lda x
eor y eor y
@ -638,28 +630,16 @@ _done
and #1 and #1
}} }}
if_nz { if_nz {
mode_5_prepare()
%asm {{ %asm {{
lda x
and #7
pha ; xbits
}}
x /= 8
x += y*(640/8)
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda x+1
sta cx16.VERA_ADDR_M
lda x
sta cx16.VERA_ADDR_L
ply ; xbits
lda bits,y
ldy color
beq +
tsb cx16.VERA_DATA0 tsb cx16.VERA_DATA0
bra ++ }}
+ trb cx16.VERA_DATA0 }
+ } else {
; only erase
mode_5_prepare()
%asm {{
trb cx16.VERA_DATA0
}} }}
} }
} }
@ -690,6 +670,46 @@ _done
}} }}
} }
} }
sub mode_1_prepare() {
%asm {{
lda x
and #7
pha ; xbits
}}
x /= 8
x += y*(320/8)
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda x+1
sta cx16.VERA_ADDR_M
lda x
sta cx16.VERA_ADDR_L
ply ; xbits
lda bits,y
}}
}
sub mode_5_prepare() {
%asm {{
lda x
and #7
pha ; xbits
}}
x /= 8
x += y*(640/8)
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda x+1
sta cx16.VERA_ADDR_M
lda x
sta cx16.VERA_ADDR_L
ply ; xbits
lda bits,y
}}
}
} }
sub pget(uword @zp x, uword y) -> ubyte { sub pget(uword @zp x, uword y) -> ubyte {

View File

@ -4,10 +4,29 @@
main { main {
sub start () { sub start () {
gfx2.screen_mode(5) gfx2.screen_mode(5)
gfx2.monochrome_stipple(false)
for cx16.r0 in 100 to 200 {
for cx16.r1 in 100 to 110 {
gfx2.plot(cx16.r0, cx16.r1, 1)
}
}
gfx2.monochrome_stipple(true) gfx2.monochrome_stipple(true)
for cx16.r0 in 100 to 200 {
for cx16.r1 in 110 to 120 {
gfx2.plot(cx16.r0, cx16.r1, 1)
}
}
gfx2.monochrome_stipple(true)
for cx16.r0 in 110 to 190 {
for cx16.r1 in 105 to 115 {
gfx2.plot(cx16.r0, cx16.r1, 0)
}
}
gfx2.disc(320, 240, 140, 1) gfx2.disc(320, 240, 140, 1)
gfx2.monochrome_stipple(false) gfx2.monochrome_stipple(false)
gfx2.disc(320, 240, 90, 1) gfx2.disc(320, 240, 100, 0)
gfx2.disc(320, 240, 40, 0)
} }
} }