Splitting the Atom |
|
page 6 |
Similarly, the floating-point ROM contains a test that
examines the utility socket at A000, by testing the locations
A000 and A001 for 40 and BF respectively. If these are present,
then interpretation is passed to the A000 ROM.
The COS commands are independent of the BASIC interpreter, and
have their own interpreter at F8F0, acessed automatically by the
leading asterisk (*) of all COS commands. The COS command
interpreter is indirected by (OSCLI), which since it is in RAM,
allows user intervention, and so the possibility of adding extra
words without the addition of a ROM. An illustration of this is
given later by the hex dump program.
Assume the following string is being interpreted:
P |
R |
I |
N |
T |
A |
; |
P |
R |
I |
N |
T |
B |
0D |
and that we are in the direct mode, so that this has been
typed in from the keyboard. The string is held in the direct-mode
input buffer at 100 onward. The keying of the carriage-return
(<CR>) puts an 0D at the end of the string as shown, and
passes control over to the interpreter.
The interpreter uses a vector at 5,6 to point to the location
of the string under scrutiny and so this vector is set to 100
from the direct mode, and a word match is sought. The interpreter
works its way along the word by incrementing Y, so that (5),Y
points to the character within the word being matched. Once the
machine has resolved the entire command (PRINT in the case above)
the vector (5) is consolidated by adding the Y register to it.
Then Y is set to zero, so that in our case (5),Y is pointing to A
in the PRINT A command. The interpreter goes on to find out what
needs printing, but before execution checks that there is no
rubbish behind the letter A, then executes the appropriate
routines. Having executed the PRINT A, the vector at (5),Y is now
pointing at the statement separator (semicolon) and the machine
skips past this to execute the next command.
By this means the (5),Y pointer can range throughout the whole
of the memory area. All the machine's BASIC interpreters use this
vector, and before the value of Y has been spoiled by execution
calls, its value is stored in ?3.
|