Question About PASM JMP Instruction
CJMJ
Posts: 226
in Propeller 2
I found this in the documentation example:
jmp #$ 'don't go wandering off, stay here
I'm assuming the JMP is just jumping back to itself, but I can't find the definition for the "#$" address. Does this mean jump to the address on the program counter (PC) [which would be the address of the current instruction]?
jmp #$ 'don't go wandering off, stay here
I'm assuming the JMP is just jumping back to itself, but I can't find the definition for the "#$" address. Does this mean jump to the address on the program counter (PC) [which would be the address of the current instruction]?
Comments
$ is what the assembler thinks the address of the current instruction is.
I recently found the explanation in the Propeller 1 Manual. I recommend that you have it handy until the new manual for Propeller 2 is out.
This explanation should definitely be in the P2 manual. Thanks @jrullan.
Here's how I understand your example: The FIT directive makes sure that all preceding instructions and data does not exceed address 256 but I don't understand exactly what the LONG command is doing. Normally you would use it to fill X number of [LONG] memory locations with some Y value.
Yes: The X number of longs is 256-$, and the Y value is 0.
The fit ensures that you aren't going to generate a negative value in the calculation of 256-$.
It is a verilog style command.
If the current hub address is < $400 then set the hub address to $400 else leave it as $ (ie current hub address).
When an orgh $xxx is encountered, pnut zero fills to the new current address (in pasm only code, not sure about spin2). Flexspin also handles this.
BTW: Verilog most likely borrowed the syntax from C. And given it's not a very C like syntax I'd hazard a guess C borrowed it from an even older language.
This can also be achieved usng the ORGF directive
Also be aware that when using hubexec the offsets must be scaled for longs.
[/code]