171E STR DATA stream number taken from calculator stack 18B6 NUMBER moves past FP representation in BASIC line 19FB E LINE NO stack temporarily relocated in memory 1A15 E L 1 stack replaced 1C30 VAR A 2 variable values put on stack 1C79 NEXT 2NUM single expression result placed on stack 1CE6 USE ZERO zero placed on stack 1CF0 IF last value is logical value of IF statement 1D03 FOR stack already holds VALUE and LIMIT 1D10 F USE 1 one placed on stack 1D16 F REORDER memory relocated in control variable 1DAB NEXT loop variables read from relocated memory 1E7A OUT parameters fetched from stack 1E85 TWO PARAM get two numbers from stack 1E94 FIND INT1 last value put in A register 1E99 FIND INT2 last value put in BC register 1FC3 UNSTACK Z avoids loading stack in syntax check 1FFC PR ITEM 1 parameters of AT put in BC via stack 200E PR ITEM 2 parameter of TAB put in BC via stack 2070 STR ALTER stream number put on calculator stack 2148 IN VAR 2 removes FP forms from BASIC line 21FC CO TEMP 4 control parameter fetched via stack 22D4 POINT LP pixel bit put on stack 22DC PLOT pixel coordinates fetched from stack 2307 STK TO BC gets two values from stack to B & C 2314 STK TO A gets value from stack to A 2320 CIRCLE radius obtained from stack 233B C R GRE 1 x 4 in four bytes by rewriting exponent 235A C ARC GE1 manipulates exponent of number in memory 23A3 DR SIN NZ exponent read from (HL) 23C1 DR PRMS values loaded to stack then to memory 2420 DRW STEPS values in stack and memory 2425 ARC LOOP coordinates and steps remain on stack 247D CD PRMS1 on entry, last three values are X,Y,Z; six parameters stored in memory 2497 DRAW SAVE arc count saved while memory filled 24B7 DRAW LINE line increments are on top of stack 24FB SCANNING value of expression is left as last value 2522 S 2 COORD puts 2 coordinates on stack 25F8 S RND calculates RND from SEED 2627 S PI pi/2 doubled by manipulating exponent 268D S BIN FP form put in BASIC line with syntax check 26B6 S SP SKIP FP number read from BASIC line 26C9 S LETTER 5-byte number or string parameters stacked 2713 S CONT 3 discriminates string or numeric value 2734 S LOOP result so far is last value on stack 274C S STK LST converts op code to literal 275B S SYNTEST status of last value must match op code 2764 S RUNTEST status of last value recorded in flag 27D9 SF ARGMTS arguments of FN filled with FP numbers 2831 SF VALUES arguments of DEF FN filled with FP nos and string parameters 2852 SF ARG VL indirect deletion of last value 296B SFA CP V6 skip over FP numbers in DEF FN statement 29A1 SV SIMPLE$ puts string parameters on stack 2A22 SV NUMBER five bytes per number in numeric array 2A2C SV ELEM$ string parameters put on stack 2A49 SV SLICE? string parameters are on stack 2A52 SLICING string parameters on stack changed 2AB1 STK ST 0 puts FP no held in AEDCB on stack 2AB6 STK STORE 5-byte number copied above stack 2ACD INT EXP2 expression fetched to BC via stack 2B59 L NUMERIC can still read FP number after deletion 2B72 L DELETE$ string parameters fetched from stack 2BA6 L ENTER used to copy from stack to variables area 2BF1 STK FETCH gets last value from stack to AEDCB 2C9B DEC TO FP change decimal/BIN/E mode no to FP format 2CB8 NOT BIN integer part of number made last val 2CDA NXT DGT 1 mem-0 repeatedly divided by 10d to give digits added to last value one by one 2D18 E FP JUMP x times 10 to power m made last value 2D22 STK DIGIT puts decimal character code on stack 2D28 STACK A stacks integer value in A 2D2B STACK BC stacks integer value in BC 2D3B INT TO FP converts BASIC integer to FP on stack 2D40 NXT DGT 2 makes last value digit + 10*last digit 2D4F E TO FP puts xEm on calculator stack 2D55 E SAVE sign flag put in calculator memory 2D60 E LOOP stack holds interim values 2D7B E END delete looping value after exit from loop 2D7F INT FETCH collects small integer from stack 2D8C P INT STO puts positive no in small integer format 2D8E INT STORE puts number in small integer format 2DA2 FP TO BC puts last value in BC 2DAD FP DELETE can still read last value after deletion 2DC1 LOG (2**A) used to estimate print length in BASIC 2DE3 PRINT FP prints out last value 2DF8 PF POSTVE save offset in HL' while number printed 2E01 PF LOOP checks for small integer 2E24 PF SMALL mistake; stack not cleared 2E56 PF LARGE forms true exponent 2E6F PF MEDIUM true mantissa and true exponent 2E7B PF BITS mantissa rotated bitwise into print buffer 2ECB PF MORE last value replaced by memory value 2ECF PF FRACTN zero exponent with shift of mantissa 2F2D PF COUNT restores offset to HL' 2F9B PREP ADD prepares FP number for addition 2FAF NEG BYTE restores exponent and original exponent 2FBA FETCH TWO numbers from stack into H'B'C'CB and L'D'E'DE 2FDD SHIFT FP shifts mantissa R or L for addition 3004 ADD BACK manipulating exponent or mantissa may cause overflow 3014 addition adds two last values on stack 303C ADDN OFLW mistake; can stack incorrect result 303E FULL ADDN small integers re-stacked in full FP form and added (sum not a small integer) 3055 SHIFT LEN shift mantissa right for addition 307C TEST NEG negate negative nos and correct sign byte 30C0 PREP M/D make true mantissa for mult/division 30CA multiply try short multiplication first 30EA MULT RSLT result put on stack 30EF MULT OFLW overflow; restore stack pointer 30F0 MULT LONG numbers restacked in full FP format and HL' saved 3125 START MULT add exponents 313B MAKE EXPT prepare to convert true to FP exponent 313D DIVN EXP exp incremented by 80h & checked - 3 bytes 3146 OFLW1 CLR exponent checked for overflow 3151 OFLW2 CLR exponent saved 3159 NEAR ZERO exponent tested for zero 315E SKIP ZERO normalise exponent 316C NORMALISE normalise mantissa 316E SHIFT ONE shift mantissa L, decrement exponent 3186 NORML NOW mantissa goes past 0.5d; increment expt 3195 OFLOW CLR result copied to stack from 5 registers 31AF division mantissas divided by subtraction 31FA COUNT ONE mistake; 34th bit precision missed 3214 truncate check exponent for short-cut results 3221 T GR ZERO mistake; can't handle -65536 323F T SMALL test for small integer format 3267 T STORE result put on stack 326C T EXPNENT check for very large number 326D X LARGE exponent over A9 means no fractional part 3272 NIL BYTES zeroes mantissa bits for integer result 3293 RE ST TWO changes two small integers to full format 3297 re-stack changes small integer to full format 32B2 RSTK LOOP shift mantissa L (nb misprint), decrement exponent 32BD RS STORE stack new exponent 32D7 look-up table of literals 33A1 delete changes meaning of pointers, not stack 33A2 fp-calc-2 jumps to subroutine indexed by B register 33A9 TEST 5 SP tests if room for another value on stack 33B4 STACK NUM copies FP number on stack from memory 33C0 duplicate copies FP number on stack from memory 33C6 stk-data FP number in 2-5 literals must follow literals 34 stk-data or 86/88/8C series; A0-A4 stk-zero etc supply these from table 33C8 STK CONST saves next literal in H'L' 33DE FORM EXP counts literals supplied, adds zero bytes 3406 LOC MEM finds memory location serial A 340F get-mem five bytes moved to stack from memory 341B stk-zero puts constant from table on stack 342D st-mem five bytes moved from stack to memory 343C exchange two last values exchanged 3449 series-06 calculates Chebyshev polynomials 3453 G LOOP uses BREG as loop counter 346A abs zeroes sign bit 346E negate manipulates sign bit/byte 3474 NEG TEST manipulates sign byte of full FP form 3483 INT CASE manipulates sign byte for small integer 3492 sgn replaces X with sgn X 34A5 in last value changed from port number to input 34AC peek last value replaced by PEEK 34B3 usr jumps to usr value with return to STACK BC 34E9 TEST ZERO checks for zero FP number 34F9 greater-0 last value is returned as 1 or zero 3501 not last value zero -> one, other -> zero 3506 less-0 last value is returned as 1 or zero 3507 SIGN TO C carry made marker of sign byte 350B FP 0/1 last value is set to 1 or zero by carry flag 3524 no-&-no last value is X or zero 352D str-&-no returns with string parameters as last val 353B no-l-eql value in B discriminates 12 variants 354E NU OR STR discriminates string from numeric ops 3559 STRINGS get string parameters from stack 3588 STR TEST zero stacked if strings tested 359C strs-add string parameters put on stack 35BF STK PNTERS points HL and DE at last value 35C9 chr$ string parameters put on stack 35DE val result put on stack as number (val) or string parameters (val$) 361F str$ resulting string parameters put on stack 3645 read-in resulting string parameters put on stack 3669 code result put on stack 3671 STK CODE last value given by STACK A 3674 len returns string length as last value 367A dec-jr-nz works like djnz with loop count in BREG 3686 jump makes unconditional jump 3687 JUMP 2 length of jump is in following literal 368F jump-true jumps if last value non-zero 369B end-calc jumps to address in H'L' 36A0 n-mod-m values from stack replaced by quotient and remainder 36AF int last value replaced by its integer part 36C4 exp calculates Chebyshev polynomials 3705 N NEGTV exponent adjusted for negative result 370C RESULT OK result left as last value 370E RSLT ZERO last value made zero 3713 ln calculates Chebyshev polynomials 371C VALID manipulates exponent byte 373D GRE.8 last value is determined function of result 3783 get-argt transforms radians into fractions of pi/2 37AA cos result is last value 37B5 sin calculates Chebyshev polynomials 37B7 C ENT common to cos and sin 37DA tan result is last value 37E2 atn calculates Chebyshev polynomials 3833 asn result is last value 3843 acs result is last value 386C LAST return with last value zero or 1 calculation of random numbers see 2F58 S RND calculator memory, calculator offset, calculator stack see 335B CALCULATE CALL JUMP subroutine 162C Consists of a single JP (HL) command. Can be used anywhere in m/c as equivalent to a "computed GO SUB" command: compute HL, then call 162C CALL JUMP. Called from: 15F7 CALL SUB Exit from: 1615 CHAN FLAG CALL SUB 15F7 (0010 PRINT A 1) Exit from: 15E6 INPUT AD 15F2 PRINT A 2 (0010 PRINT A 1) capital letters see character codes CAPS LOCK key (06) see also FLAGS2 bit 3, KEYBOARD SCANNING,0260 control code table (d) The 2 key with caps shift effects CAPS LOCK; bit 3 of FLAGS2 is flopped. When it is on, any keyboard input which wouldhave been in L mode will be in C mode, ie all letters are upper case, but digit and token keys aren't affected. There is a separate key for CAPS LOCK on most later models of the Spectrum, but caps shift 2 still works. There is no SYMBOL LOCK on any model. 034F K KLC LET if set return with "main code" 10A8 KEY INPUT handled in this subroutine 10DB MEY M&CL flag (bit 3 of FLAGS2) flopped CAPS SHIFT key see KEYBOARD SCANNING C ARC GE1 235A (2320 CIRCLE) Jumps from: 233B C R GRE 1 carriage return key see ENTER carry from calculations see precision CASES 37FA (37E2 atn) Exit from: 37E2 atn 37F8 SMALL CASSETTE HANDLING ROUTINES see 04C2 SA BYTES cassette messages 09A1 The messages "Program: ", "Bytes: ", etc which are printed on screen during a LOAD, and "Start tape, then press anykey." which prompts a SAVE. Read by: 078A LD TYPE 0970 SA CONTRL CAT key (CF) see also commands, functions and operators, KEYBOARD SCANNING, 0284 extended mode key table (f) The 9 key in E mode with symbol shift produces the command CAT. As implemented on the standard Spectrum, the command accepts no parameters, though most peripherals that giveit some purpose in life require at least a numeric expression. The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A.1B14 P CAT causes a jump via 1C10 CLASS 00 and 1C16 JUMP C R to the executive routine 1793 CAT ETC, which however produces no action with the standard Spectrum. CAT ETC subroutine 1793 The executive routine of the FORMAT, MOVE, ERASE and CATcommands; not called otherwise from ROM. Merely gives the report"Invalid stream", unless Interface I or some analogous peripheral is connected. CA=10*A+C subroutine 2F8B Multiply A by 10 and add C. Used in 2DE3 PRINT FP to convert a 4-byte hex fraction into decimal digits. If the fraction is less than one, say 1/p, multiply it by 10; now if 10/p is still less than one, the first digit of the decimal fraction is zero. If 10/p is more than one, it will still be less than ten, and its integer part is the first digit of the decimal fraction. Repeat the process with the fractional part for the next digit. The fraction is in D'E'DE. This subroutine is called foreach of the bytes in turn, starting with the lowest, with the C register initially zero. Any "carry" from the multiplication is returned in C ready to be added to the next highest byte. Eg if the bytes were