Shop OBEX P1 Docs P2 Docs Learn Events
plotp explanation (graphics.spin) — Parallax Forums

plotp explanation (graphics.spin)

Erik FriesenErik Friesen Posts: 1,071
edited 2009-01-30 12:40 in Propeller 1
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.


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

  • mirrormirror Posts: 322
    edited 2009-01-30 03:47
    A full barrel roll is 32 bits, so 200 is 6 full rolls + 8 bits.

    In fact the hardware only uses the lower 5 bits, so you effectively get:
    shl mask0, (t1 and $1f)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2009-01-30 06:23
    Erik Friesen said...
    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).
    Not all. The box/rectangle/triangle options don't call the plotp routines. They have another routine for plotting that plots up to 16 pixels at a time by working on an entire long.
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2009-01-30 12:40
    stevenmess2004 said...

    Not all. The box/rectangle/triangle options don't call the plotp routines

    I hadn't got that deep. Once I get plotp though the others won't be that difficult.
    mirror said...
    In fact the hardware only uses the lower 5 bits, so you effectively get:
    shl mask0, (t1 and $1f)

    Ok that makes sense. That effectively creates the mask then.
Sign In or Register to comment.