Submitted by Steve Fewell
Routine:!addrop
Name: '?' and '!' address peek/poke operators
Starting Address: &98D1 for '!', or &98D3 (with A=0) for '?'
Entry criteria: PTR B points to next character in command line.
Exit: The IWA contains the address (&2A, &2B).
&2C contains 4 (if '!') or 0 (if '?') to indicate the variable return type at the address.
Carry is clear.
Description:
Push the Variable type (either 0 (for '?') or 4 (for '!')) to the Stack.
Increment the Text pointer B offset, to point to the next character of the command.
Get the integer value after the '?' or '!' operator and place the value in the IWA.
Note: As '!' and '?' are 'peek/poke' operators, the expression handler is not used, as the address
value for the 'peek/poke' operation has the highest precedence.
Pop the variable type from the Stack and set &2C to the variable type (0 for '?' or 4 for '!').
Clear the carry flag and exit with A = #&FF and the IWA containing the address.
98D1 | 169 004 | A9 04 | LDA#&04 | |
98D3 | H | 072 | 48 | PHA |
98D4 | 230 027 | E6 1B | INC &1B | |
98D6 | 032 180 150 | 20 B4 96 | JSR &96B4 Get Integer value at PTR B | |
98D9 | L | 076 206 153 | 4C CE 99 | JMP &99CE Set &2C and A=#&FF & exit with carry clear (numerical) |