Prev: 10834 Up: Map Next: 10956
10929: 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 10929 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 10930 RES 6,(IY+1) 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 10934 PUSH BC Save B and C briefly.
10935 CALL TEST_5_SP Is there room for 5 bytes? Do not return here unless there is room available.
10938 POP BC Restore B and C.
10939 LD HL,(23653) Fetch the address of the first location above the present stack (STKEND).
10942 LD (HL),A Transfer the first byte.
10943 INC HL Step on.
10944 LD (HL),E Transfer the second and third bytes; for a string these will be the 'start'.
10945 INC HL
10946 LD (HL),D
10947 INC HL Step on.
10948 LD (HL),C Transfer the fourth and fifth bytes; for a string these will be the 'length'.
10949 INC HL
10950 LD (HL),B
10951 INC HL Step on so as to point to the location above the stack.
10952 LD (23653),HL Save this address in STKEND and return.
10955 RET
Prev: 10834 Up: Map Next: 10956