| Routines

340F: THE 'GET FROM MEMORY AREA' SUBROUTINE (offset +41)

The address of this routine is found in the table of addresses. It is called via a calculator literal (+E0 to +E5) by the routines at BEEP, FOR, NEXT, NEXT_LOOP, CIRCLE, DRAW, CD_PRMS1, DEC_TO_FP, e_to_fp, PRINT_FP, series, n_mod_m, int, exp and cos. This subroutine is called using the literals +E0 to +E5 and the parameter derived from these literals is held in the A register. The subroutine calls LOC_MEM to put the required source address into the HL register pair and duplicate to copy the five bytes involved from the calculator's memory area to the top of the calculator stack to form a new 'last value'.
Input
A | Index of the required memory area (+00 to +05)
DE | Destination address
Output
HL | Destination address (as DE on entry)
get_mem | 340F | PUSH DE | Save the result pointer.
| 3410 | LD HL,($5C68) | Fetch the pointer to the current memory area (MEM).
| 3413 | CALL LOC_MEM | The base address is found.
| 3416 | CALL duplicate | The five bytes are moved.
| 3419 | POP HL | Set the result pointer.
| 341A | RET | Finished.