(2021-02-01, 06:18 PM)patters Wrote: FastPlot does appear to be faster than the compiler's current PLOT implementation. It can fill the screen in 416 ticks versus 535 ticks for the compiler implementation - a 22.2% improvement. I used this listing to compare:
Code:#include "zxbasic/library/fastPlot.bas" FUNCTION timerTicks() AS ULONG RETURN INT(65536*PEEK(23674)+256*PEEK(23673)+PEEK(23672)) END FUNCTION DIM x,y AS UBYTE CLS BORDER 6 DO FOR y=0 to 191 'PLOT x,y fastPlot(x,y) NEXT y x=x+1 LOOP UNTIL x=0 '255+1 will overstep the UBYTE to 0 PRINT timerTicks()
Modifying the list to DRAW 255 vertical lines to fill the screen takes 183 ticks - about twice as fast as using FastPlot to plot all the pixels individually.
The reason I was interested in this was because I wanted to find the fastest way to draw a chequerboard fill of a landscape in my game. Using FastPlot.bas I can fill the screen with alternating dots in 225 ticks, only a little bit slower than filling with vertical lines via DRAW. If x and y are INTEGER rather than UBYTE then it slows to 262 ticks. See below:
Code:#include "zxbasic/library/fastPlot.bas" FUNCTION timerTicks() AS ULONG RETURN INT(65536*PEEK(23674)+256*PEEK(23673)+PEEK(23672)) END FUNCTION DIM x,y AS UBYTE CLS BORDER 6 DO FOR y=0 to 191 STEP 2 fastPlot(x,y) NEXT y FOR y=1 to 191 STEP 2 fastPlot(x+1,y) NEXT y x=x+2 LOOP UNTIL x=0 '254+2 will overstep the UBYTE back to 0 PRINT timerTicks()
Do you have the ability to retrieve attachments from the backup of the old forum before the move to myBB?
http://boriel.com/mybb/showthread.php?ti...18#pid3318 is where the lookup table was for as used by HRPrintFast.bas and for FastPlot's even faster method. It's not in the wiki.
Not sure...
I helped britlion to implement fastplot here (in 2015!):
https://forum.boriel.com/showthread.php?...45#pid4345
This routine includes the lookup table, but I guess it's wrong.
I contacted him and the code seems to be lost.
I'll let you know if I find it...
EDIT: Found the attachment here!!
https://forum.boriel.com/showthread.php?...24#pid2624
I will upload those .asm files into the wiki to preserve them.

