fix gfx2 vertical_line

This commit is contained in:
Irmen de Jong 2020-12-29 22:53:53 +01:00
parent c81952c356
commit e09b65ea94
3 changed files with 44 additions and 21 deletions

View File

@ -217,10 +217,12 @@ _done
cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) | (14<<4)
%asm {{
ldy height
beq +
lda color
- sta cx16.VERA_DATA0
dey
bne -
+
}}
return
}
@ -228,6 +230,10 @@ _done
; 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.
cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) ; no auto advance
cx16.r15 = gfx2.plot.bits[x as ubyte & 7] ; bitmask
if active_mode>=128
cx16.r14 = 640/8
else
cx16.r14 = 320/8
if color {
if monochrome_dont_stipple_flag {
repeat height {
@ -237,7 +243,7 @@ _done
sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L
clc
adc #640/8 ; advance vera data ptr to go to the next line
adc cx16.r14 ; advance vera ptr to go to the next line
sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M
adc #0
@ -248,7 +254,8 @@ _done
}}
}
} else {
; stippling
; stippling.
height = (height+1)/2
%asm {{
lda x
eor y
@ -256,21 +263,21 @@ _done
bne +
lda cx16.VERA_ADDR_L
clc
adc #<640/8*1 ; advance vera data ptr to go to the next line, for correct stipple pattern
adc cx16.r14 ; advance vera ptr to go to the next line for correct stipple pattern
sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M
adc #0
sta cx16.VERA_ADDR_M
+
lsr height+1
ror height
asl cx16.r14
ldy height
beq +
- lda cx16.VERA_DATA0
ora cx16.r15
sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L
clc
adc #<640/8*2 ; advance vera data ptr to go to the next-next line
adc cx16.r14 ; advance vera data ptr to go to the next-next line
sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M
adc #0
@ -280,6 +287,7 @@ _done
; sta cx16.VERA_ADDR_H
dey
bne -
+
}}
}
} else {
@ -291,7 +299,7 @@ _done
sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L
clc
adc #640/8 ; advance vera data ptr to go to the next line
adc cx16.r14 ; advance vera data ptr to go to the next line
sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M
adc #0

View File

@ -11,7 +11,7 @@ main {
uword pixels = memory("pixels", 320)
uword yy = 10
uword xx = gfx2.width/2
uword xx
uword pp
uword cnt
pp=pixels
@ -24,17 +24,14 @@ main {
for xx in 0 to 639 {
gfx2.vertical_line(xx, 0, 480, 0)
}
cx16.wait(200)
gfx2.screen_mode(255)
txt.print("done!\n")
return
for cnt in 0 to 319 {
@(pp) = 255
pp++
}
xx=gfx2.width/2
yy=10
gfx2.monochrome_stipple(false)
linesy()
linesx()
@ -42,6 +39,8 @@ main {
linesy()
linesx()
sub linesx() {
repeat 8 {
gfx2.horizontal_line(10,yy,300,3)
@ -126,7 +125,7 @@ main {
xx+=4
}
; cx16.wait(3*60)
cx16.wait(3*60)
gfx2.screen_mode(255)
txt.print("done!\n")

View File

@ -9,14 +9,23 @@ main {
sub start () {
; differences between:
; @(pp) = cnt as ubyte
; @(pp) = lsb(cnt)
; @(pp) = msb(cnt)
; repeat w as ubyte / repeat lsb(w)
uword cnt
ubyte ub
; stack based evaluation for this function call even when it's inlined:
; gfx2.next_pixel((cnt as ubyte) + 30)
; TODO differences between:
repeat cnt as ubyte { ; TODO this goes via stack
ub++
}
repeat lsb(cnt) { ; TODO this doesnt
ub++
}
; TODO stack based evaluation for this function call even when it's inlined:
next_pixel((cnt as ubyte) + 30)
test_stack.test()
@ -24,4 +33,11 @@ main {
}
inline asmsub next_pixel(ubyte color @A) {
%asm {{
nop
}}
}
}