07-01-2015, 01:38 PM
(This post was last modified: 02-01-2021, 08:28 PM by boriel.
Edit Reason: Fix URL
)
Hi, Britlion
Sorry for the delay! (as always)
Are you using this FastPlot implementation?
https://zxbasic.readthedocs.io/en/docs/l.../fastplot/
Ok. You're using the 2nd implementation (the Wiki one does not include the lookup table?)
Update: In the original code, even with PAUSE 0, the code plotted in the wrong region of the screen for me...
Update: I've fastcalled your routine. Now it does not hang, but still the plots are a bit odd
Sorry for the delay! (as always)
Are you using this FastPlot implementation?
https://zxbasic.readthedocs.io/en/docs/l.../fastplot/
Ok. You're using the 2nd implementation (the Wiki one does not include the lookup table?)
Update: In the original code, even with PAUSE 0, the code plotted in the wrong region of the screen for me...
Update: I've fastcalled your routine. Now it does not hang, but still the plots are a bit odd
Code:
SUB Fastcall FastPlot (x as uByte, y as uByte)
ASM
pop hl ; hl = RETURN ADDRESS
ex (sp), hl ; Callee H = y
ex de, hl ; d = y
ld HL,FastPlotYValue+1
ld (hl), d
FastPlotASMStart:
ld hl,BLtabpow2
ld (FastPlotSaveX+1),A
and 7 ; x mod 8
add a,l
ld l,a
jr nc, FastPlotSkip1
inc h
FastPlotSkip1:
ld e,(hl) ; e contains one bit set
ld hl,BLTabLinIdx
FastPlotYValue:
ld a,0 ; Self modding code that puts y value here
add a,l
ld l,a
jr nc, FastPlotSkip2
inc h
FastPlotSkip2:
ld a,(hl) ; table lookup
; OR a <= CLEAR CARRY FLAG missing??
rrca
rrca
rrca
ld h,a
and %11100000
xor h
or %01000000
ld h,a ;- this is faster at 35 T states to do hl=a*32
FastPlotSaveX:
ld a, 255 ; X Self Modifying - this is written into to save X earlier.
rrca
rrca
rrca
and %00011111 ;x / 8 19 T states
or l
ld l,a ; + x/8.
ld a,(hl)
or e ; or = superposition mode.
ld (hl),a ; set the pixel.
END ASM
return
#ifndef BLTabLineIdxPresent
#define BLTabLineIdxPresent
ASM
;; small screen lines lookup table
BLTabLinIdx:
defb 0,8,16,24,32,40,48,56,1,9,17,25,33,41,49,57
defb 2,10,18,26,34,42,50,58,3,11,19,27,35,43,51,59
defb 4,12,20,28,36,44,52,60,5,13,21,29,37,45,53,61
defb 6,14,22,30,38,46,54,62,7,15,23,31,39,47,55,63
defb 64,72,80,88,96,104,112,120,65,73,81,89,97,105,113,121
defb 66,74,82,90,98,106,114,122,67,75,83,91,99,107,115,123
defb 68,76,84,92,100,108,116,124,69,77,85,93,101,109,117,125
defb 70,78,86,94,102,110,118,126,71,79,87,95,103,111,119,127
defb 128,136,144,152,160,168,176,184,129,137,145,153,161,169,177,185
defb 130,138,146,154,162,170,178,186,131,139,147,155,163,171,179,187
defb 132,140,148,156,164,172,180,188,133,141,149,157,165,173,181,189
defb 134,142,150,158,166,174,182,190,135,143,151,159,167,175,183,191
BLtabpow2:
;; lookup table with powers of 2
defb 128,64,32,16,8,4,2,1
END ASM
#endif
END SUB
FOR n=40 to 50
FastPlot (n,60)
next n
FOR n=40 to 50
FastPlot (n,50)
pause 0
next n