Shop OBEX P1 Docs P2 Docs Learn Events
Assembly Command Clarification — Parallax Forums

Assembly Command Clarification

While reading through the assembly command list I noticed the REP command and got curious about its limitations.
Specifically, can one REP command contain another like in this example code for driving a neopixel:
rep     #12,          %[pixel_cnt]
rdlong  %[thisPixel], %[hubPtr]
add     %[hubPtr],    #4              
mov     %[bit],       #8            

rep     #8,           #24             
drvh    %[pixel_pin]                  
testb   %[thisPixel], %[bit]       WC
incmod  %[bit],       #32         
waitx   %[tickH]                     
drvc    %[pixel_pin]                
waitx   %[tickC]                     
drvl    %[pixel_pin]                 
waitx   %[tickL]                      

Comments

  • Reps are linked to a circuit that does the rep. Only one at a time.

    The second one should just cancel the first one.

    There is no internal stack, or storage for multiple reps.
  • I see. So the best option in this example would be to replace the first REP with a For loop right?
  • yes, the outer loop with djnz.

    I am overwhelmed with P2 PASM. I still find goodies in P1 PASM, squeezing another 1-4 longs out of something.

    Mike

Sign In or Register to comment.