Prev: 2A52 Up: Map Next: 2ACC
2AB1: THE 'STK-STORE' SUBROUTINE
Used by the routine at STK_VAR.
The routine at SLICING continues here.
This subroutine passes the values held in the A, B, C, D and E registers to the calculator stack. The stack thereby grows in size by 5 bytes with every call to this subroutine.
The subroutine is normally used to transfer the parameters of strings but it is also used by STACK_BC and LOG_2_A to transfer 'small integers' to the stack.
Note that when storing the parameters of a string the first value stored (coming from the A register) will be a zero if the string comes from an array of strings or is a 'slice' of a string. The value will be '1' for a complete simple string. This 'flag' is used in the LET command routine when the '1' signals that the old copy of the string is to be 'reclaimed'.
Input
A First byte (when entering at STK_STO or STK_STORE)
B Fifth byte
C Fourth byte
D Third byte
E Second byte
Output
HL The new value of STKEND
STK_ST_0 2AB1 XOR A Signal - a string from an array of strings or a 'sliced' string.
This entry point is used by the routines at INPUT, S_SCRN_S, S_QUOTE, S_INKEY, STK_VAR, strs_add, chrs, str and read_in.
STK_STO 2AB2 RES 6,(IY+$01) Ensure the flag indicates a string result (reset bit 6 of FLAGS).
This entry point is used by the routines at STACK_BC and LOG_2_A.
STK_STORE 2AB6 PUSH BC Save B and C briefly.
2AB7 CALL TEST_5_SP Is there room for 5 bytes? Do not return here unless there is room available.
2ABA POP BC Restore B and C.
2ABB LD HL,($5C65) Fetch the address of the first location above the present stack (STKEND).
2ABE LD (HL),A Transfer the first byte.
2ABF INC HL Step on.
2AC0 LD (HL),E Transfer the second and third bytes; for a string these will be the 'start'.
2AC1 INC HL
2AC2 LD (HL),D
2AC3 INC HL Step on.
2AC4 LD (HL),C Transfer the fourth and fifth bytes; for a string these will be the 'length'.
2AC5 INC HL
2AC6 LD (HL),B
2AC7 INC HL Step on so as to point to the location above the stack.
2AC8 LD ($5C65),HL Save this address in STKEND and return.
2ACB RET
Prev: 2A52 Up: Map Next: 2ACC