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) {
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_ends = [ 0, %10000000, %11000000, %11100000, %11110000, %11111000, %11111100, %11111110, %11111111]
if length==0
return
@ -168,11 +168,21 @@ gfx2 {
if separate_pixels as uword > length
separate_pixels = lsb(length)
if separate_pixels {
if monochrome_dont_stipple_flag {
position(x,y)
cx16.VERA_ADDR_H &= %00000111 ; vera auto-increment off
cx16.VERA_DATA0 = cx16.VERA_DATA0 | masked_starts[separate_pixels]
length -= separate_pixels
if color
cx16.VERA_DATA0 |= masked_starts[separate_pixels]
else
cx16.VERA_DATA0 &= ~masked_starts[separate_pixels]
x += separate_pixels
} else {
repeat separate_pixels {
plot(x, y, color)
x++
}
}
length -= separate_pixels
}
if length {
position(x, y)
@ -211,8 +221,18 @@ _loop lda length
_done
}}
if monochrome_dont_stipple_flag {
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
}

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 ....
- 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!

View File

@ -1,29 +1,13 @@
%import textio
%zeropage basicsafe
%import gfx2
%zeropage dontuse
main {
sub start() {
ubyte a = 2
ubyte var1 = 3
ubyte var2 = 10
if a==2 and a<=10 {
a++
}
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
sub start () {
gfx2.screen_mode(5)
gfx2.monochrome_stipple(true)
gfx2.disc(320, 240, 140, 1)
gfx2.monochrome_stipple(false)
gfx2.disc(320, 240, 90, 1)
gfx2.disc(320, 240, 40, 0)
}
}