Hi iliak
Not too sure what it is you're trying to do, but the attached PDFs might help. Both of them are work-in-progress (i.e. very unfinished) though the one on the AMOS file format should get you heading in the right direction.
Note that AMOS will give you two different formats depending on whether a program has been 'verified' or not (the Test or Run buttons do this). The documents should explain enough about how this works. Just remember that when a line of code is typed or edited in the Editor, AMOS doesn't know anything about the rest of the program. So it tokenises it as best it can until the Test phase before it is run. It then adds in the missing stuff. A prime example is references to the Names of Variables, Procedures and Labels. It doesn't know what a Name really is until it's examined the rest of the program. So it always tokenises them as Variables before the Test phase. The exception is a Label at the beginning of a line, where it knows for sure it's a Label because of the semi-colon after the name.
For your specific query on Extension Library tokens, they will occur in these two formats:
Before Verification (Test):
Word | $004E | The token for an Extension Library |
Byte | $nn | The Extension Library' s Slot Number |
Byte | $00 | Padding byte |
Word | $tttt | The token for the instruction in the Extension Library |
After Verification (Test):
Word | $004E | The token for an Extension Library |
Byte | $nn | The Extension Library' s Slot Number |
Byte | $pp | Number of Parameters for the instruction (if any) |
Word | $tttt | The token for the instruction in the Extension Library |
As an instruction may have more than one token (for different numbers of Parameters) the token after Verification may be different to the one before Verification.
Some of the AMOS Pro Tokens are followed by Data Words (as in the Extension Library instruction example above). You need to take these into account so you can skip over the appropriate number of words to get to the next instruction. See the table at the end of the File Format doc. These Token Data words only apply to some instructions in the core library (AMOSPro.Lib). You'll never get them in an Extension Library.
Missing from that doc. are the Tokens for Operators. These do not appear in the library, they're hard-code in the AMOS Pro executable. They each only take up one word (no extra data required):
Token | AMOS Operator) |
$FF37 | ' xor ' |
$FF45 | ' or ' |
$FF52 | ' and ' |
$FF60 | '<>' |
$FF6B | '><' |
$FF76 | '<=' |
$FF81 | '=<' |
$FF8C | '>=' |
$FF97 | '=>' |
$FFA2 | '=' |
$FFAC | '<' |
$FFB6 | '>' |
$FFC0 | '+' |
$FFCA | '-' |
$FFD4 | ' mod ' |
$FFE2 | '*' |
$FFEC | '?' |
$FFF6 | '^' |
I've enclosed the AMOS Operators in single quotes to show the spaces that AMOS inserts when it De-tokenises a program and turn it back into text.
Hope this lot helps. I
will get around to completing the docs but I've got too many projects on the boil at the moment!
And V2.10 and the rewritten Help System have priority,