Prev: 1B17 Up: Map Next: 1B6F
1B28: 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.
Input
Output
STMT_LOOP 1B28 RST $20 Advance CH-ADD along the line.
This entry point is used by the routines at LINE_SCAN and IF_CMD.
STMT_L_1 1B29 CALL SET_WORK The work space is cleared.
1B2C INC (IY+$0D) Increase SUBPPC on each passage around the loop.
1B2F JP M,REPORT_C But only '127' statements are allowed in a single line.
1B32 RST $18 Fetch a character.
1B33 LD B,$00 Clear the B register for later.
1B35 CP $0D Is the character a 'carriage return'?
1B37 JR Z,LINE_END Jump if it is.
1B39 CP ":" Go around the loop again if it is a ':'.
1B3B JR Z,STMT_LOOP
A statement has been identified so, first, its initial command is considered.
1B3D LD HL,$1B76 Pre-load the machine stack with the return address STMT_RET.
1B40 PUSH HL
1B41 LD C,A Save the command temporarily in the C register whilst CH-ADD is advanced again.
1B42 RST $20
1B43 LD A,C
1B44 SUB $CE Reduce the command's code by +CE, giving the range +00 to +31 for the fifty commands.
1B46 JP C,REPORT_C Give the appropriate error if not a command code.
1B49 LD C,A Move the command code to the BC register pair (B holds +00).
1B4A LD HL,$1A48 The base address of the syntax offset table.
1B4D 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.
1B4E LD C,(HL)
1B4F ADD HL,BC
1B50 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 1B52 LD HL,($5C74) The temporary pointer to the entries in the parameter table (T-ADDR).
GET_PARAM 1B55 LD A,(HL) Fetch each entry in turn.
1B56 INC HL Update the pointer to the entries (T-ADDR) for the next pass.
1B57 LD ($5C74),HL
1B5A LD BC,$1B52 Pre-load the machine stack with the return address SCAN_LOOP.
1B5D PUSH BC
1B5E LD C,A Copy the entry to the C register for later.
1B5F CP $20 Jump forward if the entry is a 'separator'.
1B61 JR NC,SEPARATOR
1B63 LD HL,$1C01 The base address of the command class table.
1B66 LD B,$00 Clear the B register and index into the table.
1B68 ADD HL,BC
1B69 LD C,(HL) Fetch the offset and compute the starting address of the required command class routine.
1B6A ADD HL,BC
1B6B PUSH HL Push the address on to the machine stack.
1B6C RST $18 Before making an indirect jump to the command class routine pass the command code to the A register and set the B register to +FF.
1B6D DEC B
1B6E RET
Prev: 1B17 Up: Map Next: 1B6F