- A its array/slice index. Called from: 0629 SA BLANK 175D OPEN 2 1C30 VAR A 2 2024 PR ITEM 3 2A52 SLICING 2B72 L DELETE$ 2BC6 L STRING 34BC usr-$ 3559 STRINGS (twice) 359C strs-add (twice) 35DE val 3669 code 3674 len stk-half, stk-one, stk-pi/2 see 341B stk-zero STK PNTRS subroutine 35BF Points HL at the last value on the calculator stack and DE at the calculator stack end address in 5C65 STKEND; their standard settings for a "unary operation". Called at the start of the CALCULATE subroutine, but since this is bypassed when fp-calc-2 is used it is also made the exit routine for some of the calculation routines. Input parameters: none. Action: load HL from 5C65 STKEND - add minus five; result in HL - recover the 5C65 STKEND address in DE. Exit: RET. Output parameters: no other registers affected. Called from: 335B CALCULATE Exit from: 35B7 OTHER STR (359C strs-add) 360C V RPORT C (35DE val) 365F R I STORE (3645 read-in) STK STORE subroutine 2AB6 See 2AB1 STK ST 0 below. Called from: 2D2B STACK BC 2DC1 LOG(2>A) 359C strs-add 35C9 CHRS Exit from: 2AB2 STK STO $ STK STO $ subroutine 2AB2 See 2AB1 STK ST 0 below. Called from: 219B IN VAR 6 (misprinted IN VARS 6 and STK ST $) 25DB S STRING 2660 S IK$ STK 29A1 SV SIMPLE$ (misprinted STK STORE) 361F str$ 365F R I STORE Exit from: 257D S SCR STO 2AB1 STK ST 0 STK ST 0 subroutine 2AB1 The first of three entry points to STK STORE; STK STORE adds a FP number to the calculator stack, taking its bytes from AEDCB, the reverse of 2BF1 STK FETCH. In ROM, these subroutines are only used for string parameters and small integers. However STK STORE itself could well be used for a full format FP number. The first two entry points flag the result as a string, the STK ST 0 entry point flags the string parameters as belonging to an array or slice. Input parameters: BC, DE hold the last four bytes of the number, in the AEDCB order; if the number is a pair of string parameters, BC holds the length of the string and DE its start address - for the two later entry points, A holds the first byte; if the number is a pair of string parameters, the array/ slice index, one for simple strings or zero for an array or slice Action: zero the first byte; signalling "array or slice". _2AB2_STK_STO_$ (the entry point for string parameters ingeneral): zero the string/numeric status flag, bit 6 of FLAGS; "string result". _2AB6_STK_STORE (a still more generalized entry point, used for numeric as well as string values): call 33A9 TEST 5 SP to check that there is room in memory for an extension of the stack - get a pointer to the end of the calculator stack from 5C65 STKEND - step through 5 bytes loading AEDCB into each in turn - put the new pointer in 5C65 STKEND. Exit: RET, from STK STORE. Output parameters: HL holds the new 5C65 STKEND, others unchanged. Called from: 2A2C SV ELEM$ Exit from: 2AAD SL STORE stk-ten see 341B stk-zero STK TO A subroutine 2314 Gets the one-byte last value off the calculator stack, rounded down to an integer, as an absolute value but with a marker of the sign; reports an error if the absolute value is more than FFh/255d. Cf: 1E94 FIND INT1 - takes a one-byte number from stack into A, with error messages if negative or out of range 2D7F INT FETCH - copies a small integer into DE, without error reports or flags 2DD5 FP TO A - takes a one-byte number from stack into A, with flags but no error messages. Input parameters: none. Action: call 2DD5 FP TO A to get the number; without any error reports, but carry will be flagged if the absolute value of the number was more than 255d and NZ flagged if the number isnegative - if carry is set report "Integer out of range" - make a sign marker 01 for positive - return on Z flag - (negative number) make the sign marker FFh/minus one for negative. Exit: RET, provided the number is in range. Output parameters: A holds the number - C holds the sign flag - HL and DE point to the last value on the calculator stack and the stack end respectively. Called from: 2307 STK TO BC (twice) Rems: 171E STR DATA (STK TO A is a misprint for FIND INT1) STK TO BC subroutine 2307 see also FIND INT 2, FP TO BC Gets the last_two values off the calculator stack, rounded down to integers, as absolute values but with markers oftheir signs; if the absolute value of either integer is more than FFh/255d, reports an error. Usually called to get coordinates X,Y, eg for a PLOT command; Y is assumed to be the last on the stack. Cf: 1E99 FIND INT2 - gets a 2-byte integer from the calculator stack with error reports if negative or out of range 2DA2 FP TO BC - gets a 2-byte integer from the calculator stack with flags but no error reports and the other routines mentioned under 2314 STK TO Aabove. Input parameters: none - X and Y on the calculator stack. Action: call 2314 STK TO A twice, putting the results in the appropriate registers; see the output parameters below. Exit: RET, provided both X and Y are in range. Output parameters: B holds ABS Y, with SGN Y in D - C holds ABS X, with SGN X in E - HL still points to the last value on the calculator stack. Called from: 1FFC PR ITEM 1 22DC PLOT 24B7 DRAW LINE 2535 S SCRN$ S 2580 S ATTR S STK VAR subroutine 2996 See under 28B2 LOOK VARS. Called from: 1C30 VAR A 2 (misprinted STACK VARS) 26C9 S LETTER (misprinted STACK VARS) 2C05 D RPORT C stk-zero subroutine 341B Takes a constant from the table at 32C5 and puts it on the calculator stack in normal FP form. The same subroutine works for any of the five constants in the table, and it would have been better named "get-const" orsomething similar. Called from 0028 FP CALC with any of the literals A0: stk-zero A1: stk-one A2: stk-half A3: stk-pi/2 A4: stk-ten Can be called direct from m/c, though this isn't done bythe ROM; note a) in calls from the calculator the constant will always be loaded on to the calculator stack, but in direct calls from m/c it could be loaded to any address supplied in the DE register; on output DE will have been moved on five places, but this new pointer won't have been loaded into 5C65 STKEND as in the case of a call through the calculator b) the routine as it stands can be used only for the given table: it can't be used for a home-made table of constants. A "Chinese copy", with the address of the home-made table in the fifth line, should work OK; or copy only the first four lines, then LD HL with your address, then "JP 3422". Such routines could address up to 256d different constants in one table; they must all be in "stk-data format", see under stk-dataand the BASIC programs Appendix to this index. Input parameters: A holds the table serial of the required constant, starting at zero for the first - DE holds a destination address, usually the one in 5C65 STKEND - HL' holds the "return address" from the calculator routine; the address of the next literal to be read by FP CALC. Action: save HL' on the machine stack - put the table address in HL' - call 33F7 SKIP CONS which steps through the table to the specified serial - call 33C8 STK CONST which converts the constant to normal FP format and stacks it. Exit: RET. Output parameters: DE holds the new value for 5C65 STKEND - HL holds the address of the first byte of the constanton the stack - HL' has been restored. Called from: stk-zero: 1CE6 USE ZERO 235A C ARC GE 1 2CCF DEC RPT C 2D3B INT TO FP 2DA3 FP TO BC 2DF8 PF POSTVE 3449 series-06 3588 STR TEST 370E RESLT ZERO 371C VALID 3783 GET ARGT 37FB SMALL 385D XISO stk-one: 2497 DRAW SAVE 25F8 S RND (twice) 2CD5 DEC STO 1 36B7 X NEG 36C4 EXP 371C VALID 37A1 ZPLUS 37AA cos 37B7 C ENT 37E2 atn 37FA CASES 3833 asn (twice) 385D XISO 386A ONE stk-half: 238D DR 3 PRMS 23C1 DR PRMS 2497 DRAW SAVE 373D GRE.8 (3 times) 3783 GET ARGT 384A sqr stk-pi/2: 233B C R GRE 1 2627 S PI 37E2 atn 3843 acs stk-ten: 2CDA NXT DGT 1 2D40 NXT DGT 2 2D55 E SAVE Rems: 33C6 stk-data gets literals from constant table STK ZEROS 33F1 (33C6 STK DATA) Jumps from: auto st-mem subroutine 342D see also 340F get-mem Called from 0028 FP CALC with literals C0 to C5, depending on the memory location to be filled; puts a FP number in a calculator memory location. Mem-0 is filled by st-mem-0, literal C0, and so on to C5 st-mem-5 which fills mem-5. Can be called direct from m/c, though this isn't done inthe ROM: - in ROM calls the number put in memory is always fetchedfrom the calculator stack; not necessarily in direct calls - literals C6 to DF could be used, even through FP CALC, to address an additional twenty-six memory locations; but the memory must be relocated before doing this, by putting a new address in 5C68 MEM, or 56B2 RAMTOP etc will be overwritten. If the subroutine is called direct with the location number in A, up to 33h/51d memory locations can be used - to attempt to use more would confuse 3406 LOC MEM. Input parameters: A holds the memory location number - HL holds the address of the first byte of the number to be remembered; the last value on the calculator stack in all ROM uses, but not necessarily. Action (the coding is line for line the same as 340F get-mem-0 except for some EX DE,HLs which reverse the direction of copying): get a memory pointer from 5C68 MEM - call 3406 LOC MEM to find the first byte of the selected memory location - call 33C0 MOVE FP to copy the FP number from its present address to memory. Exit: RET. Output parameters: HL unchanged - DE now points to the stack end, or the first byte after the number just copied. Called from: st-mem-0: 03F8 BEEP 0427 BE OCTAVE 1D16 F REORDER 1DAB NEXT (nb memory relocated) 235A C ARC GE1 (twice) 23A3 DR SIN NZ 23C1 DR PRMS (twice) 2439 ARC START (twice) 2497 DRAW SAVE 2CD5 DEC STO 1 2CDA NXT DGT 1 3449 series-06 36A0 n-mod-m (twice) 36B7 X NEG