BASIC "Start" parameter

ZXNet echo conference «code.zx»

From Vlad Sotnikov To Valerij Kozhevnikoff 10 December 2002

Hello, Valerij! December 05, 2002 (and it was 10:42 pm then) Valerij Kozhevnikoff in his letter to All wrote: VK> The LIST command displays file parameters in trdos. Start and length VK> BASICS are usually the same, but sometimes different. I forgot why... VK> It seems like this has something to do with the use of variables? And the more VK> they are used, the greater the difference? And how is this difference calculated? It seems like I wrote an answer... It’s in another echo. In general, length is the length of BASIC no variables, just operators. The start parameter stores the program value, including variables - they are stored in a special format immediately behind the operators. The beginning of the variable area is defined in cell 23627 (2 bytes). Their order location corresponds to the sequence of their definition. Each variable is identified by an identifier. It takes up 1 byte and has the following view: 7 6 5 4 3 2 1 0 ___/ _______/ type ml. 5 bits The type is defined like this: 010 is a symbolic variable. 011 is a numeric variable with one character in the name. 100 is a numeric array. 101 is a numeric variable with several characters in the name. 110 is a character array. 111 - FOR...NEXT loop variable. 1. Numeric variables occupy 5 bytes: - identifier (1 byte).- code of the second character (if any, 1 byte). - byte order (1 byte). - mantissa (4 bytes). If the variable name takes up several characters, the corresponding length will increase by this value, and the byte with the last character will have 7 bits set. 2. Numeric array. Its length is determined by the number of dimensions and their magnitude. Such The chip consumes a lot of memory. - identifier (1 byte). - total length (2 bytes). - number of measurements (1 byte). - first dimension (2 bytes). - ... - last dimension (2 bytes). - first value (5 bytes). - ... - last value. So, for S(2,3,4) count. there will be 3 dimensions, the first dimension is 2, then - 3, then - 4, the values will be arranged like this: (1,1,1), (1,1,2), ..., (1,2,1), etc. All this will take up about 130 bytes. 3. Control variable FOR...NEXT. Specified by only one letter. - identifier (1 byte). - value (5 bytes). - final value (5 bytes). - step (5 bytes). - line number of the FOR operator (2 bytes). - number in the line of the operator following FOR (1 byte). 4. Character variable. Specified by only one letter. - identifier (1 byte). - string length (2 bytes).- string characters (=value "string length"). The length is not limited, and is equal to the length of the characters specified in the variable + 3 byte. If we have something like a$="", then 3 bytes are allocated for it, and The "string length" parameter is 0. 5. Character array. Its format is similar to that of a character array, with the only difference being that each value instead of 5 bytes is described by 1 byte. After specifying the array With the DIM operator, each value takes code #20. Vega/ex-Style Group. FIDO: 2:5030/1006.19 ZXNET: 500:812/19 E-mail: vega56@mail.ru