home *** CD-ROM | disk | FTP | other *** search
/ Outlet 51 / outlet-51.mgt / d3 < prev    next >
Text File  |  2021-04-18  |  13KB  |  1 lines

  1.        Called from:                                                     19E5 RECLAIM 1                                                 Exit from:                                                       19DB NEXT O 5 (19B8 NEXT ONE)                                                                                               digit keys see character codes                                                                                                  DIM key (E9) see also commands, functions and operators,    KEYBOARD SCANNING                                                       The D key in K mode produces the command DIM; it must befollowed by                                                            the array name, one letter with or without "$";                 a parenthesis with one or more numbers separated by      commas, the dimensions of the array.                                    The effect of the command is to "declare" an array, ie  to put the array in the variables area with all its values      zeroed.                                                                 The command is read by 1B29 STMT L 1 referring through  the syntax offset table 1A48 to the syntax parameter table 1A7A.1AA2 P DIM causes a jump via 1C11 CLASS 05 and 1C16 JUMP C R to the executive routine 2C02 DIM.                                                                                                     DIM subroutine 2C02                                                 Called only by the statement loop from the table at 1AA2P DIM; executes the DIM command by constructing an empty array  of the specified dimensions in the variables area.                      The number of dimensions is limited to 255d and the sizeof each dimension to FEFFh/65279d: effectively there is no limiton the dimension size other than the amount of memory available.        [Experimentalists may like to try entering                                 10 DIM a(1,1,1,1,1,...1)                             255d "1"s will pass syntax, 256d will produce a flashingerror cursor on the last dimension.                                     Similarly, DIM a(65279) gives the error report "Out of  memory", DIM a(65280) gives "Subscript wrong".]                         The space actually required in the variables area for   the new array is                                                       - 5 bytes for each element of a numeric array, or one foreach character of a string array                                       - plus a byte for the variable letter                           - plus two bytes for the array length                           - plus two bytes for the size of each dimension.                 This is calculated as follows: read each dimension from BASIC, and PUSH each dimension on the machine stack as it is    read.                                                                   Multiply the first dimension by the element length, fivefor numeric elements or one for characters; this is the length  required for all the elements of the first dimension.                   Now multiply this product by the second dimension;      dimensions (x,y) will take up the space of x * y * element      length in the variables area. And so on. As each dimension is   counted and calculated, the accumulated product indicating the  length required is retained on the calculator stack.                    The total length of the array in the variables area is  now figured as the accumulated product of dimensions, plus four for the leading bytes, plus two bytes for each dimension size   POPped from the machine stack and recorded in the empty array.         Input parameters: none                                           - the BASIC pointer in 5C5D CH ADD is on the letter of  the array name in BASIC.                                               Action: call 28B2 LOOK VARS, which searches the variablesarea for an array of the same name and returns with a motley    array of output parameters, repeated here for convenience from  the entry under LOOK VARS:                                             HL holds a start address for the variable                       C holds a "discriminator byte" abcxxxxx:                          a is one for syntax checking, zero for run time                 bc is 00 for numeric arrays, 10 for string arrays               xxxxx indicate the variable letter, zeroes in syntax                  checking                                                the zero flag shows Z if there was a "(" after the       variable letter in the BASIC or the "$" after it, NZ if there   wasn't                                                                 the carry flag shows NC if a matching variable was found,C if it wasn't.                                                        _2C05_D_RPORT_C: if the zero flag shows NZ report        "Nonsense in BASIC"; the DIM variable must have a parenthesis           - in run time jump on to D RUN                                  - (syntax checking) zero bit 6 of C; now bc will be 00, and the whole byte 10000000b                                            - call 2996 STK VAR, see under 28B2 LOOK VARS, which    does all the necessary syntax checking                                  - call 1BEE CHECK END, which reports an error if this isnot the end of the statement, or makes a double return to 1B76  STMT RET if it is.                                                     _2C15_D_RUN (run time): if the carry flag is set jump on to D LETTER; no array was found with a matching name                    - (there is an array with matching name, and HL has the address of its letter in the variables area) call 19B8 NEXT ONE and 19E8 RECLAIM 2; this deletes the old array.                        _2C1F_D_LETTER: set bit 7 of the discriminator byte; it  is now in the correct form for a variable letter, 100xxxxx for anumber array, 110xxxxx for a string array                               - make a one-byte dimension counter set to zero and a   two-byte length accumulator set to one; assuming an array of    characters                                                              - if bit 6 of the variable letter is zero make the      accumulator five; number array, five bytes for each value.             _2C2D_D_SIZE: save the accumulator.                             _2C2E_D_NO_LOOP: move the BASIC pointer on to the first  code of the dimension                                                   - set a limit value for the dimension of FF00                   - call 2ACC INT EXP1 to read the dimension                      - if it returns with carry report "Subscript wrong"             - put the dimension size on the machine stack; a        dimension size goes on the stack for every turn of the loop             - increment the dimension counter                               - call 2AF4 GET HL*DE to multiply the dimension size by the accumulator                                                         - read the next character                                       - if it is 2C comma loop back to D NO LOOP                      - if it isn't 29h ) report "Nonsense in BASIC"                  - (all dimensions multiplied together) move on the BASICpointer                                                                 - make the dimension counter a two-byte counter;        required for the next operations even though it is still < 256d         - increment the dimension counter by two; to allow for  the four leading bytes                                                  - double it                                                     - add the accumulated element length count                      - if this produces carry report "Out of memory"; a carryfrom this total, indicating length over 65535d bytes, could givequite a small number in HL, so the error must be reported now           - put a pointer on the 80-byte before 5C59 E LINE; the  end of the variables area                                               - call 1655 MAKE ROOM to make a space there of the totallength required; it will report "Out of memory" if necessary            - put the variable letter, the length excluding the     first three leading bytes, and the dimension counter in the     first four spaces cleared                                               - put zero in the last byte of the cleared space                - if bit 6 of the variable letter is zero jump on to DIMCLEAR; this is a number array                                           - (string array) put 20h space in the last byte.               _2C7C_DIM_CLEAR: copy the last byte backwards to as many empty spaces as indicated by the length; zeroes if it is a      numeric array, spaces if it is string.                                 _2C7F_DIM_SIZES: recover a dimension off the stack               - enter it in the next two bytes of space, working      backwards; they come off the stack in reverse order                     - decrement the dimension counter                               - jump back to DIM SIZES till the counter reaches zero.        Exit: RET.                                                      Output parameters: none.                                        Rems:                                                            2996 STK VAR used only to check syntax                                                                                      DIM CLEAR 2C7C (2C02 DIM)                                          Jumps from:                                                      2C2E D NO LOOP                                                                                                              dimension of array see arrays, 2C02 DIM                                                                                         dimension size, DIM limit see 2ACC INT EXP1                         2ACC INT EXP1 and 2ACD INT EXP2 are used for reading    array dimensions and subscripts from BASIC, and are entered witha limit value in HL; if the value read from BASIC is above the  given limit, they report "Subscript wrong".                             For subscripts (29FB SV MULT) the dimension read from   the dimension list in the variables area is used as a dimension limit; for dimensions, when the array is being declared by a DIMcommand, FF00 is used (2C2E D NO LOOP). No array could possibly have a dimension of this size without producing a memory        overflow; the real limitation on dimension sizes is the amount  of memory available.                                                                                                                DIM SIZES 2C7F (2C02 DIM)                                          Jumps from:                                                      auto                                                                                                                        direct commands (BASIC)                                             A BASIC statement input in editing mode without a line  number. It is read both for syntax checking and execution       exactly like a BASIC line; indeed numbered program lines are    only executed by jumps from execution of direct commands such asRUN, GO TO.                                                             12A2 MAIN EXEC controls execution of                            12CF MAIN 3 edit line interpreted first                                                                                     disable see interrupt                                                                                                           discarding see address dropping                                                                                                 discriminator byte of BASIC variable see variable                                                                               DISPLAY AREA 4000 see also upper screen                          1. The display area consists of 1800h/6072d bytes,         extending from the start of the RAM at 4000h to 57FFh. Each bytecarries eight pixels of the screen, so there are C000h/49152d   pixels in all.                                                          The addresses are the_screen_addresses or_pixel         _addresses, and the bytes they hold are the_character_bytes or  _pixel_bytes; "pixel line" is occasionally used as synonymous   with "pixel byte", eg in 0B75 PR ALL, but this is wrong and     confusing.                                                             _Pixel is short for "picture element": a_pixel_bit is a  single binary bit, and the corresponding pixel is a dot on the  screen, printed in INK colour if the bit is a one and in PAPER  colour if it is a zero, adjusted for INVERSE and FLASH.                 The following description of the display area uses hex  numbers; despite their relative unfamiliarity they expose the   logic of the arrangement much better than decimals. The screen  is divided into_thirds each of 8_character_lines or_screen      _lines; these contain 40h_pixel_lines or_pixel_rows, each       containing 20h pixel bytes, 100h pixels: each 'third' is        therefore 100h characters, 800h pixel bytes, and 4000h pixels.          In each third the sequence of pixel bytes in the memory is: first the 100h bytes giving the top row of pixels in all theeight lines of the 'third', then 100h bytes with the second row of all the eight lines, etc. Thus: