diff --git a/compiler/res/prog8lib/cx16/gfx2.p8 b/compiler/res/prog8lib/cx16/gfx2.p8 index 18fd5a230..5c947efab 100644 --- a/compiler/res/prog8lib/cx16/gfx2.p8 +++ b/compiler/res/prog8lib/cx16/gfx2.p8 @@ -212,15 +212,21 @@ _done sub vertical_line(uword x, uword y, uword height, ubyte color) { if active_mode==1 { - ; TODO for the 320x256 8bbp mode use vera auto increment - repeat lsb(height) { - plot(x, y, color) - y++ - } + position(x,y) + ; set vera auto-increment to 320 pixel increment (=next line) + cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) | (14<<4) + %asm {{ + ldy height + lda color +- sta cx16.VERA_DATA0 + dey + bne - + }} return } ; note for the 1 bpp modes we can't use vera's auto increment mode because we have to 'or' the pixel data in place. + ; TODO optimize by manually advancing the vera's data pointer (note stipple and black color!) repeat height { plot(x, y, color) y++ diff --git a/examples/cx16/testgfx2.p8 b/examples/cx16/testgfx2.p8 index 85ec6dcac..07ff304cf 100644 --- a/examples/cx16/testgfx2.p8 +++ b/examples/cx16/testgfx2.p8 @@ -7,7 +7,7 @@ main { sub start() { - gfx2.screen_mode(1) + gfx2.screen_mode(128) uword pixels = memory("pixels", 320) uword yy = 10 @@ -16,8 +16,8 @@ main { uword cnt pp=pixels - for xx in 10 to 300 { - gfx2.vertical_line(xx, 10, 220, 1) + for xx in 0 to 639 { + gfx2.vertical_line(xx, 0, 480, 1) } gfx2.screen_mode(255) txt.print("done!\n")