| Routines

3406: THE 'MEMORY LOCATION' SUBROUTINE

Used by the routines at BEEP, get_mem and st_mem. This subroutine finds the base address for each five-byte portion of the calculator's memory area to or from which a floating-point number is to be moved from or to the calculator stack. It does this operation by adding five times the parameter supplied to the base address for the area which is held in the HL register pair. Note that when a FOR-NEXT variable is being handled then the pointers are changed so that the variable is treated as if it were the calculator's memory area.
Input
A | Index of the required entry
HL | Base address (SEMITONES or MEM)
Output
HL | Base address + 5 * A
LOC_MEM | 3406 | LD C,A | Copy the parameter to C.
| 3407 | RLCA | Double the parameter.
| 3408 | RLCA | Double the result.
| 3409 | ADD A,C | Add the value of the parameter to give five times the original value.
| 340A | LD C,A | This result is wanted in the BC register pair.
| 340B | LD B,$00
| 340D | ADD HL,BC | Produce the new base address.
| 340E | RET | Finished.