Splitting the Atom |
|
page 5 |
Chapter 2: The Structure
of the Interpreter
C000 |
BASIC |
--- BASIC |
|
F000 |
BASIC COS |
|
D000 |
BASIC |
--- FLOATING POINT ROM |
|
A000 |
BASIC |
--- UTILITY ROM |
Programs are stored in memory as a series of strings, which in
the Atom are normally begun at #2900. Address 2900 contains and
0D which means start of program. Each line in the program
consists of a two-byte line number (stored as hex), followed by
the actual ASCII code for whatever you typed in. At the end of
each line is an 0D, and the end of the program is marked by an FF
(thus a program always ends in 0D FF). A program consisting only
of 20 PRINT "HELLO";END would look like this
if we did an ASCII dump starting at 2900:
0D |
0C |
14 |
P |
R |
I |
N |
T |
" |
H |
E |
L |
L |
O |
" |
E |
N |
D |
0D |
FF |
P.&TOP would give 2915, since this is the next
memory location after the FF at the end of the program.
Strings being interpreted, either in direct mode or as a
program being run, are first checked by the C000 BASIC
interpreter. If they are valid, a match with the word in the
string is found in the ROM, and the appropriate routines are
called for the execution of the word.
If the C000 interpreter can't find a match for the string,
then it passes control over to the F000 BASIC interpreter. Again,
valid matches are sought, and executed if one is found.
If the F000 interpreter can't resolve the string, then
normally this would mean that an erroneous string is present, and
an error routine is called. However, before giving up all hope, a
simple test is made which looks for the signature of a ROM at
D000 (the floating-point ROM), and if the ROM is present, then
the string is passed over to it for interpretation.
By this means the Atom can work with or without the
floating-point ROM installed, and when one is plugged in, the
machine is able to detect that it is there.
|