Caps shift 4 puts no code on the screen, but all following printout is in INVERSE on, and similarly the 3 key produces INVERSE off. There are no direct keystrokes for OVER on or off. Later models of the Spectrum mostly have special_INV _VIDEO and_TRUE_VIDEO keys, but 3 and 4 with caps shift still work. The keyboard scanning routines at 039D K KLC DGT return the initial codes 05 for INVERSE on/INV VIDEO and 04 for INVERSEoff/TRUE VIDEO, and put these values in 5C08 LAST K. However these codes are corrected by 10A8 KEY INPUT, which puts 14h in the A register for INVERSE, and 00 or 01 for OFF or ON in the C register. The channel address is switched so that A and C are returned in series, and both are put in the BASIC line. None of this applies to OVER, but the OVER control code and parameter can be incorporated in strings to give a similar effect, see below. When the BASIC line is printed out by 18FF OUT LINE, either in a listing or in the lower screen for editing, the INVERSE or OVER command is implemented for the remainder of the print, but the presence of the codes isn't otherwise indicated. It can be detected by cursor moves: the cursor moves over the two bytes in one jump when going left, but takes two jumps goingright - due to a mistake in the ROM, see 100C ED RIGHT. DELETE must be used twice to delete the control code and its parameter. Such INVERSE controls can be incorporated in variable names, eg to give them prominence in the listing: they are ignored when reading the variable for evaluation. [But see the minor error described under 28B2 LOOK VARS.] The INVERSE or OVER control codes 14h/20d and 15h/21d can be incorporated in strings: 10 LET a$="cliche" + CHR$ 8 + CHR$ 21 + CHR$ 1 + "'" 20 PRINT a$ will print "cliche" with an acute accent, not a very good one, on the e; or you can similarly print "Noel" with a diaeresis " on the o. Similarly with CHR$ 20 for INVERSE. This is much more useful when printing from m/c. Introduction INVERSE/OVER checked on every keystroke 007D SKIP OVER only one skip forward 0A3D PO RIGHT cursor right = space with OVER 0A6D PO TV 2 controls need 1 operand 0A7A PO 1 OPER changes output routine 0A87 PO CONT jump for 1-operand keys 0B93 PR ALL 1 check INVERSE and OVER 0BA4 PR ALL 2 make mask for INVERSE 0BB7 PR ALL 4 check INVERSE mask 103E ED EDGE 1 not split from parameter by cursor 10A8 KEY INPUT change INVERSE to final code 10FA KEY CONTR doesn't handle INVERSE 18C1 OUT FLASH ensures INVERSE and OVER off 2211 CO TEMP 5 sets P FLAG for INVERSE and OVER 22DC PLOT considers INVERSE and OVER 22F0 PLOT LOOP checks for OVER 22FD PL TEST IN implements INVERSE and OVER in PLOT inverted character see 0C0A PO MSG INV VIDEO key see INVERSE control code I RESTORE 2AEB (2ACC INT EXP1) Exit from: 2AE8 I CARRY (2ACC INT EXP1, 2ACD INT EXP2) IX END 3290 (3214 truncate) Exit from: 3214 truncate, through either of: 3283 BITS ZERO 328A LESS MASK IX register The IX register is set at a number of places in the ROM,all in the BEEP and SAVE/LOAD routines, see list below; but always in an ad hoc manner. Unlike the IY register it can be used freely in m/c programs, even those using ROM routines, provided it is borne in mind that some of them will reset IX fortheir own purposes. IX placed by: 03B5 BEEPER (at 03D1, then incremented) 04D0 SA FLAG (decremented) 0525 SA 8 BITS (incremented) 05C2 LD NEXT (incremented) 0621 SA SPACE (from stack) 075A SA ALL (incremented) 07F4 VR CONT 2 (from stack) 084C LD DATA 1 (from stack) 08AD LD PROG 1 (from stack) 08B6 ME CONTRL (from stack) 0991 SA 1 SEC (from stack) IX referred to by: 03D6 BE H&L LP 03F2 BE AGAIN 04FE SA LOOP 05A9 LD LOOP 05BD LD VERIFY 0629 SA BLANK 064B SA NAME 0672 SA V OLD (twice) 0685 SA V NEW 068F SA V TYPE 06A0 SA SCR$ (four times) 06F9 SA CODE 4 (four times) 0710 SA TYPE 3 0716 SA LINE 0723 SA LINE 1 (twice) 073A SA TYPE 0 (five times) 0767 LD LOOK H (PUSHed, POPped and read twice) 078A LD TYPE 07AD LD CH PR 07CB VR CONTRL (five times) 07E9 VR CONT 1 (twice) 0808 LD CONTRL (twice) 0819 LD CONT 1 (twice) 082E LD DATA (read, stored and retrieved) 084C LD DATA 1 (three times) 0873 LD PROG (stored, retrieved, read six times) 08B6 ME CONTRL (twice) 0970 SA CONTRL (PUSHed and POPped) 0991 SA 1 SEC (twice) IY register see also 2D2B STACK BC, system variables The IY register is set on start-up by 1219 RAM SET to the address 5C3A ERR NR; thus it can be used to address any bytefrom IY - 80h = 5BBAh/23482d to IY + 7Fh = 5CB9h/23737d, including all the system variables, the "new key status" area, stream information area, and the calculator memory area, and this is very frequently used in all parts of the ROM. It is reset automatically by 2D2B STACK BC which is always the exit routine of any USR function; see the note on 34B3 usr-no. This means you can freely use the unaltered IY to refer to the ROM's svs in your own programming, and you_can relocate the IY register in your m/c programs, despite the warning on page 180 of the old Handbook, which is amplified in the Plus 2 book, page 154. However if this is done 1. Calls to ROM routines must be limited to the simplest routines, which make no reference to system variables etc - unless of course you make your own version of the system variables which are referred to. 2. The interrupt must be disabled, because the maskable interrupt routine 0038 MASK INT makes many references to the Spectrum svs. ----- jump subroutine 3686 Called only from 0028 FP CALC with literal 33, but both JUMP and JUMP 2 are used as exit routines. The calculator analogue of the Z80 assembly language command JR nn, an unconditional relative jump to the literal from -80h/-128d backwards to +7Fh/+127d forwards, counting from the literal after 33 jump as zero; so 33 jump FF jumps to the jump literal itself, making an endless loop. The "distance" to be jumped is in the next literal: it is the number of bytes forward or backward to jump. 80h or more is automatically read as a backward jump. The one-byte distance is extended to two bytes by putting 00 in its hi byte if it is less than 80h, otherwise FF: this distance is then added to the address of the distance literal to give the address of the next literal to be used by the calculator. There is no check that the address jumped to is a literal within a sequence of calculator literals recognised by the 335B CALCULATE routine. If it isn't the whole system is likely to crash. Input parameters: HL' addresses the distance literal following 33 jump. Action: change to the alternate registers. _3687_JUMP_2 (the exit point from 367A dec-jr-nz if 5C67 BREG isn't yet zero): get the distance - RLA/SBC A,A makes 00 if the distance is positive, FF if it is negative - make the distance a two-byte value with this sign bytein its hi byte - add the distance to the distance address and exchange the registers back. Exit: RET, from 3687 JUMP 2. Output parameters: HL' holds the address from which the next literal will be read. Called from: 2D60 E LOOP 37AA cos 37E2 atn Exit from: 368F jump-true (as JUMP) JUMP C R 1C16 (1C11 CLASS 05) The label is never used or even referred to in the ROM or the notes, except in its cross-heading; but it is frequently referred to in this index. It makes an indirect jump to the address in 5C74 T ADDR, which will be a command routine address taken from the syntax parameter table. jump in BASIC see 5C44 NSPPC "jump on minus", "jump on plus", "jump on zero" see jump- true jump-true subroutine 368F see also 3686 jump Called only from 0028 FP CALC with literal 00. Makes a relative jump, like that of 3686 jump, if a_test_byte isn't zero. The test byte is byte 3 of the last value on the calculator stack, which is assumed to be in small integer formatmaking this the lo byte of a small integer. Although the name jump-true refers to logical values, in ROM the value jumped on is often a normal numerical value. Very often standard sequences are used for other conditional jumps, such as jump on minus: 36 less-0 00 jump-true jump on plus: 37 greater-0 00 jump-true jump on zero: 30 not 30 not 00 jump-true Input parameters: the distance of the jump is in the distance literal following the jump-true literal 00; positive ornegative, as for 3686 jump - HL' as usual points to the "return address", in this case holding the distance literal - DE addresses the last value on the calculator stack and HL the second last; because the literal 00 makes 0028 FP CALC treat this as a binary operation. On return from jump-true the last value, containing the test byte, is therefore deleted. Action: move the last value pointer on to the test byte - read the byte and move the pointer back again - if the test byte is non-zero exit to 3686 jump - (test byte zero) move on the "return address" pointer;the next call to FP CALC will use the literal following the distance literal. Exit: RET if the test byte is zero, into 3686 jump if not. Output parameters: main registers unchanged, A corrupted - HL' advanced one if the test byte was zero - the last value on the stack, containing the test byte,has been deleted; whether or not a jump was made. Called from: 1DDA NEXT LOOP (jump on minus) 1DE2 NEXT 1 (jump on plus) 238D DR 3 PRMS (jump on zero) 2D60 E LOOP (jump on NZ) 2DE3 PRINT FP (jump on plus and jump on minus) 36AF int (jump on minus 36B7 X NEG (jump on NZ) 3713 ln (jump on plus) 371C VALID (jump on plus) 3783 get-argt (jump on plus) 37A1 Z PLUS (jump on minus) 37AA cos (jump on NZ) 37E2 atn (jump on minus) 384A sqr (jump on NZ) 3851 to-power (jump on NZ) 385D XISO (jump on NZ and jump on plus) Rems: 34F9 greater-0 used for jump on plus 3501 not - used for jump on zero 3506 less-0 used for jump on minus 3686 jump - used by JUMP 2 3687 (3686 jump) Exit from: 367A dec-jr-nz 3686 jump ----- K CH SET 02D1 (O2BF KEYBOARD) Exit from: 02C6 K ST LOOP (twice) K CUR system variable 5C5B Bytes: 2 The present address within the editing area or work space at which the_editing_cursor is to be printed when the BASIC is output to screen. This cursor is printed as a flashing K, L, C, E or G depending on the mode of the next keystroke to be interpreted, so the notes sometimes also call it the_mode _cursor. K CUR is initialized to the start of the work space or editing area whenever either is cleared by 1097 CLEAR SP, and tothe start of the editing area by 16B0 SET MIN. Left and right cursor moves in the 0F2C EDITOR loop operate simply by increasing or decreasing K CUR; this is all that is necessary, since the edit line is recopied to the lower screen after every edit keystroke with the appropriate mode cursor at the place marked by K CUR. It is one of the fourteen system pointers whose positionis adjusted by 1664 POINTERS whenever space is made or reclaimedin the RAM. Written by: 0F8B ADD CH 1 0FA9 ED EDIT 1011 ED CUR 1097 CLEAR SP 166B PTR NEXT 16B0 SET MIN 2129 IN PR 3 2161 IN VAR 4 (hi byte zeroed) 361F Read by: 0F6C ED CONTR 0F81 ADD CHAR 0F92 ED KEYS 166B PTR NEXT 18E1 OUT CURS 361F Rems: 1007 ED LEFT moves cursor left 100C ED RIGHT moves cursor right 1015 ED DELETE moves cursor left with delete 1031 ED EDGE moves cursor left unless at start