gfx2 optimizations for vertical lines

This commit is contained in:
Irmen de Jong 2020-12-29 01:36:08 +01:00
parent 51f32677b7
commit f80e462d25
2 changed files with 14 additions and 8 deletions

View File

@ -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++

View File

@ -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")