Routines |
Prev: 1EA1 | Up: Map | Next: 1EED |
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 | 1EAC | CALL FIND_INT2 | Fetch the operand - using zero by default. | |
This entry point is used by the routine at RUN.
|
||||
CLEAR_RUN | 1EAF | LD A,B | Jump forward if the operand is other than zero. When called from RUN there is no jump. | |
1EB0 | OR C | |||
1EB1 | JR NZ,CLEAR_1 | |||
1EB3 | LD BC,($5CB2) | If zero use the existing value in RAMTOP. | ||
CLEAR_1 | 1EB7 | PUSH BC | Save the value. | |
1EB8 | LD DE,($5C4B) | Next reclaim all the bytes of the present variables area (VARS to E-LINE-1). | ||
1EBC | LD HL,($5C59) | |||
1EBF | DEC HL | |||
1EC0 | CALL RECLAIM_1 | |||
1EC3 | 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.
|
||||
1EC6 | LD HL,($5C65) | The current value of STKEND is increased by 50 before being tested. This forms the lower limit. | ||
1EC9 | LD DE,$0032 | |||
1ECC | ADD HL,DE | |||
1ECD | POP DE | |||
1ECE | SBC HL,DE | |||
1ED0 | JR NC,REPORT_M | RAMTOP will be too low. | ||
1ED2 | LD HL,($5CB4) | For the upper test the value for RAMTOP is tested against P-RAMT. | ||
1ED5 | AND A | |||
1ED6 | SBC HL,DE | |||
1ED8 | JR NC,CLEAR_2 | Jump forward if acceptable. | ||
Report M - RAMTOP no good.
|
||||
REPORT_M | 1EDA | RST $08 | Call the error handling routine. | |
1EDB | DEFB $15 | |||
Continue with the CLEAR operation.
|
||||
CLEAR_2 | 1EDC | EX DE,HL | Now the value can actually be passed to RAMTOP. | |
1EDD | LD ($5CB2),HL | |||
1EE0 | POP DE | Fetch the address of STMT_RET. | ||
1EE1 | POP BC | Fetch the 'error address'. | ||
1EE2 | LD (HL),$3E | Enter a GO SUB stack end marker. | ||
1EE4 | DEC HL | Leave one location. | ||
1EE5 | LD SP,HL | Make the stack pointer point to an empty GO SUB stack. | ||
1EE6 | PUSH BC | Next pass the 'error address' to the stack and save its address in ERR-SP. | ||
1EE7 | LD ($5C3D),SP | |||
1EEB | EX DE,HL | An indirect return is now made to STMT_RET. | ||
1EEC | JP (HL) | |||
Prev: 1EA1 | Up: Map | Next: 1EED |