One useful feature of the 8080 was the ability to call a handful of addresses in low memory with a single-byte instuction, as opposed to the usual three bytes needed for CALL and other branch instructions. These addresses were known as the "Restart" addresses, and memory-conscious programmers would always put their most-commonly called functions here, thus saving two bytes on every call elsewhere in the program. There are 7 restart addresses, spaced at 8 byte intervals from 0000 to 0030 inclusive. (NB: There is support for an eighth restart function, RST 7, but Basic makes no use of it).
Once the loader had finished loading Basic into memory from paper tape it would jump to address 0000, the very start of the program. Not much needs to be done here - just disable interrupts and jump up to the Init section in upper memory. Notice that the jump address here is coloured red, indicating the code is modified by code elsewhere. In this case, the jump address is changed to point to Ready once Init has run successfully. (fixme: not yet it isnt).
Fixme: What are these two addresses for?
Here is a truly beautiful piece of code, it's Golden Weasel richly deserved. It's used at run-time to check syntax in a very cool way : the byte immediately following an RST 1 instruction is not the following instruction, but the keyword or operator ID that's expected to appear in the program at that point. If the keyword or operator is not present, then it Syntax Errors out, but if it is present then the return address is fixed-up - ie advanced one byte - and the function falls into NextChar so the caller has even less work to do. I honestly doubt syntax checks could be done more efficiently than this. Sheer bloody genius.
Return next character of input from the buffer at HL, skipping over space characters. The Carry flag is set if the returned character is not alphanumeric, also the zero flag is set if a null character has been reached.
Prints a character to the terminal.
Compares HL and DE with same logical results (C and Z flags) as for standard eight-bit compares.
Variables controlling the current X and Y positions of terminal output.
Tests the state of FACCUM. This part returns with A=0 and zero set if FACCUM==0, the tail of the function sets the sign flag and A accordingly (0xFF is negative, 0x01 if positive) before returning.
Effectively PUSH (HL). First we write the return address to the JMP instruction at the end of the function; then we read the word at (HL) into BC and push it onto the stack; lastly jumping to the return address.