Spectrum ROM | Routines |
Prev: 02230 | Up: Map |
Used by the routine at ME_CONTRL.
This subroutine is entered with the following parameters:
|
|||||||
ME_ENTER | 02348 | JR NZ,ME_ENT_1 | Jump if handling an 'addition'. | ||||
02350 | EX AF,AF' | Save the flags. | |||||
02351 | LD (23647),HL | Save the 'new' pointer (in X-PTR) whilst the 'old' line or variable is reclaimed. | |||||
02354 | EX DE,HL | ||||||
02355 | CALL NEXT_ONE | ||||||
02358 | CALL RECLAIM_2 | ||||||
02361 | EX DE,HL | ||||||
02362 | LD HL,(23647) | ||||||
02365 | EX AF,AF' | Restore the flags. | |||||
The new entry can now be made.
|
|||||||
ME_ENT_1 | 02366 | EX AF,AF' | Save the flags. | ||||
02367 | PUSH DE | Make a copy of the 'destination' pointer. | |||||
02368 | CALL NEXT_ONE | Find the length of the 'new' variable/line. | |||||
02371 | LD (23647),HL | Save the pointer to the 'new' variable/line (in X-PTR). | |||||
02374 | LD HL,(23635) | Fetch PROG - to avoid corruption. | |||||
02377 | EX (SP),HL | Save PROG on the stack and fetch the 'new' pointer. | |||||
02378 | PUSH BC | Save the length. | |||||
02379 | EX AF,AF' | Retrieve the flags. | |||||
02380 | JR C,ME_ENT_2 | Jump forward if adding a new variable. | |||||
02382 | DEC HL | A new line is added before the 'destination' location. | |||||
02383 | CALL MAKE_ROOM | Make the room for the new line. | |||||
02386 | INC HL | ||||||
02387 | JR ME_ENT_3 | Jump forward. | |||||
ME_ENT_2 | 02389 | CALL MAKE_ROOM | Make the room for the new variable. | ||||
ME_ENT_3 | 02392 | INC HL | Point to the first new location. | ||||
02393 | POP BC | Retrieve the length. | |||||
02394 | POP DE | Retrieve PROG and store it in its correct place. | |||||
02395 | LD (23635),DE | ||||||
02399 | LD DE,(23647) | Also fetch the 'new' pointer (from X-PTR). | |||||
02403 | PUSH BC | Again save the length and the 'new' pointer. | |||||
02404 | PUSH DE | ||||||
02405 | EX DE,HL | Switch the pointers and copy the 'new' variable/line into the room made for it. | |||||
02406 | LDIR | ||||||
The 'new' variable/line has now to be removed from the work space.
|
|||||||
02408 | POP HL | Fetch the 'new' pointer. | |||||
02409 | POP BC | Fetch the length. | |||||
02410 | PUSH DE | Save the 'old' pointer. (Points to the location after the 'added' variable/line.) | |||||
02411 | CALL RECLAIM_2 | Remove the variable/line from the work space. | |||||
02414 | POP DE | Return with the 'old' pointer in the DE register pair. | |||||
02415 | RET |
Prev: 02230 | Up: Map |