Prev: 07841 Up: Map Next: 07917
07852: THE 'CLEAR' COMMAND ROUTINE
The address of this routine is found in the parameter table.
This routine allows for the variables area to be cleared, the display area cleared and RAMTOP moved. In consequence of the last operation the machine stack is rebuilt thereby having the effect of also clearing the GO SUB stack.
CLEAR 07852 CALL FIND_INT2 Fetch the operand - using zero by default.
This entry point is used by the routine at RUN.
CLEAR_RUN 07855 LD A,B Jump forward if the operand is other than zero. When called from RUN there is no jump.
07856 OR C
07857 JR NZ,CLEAR_1
07859 LD BC,(23730) If zero use the existing value in RAMTOP.
CLEAR_1 07863 PUSH BC Save the value.
07864 LD DE,(23627) Next reclaim all the bytes of the present variables area (VARS to E-LINE-1).
07868 LD HL,(23641)
07871 DEC HL
07872 CALL RECLAIM_1
07875 CALL CLS Clear the display area.
The value in the BC register pair which will be used as RAMTOP is tested to ensure it is neither too low nor too high.
07878 LD HL,(23653) The current value of STKEND is increased by 50 before being tested. This forms the lower limit.
07881 LD DE,50
07884 ADD HL,DE
07885 POP DE
07886 SBC HL,DE
07888 JR NC,REPORT_M RAMTOP will be too low.
07890 LD HL,(23732) For the upper test the value for RAMTOP is tested against P-RAMT.
07893 AND A
07894 SBC HL,DE
07896 JR NC,CLEAR_2 Jump forward if acceptable.
Report M - RAMTOP no good.
REPORT_M 07898 RST 8 Call the error handling routine.
07899 DEFB 21
Continue with the CLEAR operation.
CLEAR_2 07900 EX DE,HL Now the value can actually be passed to RAMTOP.
07901 LD (23730),HL
07904 POP DE Fetch the address of STMT_RET.
07905 POP BC Fetch the 'error address'.
07906 LD (HL),62 Enter a GO SUB stack end marker.
07908 DEC HL Leave one location.
07909 LD SP,HL Make the stack pointer point to an empty GO SUB stack.
07910 PUSH BC Next pass the 'error address' to the stack and save its address in ERR-SP.
07911 LD (23613),SP
07915 EX DE,HL An indirect return is now made to STMT_RET.
07916 JP (HL)
Note: when the routine is called from RUN the values of NEWPPC and NSPPC will have been affected and no statements coming after RUN can ever be found before the jump is taken.
Prev: 07841 Up: Map Next: 07917