colon see ":" (code 3A) after end of alphabet colour control codes/parameters, colour item commands see colours COLOUR ITEM ROUTINES see 21E2 CO TEMP 2 colours Screen colours are controlled by the_attributes. The_attributes_area, 5800 to 5AFF inclusive, one attribute byte for each of the 300h/768d character positions on the screen, takes up much less memory than the display area, which has eight bytes for each character. Logically enough, the first 20h/32d attribute bytes control the colours of the first line of characters in the display and so on. In each attribute byte the bits represent fbpapink: bit 7 is on for FLASH bit 6 is on for BRIGHT bits 5 to 3 hold the PAPER (000 BLACK to 111b/7d WHITE) bits 2 to 0 hold the INK (000 BLACK to 111b/7d WHITE) The attributes are set from the system variables 5C8D ATTR P, 5C8F ATTR T, and 5C48 BORDCR. The_permanent_colours, which are used to colour the upper part of the screen as a whole, are kept in ATTR P, and the_temporary_colours, those to be used for the next character printed, in ATTR T. The permanentattributes for the lower screen are are kept separately in BORDCR, with the same PAPER colour as the border. The attributes don't control INVERSE and OVER which are signalled by flags in 5C91 P FLAG, and the border, apart from the lower screen, is coloured by quite different means, see 2294BORDER. Whenever a character is printed, the corresponding attribute byte is loaded from ATTR T with the temporary colours,by 0BDB PO ATTR. When INK, PAPER, FLASH, BRIGHT, INVERSE, OVER - the _INK_to_OVER tokens - are used as commands, ie opening a BASIC statement on their own, the executive routine 1C96 CLASS 07 (PERMS) changes both the permanent attributes in ATTR P and the temporary attributes in ATTR T. However, if a PRINT command is followed by an INK to OVER item - these aren't now commands but_embedded_colour_items or_colour_control_items - the call to 21F2 CO TEMP 3 from 2024 PR ITEM 3 prints out the necessary_control_codes, see below; these are executed by 0A6D PO TV 2, which exits from 0A87 PO CONT to 2211 CO TEMP 5, where a mask is prepared, and finally the temporary colours are set in ATTR T by 2287 CO CHANGE. If the PRINT command doesn't specify any of INK to OVER,then it is the permanent colour values in ATTR P which are to beused, so each time a PRINT command is executed (1FCF PRINT 1) a call is made to 0D4D TEMPS to put the ATTR P values in ATTR T; if they aren't changed by an embedded colour item, these are thevalues which will be implemented in printing the character. Some of the "embedded print items" can be substituted bykeying codes directly, all in E mode except INVERSE VIDEO and TRUE VIDEO - you can even colour code your BASIC in this way, see variables: INK by keying the INK colour with caps shift PAPER by keying the PAPER colour without shift FLASH key 9 (on) or key 8 (off) with caps shift BRIGHT key 9 (on) or key 8 (off) without shift INVERSE VIDEO and TRUE VIDEO are separate keys on later models, but on the older Spectrum they can be got by keying 4 (on) or 3 (off) in L mode with caps shift - and this still workswith the new models. It isn't possible to key in OVER (1Bh) in this way. These keystrokes are coded by 0367 K DIGIT with character codes as follows: FLASH 00 off, 01 on BRIGHT 02 off, 03 on TRUE VIDEO 04 INVERSE VIDEO 05 PAPER 10h BLACK to 17h WHITE INK 18h BLACK to 1Fh WHITE However they are recoded by 10A8 KEY INPUT into two _control_codes each, the same as those produced by the embedded colour items described above: off on INK 10h/16d colour no PAPER 11h/17d colour no FLASH 12h/18d 0 1 BRIGHT 13h/19d 0 1 INVERSE 14h/20d 0 1 (OVER 15h/21d 0 1) All these, including OVER, can be incorporated in strings by concatenating their control codes as CHR$ X + CHR$ Y,or of course used in m/c programs. And the colour 8 "leave the present attribute as it is" can be used with all the controls except INVERSE and OVER; colour 9 "black or white contrasting" only with PAPER and INK. 007D SKIP OVER skips parameters of INK to OVER 0367 K DIGIT keys 0-9 in E mode control INK to OVER 0382 K 8 & 9 checks for BRIGHT and FLASH 06A0 SA SCR$ the attributes are saved by SAVE SCREEN$ 09F4 PRINT OUT A may hold INK to OVER on entry 0A11 control character table incl INK to OVER 0A6D PO TV 2 INK to OVER require one operand 0A7A PO 1 OPER entry to PO TV 2 for colour controls 0A7D PO TV 1 control saved in TV DATA 0A80 PO CHANGE channel output address changed to fetch parameter 0A87 PO CONT fetch parameter 0BC1 PR ALL 5 ready to set attribute byte 0BDB PO ATTR attribute set by ATTR T 0BFA PO ATTR 1 contrast with PAPER for INK 9 0C08 PO ATTR 2 attribute put on screen 0CD2 PO SCR 3 finds attribute position 0CF0 PO SCR 3A two lines in lower screen filled with attributes 0D02 PO SCR 4 lower screen cleared with permanent cols 0D6B CLS all attributes set with ATTR P 0D6E CLS LOWER lower screen cleared with border colours 0D89 CLS 2 attributes set backwards from line end 0E19 CL SCR 3 scroll all attributes up 20h/32d places 0E4D CL LINE 2 finds attribute posn and gets attr value 0E80 CL LINE 3 copy BC attributes 0E88 CL ATTR finds attribute address for given position 0F38 ED LOOP editing INK to TAB (AT and TAB in error) 0F6C ED CONTR gets parameter code 1031 ED EDGE cursor skips over parameters 103E ED EDGE 1 cursor left (AT, TAB included in error) 1051 ED EDGE 2 control code deleted by DELETE 10A8 KEY INPUT handles colour control parameters 10FA KEY CONTR handled by, except FLASH, BRIGHT, INVERSE 1105 KEY DATA returns code & parameter in two passes 111D ED COPY permanent colours to print in lower screen 1150 ED BLANK spaces in permanent paper colour 1219 RAM SET PAPER 7 INK 0, FLASH/BRIGHT 0, on start-up 1937 OUT CHAR handles print controls in listing BASIC 1CBE CLASS 09 default colours "8" set up (DRAW etc) 1C96 CLASS 07 (PERMS) executes colour item commands 1CD6 CL 09 1 look for temporary colours (DRAW etc) 2024 PR ITEM 3 outputs INK to OVER and one parameter 2089 INPUT can be embedded items in INPUT statement 20C1 IN ITEM 1 deals with embedded items 21E1 CO TEMP 1 handles embedded items, ATT P etc 21E2 CO TEMP 2 check for embedded item 21F2 CO TEMP 3 parameter read 21FC CO TEMP 4 outputs control code and parameter 2211 CO TEMP 5 alters attribute svs as needed 2211 CO TEMP 5 makes mask for INVERSE/OVER 2228 CO TEMP 6 deals with INVERSE/OVER 2234 CO TEMP 7 deals with PAPER/INK 223E CO TEMP 8 only allows PAPER/INK 0 to 9 2244 REPORT K invalid colour 2246 CO TEMP 9 handles colours 8 and 9 2258 CO TEMP B adjusts mask for PAPER/INK 8 or 9 2273 CO TEMP C deals with FLASH/BRIGHT 2287 CO TEMP E FLASH/BRIGHT 8 2580 S ATTR S executes ATTR (x,y) 28AB FN SKPOVR skips all control codes 295A SFA LOOP skips all control codes 2B0B L EACH CH ignores colour codes 2B0C L NO SP step over codes following INK to OVER colour system variables see 5C8D ATTR P, 5C8F ATTR T, colours, 5C91 P FLAG column number see DISPLAY AREA comma see "," (code 2C, at end of alphabet), control characters (PRINT comma, code 06) command (BASIC), command classes see 1B8A LINE RUN, 1C10 CLASS 00 to 1CDB CLASS 0B, commands, functions and operators COMMAND CLASSES 01, 02 AND 04 see 1C1F CLASS 01 command class tables 1C01 see 1B8A LINE RUN, commands, functions and operators, tables command codes, command routines Ie the codes and routines which execute BASIC commands. A reference to the appropriate routine will be found in this index under the "key" of each command; see also 1B8A LINE RUN. commands, functions, and operators see also 1B8A LINE RUN, 24FB SCANNING Keys CE DEF FN -> FF COPY are all_commands; they can start a BASIC line, they aren't evaluated as expressions - ie read as numbers or values of string variables - and all the commonly used ones are read as the value of their keys in K- mode, indeed all the letter keys in K-mode produce commands. Commands are interpreted and executed by 1B28 STMT LOOP (see under 1B8A LINE RUN) through the tables at 1A48 and following. BASIC commands are classified according to the operands which they require; 1B55 GET PARAM (see under 1B28 LINE RUN), inconjunction with the 1A7A syntax parameter table and the CLASS 00-0B routines ensure that the parameters are fetched and storedsuitably before the jump to the executive routine. There is a list of the classes on page 86 of the notes, but it doesn't givethe subroutine addresses; they are in the table at 1C01: 1C10 CLASS 00 no more operands 1C1F CLASS 01 one variable 1C4E CLASS 02 one expression 1C0D CLASS 03 numeric expression, default zero 1C6C CLASS 04 one-character variable 1C11 CLASS 05 optional operand or operands 1C82 CLASS 06 numeric expression 1C96 CLASS 07 handles colour items 1C7A CLASS 08 two numeric expressions with comma 1CBE CLASS 09 same with optional colour items 1C8C CLASS 0A string expression 1CDB CLASS 0B handles cassette routines Keys A5 RND -> C4 BIN except for AC AT and AD TAB are _functions, which in most cases are followed by_arguments; the arguments may be numbers or strings, depending on the function. The functions are evaluated through 24FB SCANNING and the following routines into a numeric or string value. A function together with its arguments if any is an_expression, treated syntactically as a number or a string. Keys C5 OR -> C9 <> , and the arithmetic symbols 28 ( to47 / and 3C < to 3E > are_binary_operators, which resemble functions in being evaluated to a numeric or string value, but differ from them in coming_between their operands, ie the numberor string produced depends on what precedes as well as what follows. "Operand" means much the same as "argument"; the notes usually call them operands for operators and arguments for functions, but the distinction isn't a real one - indeed, in maths, operators_are functions. The word "operations" is sometimes used in the notes to mean "operators and functions". Operators therefore must have a priority ranking. They are mostly handled by 2713 S CONT 3 and the following routines: the priority table is at 2780. NOT is described as a "unary operator", and "+" and "-" can also be used as unary operators; there is no distinction between unary operators and functions, except that all functions have maximum priority and unary operators don't. For the other tokens - AT, TAB, LINE, THEN, TO, STEP - see under the "key" entry in this index.