Prev: 19DD Up: Map Next: 19FB
19E5: THE 'RECLAIMING' SUBROUTINE
Used by the routines at LD_CONTRL, CLEAR_SP, REC_EDIT and CLEAR.
The main entry point is used when the address of the first location to be reclaimed is in the DE register pair and the address of the first location to be left alone is in the HL register pair. The entry point RECLAIM_2 is used when the HL register pair points to the first location to be reclaimed and the BC register pair holds the number of bytes that are to be reclaimed.
Input
DE Start address of the area to reclaim
HL One past the end address of the area to reclaim
Output
HL Start address of the area reclaimed (as DE on entry)
RECLAIM_1 19E5 CALL DIFFER Use the 'difference' subroutine to develop the appropriate values.
This entry point is used by the routines at LD_CONTRL, ME_ENTER, ED_DELETE, REMOVE_FP, MAIN_ADD, LET and DIM.
RECLAIM_2 19E8 PUSH BC Save the number of bytes to be reclaimed.
19E9 LD A,B All the system variable pointers above the area have to be reduced by BC, so this number is 2's complemented before the pointers are altered.
19EA CPL
19EB LD B,A
19EC LD A,C
19ED CPL
19EE LD C,A
19EF INC BC
19F0 CALL POINTERS
19F3 EX DE,HL Return the 'first location' address to the DE register pair and form the address of the first location to the left.
19F4 POP HL
19F5 ADD HL,DE
19F6 PUSH DE Save the 'first location' whilst the actual reclamation occurs.
19F7 LDIR
19F9 POP HL
19FA RET Now return.
Prev: 19DD Up: Map Next: 19FB