mirror of
https://github.com/irmen/prog8.git
synced 2025-02-20 18:29:06 +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[4] mask4c = [%00111111, %11001111, %11110011, %11111100]
|
||||
ubyte[4] shift4c = [6,4,2,0]
|
||||
uword addr
|
||||
cx16.r0L = lsb(x) & 7 ; xbits
|
||||
|
||||
when active_mode {
|
||||
1 -> {
|
||||
@ -565,6 +563,7 @@ _done
|
||||
and #1
|
||||
}}
|
||||
if_nz {
|
||||
cx16.r0L = lsb(x) & 7 ; xbits
|
||||
x /= 8
|
||||
x += y*(320/8)
|
||||
%asm {{
|
||||
@ -611,15 +610,25 @@ _done
|
||||
and #1
|
||||
}}
|
||||
if_nz {
|
||||
; TODO get rid of all the vpoke calls to optimize all plot() ?
|
||||
addr = x/8 + y*(640/8)
|
||||
ubyte value = bits[lsb(x)&7]
|
||||
if color
|
||||
cx16.vpoke_or(0, addr, value)
|
||||
else {
|
||||
value = ~value
|
||||
cx16.vpoke_and(0, addr, value)
|
||||
}
|
||||
cx16.r0L = lsb(x) & 7 ; xbits
|
||||
x /= 8
|
||||
x += y*(640/8)
|
||||
%asm {{
|
||||
stz cx16.VERA_CTRL
|
||||
stz cx16.VERA_ADDR_H
|
||||
lda x+1
|
||||
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 -> {
|
||||
|
@ -5,7 +5,7 @@
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
gfx2.screen_mode(4) ; lo res 256c
|
||||
gfx2.screen_mode(6) ; highres 4c
|
||||
gfx2.text_charset(3)
|
||||
gfx2.text(10, 10, 1, @"Hello!")
|
||||
|
||||
@ -14,12 +14,22 @@ main {
|
||||
ubyte yy
|
||||
uword rw
|
||||
|
||||
;480 jiffies (highres mono) / 442 jiffies (lores 4c)
|
||||
repeat 50000 {
|
||||
; 520 jiffies (hires 4c)
|
||||
repeat 20000 {
|
||||
rw = rndw()
|
||||
yy = (lsb(rw) & 127) + 20
|
||||
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 {
|
||||
rw = rndw()
|
||||
yy = (lsb(rw) & 127) + 20
|
||||
|
Loading…
x
Reference in New Issue
Block a user