Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Value of FastPlot library
#9
(02-01-2021, 05: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://www.boriel.com/forum/showthread....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://www.boriel.com/forum/showthread....24#pid2624

I will upload those .asm files into the wiki to preserve them.
Reply


Messages In This Thread
Value of FastPlot library - by patters - 01-28-2021, 06:39 PM
RE: Value of FastPlot library - by boriel - 01-28-2021, 09:28 PM
RE: Value of FastPlot library - by patters - 01-28-2021, 10:43 PM
RE: Value of FastPlot library - by boriel - 01-28-2021, 11:46 PM
RE: Value of FastPlot library - by patters - 01-29-2021, 12:38 AM
RE: Value of FastPlot library - by boriel - 01-29-2021, 08:33 AM
RE: Value of FastPlot library - by patters - 02-01-2021, 05:18 PM
RE: Value of FastPlot library - by boriel - 02-01-2021, 08:22 PM
RE: Value of FastPlot library - by boriel - 02-01-2021, 08:32 PM
RE: Value of FastPlot library - by patters - 02-01-2021, 10:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)