Splitting the Atom back exit forward page 16
C9E7 to CA23 BASIC error handler. This is a BASIC statement executed whenever a BRK command is executed, normally meaning an error of some type. It says:
@=1;P.$6$7'"ERROR "?0;
@=8;IF ?1 \ ?2 P.LINE"! 1 & #FFFF;P.';E.

It uses ?0 as the error number and ! 1 & #FFFF as the line number. If the line number is zero then this is inferred as a direct mode error, and no line number is displayed. Usable by pointing 5,Y at C9E7, then jump C55B.

CACD to CB56 Execute NEXT.
CAD0 checks the value of the FOR/NEXT stack pointer (?15) and causes BRK if 0, since this must mean no FOR/NEXT has been set.
CAE5 - adds the STEP size to the variable.
CB16 - checks if the control variable has reached the final value.
CB45 - moves the text pointer back to the statement after the corresponding FOR statement.
CB57 to CB80 Execute FOR.
CB5F sets the control variable equal to its first value.
CB65 - checks that the FOR/NEXT stack pointer has not exceeded the allowable range.
CB86 - saves a default STEP value of 1.
CB81 to CBA1 Execute TO.
CB89 saves the terminal value of the FOR control variable.
CBA2 to CBD1 Execute STEP.
CBAA saves the STEP size.
CBC3 - saves the FOR/NEXT stack pointer at 15.
CBD2 to CBEB Execute GOSUB.
CBD8 tests the GOSUB stack pointer (14), and yields an error if too many.
CBDE saves the return address, and increments the GOSUB stack pointer.
CBEC to CBC04 Executes RETURN.
CBEF tests the GOSUB stack pointer (14), and if 0 gives the RETURN WITHOUT GOSUB ERROR.
CBF5 - pulls the return address from the data stack into the text pointer at 5.

back exit forward