Prev: 13303 Up: Map Next: 13327
13318: 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 13318 LD C,A Copy the parameter to C.
13319 RLCA Double the parameter.
13320 RLCA Double the result.
13321 ADD A,C Add the value of the parameter to give five times the original value.
13322 LD C,A This result is wanted in the BC register pair.
13323 LD B,0
13325 ADD HL,BC Produce the new base address.
13326 RET Finished.
Prev: 13303 Up: Map Next: 13327