2AAD SL-STORE CALL 2530,SYNTAX-Z Return at this point if RET Z checking syntax; otherwise continue into the STK-STORE subroutine. THE 'STK-STORE' SUBROUTINE This subroutine passes the values held in the A, B, C, D & 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'. 2AB1 STK-ST-0 XOR A Signal - a string from an array of strings or a 'sliced' string. 2AB2 STK-STO-S RES 6,(FLAGS) Ensure the flag Indicates a string result. 2AB6 STK-STORE PUSH BC Save B & C briefly. CALL 33A9,TEST-5-SP Is there room for 5 bytes? Do not return here unless there is room available. POP BC Restore B & C. LD HL,(STKEND) Fetch the address of the first location above the present stack. LD (HL),A Transfer the first byte. INC HL Step on. LD (HL),E Transfer the second and INC HL third bytes; for a string LD (HL),D these will be the 'start'. INC HL Step on. LD (HL),C Transfer the fourth and INC HL fifth bytes; for a string LD (HL),B these will be the 'length'. INC HL Step on so as to point to the location above the stack. LD (STKEND),HL Save this address In STKEND RET and return. THE 'INT-EXP' SUBROUTINE This subroutine returns the result of evaluating the 'next expression' as an integer value held in the BC register pair. The subroutine also tests this result against a limit-value supplied in the HL register pair. The carry flag becomes set if there is an 'out of range' error. The A register is used as an 'error register' and holds +00 of there is no 'previous error' and +FF if there has been one. 2ACC INT-EXP1 XOR A Clear the 'error register'. 2ACD INT-EXP2 PUSH DE Save both the DE & HL PUSH HL register pairs throughout. PUSH AF Save the 'error register' briefly. CALL 1C82,EXPT-1NUM The 'next expression' is evaluated to give a 'last value' on the calculator stack. POP AF Restore the 'error register'. CALL 2530,SYNTAX-Z Jump forward if checking