| Routines

1F23: THE 'RETURN' COMMAND ROUTINE

The address of this routine is found in the parameter table. The line number and the statement number that are to be made the object of a 'return' are fetched from the GO SUB stack.
RETURN | 1F23 | POP BC | Fetch the address - STMT_RET.
| 1F24 | POP HL | Fetch the 'error address'.
| 1F25 | POP DE | Fetch the last entry on the GO SUB stack.
| 1F26 | LD A,D | The entry is tested to see if it is the GO SUB stack end marker.
| 1F27 | CP $3E
| 1F29 | JR Z,REPORT_7 | Jump if it is.
| 1F2B | DEC SP | The full entry uses three locations only.
| 1F2C | EX (SP),HL | Exchange the statement number with the 'error address'.
| 1F2D | EX DE,HL | Move the statement number.
| 1F2E | LD ($5C3D),SP | Reset the error pointer (ERR-SP).
| 1F32 | PUSH BC | Replace the address STMT_RET.
| 1F33 | JP GO_TO_2 | Jump back to change NEWPPC and NSPPC.
Report 7 - RETURN without GOSUB.
REPORT_7 | 1F36 | PUSH DE | Replace the end marker and the 'error address'.
| 1F37 | PUSH HL
| 1F38 | RST $08 | Call the error handling routine.
| 1F39 | DEFB $06