IDE Compiler suggestion - Indirect Call/Jumps
Cluso99
Posts: 18,069
I've just been burnt and yes I was warned (I've seen lots of posts) - but still I wasted more than a day.
The problem:
······ jmp···· #goto1···· 'jumps directly to the location
······ jmp·····indirect1·· 'jumps to the address stored at indirect - BUT this catches a lot of assembler people because they forget the "#"
The proposed solution:
······ option· indirect=1 (or whatever)·· 'compiler option
this will use the following formats
······ jmp···· #goto1···· 'jumps directly to the location
······ jmp·····@indirect1·'jumps to the address stored at indirect (or preceed with another character like "^", "&" or whatever)
this instruction will force an error
······ jmp·····indirect1·· 'illegal (by the option) and forces an error
The same applies to other forms of jumps and calls.
······
The problem:
······ jmp···· #goto1···· 'jumps directly to the location
······ jmp·····indirect1·· 'jumps to the address stored at indirect - BUT this catches a lot of assembler people because they forget the "#"
The proposed solution:
······ option· indirect=1 (or whatever)·· 'compiler option
this will use the following formats
······ jmp···· #goto1···· 'jumps directly to the location
······ jmp·····@indirect1·'jumps to the address stored at indirect (or preceed with another character like "^", "&" or whatever)
this instruction will force an error
······ jmp·····indirect1·· 'illegal (by the option) and forces an error
The same applies to other forms of jumps and calls.
······
Comments
-Phil
Ditto that request! Not so much for spotting indirect jumps, but just for seeing whether the assembler interpreted what I wrote the way I did. This is the first assembler I've ever used that doesn't provide the option for a listing file.
(Since the compiler proper is written in x86 assembly and is not part of the IDE per se, both these requests may be in the limbo queue for awhile.)
-Phil
Maybe we need a program that reads the binaries and spin and put's it into a form of listing (if parallax won't alter the compiler) ??
Phil: What's the problem/implication of x86 ??
What I think is the underlying problem ( beyond typo ) is that many PASM programmers come from other assemblers where the default varies with the opcode, for loads and math an operand with a # is a constant, without a # a register, with an @ an indirect of register, while for branches, without a # it's a destination label ( a constant ), @ being added for a jump indirect via register, # not having any place at all in those opcodes.
If one were creating a constant pointer to a destination in PASM one should for consistency with PASM be using "long #lab", but it's "long lab" ( likewise with org ). It's inconsistency of # use which I think is partly what initially confuses programmers unfamiliar with PASM.
I can understand the logic of the choice for PASM but I still sometimes get bitten by my old habits.
@ Phil : Re x86, is the compiler written in x86 or is it just the IDE ? I know x86 is cited as the reason PropTool won't work on Win98 but Propellent works okay AFAICT except for downloading where it cannot enumerate serial ports.
I'd vote against using the immediate flag in longs, though, since those are declarations, not instructions (most of the time). The immediate bit is only used in instructions and with data that doesn't exceed 9 bits.
BTW, it's my understanding that the compiler was written by Chip in x86 assembly, and the IDE was written by Jeff in Delphi, a variant of Pascal.
-Phil
PASD does exatly this to show a listing. It works not always perfect, especially with byte, word long statements, but almost:
http://forums.parallax.com/showpost.php?p=0
You need the actual version 0.3 from:
www.insonix.ch/propeller/prop_pasd.html
Andy
.... label(PC)...
This refers to the content of label offset from PC, which is what you want EXCEPT in jump/call. For those, you want the instructions to treat the operand as the actual destination, not containing the destination. Sadly, the MSP430 does the wrong thing and it take multi-instructions to support position independent code. So close, yet so far.
········jmp #direct_label
········jmp indirect_label
This has the additional "benefit" of moving the solution from the compiler to the IDE ... um right, Jeff?
-Phil