04-18-2012, 01:10 AM

This is interesting. There's quite a lot of overhead in PLOT, I think - this is fairly unoptimized, still - and appears to be a little buggy. It also doesn't use the screen tables lookup yet. But it's late and I need to go to bed

Code:

`SUB plotPoint (x as uByte, y as uByte)`

ASM

ld d,(IX+5) ;'X

ld e,(IX+7) ;'Y

ld a, 191

sub e

ret c

ld e, a

and a

rra

scf

rra

and a

rra

xor e

and 248

xor e

ld h, a

ld a, d

rlca

rlca

rlca

xor e

and 199

xor e

rlca

rlca

ld l, a

ld a, d

and 7

ld b, a

inc b

ld a, 1

plotPoint_loop:

rrca

djnz plotPoint_loop

;cpl

ld b, a

ld a, (hl)

or b

ld (hl), a

END ASM

END SUB

FUNCTION t() as uLong

asm

DI

LD DE,(23674)

LD D,0

LD HL,(23672)

EI

end asm

end function

dim time0, time1, time2 as long

dim n as uInteger

cls

for n=1 to 150

plotPoint(n,n-1)

plot n,n+3

next n

time0=t()

for n=0 to 50000

plot 50,50

next n

time1=t()

for n=0 to 50000

plotPoint(50,50)

next n

time2=t()

print "ZX Basic 50,000 plot:"

print time1-time0;"frames =";(time1-time0)/cast(float,50);" seconds"

print

print "plotPoint 50,000 times:"

print time2-time1;"frames=";(time2-time1)/cast(float,50);" seconds"