| Routines

07971: 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 | 07971 | POP BC | Fetch the address - STMT_RET.
| 07972 | POP HL | Fetch the 'error address'.
| 07973 | POP DE | Fetch the last entry on the GO SUB stack.
| 07974 | LD A,D | The entry is tested to see if it is the GO SUB stack end marker.
| 07975 | CP 62
| 07977 | JR Z,REPORT_7 | Jump if it is.
| 07979 | DEC SP | The full entry uses three locations only.
| 07980 | EX (SP),HL | Exchange the statement number with the 'error address'.
| 07981 | EX DE,HL | Move the statement number.
| 07982 | LD (23613),SP | Reset the error pointer (ERR-SP).
| 07986 | PUSH BC | Replace the address STMT_RET.
| 07987 | JP GO_TO_2 | Jump back to change NEWPPC and NSPPC.
Report 7 - RETURN without GOSUB.
REPORT_7 | 07990 | PUSH DE | Replace the end marker and the 'error address'.
| 07991 | PUSH HL
| 07992 | RST 8 | Call the error handling routine.
| 07993 | DEFB 6