STKEND is not on, but one beyond, the last byte of the last number on the stack; therefore also the first byte to be filled by any new number put on the stack, or if a number has just been deleted from the stack it points to the first byte of that number, which isn't overwritten until there has been a callto 16C5 SET STK or similar. Written by: 1219 RAM SET 166B PTR NEXT 16C5 SET STK 19FB E LINE NO 268D S DECIMAL 2852 SF ARG VL 2981 SFA MATCH 2AB6 STK STORE 2BF1 STK FETCH 3365 RE ENTRY 33B4 STACK NUM Read by: 1655 MAKE ROOM 166B PTR NEXT 1EB7 CLEAR 1 1F05 TEST ROOM 268D S DECIMAL 2852 SF ARG VL 2981 SFA MATCH 2AB6 STK STORE 2BF1 STK FETCH 338E ENT TABLE (really a read of BREG; should be written LD BC,(BREG-1)) 33B4 STACK NUM 35BF STK PNTRS Rems: 167F PTR DONE left in DE after PTR NEXT; top of block to be moved up or down 2B59 L NUMERIC delete moves STKEND down five bytes 2D2B STACK BC end-calc makes HL point to STKEND-5 2DA2 FP TO BC end-calc makes HL point to STKEND-5 2DAD FP DELETE after end-calc DE points to STKEND 3014 addition exits with DE=STKEND, HL=STKEND-5 30EA MULT RSLT exits with DE=STKEND 323F T SMALL save STKEND on machine stack* 3267 T STORE exit with DE=STKEND* 3272 NIL BYTES save STKEND on machine stack* 3290 IX END exit with DE=STKEND* 335B CALCULATE set DE=STKEND 342D st-mem exit with DE=STKEND* 3483 INT CASE exit with DE=STKEND* 3492 sgn exit with DE=STKEND* *These notes aren't quite correct, because DE isn't necessarily STKEND; the subroutines are always used in the ROM for numbers on the stack, but they could be used otherwise. STK F ARG 2951 (28B2 LOOK VARS) Exit from: 28E3 V TEST FN (28B2 LOOK VARS) STK FETCH subroutine 2BF1 Copies the last value from the calculator stack into theregisters AEDCB, and moves 5C65 STKEND down so that the value isnotionally removed from the stack; but in fact it is still thereand can be read by appropriate m/c. Input parameters: none. Action: set a pointer on 5C65 STKEND - step it back five times, copying the byte into the appropriate register at each step - put the final pointer address in 5C65 STKEND. Exit: RET. Output parameters: A, BC, DE have all been given values as indicated - HL holds the new 5C65 STKEND - if the last value is a pair of string parameters, as often - BC holds the length of the string - DE its start address