8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly

Page Last Altered:

98DC '$' address peek/poke operator

Submitted by Steve Fewell

Name: '$' address peek/poke operator
Starting Address: &98DC
Entry criteria: PTR B points to next character in command line.
Exit: The IWA contains the address (&2A, &2B).
&2C contains #&80 to indicate that a string is the variable type at the address.
Carry is set.


Increment the Text pointer B offset, to point to the next character of the command.
Get the integer value after the '$' operator and place the value in the IWA.
Note: As '$' is a 'peek/poke' operator, the expression handler is not used, as the address
value for the 'peek/poke' operation has the highest precedence.
BASIC does not allow an '$' function to be applied to a zero-page address, so if the
addess MSB (in &2B) is zero then generate the '$ range' error.
Otherwise, set &2C (the variable type at the address) to #&80 (to indicate a String),
set the carry flag (as the return value is a String) and exit.

Disassembly for the '$' address peek/poke operator routine

98DC   230 027 E6 1B INC &1B
98DE   032 180 150 20 B4 96 JSR &96B4 Get Integer value at PTR B
98E1 + 165 043 A5 2B LDA &2B
98E3   240 006 F0 06 BEQ 6 --> #&98EB $ range error
98E5   169 128 A9 80 LDA#&80
98E7 , 133 044 85 2C STA &2C
98E9 8 056 38 SEC
98EA ` 096 60 RTS


 Back to 8BS