ZX Spectrum Calculator literals =============================== 00 jump-true Jump if the top item is non-zero. dest-$ 01 exchange Top two items on the stack are swapped. 02 delete Delete top item Binary operations - replace top two items with result ----------------------------------------------------- 03 subtract X - Y (2nd item) - (top item) 04 multiply X * Y (2nd item) * (top item) 05 division X / Y (2nd item) / (top item) 06 to-power X ^ Y (2nd item) ^ (top item) 07 or X OR Y (2nd item) OR (top item) 08 no-&-no X AND Y (2nd item) AND (top item) 10 str-&-no X$ AND Y (2nd item) AND (top item) 09 no-l-eql X <= Y (2nd item) <= (top item) 11 str-l-eql X$ <= Y$ (2nd item) <= (top item) 0A no-gr-eq X >= Y (2nd item) >= (top item) 12 str-gr-eq X$ >= Y$ (2nd item) >= (top item) 0B nos-neql X <> Y (2nd item) <> (top item) 13 strs-neql X$ <> Y$ (2nd item) <> (top item) 0C no-grtr X > Y (2nd item) > (top item) 14 str-grtr X$ > Y$ (2nd item) > (top item) 0D no-less X < Y (2nd item) < (top item) 15 str-less X$ < Y$ (2nd item) < (top item) 0E nos-eql X = Y (2nd item) = (top item) 16 strs-eql X$ = Y$ (2nd item) = (top item) 0F addition X + Y (2nd item) + (top item) 17 strs-add X$ + Y$ (2nd item) + (top item) Uniary operations - replace top item with result ------------------------------------------------ 18 val$ VAL$ Convert string to calculated string 19 usr-$ USR Calculate address of user graphic character. 1A read-in INKEY INKEY$#n to read character from stream n. 1B negate - Negate top item 1C code CODE Convert string to character code. 1D val VAL Convert string to number. 1E len LEN Convert string to length of string. 1F sin SIN Calculate SIN n. 20 cos COS Calculate COS n. 21 tan TAN Calculate TAN n. 22 asn ASN Calculate ASN n. 23 acs ACS Calculate ACS n. 24 atn ATN Calculate ATN n. 25 ln LN Use series generator to calculate LN n. 26 exp EXP Use series generator to calculate EXP n. 27 int INT Round down to integer value. 28 sqr SQR Calculate square root. 29 sgn SGN Get sign of top item. 2A abs ABS Get absolute value of top item. 2B peek PEEK Read byte from memory. 2C in IN IN A,(C) to read from I/O port. 2D usr-no USR Call machine code. 2E str$ STR$ Convert number to string. 2F chr$ CHR$ Convert number to character. 30 not NOT Replace top item with 1 if it is zero, otherwise replace with zero. Misc. operations ---------------- 31 duplicate Duplicate the top item. 32 n-mod-m (2nd item) MOD (top item), returning INT (N/M) at top of stack and N-INT(N/M) as a calculated MOD as 2nd item. 33 jump Unconditional jump. dest-$ 34 stk-data Stacks the embedded compressed literal. nn (nn AND &3F)+&50=exponent, (nn DIV &40)+1=number of mantissa bytes mm.... mantissa bytes 35 dec-jr-nz Decrement BREG and branch if non-zero. dest-$ 36 less-0 Replace top item with 1 if less than zero, otherwise replace with zero. 37 greater-0 Replace top item with 1 if greater than zero, otherwise replace with zero. 38 end-calc End calculator operations and return to Z80 code. 39 get-argt Preprocess argument of SIN or COS. 3A truncate Round integer towards zero. 3B fp-calc-2 Perform the calculator operation in the B register. This is used to perform most Basic functions with B=&18 to &30. Replaces top of stack with result. 3C e-to-fp Calculate constant number xEm (eg 4.5E3). Cannot be called via the calculator as 3C str$hex A is used to pass a parameter. JGHROM replaces this with STR$~ to convert top item to a hex string. 3D re-stack Restacks current number in full 5-byte floating form. Multiple operations ------------------- 8x series-X Series generator. Calculates the polynomial for X, normally 6, 8 or &C. Ax stk-const Stacks a constant. X=0 zero, X=1 one, X=2 half, X=3 PI/2, X=4 ten. Cx st-mem-X Copies top item, storing it in calculator area X. Ex get-mem-X Fetches from calculator memory area X, pushes to top of stack.