Shop OBEX P1 Docs P2 Docs Learn Events
What does ## mean in Prop-2 assembly language? — Parallax Forums

What does ## mean in Prop-2 assembly language?

I have seen the double pound sign symbol (##) used in several assembly-language programs for the Propeller-2, but don't understand what it means. It's not mentioned in the Prop-1 docs. Can someone offer an explanation and an example?

Thanks. --Jon

Comments

  • It inserts an AUGS and/or AUGD instruction before the actual instruction to allow for large immediates
  • It means you want a value larger than 511, at the cost of doubling the size of the instruction.
  • Ah, perfect. Thank you both. --Jon
  • Cluso99Cluso99 Posts: 18,069
    edited 2020-05-01 23:09
    ## if used in the D operand (main use) then the instruction
    [label]  opcode  [#]S,##D
    
    will become 2 instructions something like
    label  AUGD    #(D>>9)            ' D[22:0] are 23-bits forwarded to D [31:9] in the next instruction
           opcode  [#]S,#(D & $1FF)   ' D[8:0] plus the forwarded D[31:9] from the previous instruction
    
    such that the AUGS instruction feeds the top 23 bits [31:9] (ie 32-9) bits which gets fed forward to be used in the next "S" instruction when it executes. Note that addresssing is only 20 bits, so if it's an address in the next instruction, only the bits [19:0} will be forwarded. This allows for the following instruction to be able to load a register with a full 32 bit value. The following instruction provides the bits [8:0] (ie 9 lower bits) which are combined with those forwarded by the previous AUGS instruction.

    AUGD provides a similar method for the D bits in the following instruction.
  • evanhevanh Posts: 15,187
    There is very terse pasm2 description in "Instructions.txt" of the Pnut zip download. Should be some help - https://forums.parallax.com/discussion/171196/pnut-spin2-latest-version-v34r

  • RaymanRayman Posts: 13,860
    You picked a great time to learn PASM!
    In the past, it was a pain to use any numeric value > 511
    Now, it's no problem! Just use ## and the assembler will magically make it all work.
    (It just adds an extra instruction)
Sign In or Register to comment.