Prev: 06935 Up: Map Next: 07023
06952: THE STATEMENT LOOP
Used by the routines at NEXT_LINE and STMT_NEXT.
Each statement is considered in turn until the end of the line is reached.
STMT_LOOP 06952 RST 32 Advance CH-ADD along the line.
This entry point is used by the routines at LINE_SCAN and IF_CMD.
STMT_L_1 06953 CALL SET_WORK The work space is cleared.
06956 INC (IY+13) Increase SUBPPC on each passage around the loop.
06959 JP M,REPORT_C But only '127' statements are allowed in a single line.
06962 RST 24 Fetch a character.
06963 LD B,0 Clear the B register for later.
06965 CP 13 Is the character a 'carriage return'?
06967 JR Z,LINE_END Jump if it is.
06969 CP ":" Go around the loop again if it is a ':'.
06971 JR Z,STMT_LOOP
A statement has been identified so, first, its initial command is considered.
06973 LD HL,7030 Pre-load the machine stack with the return address STMT_RET.
06976 PUSH HL
06977 LD C,A Save the command temporarily in the C register whilst CH-ADD is advanced again.
06978 RST 32
06979 LD A,C
06980 SUB 206 Reduce the command's code by 206, giving the range 0 to 49 for the fifty commands.
06982 JP C,REPORT_C Give the appropriate error if not a command code.
06985 LD C,A Move the command code to the BC register pair (B holds 0).
06986 LD HL,6728 The base address of the syntax offset table.
06989 ADD HL,BC The required offset is passed to the C register and used to compute the base address for the command's entries in the parameter table.
06990 LD C,(HL)
06991 ADD HL,BC
06992 JR GET_PARAM Jump forward into the scanning loop with this address.
Each of the command class routines applicable to the present command is executed in turn. Any required separators are also considered.
SCAN_LOOP 06994 LD HL,(23668) The temporary pointer to the entries in the parameter table (T-ADDR).
GET_PARAM 06997 LD A,(HL) Fetch each entry in turn.
06998 INC HL Update the pointer to the entries (T-ADDR) for the next pass.
06999 LD (23668),HL
07002 LD BC,6994 Pre-load the machine stack with the return address SCAN_LOOP.
07005 PUSH BC
07006 LD C,A Copy the entry to the C register for later.
07007 CP 32 Jump forward if the entry is a 'separator'.
07009 JR NC,SEPARATOR
07011 LD HL,7169 The base address of the command class table.
07014 LD B,0 Clear the B register and index into the table.
07016 ADD HL,BC
07017 LD C,(HL) Fetch the offset and compute the starting address of the required command class routine.
07018 ADD HL,BC
07019 PUSH HL Push the address on to the machine stack.
07020 RST 24 Before making an indirect jump to the command class routine pass the command code to the A register and set the B register to 255.
07021 DEC B
07022 RET
Prev: 06935 Up: Map Next: 07023