Alphabetical list of tokens and symbols: token/ |code |priority, |arguments symbol | |Command, |command | | |Function, |class| | | |Operator, | |literal | | |Separator | | | | | | |main | | |executive SR | | | |key | | | | | | | |mode | | | | ---------+--+-+-+------------+--+--+--------------+------------ + |2B|O|K|K/L sym sh |P6|0F|3014 addition |two num | |O| | | |17|359C strs-add |two str | |F| | | | |25AF S U PLUS |num - |2D|O|J|K/L sym sh |P6|03|300F subtract |two num unary - |2D|O|J|K/L sym sh |P9|1B|346E negate |num * |2A|O|B|K/L sym sh |P8|04|30CA multiply |two num / |2F|O|V|K/L sym sh |P8|05|31AF division |two num up arrow |5E|O|H|K/L sym sh |PA|06|3851 to-power |two num = |3D|O|L|K/L sym sh |P5|0E|353B nos-eql |two num | | | | | |16|353B str-eql |two str > |3E|O|T|K/L sym sh |P5|0C| |two num | | | | | |14|353B str-eql |two str < |3C|O|R|K/L sym sh |P5|0D| |two num | | | | | |15|353B str-eql |two str <= |C7|O|Q|K/L sym sh |P5|09| |two num | | | | | |11|353B str-eql |two str >= |C8|O|E|K/L sym sh |P5|0A| |two num | | | | | |12|353B str-eql |two str <> |C9|O|W|K/L sym sh |P5|0B| |two num | | | | | |13|353B str-eql |two str . |2E|F|M|K/L sym sh | | |268D S DECIMAL|num , |2C|S|N|K/L sym sh | | | | |06| |N|K/L sym sh | | |0AF5 PO COMMA |two any " |22|F|P|K/L sym sh | | |25B3 S QUOTE |any ( |28|F|8|K/L sym sh | | |25EB S BRACKET|any ABS |BD|F|G|E no shift | |2A|346A abs |num ACS |B6|F|W|E either sh | |23|3843 acs |num AND |C6|O|Y|K/L sym sh |P3|08|3524 no-&-no |two num | | | | |P3|10|32F7 str-&-no |str & num ASN |B5|F|Q|E either sh | |22|3833 asn |num AT |AC|-|I|K/L sym sh | | |0A75 PO 2 OPER|two num ATN |B7|F|E|E either sh | |24|37E2 atn |num ATTR |AB|F|L|E either sh | | |2672 S ATTR |two num BEEP |D7|C|Z|E either sh |C8| |03F8 BEEP |two num BIN |C4|F|B|E no shift | | |268D S DECIMAL|bin digits BORDER |E7|C|B|K |C6| |2294 BORDER |num BRIGHT |DC|C|B|E either sh |C7| |1C96 PERMS |num CAT |CF|C|9|E sym shift |CA| |1793 CAT ETC |str CIRCLE |D8|C|H|E either sh |C9| |2320 CIRCLE |three num CHR$ |C2|F|U|E no shift | |2F|35C9 chr$ |num CLEAR |FD|C|X|K |C3| |1EAC CLEAR |none or num CLOSE # |D4|C|5|E sym shift |C6| |16E5 CLOSE |num CLS |FB|C|V|K |C0| |0D6B CLS |none CODE |AF|F|I|E no shift | |1C|3669 code |str CONTINUE |E8|C|C|K |C0| |1E5F CONTINUE |none COPY |FF|C|Z|K |C0| |0EAC COPY |none COS |B3|F|W|E no shift | |20|37AA cos |num DATA |E4|C|D|E no shift |C5| |1E27 DATA |strs or nums DEF FN |CE|C|1|E sym shift |C5| |1F60 DEF FN |str or num DIM |E9|C|D|K |C5| |2C02 DIM |num or str DRAW |FC|C|W|K |C9| |2382 DRAW |2/3 num ERASE |D2|C|7|E sym shift |CA| |1793 CAT ETC |str EXP |B9|F|X|E no shift | |26|36C4 exp |num FLASH |DB|C|V|E either sh |C7| |1C96 PERMS |num FN |A8|F|2|E sym shift | | |25F5 S FN |str or num FOR |EB|C|F|K |C4| |1D03 FOR |num FORMAT |D0|C|0|E sym shift |CA| |1793 CAT ETC |str GO SUB |ED|C|H|K |C6| |1EED GO SUB |num GO TO |EC|C|G|K |C6| |1E67 GO TO |num IF |FA|C|U|K |C6| |1CF0 IF |num IN |BF|F|I|E either sh | |2C|34A5 in |num INK |D9|C|X|E either sh |C7| |1C96 PERMS |num INKEY$ |A6|F|N|E no shift | | |2634 S INKEY$ |none INPUT |EE|C|I|K |C5| |2089 INPUT |num or str INT |BA|F|R|E no shift | |27|36AF int |num ---------+--+-+-+------------+--+--+--------------+------------ token/ |code |priority, |arguments symbol | |Command, |command | | |Function, |class| | | |Operator, | |literal | | |Separator | | | | | | |main | | |executive SR | | | |key | | | | | | | |mode | | | | ---------+--+-+-+------------+--+--+--------------+------------ INVERSE |DD|C|M|E either sh |C7| |1C96 PERMS |num LEN |B1|F|K|E no shift | |1E|3674 len |str LET |F1|C|L|K |C1| |2AFF LET |nu or str LINE |CA| |3|E sym shift | | | | LIST |F0|C|K|K |C5| |17F9 LIST |none or num LLIST |E1|C|V|E no shift |C5| |17F5 LLIST |none or num LN |B8|F|Z|E no shift | |25|3713 ln |num LOAD |EF|C|J|K |CB| |0605 SAVE ETC |str LPRINT |E0|C|C|E no shift |C5| |1FC9 LPRINT |any MERGE |D5|C|Y|E either sh |CB| |0605 SAVE ETC |str MOVE |D1|C|6|E sym shift |CA| |1793 CAT ETC |str NEW |E6|C|A|K |C0| |1187 NEW |none NEXT |F3|C|N|K |C4| |1DAB NEXT |num NOT |C3|F|S|K/L sym sh | |30|3501 not |num OPEN # |D3|C|4|E sym shift |C6| |1736 OPEN |num & str OR |C5|O|U|K/L sym sh |P2|07|351B or |two num OUT |DF|C|O|E either sh |C8| |1E7A OUT |two num OVER |DE|C|N|E either sh |C7| |1C96 PERMS |num PAPER |DA|C|C|E either sh |C7| |1C96 PERMS |num PAUSE |F2|C|M|K |C6| |1F3A PAUSE |num PEEK |BE|F|O|E no shift | |2B|34AC peek |num PI |A7|F|M|E no shift | | |2627 S PI |none PLOT |F6|C|Q|K |C9| |22DC PLOT |two num POINT |A9|F|8|E sym shift | | |267B S POINT |two num POKE |F4|C|O|K |C8| |1E80 POKE |two num PRINT |F5|C|P|K |C5| |1FCD PRINT |num or str RANDOMIZE|F9|C|T|K |C3| |1E4F RANDOMIZE|none or num READ |E3|C|A|E no shift |C5| |1DED READ |strs or nums REM |EA|C|E|K |C5| |1BB2 REM |any RESTORE |E5|C|S|E no shift |C3| |1E24 RESTORE |num RETURN |FE|C|Y|K |C0| |1F23 RETURN |none RND |A5|F|T|E no shift | | |25F8 S RND |num RUN |F7|C|R|K |C3| |1EA1 RUN |none or num SAVE |F8|C|S|K |CB| |0605 SAVE ETC |str SCREEN$ |AA|F|K|E either sh |- | |2535 S SCRN$ S|two num SGN |BC|F|F|E no shift | |29|3492 sgn |num SIN |B2|F|Q|E no shift | |1F|37B5 sin |num SQR |BB|F|H|E no shift | |28|384A sqr |num STEP |CD| |D|K/L sym sh | | |1D03 FOR |num STOP |E2|C|A|K/L sym sh |C0| |1CEE STOP |none STR$ |C1|F|Y|E no shift | |2E|361F str$ |num TAB |AD| |P|E no shift | | |0A75 PO 2 OPER|two num TAN |B4|F|E|E no shift | |21|37DA tan |num THEN |CB|S|G|K/L sym sh | | | | TO |CC| |F|K/L sym sh | | |1D03 FOR |num USR |C0|F|L|E no shift | |2D|34B3 usr-no |num | | | | | |19|34BC usr-$ |str VAL |B0|F|J|E no shift | |1D|35DE val |str VAL$ |AE|F|J|E either sh | |18|35DE val$ |str VERIFY |D6|C|R|E either sh |CB| |0605 SAVE ETC |str ---------+--+-+--------------+--+--+--------------+------------ COMPARE LINE NUMBERS SUBROUTINE see 1980 CP LINES COMPARISON OPERATIONS see 353B no-l-eql compiling BASIC see BASIC INTERPRETER 'complete' simple strings see 2AFF LET CONTINUE key (E8) see also commands, functions and operators, KEYBOARD SCANNING The C key in K mode produces the command CONTINUE, whichaccepts no parameters. The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A.1AB8 P CONT causes a jump via 1C10 CLASS 00 and 1C16 JUMP C R tothe executive routine 1E5F CONTINUE. CONTINUE subroutine 1E5F Called only by the statement loop through the syntax parameter table 1A7A to execute the CONTINUE command. Jumps to the last recorded line and statement numbers. Input parameters: none Action: get the line and statement numbers in svs 5C6E OLDPPC and 5C70 OSPCC; see 1376 MAIN 7 under 12A2 MAIN EXEC for the way these are prepared for CONTINUE. Exit: into 1E73 GO TO 2, which puts the numbers in svs 5C42 NEWPPC and 5C44 NSPPC and returns into the statement loop at 1B76 STMT RET. Output parameters: none. control characters (control codes/keys) see also colours, editing The expressions "control characters" and "control codes/keys" are used in the notes to refer to three different kinds ofcode: 1. The_print_items which can follow a PRINT command: they include the_"INK_to_OVER" colour controls D9 INK, DA PAPER, DB FLASH, DC BRIGHT, DD INVERSE, DE OVER, which are discussed separately under "colours" the_position_controllers AC AT and AD TAB the controls 06_PRINT_comma, 3B_semicolon and 27h '; these are also position controllers. INK to INVERSE can all also be used as free-standing BASIC commands, but OVER and the position controllers cannot. 2. The_embedded_print_items: the digit keys in extended mode can produce the eight paper and ink colours, FLASH and BRIGHT. They put a control code in the BASIC line followed by a colour or on/off parameter: the codes are 10h INK, 11h PAPER, 12h FLASH and 13h BRIGHT. Code 06 PRINT comma can be input similarly, by the fairly well-known trick of keying E-mode 6 andthen DELETE: E-mode 6 is the colour control for yellow paper, and puts the control codes 11h, 06 in the BASIC line. DELETE deletes the 11h leaving the 06 isolated, which will now be interpreted as a PRINT comma. These inputs work directly on the BASIC line which includes them, but if they are in a string they are incorporatedin the string whenever it is used, and to some extent the same is true of variable names, see the index entry "variables". The 8 and 9 colours, INVERSE, OVER, AT, TAB and the newline cannot be input direct from the keyboard in this way, but they can be input by other channels or of course used from machine code. 3. The_editing_controls, 07 EDIT, 08 -> 0B cursor shifts, 0C DELETE, 0D ENTER: none of these can be used as BASIC commandsor can follow a PRINT command. One of them, 08 cursor left, can be concatenated in strings, sometimes usefully, but not the others. AT and TAB each require two numeric_operands or _parameters. The second parameter of TAB isn't put in the BASIC - the single BASIC parameter is made into two bytes by the ROM -but must be incorporated in string concatenations or m/c printing. The colour items have one parameter each; PRINT comma,semicolon and 27h ' of course have none. The implementation of the colour controls in all their different forms is explained in the index under colours. The implementation of the position controllers is in thePRINT command routine 1FCD PRINT, by calls from 1FE5 PRINT 3 to 204E PR POSN 1 and 1FFC PR ITEM 1. 204E PR POSN 1 outputs codes to 0010 PRINT A 1 as follows: 3B semicolon: no output - this just means "no tab" 2C comma: outputs 06 PRINT comma 27 ': outputs 0D newline 1FFC PR ITEM 1 outputs codes to 0010 PRINT A 1 as follows: AC,X,Y (AT X,Y): 16h,X,Y; 16h is the control code for AT AD,X (TAB X): 17h,0,Y; 17h is the control code for TAB, Yis X modulo 32d This is similar to the implementation of the colour items. Like the colour items, the position control codes can beconcatenated into strings: 10 LET h$="hello"+CHR$ 13+"there" 20 PRINT h$ will print hello there Code 13d is the newline produced by 27h '. This kind of thing can also be done extensively in printing from m/c. The edit controls are read from the input by the 0F2C EDITOR routine at 0F38 ED LOOP. The input is usually the keyboard, which actually cannot produce some of the codes which the ROM is designed to handle, eg 0D newline; but with Interface1 and other peripherals, or indeed from m/c, other inputs are possible, which could produce these codes. All the keyboard codes cause a jump from ED LOOP to 0F92 ED KEYS, where they index into the editing keys table to produce their effects. The codes are handled as follows: 07 EDIT (0FA9 ED EDIT): copies the current BASIC line, ifany, to the editing area and lower screen, with editing cursor. 08 left arrow (backspace, 1007 ED LEFT): moves the cursorleft in the line in the lower screen, unless it is already at line start; if the line contains "invisible" colour control codes with a parameter, it goes over both. 09 right arrow (100C ED RIGHT): moves the cursor right, unless it reaches a newline. There is no provision for "invisible" colour controls, probably a programming mistake. 0A down arrow (0FF3 ED DOWN): increments the current lineand lists BASIC again without disturbing the editing line. 0B up arrow (10F9 ED UP): finds the number of the previous line, makes it the current one, and lists BASIC again without disturbing the editing line. 0C DELETE (1015 ED DELETE): does exactly the same as the left arrow, and then reclaims one character If the backspace jumped over an "invisible colour" parameter, it is the control code that is deleted, leaving the parameter zero to 07, which rather unexpectedly appears in the editing line as a "?"; exceptin the case of code 06, see above. 0D ENTER (1024 ED ENTER): clears the stack and returns from the editing routine. None of these puts any code in the editing line or outputs anything to 0010 PRINT A 1, not even ENTER; but there isa newline permanently at the end of the editing area. In output to the screen by 09FD PRINT OUT all three kinds of control code are handled together, by indexing into thecontrol character table 0A11. Several of the entries in this table jump out to 0A69 PO QUEST, and merely print a "?", all those whose address and offset add to 0A69. The only effective codes, apart from the colour controls are: 06 PRINT comma: 0A5F PO COMMA does a tab to the next linestart or half-line. 08 backspace: 0A23 PO BACK 1 moves the print position back one, up a line if necessary unless already on the top line.[Note the error, described under 09F4 PRINT OUT.] 09 right arrow; can only be output by m/c or string concatenation, of doubtful usefulness. 0A3D PO RIGHT prints an invisible space, which does nothing except move the print position one place to the right. [Note the error, described under 09F4 PRINT OUT.] 0D newline: 0A4F PO ENTER moves the print position to thestart of the next line, and empties the printer buffer, if the printer is being used. 16h AT: 0A75 PO 2 OPER collects the two parameters by juggling with the channel output address, ending up in 0A87 PO CONT. Then the print position is recalculated using the AT parameters. 17h TAB: much like AT. 007D SKIP OVER skips parameters of AT and TAB 0260 control codes table (d) 09F4 PRINT OUT may enter with control code in A 0A11 control character table 0A6D PO TV 2 two operands for AT and TAB 0A7D PO TV 1 saves AT/TAB in TV DATA 0A80 PO CHANGE channel address changed to fetch operand 0A87 PO CONT control AT is dealt with OAC2 PO TAB fetch first parameter of TAB 0F38 ED LOOP AT and TAB included in error 1031 ED EDGE left-moving cursor skips over parameters 103E ED EDGE 1 skip two parameters for AT and TAB 1051 ED EDGE 2 control code deleted by DELETE 1937 OUT CHAR prints control codes 1FE5 PRINT 3 output position control codes 1FFC PR ITEM 1 outputs AT and two parameters 200E PR ITEM 2 outputs TAB and two parameters