Each_digit_code is 30h/48d higher than its value: 00110000b/30h/48d "zero" to 00111001b/39h/57d "9" Letters can be made uniformly upper-case by AND 11011111b/DFh/223d and made uniformly lower-case by OR 00100000b/20h/32d. 3. When the letters are used for variable names the first three bits are changed, and all letters are made lower case. 4. Printable codes: this means different things in different parts of the notes. In 007D SKIP OVER and its related routines it means any code from 21h "!" upwards, ie any letter, digit, symbol, graphic or token, but_not the space and not colour or position control codes. The space is printed, of course, but is skipped in reading BASIC, eg in variable "long names". At 09F4 PRINT OUT the space is printable, but not control codes. Similarly at 0A69 PO QUEST and 0AD9 PO ABLE. 5. The token codes can be classified as _command_codes: CE DEF FN to FF COPY _functions A5 RND to C2 CHR$ a few others: "adverbs" such as STEP, CODE, LINE "terminators", THEN. Rems ["Get next character" and similar in the notes, annotating calls to 0018 GET CHAR or 0020 NEXT CHAR, haven't been indexed in this long list]: Introduction: returned by keyboard routine 0010 PRINT A 1 code held in A 0018 GET CHAR check for printable character 001C TEST CHAR check for printable character 007D SKIP OVER skips control parameters and flags everything below 21h "!" 0333 K DECODE handles G mode 0341 K E LET handles E mode 034F K KLC LET handles K/L/C modes and SYMBOL SHIFT 0367 K DIGIT separate according to mode 0382 K 8 & 9 BRIGHT and FLASH 0389 K GRA DGT block graphics 039D K KLC DGT modes K, L, C 0621 SA SPACE ten characters allowed for file name 0652 SA DATA is it 'DATA'? 0716 SA LINE is it "LINE"? 0767 LD LOOK H ten characters of name matched 078A LD TYPE checked and printed simultaneously 07A6 LD NAME check old against new 07AD LD CH PR print ten new 0909 ME OLD V2 point to first character of name 0912 ME OLD V3 letter-by-letter comparison of vble names 09F4 PRINT OUT entered holding in A 0A3D PO RIGHT print invisible space 0A4F PO ENTER carriage return empties print buffer 0A69 PO QUEST "?" printed for "unprintable" codes 0A6D PO TV 2 control codes saved 0A75 PO 2 OPER code of AT or TAB saved 0A7D PO TV 1 control code saved 0A80 PO CHANGE make next code count as operand 0A87 PO CONT deal with AT 0AC2 PO TAB deal with TAB 0AD9 PO ABLE prints a code 0B24 PO ANY jump forward with all but graphics codes 0B38 PO GR 1 construct graphic characters 0B3E PO GR 2 graphic code determined 0B52 PO T&UDG tokens and UDG codes separated 0B6A PO CHAR 2 jump if not space 0B76 PO CHAR 3 put 8*code in HL, add to character base 0B7F PR ALL prints all characters 0BB7 PR ALL 4 prints character 0BC1 PR ALL 5 set attribute after printing character 0C10 PO TOKENS prints token codes 0C22 PO EACH print characters of tokens 0C3B PO SAVE single character printed "recursively" 0C41 PO SEARCH initial character found in table 0C44 PO STEP finds next after inverted character 0C55 PO SCR called on carriage return 0E0D CL SCR 2 line holds 20h characters 0E19 CL SCR 3 count characters remaining in third 0F38 ED LOOP sorts out control and edit codes 0F81 ADD CHAR adds code to EDIT or INPUT line 0F8B ADD CH 1 enters code 0F92 ED KEYS code indexes jump to editing routine 100C ED RIGHT put cursor after current character 1015 ED DELETE reclaim one character 101E ED IGNORE key inputs ignored 103E ED EDGE 1 jump if not control code 10A8 KEY INPUT checks LAST K and corrects control codes 111B KEY DONE return with code in A 11A7 REMOVE FP check characters for number marker 1313 MAIN G adds 7 to ASCII value for report number 15DE WAIT KEY1 loops till it gets an acceptable code 15EF OUT CODE called with code in A 1767 OPEN 3 channel code used in look-up table 178B OPEN END channel code must be single character 1865 OUT LINE1 pointer set on first character of line 1894 OUT LINE4 loop to print characters of BASIC line 18B6 NUMBER looks for character 0E (number marker) 18C1 OUT FLASH prints a flashing cursor 18E1 OUT CURS uses C, E, G, K or L for cursor 18F3 OUT C 1 chooses cursor character according to mode 1925 OUT SP 2 prints all characters and tokens in BASIC 192B OUT SP 1 digit printed 1937 OUT CHAR discriminated from other keys 1937 OUT CHAR entry point for characters and tokens 195A OUT CH 1 discriminates " from other characters 1968 OUT CH 2 signal characters in L mode 196D OUT CH 3 prints character 1998 EACH S 2 loop to look at each character in line 19CE NEXT O 2 looks for last in variable long name 19FB E LINE NO reads digits of line number 1A30 OUT NUM 3 prints digits of line number 1A42 OUT NUM 4 prints digits of line number 1B17 LINE SCAN each in turn addressed by CH ADD 1B29 STMT L 1 check for newline or ":" 1BD1 NEXT LINE pointer set before first of line 1D64 F LOOP lower case set by OR 20h 1D96 LOOK PROG on entry, code in E register 1F86 DEF FN 1 must be a letter 1FF2 PRINT 4 return if ')' 1FFC PR ITEM 1 handles AT 200E PR ITEM 2 handles TAB 2045 PR END Z return if ')' 2048 PR ST END return if carriage return 204E PR POSN 1 handles PRINT comma 20C1 IN ITEM 1 jumps depending on code read 20ED IN ITEM 3 jump if not a letter 211C IN PR 2 two characters printed on screen 21B9 IN ASSIGN fetch code, check for STOP/ENTER 24FB SCANNING reads first character of expression 24FF S LOOP 1 index into table with character 250F S QUOTE 3 step through chars to find close quote 2522 S 2 COORD checks for "(" and ")" 2535 S SCRN$ S character set holds 96 characters 254F S SCRN LP character on screen checked with char set 255D S SC ROWS converts counter to character code 2573 S SCR NXT loop through 96 characters in char set 257D S SCR STO stack character 25CB S Q COPY copy characters to work space 2634 S INKEY$ character is string length one 2684 S ALPHNUM check if alphanumeric 268D S DECIMAL read expression starting with a digit 26B6 S SD SKIP step through till number marker found 26DF S NEGATE char checked for various function codes 2723 S OPERTR checks for binary operators 27D0 SF BRKT 1 error unless "(" 27E4 SF BRKT 2 error unless ")" 2814 SF CP DEF checks function name for "$" 283E L CHAR each code of "long name" made lower case 2843 SF ARG LP checks for "$" or number marker 2852 SF ARG VL checks after FP no for ")", "," 28AB FN SKPOVR steps over spaces/control codes in DEF FN 28EF V RUN/SYN blanks character code 2900 V EACH checks codes in variable name 2912 V MATCHES check next 2913 V SPACES checks codes, skipping spaces and making all lower case by OR 20h 2934 V SYNTAX fetch code, check for "(" 294B V END points to last code of variable name 296B SFA CP VR checks for ")" in DEF FN 29C3 SV COMMA checks for comma and ")" 29D8 SV CLOSE checks for ")" and TO 29E0 SV CH ADD gets char and moves back to previous 29EA SV LOOP checks for ")" and TO 2A12 SV RPT C checks for ")" 2A2C SV ELEM$ checks for ")" and comma 2A49 SV SLICE? checks for "(" 2A7A SL RPT C single character slice 2B0B L EACH CH characters in variable name counted 2B0C L NO SP checks codes in variable name 2B1F L TEST CH checks alphanum or "$" 2B29 L SPACES marks codes in variable name 2B3E L CHAR all codes made lower case 2C88 ALPHANUM check for digit or letter 2C8D ALPHA check for letters 2CB8 NOT BIN looks for digits to print 2CDA NXT DGT 1 picks up decimal digit and adds in to FP number 2CEB E FORMAT check for 'E' or 'e' 2CFE SIGN DONE read first digit of E format number 2CFF ST E PART check for digit 2D1B NUMERIC discriminates digit codes 2D22 STK DIGIT replace digit code by digit value 2D3B INT TO FP fetch and save digits 2D40 NXT DGT 2 reads digit codes from BASIC 2DE3 PRINT FP converts FP number to string of decimal digits 2DF2 PF NEGTVE prints code "-" for negative numbers 2E24 PF SMALL mem-5 holds number of digits to print 2E56 PF LARGE not more than 8 digits in E-format 2E8A PF BYTES two-digit bytes converted to 1-digit 2EA1 PF DIGITS jump if digit not zero 2EA9 PF INSERT counting digits 2EB8 PF ALL 9 nine digits stored in print buffer 2EDF PF FRN LP last digit rounded in print buffer 2EEF PF FR EXX store digit count and last digit 2F0C PF ROUND round eighth digit in print buffer 2F18 PF RND LP final 0 or 10d not valid digit 2F25 PF R BACK overflow makes 1 more before point 2F2D PF COUNT number of digits to be printed 2F46 PF NOT E initial zero if none before point 2F4A PF E SBRN print digits before the point 2F52 PF OUT LP put digit in A for printing 2F59 PF OUT DT print digit 2F5E PF DC OUT puts fraction point code in A 2F64 PF DEC 0S prints point and puts code for "0" in A 2F6C PF E FRMT prints code "E" in E-format numbers 2F83 PF E POS prints code "+" in E-format numbers 35DE val adds newline to end of expression 361F str$ room made in work space for each character 3669 code returns first character code in A$ character form see character set character line see DISPLAY AREA character pointers Used in 2991 SFA END to mean "the addresses of the variable letter and the following character in the program area or work space which were pushed on the stack in 28B2 LOOK VARS, before the jump to 2951 STK F ARG from 2853 V TEST FN". characters see character code character set 3D00 (confusingly called "character area" in 0B65 PO CHAR) The character set consists of 96d_character_forms, one form for each character code from 20h/32d space to 7Fh/127d copyright symbol inclusive: each form consists of eight consecutive bytes, one for each pixel line of the character. Seethe description on page 221 of the notes, or in Chapter/Part 16 of the Spectrum handbooks. The "base address" of the character set in 5C36 CHARS isn't 3D00 as you might expect, but 3C00; to find any character form in the set you add 8 times its code to the base address, but the first code is character 20h, so you find it by 3C00 + 8 * 20 = 3D00. The set contains only the letters, digits and symbols, not the graphic forms which are drawn as required by ROM, the user-defined graphics or of course any tokens. The character set, being in ROM, cannot be changed: the user-defined graphics are put in RAM precisely so that they can be changed. 0B38 PO GR 1 graphics constructed ad hoc in MEMBOT area 0B4C PO GR 3 construction of graphics 0B65 PO CHAR form found in character set 0B76 PO CHAR 3 finds character form in char set or UDGs 0B7F PR ALL on entry DE holds address of char form 0BB7 PR ALL 4 screen byte XORed with form byte 0BC1 PR ALL 5 next pixel byte of 11EF RAM DONE forms A to U copied to UDG 2535 S SCRN$ prepare to check screen pixel byte against first form byte of 60h/96d characters 254F S SCRN LP check both direct and inverse 255D S SC ROWS check remaining 7 bytes of form/screen 2573 S SCR NXT loop on to next form 3D00 character set holds 60h/96d codes 20h -> 7Fh character strings see strings CHARS system variable 5C36 Bytes: 2 The base address of the character set: since the set consists of characters 32 -> 127d, CHARS is set 8 * 32 = 256d/ 100h_below the first character form. Normally set at 3C00; can be set at 100h below any m/c character set. Written by: 1219 RAM SET Read by: 0B65 PO CHAR 2535 S SCRN$ S Chebyshev polynomials see also series-06 This is a way of finding approximations to complicated functions by a long series of simple calculations. The calculations used are essentially only addition, subtraction andmultiplication. It is an example, a very difficult one, of an algorithm; see algorithms in the index. A "function of z" means an expression like SIN z or z**2or 7z + 14, which has z as a variable and takes different valuesfor different values of z. It is a mathematical fact that any function whatever of z can be_approximated_within_a_limited_range of z by an expression of the type A + Bz + Cz**2 + Dz**3 ... + Pz**N, it being understood that z is the only variable in the expression; the_coefficients A, B, C ... P are actual numbers determined for the approximation of this particular function. Some of the constants A, B etc may be zero or negative, and often are. Such an expression is called a_polynomial_in_z. Generally speaking the range of z, ie the range of values for which the polynomial gives a good approximation to the function,is limited to -1 < z < 1. N will be quite a small number, depending on the closeness of the approximation desired, the range to be covered,and the degree of complication of the function of z. In the ROM,the highest value of N used is 12d, for LN z and ATN z. An illustration may help: if you draw a line from Londonto Manchester on the map, and another line from London to Birmingham, and measure the angle between them, you won't get exactly the same angle as if you drew the lines on the ground; because the world is round and your map is flat. But for distances of a few hundred miles, the straight-line approximation, using a polynomial in which the highest value of N is one, ie Y = A + Bz, gives an approximation to the curved lines on the ground good enough for navigation. If you were sailing from Yokohama to San Francisco across the Pacific, you would have to allow for the world being round. Navigators use formulae which assume the world is spherical, and get good results over any distance by using circles to approximate the curves through which their craft are travelling. Circles represent polynomial approximations in whichthe highest value of N is two, Y = A + Bz + Cz**2. This isn't really exact either, because the world isn't a perfect sphere, but slightly oval; not even quite symmetrical,but slightly pear-shaped. However the difference isn't big enough to matter: if the ship is an inch or two too far to the left as it sails into San Francisco Bay the navigator isn't going to get the sack for it.