| Routines

342D: THE 'STORE IN MEMORY AREA' SUBROUTINE (offset +40)

The address of this routine is found in the table of addresses. It is called via a calculator literal (+C0 to +C5) by the routines at BEEP, FOR, NEXT, CIRCLE, DRAW, CD_PRMS1, DEC_TO_FP, e_to_fp, PRINT_FP, series, n_mod_m, int, exp and get_argt. This subroutine is called using the literals +C0 to +C5 and the parameter derived from these literals is held in the A register. This subroutine is very similar to get_mem but the source and destination pointers are exchanged.
Input
A | Index of the required memory area (+00 to +05)
HL | Source address
st_mem | 342D | PUSH HL | Save the result pointer.
| 342E | EX DE,HL | Source to DE briefly.
| 342F | LD HL,($5C68) | Fetch the pointer to the current memory area (MEM).
| 3432 | CALL LOC_MEM | The base address is found.
| 3435 | EX DE,HL | Exchange source and destination pointers.
| 3436 | CALL duplicate | The five bytes are moved.
| 3439 | EX DE,HL | 'Last value'+5, i.e. STKEND, to DE.
| 343A | POP HL | Result pointer to HL.
| 343B | RET | Finished.
Note that the pointers HL and DE remain as they were, pointing to STKEND-5 and STKEND respectively, so that the 'last value' remains on the calculator stack. If required it can be removed by using delete.