plotp explanation (graphics.spin)
Erik Friesen
Posts: 1,071
I am trying to understand the plotp routine. If I understand the graphics routines, all the routines place coordinates of the pixel desired to be lit into dx and dy, and then call plotp(not referring to wplot).
What I don't understand here, is supposing dx = 100. See questions in code.
What I don't understand here, is supposing dx = 100. See questions in code.
plotp tjnz pwidth,#wplot 'if width > 0, do wide plot mov t1,px 'compute pixel mask t1=100 shl t1,#1 't1=200 mov mask0,#%11 'mask=%11 shl mask0,t1 'mask=mask<<200???? shr t1,#5 't1=long pixel is in? cmp t1,xlongs wc 'if x or y out of bounds, exit if_c cmp py,ylongs wc if_nc jmp #plotp_ret mov bits0,pcolor 'compute pixel bits and bits0,mask0 shl t1,#1 'get address of pixel long add t1,basesptr mov t2,py rdword t1,t1 shl t2,#2 add t1,t2 rdlong t2,t1 'write pixel andn t2,mask0 or t2,bits0 wrlong t2,t1 plotp_ret plotd_ret ret
Comments
In fact the hardware only uses the lower 5 bits, so you effectively get:
shl mask0, (t1 and $1f)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I hadn't got that deep. Once I get plotp though the others won't be that difficult.
Ok that makes sense. That effectively creates the mask then.