Splitting the Atom back exit forward page 12

Chapter 4: Addresses of routines

C000 to C22B All this is data for the interpreter. The interpreter looks in this area for a match for the first letter of the word it is looking at. It then jumps in the table to an area containing all the words beginning with that first letter, and looks at the second letter. It thus performs a tree search of the BASIC words stored in this area.
C22C to C278 A subroutine, the Function Interpreter. This area evaluates the value of any arbitrarily complex function pointed to by (5),Y, finds its value, then stores the results on the workspace stack (see C3C8).
C279 to C2AC Looks up the "meaning" of commands. If there is no match in the tree table at C000 it hands over to those kept at F000, if not there then D000, if not there then A000, if not there then error. The tree search is very quick and it seems that this is the original Acorn interpreter. The later additions at F000 and elsewhere are total linear searches and slower.
C2AD Executes the command NEW. This is available to you, but exits back to direct mode. Enter routine at C2B2.
C2B2 to C31A Execution of the <BREAK> key comes to here from about FF94. It puts 0D FF into 2900,2901, sets @=8, then hands over to the CD0F keyboard-input routines. This routine is entered at C2CF after a command execution, and at the end of a BASIC program. It carries on thus:
C2D5 - set vector at (5) to 100
C2DC - set line number to 0
C2E0 - set BRK vector to C9D8
C2EA - set error pointer to C9E7
C2F2 - set stack pointer to FF
C2F5 - zero the temporary X and Y stores
C2FB - set nesting level of all GOSUB, FOR, DO loops to 0
C301 - sets all labels to 0
C309 asks "is this a line number"; C313 - YES; C316 - NO.
This area can be entered anywhere if there is a command in the input buffer.
C31B to C333 Executes the command THEN
C325 to C333 Executes the command LET
C334 to C33E Executes the command PRINT
C33F to C3B1 PRINT in hexadecimal. Entry at C349 prints the workspace stack in hex. See example, chapter 6.
C3B2 to C3C7 Executes the command LINK
C3C8 to C3E4 A subroutine to evaluate the value of an arbitrarily complex function pointed to by (5),Y and store the computed value on the workspace stack. On return the current value of the workspace stack pointer is where the answer is stored. The value is also copied to 52,53,54,55. On return the (5),Y pointer has been consolidated, i.e. (5),0 points to the last character in the string interpreted.

back exit forward