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