MAIN ADD1 157D (see BASIC INTERPRETER) Jumps from: 155D MAIN ADD MAIN ADD2 15AB (see BASIC INTERPRETER) Jumps from: 157D MAIN ADD1 main code of key see KEYBOARD SCANNING MAIN EXEC 12A2, MAIN EXECUTION LOOP, see BASIC INTERPRETER Jumps from: 12CF MAIN 3 15AB MAIN ADD2 MAIN G 1313 (12A2 MAIN EXEC, see BASIC INTERPRETER) Jumps from: 1555 REPORT G main key table 0205 see KEYBOARD SCANNING MAIN PARSER OF THE BASIC INTERPRETER see BASIC INTERPRETER, 1B17 LINE SCAN main part of screen see upper screen MAIN PRINTING SUBROUTINE see 15EF OUT CODE main screen see upper screen MAIN 1 12A9 (see BASIC INTERPRETER) Jumps from: 1219 RAM SET MAIN 2 12AC (see BASIC INTERPRETER) Jumps from: 1386 MAIN 9 auto MAIN 3 12CF (see BASIC INTERPRETER) Jumps from: 12AC MAIN 2 MAIN 4 1303 (see BASIC INTERPRETER) This address in the main execution loop is the error address during BASIC execution as well as the return address from the call to 1B8A LINE RUN in 12CF MAIN 3 on completion of execution. Thus all inputs return here eventually. Jumps from: 12AC MAIN 2 MAIN 5 133C (see BASIC INTERPRETER) Jumps from: 1313 MAIN G MAIN 6 1373 (see BASIC INTERPRETER) Jumps from: 133C MAIN 5 MAIN 7 1376 (see BASIC INTERPRETER) Jumps from: 133C MAIN 5 MAIN 8 1384 (see BASIC INTERPRETER) Jumps from: 1376 MAIN 7 MAIN 9 1386 (see BASIC INTERPRETER) Jumps from: 133C MAIN 5 MAKE BC SPACES RESTART see 0030 BC SPACES MAKE EXPT 313B (30CA multiply) Jumps from: 3125 STRT MLT MAKE ROOM subroutine 1655 Shifts a block of memory upwards by a specified number of bytes and adjusts the fourteen system pointers as needed, see1664 POINTERS. Used to open up a space for new data in any of the areas from the microdrive maps upwards. It can be called through 0030 BC SPACES, which always makes space in the work space, or 1652 ONE SPACE if only a single space is required. Input parameters: HL points to the first byte to be moved - BC holds the number of new spaces required. Action: call 1F05 TEST ROOM to check for "Out of memory" - call 1664 POINTERS which adjusts the pointers and loads BC with the number of bytes to be moved - put a pointer on the new address of 5C65 STKEND - move up the block of bytes from the pointer down to the address set on input. Exit: RET. Output parameters: the new space made isn't blank, but still contains a copy of the bytes in the area immediately aboveit - HL holds the address of the last byte below the lower version - DE that of the last below the upper one; the notes areconfusing, the "second description" as given is valid only when the call was to 1652 ONE SPACE. Called from: 084C LD DATA 1 0873 LD PROG 093E ME ENT 1 0955 ME ENT 2 0F6C ED CONTR 157D MAIN ADD1 169E RESERVE 1D16 F REORDER 1F94 DEF FN 5 268D S DECIMAL 2B29 L SPACES 2BC6 L STRING 2C2E D NO LOOP Exit from: 1652 ONE SPACE Rems: 0F81 ADD CHAR make single space in editing or input 0F8B ADD CH 1 put new input in space 255D S SC ROWS make space in work space for character 25BE S Q AGAIN make space in work space for new string 2B72 L DELETE$ make room in work space 361F str$ make space in work space for character making room see 0030 BC SPACES, 1655 MAKE ROOM, 1652 ONE SPACE, 1664 POINTERS manipulatory operations see 0028 FP CALC mantissa see CALCULATE marker bit see 8-bit loop after end of alphabet marker byte (sign) see 2F9B PREP ADD maskable interrupt see interrupts, 0038 MASK INT MASK INT restart subroutine 0038 Called 50d times per second by the maskable interrupt, except during BEEPS, LOAD/SAVE operations, and COPY. Works the clock and reads the keyboard. Can be called from m/c, and this is sometimes useful for programs which run with the interrupt disabled. It enables the interrupt. Input parameters: none. Action: increment the two lo bytes of the 3-byte system variable 5C78 FRAMES, see index entry - if the lo bytes are now zero, increment the hi byte. _0048_KEY_INT: call 02BF KEYBOARD to read the keyboard - re-enable the interrupt; any interrupt call to the Z80chip automatically disables it. Exit: RET. Output parameters: all the main registers are saved and restored unchanged - IX and the alternate registers aren't used. Rems: 02BF KEYBOARD called by MASK P system variable 5C8E Bytes: 1 The byte following ATTR P; they are handled together as a single system variable. Copied as required to 5C60 MASK T. Written by: 1C96 PERMS (with ATTR P) Read by: 0D4D TEMPS (with ATTR P) masks Strictly, a mask is a byte used to combine two other bytes by an XOR/AND/XOR: A is XORed twice with another "setting"byte, but ANDed in between with the mask in some other register.Where the mask has its bits set, the two XORs cancel out and A keeps its original bits, but where the mask has zero bits or "holes" the bits of A are replaced by the bits of the setting byte: they are zeroed by the mask, and then the second XOR sets or zeroes them as the setting byte is one or zero. Eg: if A is 0 0 0 0 1 1 1 1 b, the mask is 0 1 0 1 0 1 0 1 b, the setting byte is 0 0 1 1 1 1 0 0 b: XOR A with the setting byte: 0 0 1 1 0 0 1 1 b AND this with the mask: 0 0 0 1 0 0 0 1 b XOR with the setting byte again: 0 0_1 0_1 1_0 1 b. This has the bits of A except where "holes" in the mask have "let through" the underlined bits from the setting byte. See 0BDB PO ATTR, 1C96 CLASS 07, 22AA PIXEL ADD and 226CCO CHANGE for examples. The term is also used when the mask byteis combined with one other byte, to zero or set particular bits. 1C96 PERMS copy even bits of P FLAG to odd: 10101010b/AA 2211 CO TEMP 5 mask for P FLAG - OVER/INVERSE 2228 CO TEMP 6 mask in B register 2234 CO TEMP 7 mask for P FLAG - INK/PAPER 2258 CO TEMP B mask in B for ATTR T, MASK T, P FLAG 226C CO CHANGE use of the mask 2273 CO TEMP C mask for FLASH/BRIGHT 3214 truncate used to zero bits after fraction point 3221 T GR ZERO used to zero FP 91 80 00 00 00/-65536d 3283 BITS ZERO prepares mask to truncate byte 328A LESS MASK loop to shorten mask MASK T system variable 5C90 Bytes: 1 The byte following ATTR T; the two are usually handled together as a single system variable. Used as a mask in setting attributes: any bit which is set in the mask is left unchanged from what is on screen already, see 0BDB PO ATTR. ATTR T and MASK T are the attribute svs actually used insetting screen attributes, but in every case they are copied from other svs - either 5C8D ATTR P and MASK P for the upper screen, or 5C48 BORDCR and zero for the lower. Written by: 0C88 PO SCR 2 (with ATTR T) 0D2D PO SCR 4B (with ATTR T) 0D5B TEMPS 1 (with ATTR T) 18C1 OUT FLASH (with ATTR T) Read by: 0BDB PO ATTR (with ATTR T) 0C88 PO SCR 2 (with ATTR T) 0D02 PO SCR 4 (with ATTR T) 18C1 OUT FLASH (with ATTR T) 1CBE CLASS 09 Rems: 0D4D TEMPS loaded either with 00 or with MASK P 2211 CO TEMP 5 altered by embedded colour items 2245 CO TEMP 9 prepare to alter (load base address) 2258 CO TEMP B changed by prepared mask 2287 CO TEMP E changed by prepared mask "matching" subroutine (for strings) see 250F S QUOTE S ME CONTRL 08B6 (0605 SAVE ETC) Exit from: 07AD LD CH PR ME ENTER subroutine 092C MERGEs a single BASIC line or variable, which has been read into the work space from tape, into the program area: ie adds it, deleting any line with the same line number or variablewith the same discriminator byte. The old line/variable is deleted from the BASIC before the new one is copied, but the newone remains in the work space till it has been MERGEd; so if there is pressure on memory, an "Out of memory" report can occur. Input parameters: HL is a work space pointer, holding theaddress in the work space of the first byte of the new line or variable to be MERGEd - DE is a BASIC pointer, holding the address in the program or variables area of the first byte of the old line withthe same or next highest number, or in the case of a variable, the first byte of the matching variable or the last byte in the variables area - carry in the C flag indicates that a variable is beinghandled - zero in the Z/NZ flag that there is a match between old and new and the old line or variable is to be reclaimed. Action: if the flag shows NZ jump on to ME ENT 1; there is no old line/variable to be reclaimed - (reclaiming required) save the flags - save the work space pointer in 5C5F X PTR - call 19B8 NEXT ONE and 19E8 RECLAIM 2, which delete the old line/variable from the program/variables area; since X PTR is one of the "fourteen pointers", the work space pointer will be adjusted by 1664 POINTERS to compensate for the reclaim - recover the flags and pointer. _093E_ME_ENT_1: save the flags again - call 19B8 NEXT ONE again, this time for the length of the new line/variable - save the start address in 5C5F X PTR; again it will beadjusted to compensate for the "make room" to follow - save the value of 5C53 PROG, in case room has to be made there; cf 157D MAIN ADD 1 - save the length and recover the flags - if carry was set jump on to ME ENT 2; a variable is being handled - (handling a BASIC line) make room just before the BASIC pointer - jump on to ME ENT 3. _0955_ME_ENT_2 (handling a variable): make room_at the BASIC pointer in or at the end of the variables area. _0958_ME_ENT_3: recover the pointers and stack them again - copy the line/variable into its proper place. - recover the pointers again and call 19E8 RECLAIM 2 again; each line/variable is deleted from the work space when ithas been copied, to avoid excessive demands on the memory. Exit: RET, from 0958 ME ENT 3. Output parameters: DE holds a BASIC pointer to the start of the next line/variable in the program or variables area. Called from: 08EB ME NEW L2 0923 ME VAR L2 ME ENT 1 093E (092C ME ENTER) Jumps from: 092C ME ENTER ME ENT 2 0955 (092C ME ENTER) Jumps from: 093E ME ENT 1 ME ENT 3 0958 (092C ME ENTER) Exit from: 092E ME ENTER through one of: 093E ME ENT 1 0955 ME ENT 2 MEM system variable 5C68 Bytes: 2. Holds the address of the first byte of the calculator memory, normally the address of 5C92 MEMBOT. See 335B CALCULATE.