mirror of
https://github.com/irmen/prog8.git
synced 2024-10-19 22:24:17 +00:00
optimized gfx2.plot() for hires-monochrome
This commit is contained in:
parent
a1e4e9c50f
commit
7f0e25cb50
@ -552,8 +552,6 @@ _done
|
|||||||
ubyte[8] bits = [128, 64, 32, 16, 8, 4, 2, 1]
|
ubyte[8] bits = [128, 64, 32, 16, 8, 4, 2, 1]
|
||||||
ubyte[4] mask4c = [%00111111, %11001111, %11110011, %11111100]
|
ubyte[4] mask4c = [%00111111, %11001111, %11110011, %11111100]
|
||||||
ubyte[4] shift4c = [6,4,2,0]
|
ubyte[4] shift4c = [6,4,2,0]
|
||||||
uword addr
|
|
||||||
cx16.r0L = lsb(x) & 7 ; xbits
|
|
||||||
|
|
||||||
when active_mode {
|
when active_mode {
|
||||||
1 -> {
|
1 -> {
|
||||||
@ -565,6 +563,7 @@ _done
|
|||||||
and #1
|
and #1
|
||||||
}}
|
}}
|
||||||
if_nz {
|
if_nz {
|
||||||
|
cx16.r0L = lsb(x) & 7 ; xbits
|
||||||
x /= 8
|
x /= 8
|
||||||
x += y*(320/8)
|
x += y*(320/8)
|
||||||
%asm {{
|
%asm {{
|
||||||
@ -611,15 +610,25 @@ _done
|
|||||||
and #1
|
and #1
|
||||||
}}
|
}}
|
||||||
if_nz {
|
if_nz {
|
||||||
; TODO get rid of all the vpoke calls to optimize all plot() ?
|
cx16.r0L = lsb(x) & 7 ; xbits
|
||||||
addr = x/8 + y*(640/8)
|
x /= 8
|
||||||
ubyte value = bits[lsb(x)&7]
|
x += y*(640/8)
|
||||||
if color
|
%asm {{
|
||||||
cx16.vpoke_or(0, addr, value)
|
stz cx16.VERA_CTRL
|
||||||
else {
|
stz cx16.VERA_ADDR_H
|
||||||
value = ~value
|
lda x+1
|
||||||
cx16.vpoke_and(0, addr, value)
|
sta cx16.VERA_ADDR_M
|
||||||
}
|
lda x
|
||||||
|
sta cx16.VERA_ADDR_L
|
||||||
|
ldy cx16.r0L ; xbits
|
||||||
|
lda bits,y
|
||||||
|
ldy color
|
||||||
|
beq +
|
||||||
|
tsb cx16.VERA_DATA0
|
||||||
|
bra ++
|
||||||
|
+ trb cx16.VERA_DATA0
|
||||||
|
+
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
6 -> {
|
6 -> {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
gfx2.screen_mode(4) ; lo res 256c
|
gfx2.screen_mode(6) ; highres 4c
|
||||||
gfx2.text_charset(3)
|
gfx2.text_charset(3)
|
||||||
gfx2.text(10, 10, 1, @"Hello!")
|
gfx2.text(10, 10, 1, @"Hello!")
|
||||||
|
|
||||||
@ -14,12 +14,22 @@ main {
|
|||||||
ubyte yy
|
ubyte yy
|
||||||
uword rw
|
uword rw
|
||||||
|
|
||||||
;480 jiffies (highres mono) / 442 jiffies (lores 4c)
|
; 520 jiffies (hires 4c)
|
||||||
repeat 50000 {
|
repeat 20000 {
|
||||||
rw = rndw()
|
rw = rndw()
|
||||||
yy = (lsb(rw) & 127) + 20
|
yy = (lsb(rw) & 127) + 20
|
||||||
gfx2.plot(msb(rw), yy, 1)
|
gfx2.plot(msb(rw), yy, 1)
|
||||||
}
|
}
|
||||||
|
repeat 20000 {
|
||||||
|
rw = rndw()
|
||||||
|
yy = (lsb(rw) & 127) + 20
|
||||||
|
gfx2.plot(msb(rw), yy, 2)
|
||||||
|
}
|
||||||
|
repeat 20000 {
|
||||||
|
rw = rndw()
|
||||||
|
yy = (lsb(rw) & 127) + 20
|
||||||
|
gfx2.plot(msb(rw), yy, 3)
|
||||||
|
}
|
||||||
repeat 50000 {
|
repeat 50000 {
|
||||||
rw = rndw()
|
rw = rndw()
|
||||||
yy = (lsb(rw) & 127) + 20
|
yy = (lsb(rw) & 127) + 20
|
||||||
|
Loading…
Reference in New Issue
Block a user