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,35 +580,25 @@ _done
when active_mode {
1 -> {
; lores monochrome
%asm {{
lda x
eor y
ora monochrome_dont_stipple_flag
and #1
}}
if_nz {
if color {
; solid color or perhaps stipple
%asm {{
lda x
and #7
pha ; xbits
eor y
ora monochrome_dont_stipple_flag
and #1
}}
x /= 8
x += y*(320/8)
if_nz {
mode_1_prepare()
%asm {{
tsb cx16.VERA_DATA0
}}
}
} else {
; only erase
mode_1_prepare()
%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
bra ++
+ trb cx16.VERA_DATA0
+
trb cx16.VERA_DATA0
}}
}
}
@ -631,35 +621,25 @@ _done
}
5 -> {
; highres monochrome
%asm {{
lda x
eor y
ora monochrome_dont_stipple_flag
and #1
}}
if_nz {
if color {
; solid color or perhaps stipple
%asm {{
lda x
and #7
pha ; xbits
eor y
ora monochrome_dont_stipple_flag
and #1
}}
x /= 8
x += y*(640/8)
if_nz {
mode_5_prepare()
%asm {{
tsb cx16.VERA_DATA0
}}
}
} else {
; only erase
mode_5_prepare()
%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
bra ++
+ trb cx16.VERA_DATA0
+
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 {

View File

@ -4,10 +4,29 @@
main {
sub start () {
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)
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.monochrome_stipple(false)
gfx2.disc(320, 240, 90, 1)
gfx2.disc(320, 240, 40, 0)
gfx2.disc(320, 240, 100, 0)
}
}