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) cx16.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) | (14<<4)
%asm {{ %asm {{
ldy height ldy height
beq +
lda color lda color
- sta cx16.VERA_DATA0 - sta cx16.VERA_DATA0
dey dey
bne - bne -
+
}} }}
return 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. ; 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.VERA_ADDR_H = (cx16.VERA_ADDR_H & %00000111) ; no auto advance
cx16.r15 = gfx2.plot.bits[x as ubyte & 7] ; bitmask 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 color {
if monochrome_dont_stipple_flag { if monochrome_dont_stipple_flag {
repeat height { repeat height {
@ -237,7 +243,7 @@ _done
sta cx16.VERA_DATA0 sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L lda cx16.VERA_ADDR_L
clc 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 sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M lda cx16.VERA_ADDR_M
adc #0 adc #0
@ -248,7 +254,8 @@ _done
}} }}
} }
} else { } else {
; stippling ; stippling.
height = (height+1)/2
%asm {{ %asm {{
lda x lda x
eor y eor y
@ -256,21 +263,21 @@ _done
bne + bne +
lda cx16.VERA_ADDR_L lda cx16.VERA_ADDR_L
clc 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 sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M lda cx16.VERA_ADDR_M
adc #0 adc #0
sta cx16.VERA_ADDR_M sta cx16.VERA_ADDR_M
+ +
lsr height+1 asl cx16.r14
ror height
ldy height ldy height
beq +
- lda cx16.VERA_DATA0 - lda cx16.VERA_DATA0
ora cx16.r15 ora cx16.r15
sta cx16.VERA_DATA0 sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L lda cx16.VERA_ADDR_L
clc 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 sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M lda cx16.VERA_ADDR_M
adc #0 adc #0
@ -280,6 +287,7 @@ _done
; sta cx16.VERA_ADDR_H ; sta cx16.VERA_ADDR_H
dey dey
bne - bne -
+
}} }}
} }
} else { } else {
@ -291,7 +299,7 @@ _done
sta cx16.VERA_DATA0 sta cx16.VERA_DATA0
lda cx16.VERA_ADDR_L lda cx16.VERA_ADDR_L
clc 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 sta cx16.VERA_ADDR_L
lda cx16.VERA_ADDR_M lda cx16.VERA_ADDR_M
adc #0 adc #0

View File

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

View File

@ -9,14 +9,23 @@ main {
sub start () { sub start () {
; differences between: uword cnt
; @(pp) = cnt as ubyte ubyte ub
; @(pp) = lsb(cnt)
; @(pp) = msb(cnt)
; repeat w as ubyte / repeat lsb(w)
; 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() test_stack.test()
@ -24,4 +33,11 @@ main {
} }
inline asmsub next_pixel(ubyte color @A) {
%asm {{
nop
}}
}
} }