fixed gfx2.horizontal_line problem with monochrome stippling mode (regression since version 9.0)

todo
This commit is contained in:
Irmen de Jong 2023-08-07 21:56:02 +02:00
parent 017ef8a837
commit 0bf8378fcb
3 changed files with 36 additions and 33 deletions

View File

@ -156,8 +156,8 @@ gfx2 {
} }
sub horizontal_line(uword x, uword y, uword length, ubyte color) { sub horizontal_line(uword x, uword y, uword length, ubyte color) {
ubyte[9] masked_ends = [ 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110, %11111111]
ubyte[9] masked_starts = [ 0, %00000001, %00000011, %00000111, %00001111, %00011111, %00111111, %01111111, %11111111] ubyte[9] masked_starts = [ 0, %00000001, %00000011, %00000111, %00001111, %00011111, %00111111, %01111111, %11111111]
ubyte[9] masked_ends = [ 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110, %11111111]
if length==0 if length==0
return return
@ -168,11 +168,21 @@ gfx2 {
if separate_pixels as uword > length if separate_pixels as uword > length
separate_pixels = lsb(length) separate_pixels = lsb(length)
if separate_pixels { if separate_pixels {
if monochrome_dont_stipple_flag {
position(x,y) position(x,y)
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
cx16.VERA_DATA0 = cx16.VERA_DATA0 | masked_starts[separate_pixels] if color
length -= separate_pixels cx16.VERA_DATA0 |= masked_starts[separate_pixels]
else
cx16.VERA_DATA0 &= ~masked_starts[separate_pixels]
x += separate_pixels x += separate_pixels
} else {
repeat separate_pixels {
plot(x, y, color)
x++
}
}
length -= separate_pixels
} }
if length { if length {
position(x, y) position(x, y)
@ -211,8 +221,18 @@ _loop lda length
_done _done
}} }}
if monochrome_dont_stipple_flag {
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
cx16.VERA_DATA0 = cx16.VERA_DATA0 | masked_ends[separate_pixels] if color
cx16.VERA_DATA0 |= masked_ends[separate_pixels]
else
cx16.VERA_DATA0 &= ~masked_ends[separate_pixels]
} else {
repeat separate_pixels {
plot(x, y, color)
x++
}
}
} }
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off again cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off again
} }

View File

@ -2,7 +2,6 @@ TODO
==== ====
- investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... - investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
- IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction - IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified! - IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified!

View File

@ -1,29 +1,13 @@
%import textio %import gfx2
%zeropage basicsafe %zeropage dontuse
main { main {
sub start() { sub start () {
ubyte a = 2 gfx2.screen_mode(5)
ubyte var1 = 3 gfx2.monochrome_stipple(true)
ubyte var2 = 10 gfx2.disc(320, 240, 140, 1)
if a==2 and a<=10 { gfx2.monochrome_stipple(false)
a++ gfx2.disc(320, 240, 90, 1)
} gfx2.disc(320, 240, 40, 0)
if a==var1 and a<=var2 {
a++
}
txt.print_ub(a) ; 4
byte sa = 2
byte svar1 = 3
byte svar2 = 10
if sa==2 and sa<=10 {
sa++
}
if sa==svar1 and sa<=svar2 {
sa++
}
txt.print_b(sa) ; 4 code 28f
} }
} }