APPROVED

 

  U1.00031-01 35 01-LU

 

 

 

 

 

 

 

 

 

 

                    SOFTWARE

              COMPUTER EDUCATIONAL COMPLEX

                    "ELECTRONICS MS 0202"

 

 

                            BASIC

 

                        LANGUAGE DESCRIPTION

 

                       U1.00031-01 35 01

 

                           SHEETS 98

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                             1987

                                                         LETTERS 0 - 2 -
                           

 

                       U1.00031-01 35 01

 

 

                           ANNOTATION

 

 

 

 

 

     This document is a guide to the BASIC programming language (version 1985.11.01.) And is intended for users of micro-computers "Electronics MS 0511".

     The BASIC language is designed to solve mathematical and engineering problems in the human-computer dialogue mode. It allows you to create programs for a wide range of tasks, combining ease of use and ease of study. The described version of the BASIC system is significantly expanded in comparison with the core of the BASIC language. It includes operators that allow you to create programs for processing text information, use this language for programming control systems of technological installations, as well as game tasks, etc.







     This document provides information on the syntax and semantics of operators, language functions, and system commands.

     Appendix 1 provides error messages. The list of commands, operators and functions is given in Appendix 2. Appendix 3 contains a table of codes KOI-7 “Electronics MS 0511”. Appendix 4 contains a list of words reserved in the BASIC system.



     Before studying the description of the BASIC language, it is necessary to familiarize yourself with the operation manual for the microcomputer "Electronics MS 0511", the operator’s manual U1.00031-01 34 02.


 


                             - 3 -

 

                       U1.00031-01 35 01

 

 

 

 

 

 

                          CONTENT

 

 

 

 

1. GENERAL INFORMATION ............................................ 6

 

1.1. Indirect mode ........................................ 6

1.2. Direct mode ................................. 6

1.3. Error Messages ................................... 7

1.4. BASIC language description method ........................... 7

1.5. The main characters of the language ................................. 8

 

2. DATA AND OPERATIONS ABOUT THEM ................................ 9

 

2.1. Constants .............................................. 9

2.1.1. Numeric Constants ................................... 9

2.1.2. Types of numeric constants ............................... 10

2.1.3. Text constant ............................ ...... 11

2.2. Variables ............................................. 11

2.2.1.   Definition of a variable ............................... 11

2.3. Expressions and operations ................................... 12

2.3.1. Arithmetic expression ........... .................. 12

2.3.2. Arithmetic operations .............................. 13

2.3.3. Relationship Operations ................................... 14

2.3.4. Logical operations .................................. 14

2.3.5. Functions ................ .............................. 16

2.3.6. Type Conversion ................................. 16

2.3.7. Operations on character strings ....................... 17

 

3. SYSTEM TEAMS ........................................... 18

 

3.1. Program Launch Commands ................................ 18

3.1.1. RUN Team .......................................... 18

3.1.2. CONT command ......................................... 19

3.1.3. Button (command) < SU > < A > ........................... 19

3.1.4. SYSTEM Command ....................................... 20

3.2. Storing programs on magnetic tape ......... 20

3.2.1. Team the LOAD ......................................... 20

3.2.2. Team the SAVE ............ ............................ . 2 1

3.2.3. MERGE Team ........... ............................. 2 1

3.2.4. CLOAD command ........... ............................. 2 2

3.2.5. CSAVE Team ........... ............................. 2 2

3.2.6. FILES team ........... ................ ............. 2 2

3.2.7. Team B LOAD ........... ............................. 2 3

3.2.8. BSAVE Team ........... ............................. 2 4

3 .3. Working with program texts ............................. 24

3.3.1. LIST command ................ ......................... 2 5

3.3. 2 . DELETE command ....................................... 2 6

3.3. 3 . RENUM team ........................................ 2 6

3.3. 4 . AUTO command ......................................... 2 7

3.3. 5 . Team NEW. .... ..................................... 2 8

 

4 . OPERATORS ................................................. . 28


                            - 4 -

 

                       U1.00031-01 35 01

 

 

4.1. Basic operators ..................................... 2 8

4.1.1. LET statement ......................................... 28

4.1. 2 . GOTO operator ........................................ 2 9

4.1. 3 . GOSUB operator ....................................... 2 9

4.1. 4 . RETURN operator ............................ .......... 3 0

4.1. 5 . Operator the IF . ......................................... 31

4.1. 6 . FOR statement ......................................... 32

4.1. 7 . NEXT operator ........................................ 3 2

4.1. 8 . The operator is ON . ................... ...................... 33

4.1. 9 . STOP statement ........................................ 3 4

4.1.1 0 . END statement ......................................... 35

4.1.1 1 . REM operator ......................................... 36

4.2.    Descriptive, memory reservation, and

       initial values ​​........................... 36

4.2.1. DIM statement ......................................... 37

4.2.2. KEY operator ......................................... 37

4.2.3. CLEAR .. operator ..................................... 38

4.2.4. DATA operator ........................................ 39

4.2.5. READ statement ........................................ 40

4.2.6. RESTORE statement ..................................... 40

4.2.7. DEF statement ......................................... 41

4 .2.7.1. DEF USR statement ..................................... 41

4 .2.7.2. DEF operator FN . ..................................... 4 2

4.3. I / O Operators ................................. 43

4.3.1. PRINT statement ....................................... 43

4.3.2. INPUT statement .......... ............................. 4 4

4.3.3. Operator the OPEN . .......... ............................. 4 5

4.3.4. CLOSE statement .......... ....................... ...... 4 6

4 .4. Direct memory access statements ........... 46

4.4.1. The operator POKE . ....................................... 4 6

4.4.2. OUT operator ... ....................................... 4 7

4 .5. TV screen control operators ................ 48

4.5.1. CLS .. operator ....................................... 4 8

4.5.2. COLOR operator ....................................... 4 8

4.5.3. SCREEN operator ...................................... 4 9

4.5.4. LOCATE statement ........ .............................. 50

4 .6. Operators and functions of graphics ............................ 51

4.6.1. Operator PSET . ....................................... 51

4.6.2. PRESET statement ...................................... 52

4.6.3. POI NT function . ....................................... 52

4.6.4. LINE statement ....................................... 53

4.6.5. CIRCLE statement ...................................... 54

4.6.6. Operator PAINT . ...................................... 55

4.6.7. DRAW statement . ....................................... 56

4 .7. Sound Control Operator ............................. 58

4.7.1. BEEP operator ........................................ 58

4.8. Program trace statements ........................ 59

4.8.1. The TRON statement . ....................................... 59

4.8.2. TROFF operator ....................................... 59

 

5 . FUNCTIONS ................................................. .. 60

 

5.1. Numeric functions .......................... ............. 60

5.1.1. SQR function .......................................... 60

5.1.2. SIN function .......................................... 60

5.1.3. COS function .......................................... 61

5.1.4. TAN function ................. ......................... 61

5.1.5. ATN function .......................................... 61


                             - 5 -

 

                       U1.00031-01 35 01

 

 

5.1. 6 . PI function . .......................................... 6 2

5.1. 7 . EXP function .......................................... 6 2

5.1. 8 . LOG function .......................................... 6 3

5.1. 9 . ABS function .......................................... 6 3

5.1.1 0 . FIX function .......................................... 6 3

5.1.1 1 . INT function .......................................... 6 4

5.1.1 2 . SGN function .......................................... 6 4

5.1.1 3 . RND function .......................................... 6 5

5.1.1 4 . FRE function ................................. ......... 6 5

5 .2. Type Conversion Functions ........................... 66

5. 2 .1. CINT function ............ ............................. 66

5. 2 .2 . CSNG function ............ ............................. 67

5. 2 .3 . CDBL function ............ ........ ..................... 67

5 .3. Direct Memory Access Functions ........... 67

5.3.1. PEEK function ......................................... 6 8

5.3.2. INP function .......................................... 6 8

5.4. Character functions .... ................................. 69

5.4.1. ASC function .......................................... 6 9

5. 4 . 2 . CHR function ¤ ......................................... 70

5. 4 . 3 . LEN function .......................................... 70

5. 4 . 4 . MID function ¤ ......................................... 71

5. 4 . 5 . STRING function ¤ ...................................... 7 2

5. 4 . 6 . VAL function .......................................... 73

5. 4 . 7 . INKEY ¤ function ....................................... 73

5. 4 . 8 . STR¤ function ......................................... 7 4

5. 4 . 9 . BIN¤ function ......................................... 74

5. 4 .1 0 . OCT function ¤ ......................................... 75

5. 4 .1 1 . HEX function ¤ ....................................... .. 75

5 .5. I / O Auxiliary Functions ................... 76

5.5.1. CSRLIN function ....................................... 7 6

5.5.2. POS function .......................................... 76

5.5.3. LPOS function ........................... .............. 77

5.5.4. EOF function .......................................... 77

5 .6. Functions of the PRINT operator ................................ 78

5.6.1. AT function . .......................................... 78

5.6.2. TAB function ................ .......................... 78

5.6.3. SPC function .......................................... 79

5 .7. User Defined Functions .................... 80

5.7.1. Function and FN . .......................................... 8 0

5.7.2. USR Functions .... ...................................... 8 0

 

ANNEX 1. ERROR MESSAGES .......................... 82

 

 

APPENDIX 2. LIST OF TEAMS, OPERATORS AND FUNCTIONS ........... 86

 

 

APPENDIX 3. TABLE OF CODES KOI-7 "ELECTRONICS MS 0511" .... 94

 

 

ANNEX 4. RESERVED IN THE BASIC WORD SYSTEM ...... 96


                             - 6 -

 

                       U1.00031-01 35 01

 

 

                      1. GENERAL INFORMATION

 

 

 

     A BASIC program consists of strings that can contain operators and commands. A program can be entered and executed in one of two modes: indirect and direct.


 

 

 

     1.1. Indirect mode

 

 

     Most   often, a BASIC program is recorded in an indirect mode. In this case, each line begins with a line number . A line number is followed by an operator. The line ends with the control character  < S >   (line feed) obtained by pressing the < Enter > key . The line number must be in the range from 0 to 65535. The line number performs two functions: firstly, it serves as the label of the operator and can be used to refer to this operator; secondly, the line number determines the usual order of execution of statements. In addition, the presence of line numbers makes debugging easier because the error message indicates the line number in which the error occurred.









     Any of the BASIC language operators must be placed on one line, the maximum line length is 255 characters.

     The line number is also used when editing the program. Entering a line whose number already exists leads to the replacement of the previous line. Entering only line numbers (empty line) erases the corresponding line.


 

 

 

    1.2. Direct mode

 

 

     Depending on the presence or absence of a line number, the BASIC system distinguishes lines entered in indirect mode from lines entered for direct execution. Operators that start with a line number are remembered, operators without a line number are executed immediately as they are entered into the system, i.e. Operators  are   executed  in direct mode.





     Therefore, when entering a string

 

            10 PRINT "ELECTRONICS MS 0511"

 

the line is entered in the program text, while the input

 

            PRINT "ELECTRONICS MS 0511"

 

causes its immediate execution and as a result the message is immediately displayed

 

             ELECTRONICS MS 0511

 

     BASIC system direct mode allows using
 


                             - 7 -

 

                      U1.00031-01 35 01

 

 

computer as a very powerful calculator.

 

 

 

      1.3. Error messages

 

 

    If an error is detected during input, parsing or program execution, the BASIC system displays an error message. The message format is as follows:

 

            < ERROR > in line YYYYY

 

where < ERROR > is the abbreviated name of the error, YYYYY is the number of the line containing the error.

    In direct execution mode, the line number is not indicated.

     The types of error messages are given in Appendix 1.

 

 

 

      1.4. BASIC language description method

 

 

    For a formal description of the language, a number of notations are used, which must be understood in the following sense:

       - information written in capital letters of the Latin       alphabet is constant;
  

       - information written in the letters of the Russian alphabet and         enclosed in triangular brackets "<>" is a variable;

       - information enclosed in square brackets "[]"   may be omitted when used;
      

      - from the parameters placed under each other,     only one should be selected;
    

       - the parameter enclosed in square brackets [< OPTION > ... ] N , followed by ellipsis, is        used to denote multiplicity; N indicates the         upper limit of possible parameter repetitions; if N is not          specified, then the number of repetitions of the parameter is not defined.
        
 

 

 

     NOTE. In operators with several operands , if further operands are specified, commas must correspond to the missing operands , for example:

 

             CIRCLE (100,100), 50 ,,,, 2


                             - 8 -

 

                       U1.00031-01 35 01

 

 

      1 .5. Basic language characters

 

 

    All language constructs can be expressed using the
main characters:

        - Uppercase and lowercase letters of the Latin alphabet: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ;  
        

       - digits: 0 1 2 3 4 5 6 7 8 9;

        - special characters given in TABLE 1.

 

                        SPECIAL SYMBOLS

 

 

                                                TABLE 1

-------------------------------------------------- ----------

   SYMBOL! NAME OF SYMBOL

-------------------------------------------------- ----------

               Space

    : Colon

    = Equal

    + Plus

    - minus

    * Asterisk

    / Slash

    ^           Underline or exponentiation

    (Opening bracket

    ) Closing bracket

    Comma

    ; Semicolon

    . Point

    Quotes

    ''           Apostrophe

    ¤ Currency symbol

    <           Less

    >           More

    ? Question mark

    @           Relative sign

    \           Symbol of the whole division

    & Ampersand         

    ! Exclamation mark

    % Percent

    #           Sign of number

    _ Underscore         

------------------------------------------------- - ----------

 

      The BASIC system uses a number of words to denote commands,
operators, function names, etc. The
user cannot change the meaning of these words , therefore such words are called
reserved.

      These in the BASIC system include:

        - team names, for example: LIST , SAVE , LOAD , RUN ;

        - names of operators and separators, for example : LET , IF , THEN ,

          GOTO, GOSUB, FOR, NEXT;

        - names of standard and symbolic functions, for example: SIN , C OS , TAN , EXP , LOG , SQR .
         

      A complete list of reserved words is given in Appendix 4.


                              - 9 -

 

                        U1.00031-01 35 01

 

 

      The space character is not significant and therefore can be freely
used to improve the visibility of the program. An exception
is the case of writing a space character in a text constant.

 

 

      NOTE. The use of a space within reserved words, numbers and variable names is not allowed .

 

 

 

 

                  2. DATA AND OPERATIONS ABOUT THEM

 

 

 

 

 

 

       2.1. Constants

 

 

      The BASIC system uses numeric and text
constants.

 

 

 

     2.1.1. Numeric constants

 

 

      In the BASIC system, six forms of writing numerical constants are permissible
:

      1) Integer constants are in the form of decimal integers with
or without a sign.

      Examples:

              123

              -2345

 

      2) Real constants represented in the form of
fixed-point numbers are positive or negative
numbers with a decimal point.

 

      Examples:

              2.45

              -102.36

 

      3) The material constants written in exponential
form, composed of a mantissa and order, separated from the mantissa
letter E .

 

      Examples:

              235.988 E-7 = .0000235988

              2359E6 = 2359000000

 

      Instead of the letter E
, the letter D is used to indicate double precision constants  .

 

      4) The hexadecimal constants denoted  & H .   The
base of these numbers is 16. To indicate numbers from 10 to 15


                              - 10 -

 

                       U1.00031-01 35 01

 

 

letters from A to F are used .

 

      Examples:

              & H76

              & HA2F

 

      5) Octal constants are denoted by & O ( letter O ).   The
number base for these numbers is 8, so the constants cannot
contain the numbers 8 and 9.

 

      Examples:

              & O347

              & O177700

 

      6) Binary constants are binary numbers for
which & B is used . These numbers contain only the numbers 1 and 0.

 

      Examples:

              & B01110110

              & B10101101

 

 

 

     2 .1.2. Types of Numeric Constants

 

 

 

      According to the internal representation, the numerical constants are
divided into integers, real single precision and
real double precision.

      For the internal representation of constants of an integer type
, one memory word (16 bits) is used. This provides
processing speed and memory savings for their storage. An integer type of
constant indicates the% sign after the decimal constant, for example:

 

              156%

              -3000%

 

      Binary, octal, and hexadecimal constants are also integers
.

      Real numerical constants can be represented with
single or double precision. For single precision constants
, 7 decimal digits are stored, and for double precision - 17 and
2 or 4 machine words are highlighted, respectively. By default, in the BASIC
system, the accuracy for constants is assumed to be single.

      The single precision constant differs in terms of:

 

        - an exponential form with the
          letter E is used to record it ;

        - when writing it, an exclamation mark <!> is used ;

        - any record of a number without specifying a type.

 

      Examples:

              3451415.92

              -1.09 E-09

              23.567!

 

      The double precision constant differs in terms of:

        - exponential notation with the letter D ;


                              - 1 1 -

 

                       U1.00031-01 35 01

 

 

        - sign of double precision number # .

 

      Examples:

              -1.09432 D-09

              348.9 #

 

 

 

     2.1.3. Text constant

 

 

      Formal description of a text constant:

 

      < TEXT CONSTANT > :: = "[< SYMBOL > ... ] 255 "

 

      A text constant is a sequence of characters (a string of
characters) enclosed in quotation marks. The number of characters must
not exceed 255.

      The space character within the character string is significant.

 

      Examples:

              "Hello"

              "ELECTRONICS MS 0511"

 

 

 

      2.2. Variables

 

 

 

 

 

     2.2.1. Variable definition

 

 

      Formal definition of a variable:

 

      < VARIABLE > :: = < SIMPLE VARIABLE >

                    < INDEXED VARIABLE >

 

      < SIMPLE VARIABLE > :: = < VARIABLE NAME >

 

      < INDEXED VARIABLE > :: =

< VARIABLE NAME > (< INDEX > [, < INDEX > ...])

 

      Variables identifying numerical data are called
numerical variables; variables that identify text
data are called character variables. The maximum length of a
character variable value can be 255 characters.

      Variables have a symbolic name - an identifier
consisting of any number of letters of the Latin alphabet and numbers; of these, only the first two are taken into account. The variable name must begin with a letter. The name of the variable at the end may have a character indicating the type of variable:


 

              ¤   symbolic;


                              - 12 -

 

                       U1.00031-01 35 01

 

 

              % whole;  

              ! single precision materials;  

              #    double precision.

 

      In the absence of a sign, the variable is considered to be single
precision.

      Integer variables can take values ​​from the interval [ -32768,32767 ] .

 

      Examples :

              L #

              MINIMUM!

              K%

              Abc

              N¤

 

      Distinguish between simple and indexed variables. Simple
variables uniquely identify a single data item.
Indexed variables identify an element of an ordered
data set - an array. Each element of the array is identified by the
name of the array and indices enclosed in parentheses.
Indexes are integer  expressions that take  positive values. The number of index expressions must match the number of dimensions in the array. Index expressions are separated by commas. Specifying a negative index results in error 5. The DIM operator is used to declare arrays .



 

 

 

       2.3. Expressions and Operations

 

 

 

      An expression may consist of textual or numeric constants
and variables, or combinations of these elements connected
by operation signs, which leads to the calculation of the
value of the expression.

      Operations in the BASIC system are divided into

 

        - arithmetic;

        - relations;

        - brain teaser;

        - functions.

 

 

 

     2.3.1. Arithmetic expression

 

 

      < ARITHMETIC :: = [+] < TERM > [[+] < TERM > ...]

       EXPRESSION > [-] [-]

 

                           [*]

      < THERM > :: = < MULTIPLIER > [[/] < MULTIPLIER > ... ]

                           [^]

 

                      < VARIABLE >

      < MULTIPLE > :: = < NUMERICAL CONSTANT >


                              - 1 3 -

 

                       U1.00031-01 35 01

 

 

                     (< Arithmetic expression >)

                     < FUNCTION >

 

      An arithmetic expression is used in
assignment, loop, condition, print, function definition operators .
Elements of an arithmetic expression can be variables,
functions, numerical constants, or combinations of these elements
connected by parentheses, signs of arithmetic operations,
signs of relations, and logical operations. An expression can
use an arbitrary number of parentheses. If the
number of opening and closing brackets is not consistent, an error message 2 is issued
.

      Next, the concept of the whole expression is used. This is an arithmetic expression that takes values ​​from the interval [ -32768,32767 ] .

 

 

 

     2.3.2. Arithmetic operations

 

 

      The symbols given in TABLE 2 are used to indicate arithmetic operations
.

 

 

                  SYMBOLS OF ARITHMETIC OPERATIONS

 

 

                                              TABLE 2

-------------------------------------------------- ---------

SYMBOL! Designation! EXAMPLE

OPERATIONS!                                     !

-------------------------------------------------- ---------

   ^! Raising to a power ( A to power B )!   A ^ b

   *! Multiplication ( A multiply by B ) !   A * b        

   /! Division ( A divide by B ) ! A / b              

   \! Integer division ( A divide by B )!   A \ B

  MOD     ! Modulo division (remainder of!

         !                 dividing A by B )! A MOD B

   +! Addition ( A plus B ) !   A + B                 

   -! Subtraction ( A minus B ) !   A - B               

   (! Opening bracket!

   )! The closing bracket! B / ( A * ( B + C ))

-------------------------------------------------- ----------

      When calculating arithmetic expressions, the following priority of arithmetic operations and brackets is observed
:

 

      1) action in brackets;

      2) exponentiation;

      3) multiplication and division;

      4) integer division;

      5) modulo division;

      6) addition and subtraction

 

      Examples :

              PRINT 10 \ 4

               2

              Ok

              PRINT 10.4 MOD 4

 

 

                              - 1 4 -

 

                       U1.00031-01 35 01

 

 

               2

              Ok

 

 

 

     2 .3.3. Relationship Operations

 

 

 

      Relationship operations are used to compare two quantities in
conditional branch operators. We can consider that the
comparison result takes two integer values: "TRUE" - in all
bits of the unit, which corresponds to -1 (minus 1), and "FALSE" - in all
bits of the zeros, which corresponds to 0. How "TRUE" is also treated
any nonzero value.

      Relationship operations are given in TABLE 3.

 

                                                        TABLE 3

 

  -------------------------------------- -------

  ! OPERATION ! TESTED! EXAMPLE!

  ! ! ATTITUDE! !

  ! ----------! ---------------! ----------------!

  ! =! Equality! X = Y !           

  ! <>> <   ! Inequality! X <> Y or X > < Y !  

  ! =! Less ! X <Y !           

  ! =! More! X> Y !           

  ! =! Less or! X <= Y !          

  ! =! equal! !              

  ! =! More or! X> = Y !          

  ! =! Equally         ! !              

  ---------------------------------------------

 

      Relationship operations are less prior
to arithmetic. For example, the value of an expression

 

              X + Y = X * Y

 

      is minus 1 when X + Y is equal to X * Y .

 

 

 

     2.3.4. Logical operations.

 

 

 

      Logical operations are used to work with sets of
bits represented as 16-bit integers. The value of
each bit of the result depends on the values ​​of the corresponding bits of the
operands.

      Here are the tables that define the logical operations:

 

      NOT

              X NOT X

              0 1

              ten


                              - 1 5 -

 

                       U1.00031-01 35 01

 

 

      AND

              X Y X AND Y

              0 0 0

              0 1 0

              100

              1 1 1

 

      OR

              X Y X OR Y

              0 0 0

              0 1 1

              1 0 1

              1 1 1

 

      Xor

              X Y X XOR Y

              0 0 0

              0 1 1

              1 0 1

              1 1 0

 

      Eqv

              X Y X EQV Y

              0 0 1

              0 1 0

              100

              1 1 1

 

      IMP

              X Y X IMP Y

              0 0 1

              0 1 1

              100

              1 1 1

 

      The result of logical operations can be considered as
"TRUE" (non-zero result) or "FALSE" (zero), so they are
conveniently used to combine several relation operations in
conditional branch operators.

 

      Examples :

              IF A = ​​200 AND F <4 THEN 80

              IF I = 10 OR K> = 0 THEN 50

              IF NOT P THEN 100

 

      In mixed expressions, logical operations are less
priority than arithmetic and relations operations. The sequence
of logical operations is carried out according to the following
priority:

 

      1. NOT;

      2. AND;

      3. OR;

      4. XOR and EQV;

      5. IMP.

 

      Examples of logical operations:


                              - 16 -

 

                       U1.00031-01 35 01

 

 

      Decimal to binary

      submission submission

 

              63 111111

         AND

              16 10000

         =

              16 10000

 

 

              -1 1111111111111111

         AND

               8 1000                       

         =

               8 1000                       

 

 

               4 100                        

         OR

               2 10                         

         =

               6 110                        

 

 

 

 

     2 .3.5. Functions

 

 

      Functions are predefined data operations.
The BASIC system has "built-in" functions, which are called
standard. An example of such functions is  SQR ()   , the
square root, or SIN () , the sine. Standard
functions are described in more detail below.

 

 

 

     2.3.6. Type conversion

 

 

      Type conversion in the BASIC system is determined by several
rules:

 

      1) if the value of an arithmetic expression of one type is
assigned to a variable of another type, then conversion to the type of the variable is performed
.

 

      An example :

              10 A% = 23.42

              20 PRINT A%

              RUN

              23

              Ok

 

      2) during the calculation of the value of an arithmetic expression,
all operands are converted into one data type - the one to which the
operand that has the greatest accuracy belongs.


                              - 17 -

 

                       U1.00031-01 35 01

 

 

      An example :

              10 D # = 6/7!

              20 PRINT D #

              RUN

               .85714285714285714

              Ok

      (the arithmetic expression was calculated with double
precision).

 

      An example :

              10 D! = 6/7!

              20 PRINT D!

              RUN

               .8571429

              Ok

      ( when assigning the result of an arithmetic expression to the
variable D !, rounding occurred due to the difference in types).

 

      3) logical operations convert their operands to an integer type
and give an integer result.

 

      4) when converting types from double precision to single
, rounding occurs. When converting to an integer type, the fractional part is discarded.

 

      Example:

              10 C % = 55.88

              20 C ! = 1.23456789

              30 PRINT C %

              40 PRINT C!

              RUN

              55

               1.234568

              Ok

 

      When converting to an integer type of value that goes beyond the
limits [ -32768,32767 ] , error 6 occurs.

 

 

 

     2.3.7. Character string operations

 

 

      To work with symbolic variables, a
number of functions are included in the BASIC system (a detailed description is provided below). In addition,
character data can be combined by the + operation ( string concatenation
).

 

      Example:

              10 A¤ = " NAME "

              20 B¤ = " FILE "

              30 PRINT A¤ + B¤

              40 PRINT " NEW " + A¤ + B¤

              RUN

              FILE NAME

              NEW FILE NAME

              Ok


                              - 1 8 -

 

                       U1.00031-01 35 01

 

      Strings can be compared by relationship operations

 

              = <> > < < > <= > =             

 

      Comparison is made over the KOI-7 codes taken from the
corresponding lines. If all codes match, then the lines
are equal. If the codes of KOI-7 characters differ, then the line
with the code of the symbol in question is smaller. If one line
ends and the other does not, then the shorter line is smaller
(spaces are taken into account).

 

      Examples (the result of all expressions is "TRUE"):

 

              "AA" <> "AB"

              "A" = "A"

              "X &"> "X"

              CL> CL

              B¤ <"9.12.84" IF B¤ = "8.12.8"

              "AAC" <"ABB"

 

 

 

 

                        3 . SYSTEM TEAMS

 

 

 

      BASIC commands are used to connect the programmer with the system.
They do not have an input line number and are executed only in
immediate mode.

 

 

 

       3.1. Program Launch Commands

 

 

 

 

 

     3.1.1. RUN Team

 

 

      The team starts the program.

 

      Format:

              RUN [< ARGUMENT >]

 

 

      The RUN command allows you to run a program loaded into RAM.
By this command, the program object code is first created,
memory is allocated, and then the object code is
launched for execution. Typically, execution starts on the first
line of the program. If an argument is used, it indicates
which line of the program should begin its execution. With each
new entry of the RU N command, the   old object code and the name table are
completely erased and re-formed.

 

      Example:

              RUN

              RUN 100


                              - 1 9 -

 

                       U1.00031-01 35 01

 

 

      ( starts program execution from line number 100).

 

 

 

     3.1.2. CONT Command

 

 

 

      The team continues to execute the program from the place
where it was interrupted.

 

      Format:

              CONT

 

      Program execution is paused whenever the STOP , END
statements are encountered , or when the < STOP > key is pressed  . The CONT command continues to execute the program from where it was interrupted. In fact, the GOTO command is executed by the number of the "old" line. If after interruption of a program , actions are performed after which its execution is impossible (for example, a line of program text was edited), an attempt to continue its execution using the CONT command    leads to error 17.






      The CONT command in combination with the STOP operator and the < STOP > key is widely used during program debugging. After pausing the program, you can print the current values ​​of the variables, even change them and continue the program.


 

      Example:

              1050 STOP

              RUN

              STOP on line 1050

              Ok

              ?

              THE FIRST

              Ok

              CONT

 

 

 

     3 .1.3. Key (command) < SU > <A>

 

 

 

      Press the < GC > < A > program can be run in single-step mode, ie. E., One line (see. Operator's Manual.

U1.00031-01 34 02).


                              - 20 -

 

                       U1.00031-01 35 01

 

 

     3.1.4. SYSTEM Command

 

 

 

      The team makes the transition to the monitoring system of the microcomputer
"Electronics MS 0511".

 

      Format:

               SYSTEM

 

      The command is used to transfer control to the monitor
system of the microcomputer.

 

 

 

       3.2. Storing programs on cassette tape

 

 

 

      The texts of the user programs "Electronics MS 0511" are stored
on cassette magnetic tape. The commands described below are
intended for reading (writing) the text of the program from (to) the
magnetic tape. There are also commands for storing binary information on magnetic
tape.

      To identify programs, a file specification is used - a
text constant containing a symbolic file name. A file name
can be up to six characters long.

      In the BLOAD and BSAVE commands, the boundaries of the memory areas are indicated using the address — an integer constant from the interval  [0.65535]. For convenience, the address can also be specified in hexadecimal, octal, and binary constants.


 

 

 

     3.2.1. team LOAD

 

 

 

      The command loads the text of the user program (in the KOI-7 codes
).

 

      Format:

              LOAD < FILE SPECIFICATION > [, R ]

 

      In the presence of R, the program, after loading it, starts to
run.

      The command is used to load the program text
located on the cassette tape using the SAVE command .
The presence of the parameter R leads to the immediate launch of the program
after it is downloaded. The text of the program is presented on magnetic tape
in the codes KOI-7.

 

      An example :

              LOAD "MOD2", R

              MOD2 .ASC 003

              Ok


                              - 21 -

 

                       U1.00031-01 35 01

 

 

     3 .2.2. SAVE Team

 

 

 

      By this command, the text of the user program is written to the
cassette tape (in the codes KOI-7).

 

      Format:

              SAVE < FILE SPECIFICATION >

 

 

      This command is intended for recording program text on a
cassette tape in the KOI-7 codes.

      The main use of the SAVE command is to save user program text
on tape.

 

      Example:

              FILES "FIRST. COD "

              THE FIRST. COD

              Ok

              SAVE " SECOND "

              Ok

 

 

 

     3 .2.3. MERGE Team

 

 

 

      The command combines the text of the program in the computer memory with the text of the
program downloaded from the cassette tape.

 

      Format:

              MERGE < FILE SPECIFICATION >

 

 

      When this command is executed, the program is loaded from the
magnetic tape and combined with the program stored in memory.
The downloaded program must be in the format KOI-7.

      If the number of the loaded line coincides with the number of the
line stored in memory, when the texts are combined, the loaded line is left
.

      The command allows you to use DELETE , RENUM and SAVE to   remember part of one program, and then combine it with another program. MERGE always spoils the object code and invalidates all name definitions , which requires a new compilation of the entire program.


      The presence of this command   in the system allows storing a set of typical programs on
magnetic tape.

 

      Example:

              LOAD " FIRST "

              FIRST . ASC   005

              Ok

              MERGE " SECOND "

              SECOND .ASC 001

              Ok


                              - 22 -

 

                       U1.00031-01 35 01

 

 

     3.2.4. CLOAD Team

 

 

 

      The command loads a user program recorded in internal format from a cassette tape
.

 

      Format:

              CLOAD < FILE SPECIFICATION >

 

 

      The command loads the text of the program
stored in the internal representation of the system from the magnetic tape . The program text
must be written with the CSAVE command .

 

      Example:

              CLOAD " FIRST "

              THE FIRST. COD

              Ok

 

 

 

     3 .2.5. CSAVE Team

 

 

 

      The command writes the program text to the magnetic tape in the
internal format of the system.

 

      Format:

              CSAVE < FILE SPECIFICATION >

 

 

      By this command, the text of the program is recorded in the internal
representation of the system on magnetic tape.

 

      Example:

              CSAVE "1001"

              Ok

 

 

 

     3.2.6. FILES Team

 

 

 

      The command is designed to search for a file recorded on a
cassette tape.

 

      Format:

              FILES [< FILE SPECIFICATION >]

 

 

      The FILES command displays a list of
tape files . The name of the desired file is indicated by the argument.
The command is convenient to use when specifying a free section
of tape to record a new file.

      Like the LOAD command , this command displays when reading
 


                             - 2 3 -

 

                       U1.00031-01 35 01

 

 

names of all detected files and their types.

      If the file name is not specified, then the command simply displays the
names of all the read files.

      When  the command is executed, the  contents of RAM are not changed. The execution of the command can be interrupted by pressing the < STOP > key .

 

      Example:

              FILES "FIRST"

              FIRST .DAT

              Ok

              SAVE " SECOND "

              Ok

 

 

 

     3 .2.7. BLOAD Team

 

 

      Loads a binary file (machine code or data) into
memory.

 

      Format:

              BLOAD < ARGUMENT1 > [, R ] [< ARGUMENT2 >]

 

      < ARGUMENT1 > :: = FILE SPECIFICATION;

 

     R IS TAG IMMEDIATE STARTUP PROGRAM AFTER ITS LOADING ;  
         

 

      < ARGUMENT2 > :: = FILE START DOWNLOAD ADDRESS.

 

      The command downloads the contents of a file recorded on a cassette
tape using the  BSAVE command . The file stores the
starting address and length of the array, according to which the contents of the
file are located in the machine's memory.

      In the presence of the second argument, i.e.  R , after downloading the
contents of the file, the program starts immediately from the
starting address of the download. By specifying the third argument, you can
place the contents of the file in memory, starting with an arbitrary
RAM address. If there is no   argument  R, an additional comma is not required    to
indicate ARGUMENT 2.

      Download can be interrupted by pressing the < STOP > key  . At boot time, the
file name is displayed.

      The command allows you to load programs in machine
view into RAM for the purpose of their further
use through the USR function .

 

      An example :

              CLEAR 200, & HF40

              Ok

              BLOAD "DATA", & HF40

              DATA .BIN

              Ok

              BLOAD "PROG", R

              PROG   . Bin

      ( PROG file downloaded and launched from the beginning).


                              - 2 4 -

 

 

 

                       U1.00031-01 35 01

 

 

     3.2.8. BSAVE Team

 

 

      Writes the contents of RAM to a cassette
tape.

 

      Format:

              BSAVE < ARGUMENT1 >, < ARGUMENT2 >, < ARGUMENT3 >

 

      < ARGUMENT1 > :: = FILE SPECIFICATION;

 

      < ARGUMENT2 > :: = ADDRESS OF THE BEGINNING OF THE SAVED MEMORY AREA;

 

      < ARGUMENT3 > :: = ADDRESS OF THE END OF THE SAVED AREA.

 

      When this command is executed, the contents of the RAM,
starting with the address indicated by ARGUMENT 2, and ending with the address
indicated by ARGUMENT 3, is saved on the cassette tape
in the file whose name is indicated by ARGUMENT 1. If there is no file name, an error message 5 is issued, if there is no arguments - about error 2. The execution of the command can be interrupted by pressing the < STOP > key . In addition to the contents of the memory, the starting address and the length of the area of ​​RAM are recorded on magnetic tape .



      Basically, this command makes it possible to save the contents
of RAM on magnetic tape in binary format.
It is especially useful to use when saving programs
written in machine language and used in BASIC systems ie   when
using the tool USR .

 

      An example :

             BSAVE "PROG", & O10000, & O20000

              Ok

 

 

 

       3 .3. Work with program texts

 

 

 

      When working with program texts, the concept of line number is used - an integer constant from the interval from 0 to 65535. Instead of the line number, you can use the symbol ".", Meaning "current" line. "Current line" is the line that was last edited, displayed on the screen, or the line in which the error was detected.





                              - 2 5 -

 

                       U1. 00031-01 35 01

 

 

     3.3.1. LIST command

 

 

      The command displays the text of the program on the screen or printing
device.

 

      Format:

              [ L ] LIST [< ARGUMENT1 >] [ - [< ARGUMENT2 >]]

 

      < ARGUMENT1 > :: = FIRST LINE NUMBER OF THE
                     OUTPUT PROGRAM Fragment;

 

      < ARGUMENT2 > :: = LAST LINE NUMBER;

 

      L POINTS , THAT THE TEXT OF THE PROGRAM TO CONCLUSIONS ON prints DEVICE .  
       

 

      The LIST command displays the program text on the screen, and the LLIST command - on the printing device. When outputting text behind the line number , a space is followed by the text of the line itself.

      If both arguments are omitted, then the entire
program text is displayed . If only one argument is given, a string with the
specified number is displayed . A dash before the line number (or after it)
indicates that all text should be output before (or after) the line with the specified number, including this line. If both arguments are given, then all lines with numbers from the specified interval are displayed. You can use the "." Character to indicate the number of the "current" line.


      It should be noted that this command does not check for the presence
of lines with the specified numbers in the program, therefore, in this case
, an error message is not issued. However , if the program
contains lines with numbers from a given interval, then they
are displayed on the specified device. If the lines with the indicated
numbers are not in the program, then the command ends and the
prompt " Ok " is displayed .

      The output of lines can be paused by simultaneously pressing the
keys < CU > and <@> . Continuation of actions - pressing any key.
As always, any action is interrupted by the < STOP > key .

 

      Example:

              200 REM LAST

              150 REM MEDIUM

              100 REM FIRST

              LIST.

              100 REM FIRST

              Ok

              LIST -175

              100 REM FIRST

              150 REM MEDIUM

              Ok


                              - 2 6 -

 

                       U1.00031-01 35 01

 

 

     3 .3.2. DELETE Command

 

 

      The command deletes lines of program text.

 

      Format:

              DELETE [< ARGUMENT1 >] [- [< ARGUMENT1 >]]

 

      < ARGUMENT1 > :: = FIRST LINE NUMBER OF THE
                     REMOVED PROGRAM Fragment;

 

      < ARGUMENT2 > :: = LAST LINE NUMBER.

 

      This command deletes lines from the number
indicated by ARGUMENT 1 to the number indicated by ARGUMENT 2. If
ARGUMENT 1 is omitted, then the number of the first line of the
program is taken instead . Similarly, if argument 2 is omitted, then the
number of the last line of the program is taken instead . If
"." Is specified as ARGUMENT 1 (or ARGUMENT 2), then the "current"
line of the program is taken . The differences is,   the team  the LIST , unless the text of the program line with the specified number does not exist, then issued an error message 8.

 

      NOTE: this command can delete all or part of a program
, so use it very carefully.

 

      An example :

              DELETE 100-200

              Ok

              DELETE

              Ok

              DELETE -5000

              Ok

              DELETE 50-.

              Ok

              DELETE 135

              Ok

 

 

 

     3.3.3. RENUM Team

 

 

      The command renumber lines of program text.

 

      Format:

            RENUM [< ARGUMENT1 >] [, < ARGUMENT2 >] [, < ARGUMENT3 >]

 

      < ARGUMENT1 > :: = FIRST LINE NUMBER OF THE RENAMED
                      Fragment;

 

      < ARGUMENT2 > :: =                       LINE NUMBER FROM WHICH THE
RENEWABLE FRAGMENT BEGINS;

 

      < ARGUMENT3 > :: = STEP OF REENUMERATION, AN ENTIRE CONSTANT FROM
                      INTERVAL [ 0.65535 ] .

 

      By default, ARGUMENT 1 and ARGUMENT 3 are 10, and ARGUMENT 2


                              - 2 7 -

 

                       U1.00031-01 35 01

 

 

equal to the number of the first line of the program. Instead of ARGUMENT 1 and
ARGUMENT 2, you can use a dot - it indicates the number of the
"current" line.

 

      This command is used to change line numbers in a
program. RENUM also checks to see if all lines whose numbers are
specified in the statements really exist. If it is found that there is
no line with the specified number in the program, an error message 8 is displayed
.

 

      This command renames the program lines, starting from the
line with the number specified by ARGUMENT 2. The number of this line is
assigned the value of ARGUMENT 1,  and the  subsequent lines are numbered with the step specified by ARGUMENT 3.

 

      Example:

         RENUM 60.55

         RENUM ,, 5

 

 

 

     3.3.4. AUTO Command

 

 

 

      The command switches to automatic line numbering for
entering program text.

 

      Format:

              AUTO [< ARGUMENT1 >] [, < ARGUMENT2 >]

 

      < ARGUMENT1 > :: = INITIAL LINE NUMBER;

 

      < ARGUMENT2 > :: = ADDITION, CHI WITH LO FROM THE INTERVAL

                     [ 0.65535 ] .

 

      The AUTO command allows you to set the automatic entry of
line numbers when entering program text, that is, when you press the < Enter > key , the next line number is generated and displayed. line numbers are incremented in increments equal to the value of the second argument. In the absence of the first, second, or both arguments , they are considered to be 10.



      The point indicated at the location of the first argument is considered
the number of the "current" line.

      If it turns out that the line with the next generated
number in the program text already exists, this text is displayed
on the screen. After that, it can be edited and entered
by pressing the < Enter > key . If editing a line is not required, then
by pressing the < Enter > key , we can proceed to enter the next line.

      To end the AUTO mode,    just press the < STOP > or < CU > and < C > keys   at the same time, which returns the system to direct mode.

 

      An example :

              110 END

              AUTO 100

              100 PRINT " EXAMPLE "

              110 END ( PRESS THE "ENTER" KEY )


                              - 2 8 -

 

                       U1.00031-01 35 01

 

 

              120 (press the keys   < SS >    And   < the C >
                       simultaneously)

              List

              100 PRINT " EXAMPLE "

              110 END

              Ok

 

 

 

 

     3.3.5. Team NEW

 

 

 

      This command removes the user program.

 

      Format:

              NEW

 

      The command is used to clear all program variables
( CLEAR operator ) and delete the program from memory.

 

 

 

 

                           4. OPERATORS

 

 

 

      Language operators change the values ​​of variables, the natural
order of calculations according to the algorithm for solving the problem, reserve
memory for variables and constants, etc.

 

 

 

       4.1. Key Operators

 

 

      The main operators include: assignment,
unconditional and conditional branch, loop, call to the
subprogram, etc.

      Transition operators use line numbers — integer
constants from the interval  [ 0.65535 ] . Using a period (".")
Instead of a line number is not allowed.

 

 

 

     4.1.1. LET statement

 

 

 

      This is the main operator for assigning new values ​​to
variables.

 

      Format:

              [LET] < ARGUMET > = < EXPRESSION >

 

      < ARGUMENT > :: = < VARIABLE >

                   < MID FUNCTION >


                              - 2 9 -

 

                       U1.00031-01 35 01

 

 

      The LET operator    is used to assign the value of the expression
located to the right of the equal sign to the variable located to the
left of this sign. The type of expression must match the type of
variable.

      When assigning, if necessary, the
conversion of variable types is performed . Attempting to assign a character
value to a numeric variable or vice versa will result in error 13.

      Note that the word LET in this statement is optional.

 

      An example :

              10 LET X = 1

              20 Y = 2 * 3

              30 A¤ = B¤ + ""

              40 LET D¤ = A¤

              50 MID¤ (C¤, 1%, 2%) = D¤

 

 

 

     4.1.2. The operator GOTO

 

 

 

      The operator transfers control to the line with the specified number.

 

      Format:

             GOTO < LINE NUMBER >

 

      The GOTO transition operator is used to change the natural
order of program execution (i.e., execution in ascending
order of line numbers).

      When the GOTO statement is executed,    control is transferred to the
line with the specified number. If the line with the specified number is missing, an error message 8 is displayed
.

 

      An example :

              10 INPUT X

              20 IF X <> 0 THEN GOTO 40

              30 END

              40 P RINT X

              50 GOTO 10

 

 

 

     4.1.3. GOSUB operator

 

 

 

      The operator transfers control to the subroutine.

 

      Format:

              GOSUB <LINE NUMBER >

 

      The GOSUB operator is used to call a subprogram - a group of
statements that starts with the specified line number and
ends with the RETURN statement . A subprogram can be located
anywhere in the program and called up any number of times.  RETURN will
return  control to the  statement following  the  GOSUB statement that called the subroutine .



                              - 30 -

 

                       U1.00031-01 35 01

 

 

      If there is no line with the specified number,
an error message is issued 8. Entering the subroutine not through GOSUB   causes error
3.

 

 

 

     4.1.4. RETURN statement

 

 

 

      Ends the subroutine and returns to the next statement
after GOSUB .

 

      Format:

              Return

 

      RETURN returns to the statement
immediately after the statement that called the subroutine. After
returning, all unfinished FOR - NEXT loops    in the subroutine are
completed, that is, all information about them is "forgotten", for example:

 

               10 GOSUB 100

               20 END

              100 FOR I = 1 TO 10

              110 P RINT "KUKU"

              120 RETURN

              RUN

              KUKU

              Ok

 

      In a subroutine, nested calls to other subroutines are possible.
An additional feature of the RETURN operator        is the use of an argument in it that indicates the operator to which control should be transferred after the completion of the subprogram, which allows you to return optionally to the place of the call.



                              - 31 -

 

                       U1.00031-01 35 01

 

 

 

      An example :

              10 I = 1

              20 GOSUB 100

              30 I = 2

              40 GOSUB 100

              50 END

              100 REM PROGRAM

              110 PRINT "SUB"; I

              120 RETURN

 

 

 

      4.1.5. The operator IF

 

 

 

      The IF statement   executes one of the branches depending on the
condition.

 

      Format:

               THEN < OPERATOR > < OPERATOR >            

  IF < ARGUMENT > [ELSE]                    

               THEN   < LINE NUMBER > < LINE NUMBER >       

               Goto

 

      < ARGUMENT > :: = WHOLE EXPRESSION DEFINING THE CONDITION;

 

      < OPERATOR > :: = ANY BASIC OPERATOR;

 

      < LINE NUMBER > :: = EXISTING LINE NUMBER.

 

      The operator calculates the value of the argument and converts it
to an integer type. A zero result is considered as a "false", non-zero -
"true".

      If the condition turns out to be true, then the specified
statement is executed or a jump to the line with the specified number occurs. In the
case of a line number , the word GOTO can be used instead of the word THEN .

      If the argument is false, then the ELSE
branch is executed or control is immediately transferred to the next line if the ELSE branch is absent.

      The < OPERATOR > can be any BASIC operator,
even another IF statement . The condition is usually used
expressions connected by operations of relations and logical
operations.

 

      An example :

              10 INPUT A, B, C

              20 IF A <B THEN PRINT A; "<"; B

              30 I% = NOT (B <C AND A <C )

              40 IF I% GOTO 10 ELSE PRINT A; " AND "; B; "<"; C


                              - 3 2 -

 

                       U1.00031-01 35 01

 

 

     4.1.6. FOR statement

 

 

 

      The FOR statement together with the NEXT operator organizes the cyclic
execution of a group of statements.

 

      Format:

              FOR < PARAMETER > = < ARGUMENT1 > TO < ARGUMENT2 >

 

      [STEP < ARGUMENT3 >]

 

      < Parameter > :: = NUMERIC VARIABLE (
                   CYCLE REPEATER);

 

      < ARGUMENT1 > :: = ARITHMETIC EXPRESSION (INITIAL
                    VALUE of < Parameter > );

 

      < ARGUMENT2 > :: = ARITHMETIC EXPRESSION DETERMINING
                    THE END OF REPEATS OF THE CYCLE;

 

      < ARGUMENT 3 > :: = ARITHMETIC EXPRESSION (increment of < Parameter > , DEFAULT equals 1).
                   

 

      During the first execution of the cycle, the value of ARGUMENT 1 is
assigned to the OPTION of the cycle. The execution of statements in the
loop continues until the NEXT statement appears  . After that, the
value of the PARAMETER increases (or decreases, if the
argument 3 is negative) by the value of the argument 3 and is compared
with the value of the argument 2. If the value of the parameter is greater (less
if the argument 3 is negative) of  the argument 2, then the
following NEXT   statements are executed  , in Otherwise,
the execution of statements between FOR and NEXT statements is repeated .

      Nested loops are allowed. They should not be crossed, ie.
E.  NEXT inner loop must appear before the  NEXT
outer loop.

      An unnatural exit from the loop is possible with the help
of transition operators, bypassing the NEXT operator .

      Entering a loop bypassing the FOR statement is not allowed.

 

 

 

     4.1.7. NEXT statement

 

 

 

      Defines the end of loop statements.

 

      Format:

              NEXT [< OPTION > [, < OPTION > ...]]

 

      < PARAMETER > :: = NUMERIC VARIABLE CORRESPONDING TO
                    OPERATOR FOR .

 

      The NEXT operator     increments the loop parameter,
checks if the limit value has been reached, and, depending on
this, exits the loop.


                              - 33 -

 

                       U1.00031-01 35 01

 

 

      NEXT with a parameter is used to indicate which FOR   it refers to.  NEXT   with a comma separated list of parameters is used to end several nested loops in one place . In this case, the first variable in the list should belong to the inner loop itself, and the last to the outer one. When the outer cycle ends, information about the inner cycles is lost, for example:





               10 FOR I = 1 TO 2

               20 FOR J = 1 TO 10

               30 PRINT J

               40 NEXT I

               RUN

                one

                one

               Ok

      The body of the cycle must be located in one program section,
i.e., the cycle declared in the main program cannot be completed in the
subprogram and vice versa. Entering a loop not through the FOR statement 
causes error 1.

 

      An example :

              10 FOR X = 1 TO 10

              20 FOR Y = 10 TO 1 STEP -2

              30 PRINT Y

              40 NEXT Y

              50 PRINT TAB (3); X

              60 NEXT

 

 

 

     4 .1.8. ON statement

 

 

 

      The operator performs branching depending on the value of the
expression.

 

      Format:

              ON < EXPRESSION > [ GOTO ] < LIST >

                              Gosub

 

      < EXPRESSION > :: = WHOLE EXPRESSION TAKING THE
                     INTERVAL VALUES [0,32767] .;

 

      < LIST > :: = LIST                   OF NUMBERS OF EXISTING LINES,
Separated by Commas.

 

      This operator allows you to jump to multiple lines. When you
select a line number, the value of the expression is calculated. If the
result is zero or greater than the number of line numbers in the list,
then control is transferred to the next statement. If the value of the
expression matches the line number from the list (counting 1,
2, etc. from the left ), then this line number is used by the GOSUB
or GOTO operator  .

      If the GOSUB < LINE NUMBER > statement is executed , the RETURN statement returns control to the operator following the ON statement .

      This operator is used if there is a series


                              - 34 -

 

                       U1.00031-01 3 5 01

 

 

tasks that are selected depending on what value the
expression takes. If the tasks are short and related to the value of the
expression, then ON GOTO is used . If these tasks are larger and possibly connected with another ON operator or are accessed from other places in the program, then the ON GOSUB operator is used  , and each task needs to be executed in the form of a subprogram.

 

      A negative value of the expression results in error 5.

 

      An example :

              10 A¤ = INKEY¤

              20 IF A¤ = "" THEN 10

              30 ON ASC (A¤) -64% GOSUB 100,200,300

              40 GOTO 10

 

 

 

     4.1.9. STOP statement

 

 

 

      Temporarily stops program execution.

 

      Format:

              STOP

 

      The STOP operator  is   used to organize a dialog when
debugging programs. When the STOP statement is executed, the      program
stops, a message is displayed on the terminal

 

              Stop in line YYYYY

              Ok

 

      and the computer goes into direct mode. After pausing the program, you can print or even change the values ​​of the variables. With the CONT command    , program execution can be continued from the statement following the STOP statement  . After editing the text of the program, an attempt to resume execution of the program leads to error 17. In this case , the RUN command is used to start the program .





 

      An example :

              10 A = 10

              20 STOP

              30 A = 20

              40 PRINT A

              RUN

              Stop on line 20

              PRINT A

              ten

              Ok

              CONT

              20

              Ok


                              - 3 5 -

 

                       U1.00031-01 35 01

 

 

     4.1.10. END statement

 

 

 

      Ends program execution and closes files.

 

      Format:

              End

 

      The operator stops the execution of the program and
returns to direct mode. END can be located anywhere in the program. The operator is convenient for separating the main program from the subprograms in order to avoid transferring control to the subprogram not through the GOSUB operator .



                              - 36 -

 

                       U1.00031-01 35 01

 

 

      Example:

 

              10 GOSUB 30

              20 END

              30 PRINT A¤

              40 RETURN

 

 

 

 

    4.1.11. REM statement

 

 

 

      Indicates comments in the program text.

 

      Format:

               REM [< TEXT >]

               ''

 

      < TEXT > - ANY SEQUENCE OF CHARACTERS .

 

      The operator serves to include a comment in the text of the program
for the convenience of reading the algorithm, to identify and
determine the order of the programs, and also as an empty
operator. All text behind the word REM is ignored. Another way of
defining comments in the program text is the apostrophe ( "'").   In
contrast to  REM , which requires a separate line
of the program, the apostrophe can be used after any other
operator, automatically ending it.

      Due to the fact that the comment takes up additional space in
RAM, the storage space for other statements is reduced
.

 

      Example:

              10 REM INPUT PROGRAM

              200 X = 1 ' VARIABLE CYCLE

 

 

 

       4.2. Description, Reservation, and             Initialization Operators

 

 

 

      Memory backup statements serve as memory backup
for arrays and constants. Memory for
variables is reserved in a local or shared data area.
The memory for constant values ​​is reserved in the area of ​​the
generated program during compilation. To reserve memory for
variables and arrays, the DIM operator is used   ; to
reserve memory for constant values, DATA is used . The READ and RESTORE
operators are used to assign variables constant values .


                              - 37 -

 

                       U1.00031-01 35 01

 

 

     4.2.1. DIM statement

 

 

 

      The DIM statement reserves memory for variables and arrays,
giving them null values.

 

      Format:

              DIM < ARGUMENT > [, < ARGUMENT > ...]

 

      < ARGUMENT > :: = A VARIABLE NAME FOR A VARIABLE WHICH
                    A
                    LIST OF MAXIMUM VALUES OF                     MASSIVE INDEXES CONCLUDED IN THE BRACKETS CAN BE
FOLLOWED.

 

      This operator is usually used to define arrays,
but it can also define individual variables. Each array has
the number of indices specified in the list. The maximum value of the index is
indicated by an integer expression that takes values ​​from the interval [0.255].

      Implicit definition of variables and arrays is possible. This
definition occurs every time
an undefined variable name appears . Simple variables are usually defined
this way. When the name of the indexed
variable appears  , a one-dimensional array with a maximum index value of 10 is determined
.

      Implicit array definition is not possible in direct
mode and causes an error 12. Attempting to redefine an array that has already been
declared or defined by default leads to an
error 10. If there is not enough RAM to determine the
array, an error message 7 is issued.

 

      An example :

              10 DIM X, I%, Z (5.20.3), A¤ (30)

 

 

 

     4.2.2. KEY statement

 

 

 

      This operator changes the values ​​of the function keys.

 

      Format:

              KEY < ARGUMENT1 >, < ARGUMENT2 >

 

      < ARGUMENT1 > :: = THE WHOLE EXPRESSION
                     DEFINING THE NUMBER OF FUNCTION
                     KEY , NUMBER FROM THE INTERVAL [1,10];

 

      < ARGUMENT1 > :: = SYMBOLIC EXPRESSION DETERMINING
                     THE VALUE OF                      THE KEY (USE ONLY
THE FIRST 16 CHARACTERS).

 

      The operator is used to change the values ​​of the function
keys set by default. The first 16 characters of  ARGUMENT 2 are assigned to the key specified by ARGUMENT 1.

      The first characters are displayed in the service line of the screen


                              - 38 -

 

                       U1.00031-01 35 01

 

 

function key values. The KEY statement      makes the
appropriate changes to the service line.

      You can use the CHR функцией
function to enter the “PS” character or quotation marks .

      If the value of the first argument is outside the
acceptable range, error 5 is obtained.

      By default, function keys have the following
meanings:

 

              Color

              AU the TO

              Goto

              List

              RUN < VK >

              COLOR 8.2.2 < VK >

              CLOAD "

              CONT < VK >

              LIST. < PS > < AP 2 > A < AP 2 > A

              < SBR > RUN < VK >

 

      (the control symbol "RBS" has an octal code of 14 and
means clearing the screen).

 

      An example :

              KEY 1, "LINE"

              KEY 2, "SAVE" + CHR¤ (34)

              KEY 3, "PRINT PI" + CHR¤ (13)

 

 

 

     4 .2.3. CLEAR statement

 

 

 

      Clears the values ​​of variables, reserves symbolic and non-
basic memory.

 

      Format:

              CLEAR [< ARGUMENT1 > [, < ARGUMENT2 >]]

 

      < ARGUMENT1 > :: = WHOLE EXPRESSION
                     INDICATING THE NUMBER OF BYtes OF THE MEMORY AREA
                     RESERVED FOR SYMBOL VARIABLES;

 

      < ARGUMENT2 > :: = THE WHOLE EXPRESSION INDICATING THE ADDRESS
                     OF THE TOP BORDER OF THE RAM AREA
                     USED ​​BY THE BASIC SYSTEM
                     SHOULD NOT EXCEED THE EIGHT-EIGHT 70,000.

 

      With any form of operator, arrays and variables,
certain functions, character strings, as well as the hardware stack are cleared ,
all files are closed, and any printout ends with the symbol
"PS". USR function definitions remain unchanged.

      The first argument is used to set the size of
the memory area for storing string text; by default, it is
200 bytes. If ARGUMENT1 is specified , then the specified number of bytes is reserved for character strings
.

      The second argument is used to indicate the start of the region,


                              - 39 -

 

                       U1.00031-01 35 01

 

 

which cannot be used for BASIC programs and data.
This defines the area for raw data, USR
functions, or other uses. After executing  CLEAR   with two parameters in indirect mode, the object code is lost, and the BASIC system goes into direct mode.

      Many operations do CLEAR automatically, for example RUN , NEW , MERGE , LOAD and any change to the BASIC program text. If parameters   are not specified in  CLEAR , then the corresponding values of the row area and the upper boundary of the RAM are not changed.



      Too large a value of the first or too small second
argument causes a lack of RAM, and
an error message is issued 7. Specifying the second argument if the
first one is missing causes error 2. If ARGUMENT 2 is greater than octal
70,000, an error message 5 is issued.

 

      Example:

              CLEAR 1000, & O 30000

              Ok

      ( 1000 bytes reserved for strings and RAM over & O 30000 for
user purposes).

 

 

 

     4.2.4. DATA operator

 

 

 

      Saves the constants specified in the program text for
later use.

 

      Format:

              DATA < ITEM > [, < ITEM > ...]

 

      < ELEMENT > :: = NUMERIC CONSTANT, TEXT CONSTANT
                   IN QUOTES OR WITHOUT QUOTES, BUT NOT
                   INCLUDING A COMMARC.

 

      This operator allows you to save the "initial" values ​​in the
body of the program. In direct execution mode, the DATA statement is   ignored. During program execution, it is also omitted, and only the READ statement can use it.

      While reading, data is selected starting with the DATA operator with the
lowest line number, and the following operators are selected
sequentially. When all data has been exhausted, further reading is
not possible until the RESTOR E statement appears .

      In the DATA statement list, a      comma is used as a separator. The apostrophe does not complete the list and does not mean the beginning of the comment. Any numeric constants are allowed, including & H , & O , & B , exponential form, constants with an explicitly specified type. If there is no delimiter in the text constant, quotation marks may be omitted.





                              - 40 -

 

                       U1.00031-01 35 01

 

 

     4.2.5. READ statement

 

 

 

      Enters data from a DATA statement into a program.

 

      Format:

              READ < VARIABLE > [, < VARIABLE > ...]

 

      < VARIABLE > :: = VALID VARIABLE NAME (INCLUDING
                      AN ARRAY ELEMENT).

 

      This statement reads the following unread data from
the DATA statement  . The process is repeated until all
variables from the list take their values. The READ statement  
revises all records of each DATA statement , analyzing them from the
beginning of the program to the end. You can
use the RESTORE operator several times to read data .

      If the end of the DATA statements    is detected,
error 4 is displayed   . When you try to read text data into
numeric variables, error 13 is received.

 

      An example :

              10 DATA 1, & O22, & H3F

              20 FOR I% = 0 TO 5%

              30 DATA 234E-7

              40 READ X (I%)

              50 NEXT I%

              60 DATA -33%, 44.56, TEXT, "A, B"

              70 READ A¤, B¤

 

 

 

     4.2.6. RESTORE statement

 

 

 

      Changes the reading order of data from a DATA   statement by a READ statement .

 

      Format:

              RESTORE [< LINE NUMBER >]

 

      < LINE NUMBER > :: = EXISTING LINE NUMBER.

 

      This statement changes the value of the pointer that determines
which of the DATA statements    will be used next in
the READ statement . READ moves the pointer sequentially until all DATA statements    are used. The RESTORE statement  returns a pointer to the beginning of the program and all data can be re- entered. If a line number is present, DATA operators with the specified or large line numbers will be considered . You can reuse the RESTORE statement anywhere in the program. It allows you to look at DATA operators    as a read-only data input device.







                              - 4 1 -

 

                       U1.00031-01 35 01

 

 

      An example :

              1000 RESTORE

              1010 FOR I% = 0% TO 10%

              1020 READ X (I%)

              1030 NEXT I%

              1040 RETURN

 

      (subroutine populating array X )

 

 

 

     4.2.7. DEF statement

 

 

 

 

 

   4.2.7.1. DEF USR statement

 

 

 

      Defines functions in machine language.

 

      Format:

              DEF USR [< NUMBER >] = < EXPRESSION >

 

      < NUMBER > :: = WHOLE CONSTANT FROM INTERVAL  [0.9],

                 INDICATING NUMBER OF FUNCTION,
                 DEFAULT 0;

 

      < EXPRESSION > :: = integer expression specifying the address for
                     starting the function USR .

 

      The operator determines the starting address of the machine routine
compiled by the user. The value of the expression is converted to an
integer type and is considered the address of the program launch. Negative
values ​​from minus 32768 to minus 1 mean addresses from 32768 to
65535, respectively. It is convenient to use octal constants to specify addresses
.

      At the same time, 10 USR () functions can be defined . The number of the
defined function is indicated by a number. The
subroutine call addresses are stored in the USRTAB (& O 2100) area , where each USR () is allocated one word. Operator action can be thought of as filling in USRTAB .

      To run a program in machine language, you must
execute a sequence of statements

 

              10 DEF USR = & ONNNNNN

             20 A = USR (A)

 

      The usual way to load a machine program into memory
is to use the   BLOAD command ,    which stores the
starting address of the loaded program in the BUFSTA cell  (& O 264).
So the sequence is logical

 

              BLOAD "PROG"

              PROG .BIN

              Ok


                              - 4 2 -

 

                       U1.00031-01 35 01

 

 

              DEF USR5 = PEEK (& O264)

              Ok

 

      To allocate memory to the U SR () functions, use the CLEAR operator . This statement saves all DEF USR definitions .

 

 

 

   4.2.7.2. DEF FN statement

 

 

 

      Defines custom functions.

 

      Format:

              DEF FN < NAME > [(< LIST >)] = < EXPRESSION >

 

      < NAME > :: = ANY VALUE VARIABLE NAME;

 

      < LIST > :: = ONE OR SEVERAL NAMES OF FORMAL
                  PARAMETERS (ACCEPTABLE VARIABLE NAMES),
                  SEPARATED BY A COMA;

 

      < EXPRESSION > :: = ANY EXPRESSION OF THE SAME TYPE AS AND < NAME > .
                    

 

      When this statement is executed, the variable  < NAME > is created ,
marked as the name of the function. The operator does not
perform any calculations and can be anywhere in the program. The variable < NAME > is
not accessible in the usual way, and a normal
variable with the same name can be created . If another
function with the same name is created, the old definition is lost.

      A function can have any number of parameters. They are defined
as a list of variable names of any type, separated by commas and
enclosed in brackets. Parameters are formal and do not really
exist, i.e. any ordinary variable can have the same
name. Each argument must be of such a type that it could be
assigned the value of the actual argument specified when the
function was called, and the result will be returned to the place the function was called.
If this expression contains the names of variables declared by
formal arguments, then their values ​​are taken according to the
list of actual arguments in the function call. You
can also use any other variables in the expression if their names do not
match the names of the formal arguments. An expression can contain
any function calls, as well as non-recursive calls to FN
functions .

      Errors are checked only when the function is called. If
an error is detected in the line that calls the user-defined function, you
should check the definition of this function.

      DEF FN , unlike DATA , is an executable statement, i.e. a function must be defined before it is called. This operator is one of the few forbidden in direct mode.


 

      An example :

              10 DEF FN QU¤ (QU, ST) = MID¤ (QL¤, QU, ST)

              20 PRINT FN QU¤ (CO, LEN ( CO))


                              - 43 -

 

                       U1.00031-01 35 01

 

 

       4.3. Input / output operators

 

 

      The input / output operators  INPUT PRINT and others allow you to organize the exchange of information with external devices. 

 

 

 

     4.3.1. PRINT statement

 

 

 

      Displays data on a screen, printing device, or tape file
.

 

      Format:

               PRINT

               ? [#]

                          [< LIST >]

               Lprint

 

      < LIST > :: = ONE OR SEVERAL EXPRESSIONS OF ANY TYPE, PRINT
                  OPERATOR FUNCTIONS   ,                   SEPARATED BY A comma OR A comma;

 

     L INDICATES THAT THE CONCLUSION IS CARRYING OUT ON THE PRINTING         DEVICE;

 

      # MEANS FILM OUTPUT.

 

      The word PRINT can be replaced by the question mark "?",
With the exception of the LPRINT variant .

      LPRINT should work on RMP.

      The operator sends the data to the output device. Typically
, the output device is a screen, but this operator can output
data to a printing device or to an open file on
magnetic tape. The list of output data   can be empty
or contain several expressions of any type, the values ​​of
which are converted to text and displayed on the specified
device. A comma between two elements of the data list means
that the data will be displayed by zones , i.e. each item in the list
is allocated 1 6 positions. The rest of the data zone is filled with
spaces. If the data does not fit in the zone, the next
zone is taken . If there is a
semicolon between the two arguments of the data list , the values ​​are displayed directly one after the other.
If the comma or semicolon is the last in the
data list , the cursor remains at the same position that it
was after the last value was output, otherwise the
line is translated.

      The LPRINT statement prints all data to a printing device.

 

      Example:

              PRINT 1; -2.3

               1 -2          3 

              Ok


                              - 44 -

 

                       U1.00031-01 35 01

 

 

     4 .3.2. INPUT statement

 

 

 

      Enters data from the keyboard or from a file.

 

      Format:

              INPUT [< ARGUMENT >;] [< LIST >]

                        #

 

      < ARGUMENT > :: = HINT AS A TEXT CONSTANT;

 

      < LIST > :: = ONE OR SEVERAL VARIABLES OR
                  ARRAY ELEMENTS Separated by Commas;

 

      # INDICATES ENTERING FROM A MAGNETIC TAPE FILE.

 

      This operator organizes input from the keyboard or from
an OPEN file opened on tape. If there is no "#" sign , then
input is carried out from the keyboard. If < ARGUMENT >
is specified in the case of keyboard  input , it is displayed as a hint. Then the question mark "?" , the cursor is highlighted , and the BASIC system is waiting for data entry. The data can be any constants corresponding to the list items in type and number . Commas are used as delimiters. The text constants are missing quotation marks, if they do not contain commas. If the input stops before the end of the variable list , then the signs  "??" , and the BASIC system waits for input to continue. If more data is entered than the variables in the list, then the last values ​​are ignored.








 

      If you enter invalid
characters when entering numeric data , an error message 13 is issued and
re-entry is performed . When the INPUT   #  operator tries to  read the end of file label,
an error message 55 is displayed.

 

      Example:

              INPUT " DATA "; A , B ¤, C ¤

              DATA ? 123, " ABC , EFG "

              ?? P " Q

              Ok

              PRINT A, B¤, C¤

               123 ABC, EFG P "Q

              Ok


                              - 4 5 -

 

                       U1.00031-01 35 01

 

 

     4.3.3. OPEN statement

 

 

 

      Defines a tape data file.

 

      Format:

              OPEN < FILE SPECIFICATION > [ FOR INPUT ]  

                                             OUTPUT

 

      < FILE SPECIFICATION > :: = SYMBOLIC EXPRESSION
                              DETERMINING THE FILE NAME.

 

      The operator begins the process of data input / output. The I / O buffer is associated with the file name. The words  INPUT and  OUTPUT indicate that an input or output file is opened, respectively . Data on magnetic tape is stored in the KOI-7 format in blocks of 256 characters. The end of the file means the character "SU / Z " (code  & O 32 ). In a similar format, the SAVE , LOAD, and MERGE commands store the program text   on tape. When you open the input file, the first block of data is read into the buffer.
 





      Data from the input file can be read with the INPUT # operator  ,
written to the output file with the PRINT # operator . The file name must
be no more than 6 characters long. You can also specify the
file type . The file type must consist of no more than 3 characters and be
separated from the file name by a dot:

 

              DATA.TXT

 

      By default, the OPEN statement sets the file type to DAT .
You can specify any other type of file, only if you enter this
file must be recorded in the format KOI-7.

      If the file name is too long or empty,
an error message 56 is displayed . Attempting to reopen the file results in
error 54.

 

      Example:

              10 OPEN "PROG.ASC" FOR INPUT

              20 IF EOF THEN 60

              30 INPUT # A¤

              40 PRINT A¤

              50 GOTO 20

              60 CLOSE

 

      ( the text of the PROG program is displayed ).


                              - 4 6 -

 

                       U1.00031-01 35 01

 

 

     4.3.4. CLOSE statement

 

 

 

      Ends I / O operations and frees the buffer.

 

      Format:

              CLOSE

 

      If the OPEN operator opened the output file, the < S >
symbol and the file end indicator "SU / Z " (code & O 32 ) are added to the output data, the last block of the file is displayed and the buffer is cleared. In the case of the input file, the buffer is simply cleared.

      Some operations do  CLOSE   automatically. This is  END , CLEAR , LOAD , NEW and any change to the program text.

 

      An example :

              10 OPEN "DATA" FOR OUTPUT

              20 FOR I% = 0% TO 10%

              30 PRINT # X (I%)

              40 NEXT

              50 CLOSE

 

 

 

       4 .4. Direct memory access statements

 

 

 

 

 

     4.4.1. The operator POKE

 

 

 

      Writes data to any computer memory location.

 

      Format:

             POKE < ADDRESS >, < EXPRESSION >

 

      < ADDRESS > :: = THE WHOLE EXPRESSION DEFINING THE CELL ADDRESS
                 ;

 

      < EXPRESSION > :: = WHOLE EXPRESSION DEFINING                      RECORDS - DATA TO
BE DATA.

 

      This operator  writes the value of the expression to the specified
cell (word) of memory, both parameters are converted into a whole
type. If the address is odd, then the word containing the
specified byte is taken , that is, the value of the address is reduced by 1. This
operator can be used to change the pointers and tables of the BASIC   system, to store programs written in machine codes in memory to work with registers of external devices.

      Use the POKE operator  with   caution, since
erroneous data or an address can cause unwanted
results.


                              - 4 7 -

 

                       U1.00031-01 35 01

 

 

      An example :

              10 A% = PEEK (4%)

              20 POKE 6%, 2%

              30 POKE 4%, 6%

 

             ...

              100 POKE 4%, A%

              110 POKE 6%, 0%

 

      ( during program execution, access to non-existent memory cells is blocked
).

 

 

 

     4.4.2. OUT operator

 

 

 

      Writes data to random access memory by mask.

 

      Format:

              OUT < ADDRESS >, < MASK >, < CODE >

 

      < ADDRESS > :: = WHOLE EXPRESSION INDICATING THE PHYSICAL                  ADDRESS OF MEMORY CELL
;

      < MASK > :: = WHOLE EXPRESSION INDICATING PARTICIPATING
                 IN BIT OPERATION;

 

      < CODE > :: = THE WHOLE EXPRESSION INDICATING
               TO BE ERASED OR INSERTED BY THE SELECTED BITS;
               A ZERO VALUE indicates an Erase, a
               NULL value indicates an INSERT.

 

      The operator allows you to record or erase individual bits
directly in the memory cells. The bits of the cell
corresponding to the zero bits of the mask remain unchanged, the
remaining bits are erased (if the code value is zero), or
turned on (otherwise).

 

      Example:

              10 POKE A%, & O177777

              20 POKE B%, 0%

              30 OUT A%, & O111111.0%

              40 OUT B%, & O66666.1%

              50 PRINT OCT¤ (PEEK (A%)), OCT¤ (PEEK (B%))

              RUN

              66666 66666

              Ok


                              - 48 -

 

                       U1.00031-01 35 01

 

 

       4 .5. TV screen control operators

 

 

 

 

 

     4.5.1. CLS statement

 

 

 

      Clears the screen.

 

      Format:

              CLS

 

      The CLS statement colors the entire screen in the current background color. Using it, the fastest way to get a solid screen of any color.

 

      An example :

              100 INPUT " PASSWORD ", A¤

              110 IF PAROL¤ = A¤ THEN 200

              120 CLS

              130 PRINT AT (10,10); " KU - KU ! "

              140 CLEAR

 

 

 

     4.5.2. COLOR statement

 

 

 

      Sets the screen color.

 

      Format:

              COLOR [< ARGUMENT1 >], [< ARGUMENT2 >], [< ARGUMENT1 >]

 

      < ARGUMENT1 > :: = WHOLE EXPRESSION INDICATING THE
                     FRONT PLAN COLOR NUMBER , NUMBER WITHIN [0.8];
                    

 

      < ARGUMENT2 > :: = THE WHOLE EXPRESSION INDICATING THE NUMBER
                     OF BACKGROUND COLOR, NUMBER WITHIN [0.8];

 

      < ARGUMENT2 > :: = WHOLE EXPRESSION INDICATING THE NUMBER
                     OF COLOR OF THE CURRENT , NUMBER WITHIN [0.8].

 

      The operator sets the current foreground and background colors of the
screen. If there is no parameter, the corresponding color does not
change.

      The following color numbers are available:

 

       0 - transparent (background color); 4 - blue;

       1 - black; 5 - red;

       2 - blue; 6 - purple;

       3 - green; 7 - yellow;

                                       8 - white;


                              - 4 9 -

 

                       U1.00031-01 35 01

 

 

      The COLOR operator    changes the color of the displayed text; all
graphics operators also use the color set by this operator by default
.

 

      An example :

              100 COLOR 2,3

              110 DRAW A¤

              120 COLOR 1

              130 PSET @ (20.0)

              140 DRAW A¤

 

 

 

     4 .5.3. SCREEN statement

 

 

 

      Switch statement

 

      Format: SCREEN N

 

      In the microcomputer "Electronics MS 0511" the symbolic and
graphic output to the screen are separated . Therefore, the BASIC system allows the
user at any time to have on the screen either only
graphic or only textual information. In the system, it is
customary to call the symbolic and graphic modes of the screen
or simply symbolic and graphic screens. Text on a graphic screen can only be drawn, for example, with the DRAW operator , but there is no way to print it with the PRINT operator .

 

      The SCREEN operator allows you to switch from one mode to
another. The parameter of the SCREEN operator is an arithmetic expression. When the statement is executed, the integer part of the expression value is taken. Valid parameter values ​​are as follows:

 

         0 - go to the character screen

 

         1 - transition to the character screen

 

         2 - go to the graphic screen

 

         3 - go to the graphic screen

 

 

      For other values ​​of the parameter, the error message "incorrect function call" is issued
.

 

      When switching from one mode to another, the screen is cleared,
i.e. all is repainted in the current background color. The background colors and
character output or plotting for each screen are set separately
and can be different. This is done using the COLOR statement . It sets the colors for the current screen. The third parameter of the COLOR operator    for the graphic screen is ignored. It should be noted that the COLOR operator    does not repaint the screen, but only sets the colors for subsequent output. Therefore, the background of the graphic screen can only be changed by a sequence of operators.





                              - 50 -

 

                       U1.00031-01 35 01

 

 

           100 SCREEN 2

 

           110 COLOR, 6

 

           120 CLS

 

 

      The rendering color changes without additional operators, but the old image is not repainted.

 

      It must be remembered that the use of any graphic
operators ( PSET , PRESET , LINE , CIRCLE , PAINT DRAW and the POINT function ) is permissible only during the operation of the graphic mode. In character mode, this will result in an "incorrect function call" error . It is also necessary to remember that the transition to the symbol mode is carried out automatically when the INPUT statement is executed and when switching to the direct mode (termination of the program is natural, by mistake or by pressing the < STOP > key , and also when the SCREEN statement is executed    in the direct mode). Therefore, working with graphics in direct mode is impossible.  








 

 

 

     4.5.4. LOCATE statement

 

 

 

      Moves the cursor on the screen, highlighting and extinguishing it.

 

      Format:

              LOCATE [< ARG1 >] [, < ARG2 >] [, < ARG3 >]

 

      < ARG1 > :: = POSITION X (COLUMN), ON WHICH A
                CURSOR SHOULD BE LOCATED, WHOLE EXPRESSION WITH
                VALUE FROM INTERVAL [0,255];

 

      < ARG2 > :: = POSITION Y (LINE) ON WHICH THE
                CURSOR SHOULD BE LOCATED, WHOLE EXPRESSION WITH
                VALUE FROM INTERVAL [0,255];

 

      < ARG3 > :: = THE WHOLE EXPRESSION INDICATING TO EXTEND
                (ZERO VALUE) OR LIGHT OUT
                (NULL ZERO) CURSOR MUST ;

 

      The LOCATE statement    controls the location of the cursor on the
screen. Lines have numbers from 0 (upper) to 23 (lower).
Columns are numbered from 0 to 63 from left to right. The cursor
moves to the position specified in the LOCATE statement  . If either of the first two parameters is omitted, then its previous value is saved .

      If ARGUMENT 3 is present and it is not equal to 0, then the operator
displays a cursor, which is usually extinguished during
program execution . The cursor is also highlighted by the INPUT operator . To enter
data with the cursor extinguished, you must use the INKEY ¤ function .

      The LOCATE statement does not affect the position of the graphics cursor .

      The CSRLIN and POS functions let   you know the cursor position set by this operator. If the column or row number


                              - 51 -

 

                       U1.00031-01 35 01

 

 

more than the number of columns or rows present on the screen, but not
more than 255, the cursor will be moved through the maximum number of
positions in this direction.

      Negative or large boundary values ​​of the first two
parameters lead to error 5.

 

      An example :

              100 LOCATE 0.22

              110 INPUT " NUMBER "; X

              120 LOCATE 0,0,0

              130 PRINT X

 

 

 

       4 .6. Graphics Operators and Functions

 

 

 

 

 

     4.6.1. PSET statement

 

 

      Used to color a point on the screen in a given
color.

 

      Format:

              PSET [@] (< ARG1 > < ARG 2>) [, < ARG 3>]

                    STEP

 

      < ARG1 > :: = INTEGER  EXPRESSION ,   Setpoint   Coordinates X POINT;
              

 

      < ARG2 > :: = INTEGER  EXPRESSION ,   Setpoint   Coordinates Y POINT;
              

 

      < ARG 3> :: = WHOLE EXPRESSION ,    DETERMINING THE COLOR OF THE DOT; NUMBER FROM INTERVAL [0.8] ;
              

 

      STEP (@) - COORDINATES OF
                 THE SPECIFIED POINT ARE CALCULATED WITH RESPECT TO THE LAST POINT PROCESSED BY GRAPHIC
                 OPERATORS.

 

      If the specified point is outside the screen
( X coordinate from the interval [0.639] Y   - [0.263]) , then the command
does not perform any actions. Otherwise, it is
painted in the color specified by argument 3, or, if it is
absent, in the current color specified by the COLOR operator .

      If the color number is out of range, an error message 5 is issued .

 

      An example :

              10 FOR Y = 1 TO 120

              20 PSET (SQR (Y), Y)

              30 NEXT


                              - 5 2 -

 

                       U1.00031-01 35 01

 

 

     4.6.2. PRESET statement

 

 

      The operator is used to color the dots on the screen in the background color
.

 

      Format:

              The PRESET [@] (< ARG1 > < ARG 2>) [, < ARG 3>]

                      STEP

 

      < ARG1 > :: = INTEGER  EXPRESSION ,   Setpoint Coordinates X POINT;
              

 

      < ARG2 > :: = INTEGER  EXPRESSION ,   Setpoint  Coordinates Y POINT;
              

 

      < ARG 3> :: = WHOLE   EXPRESSION ,    DETERMINING THE COLOR OF THE DOT; NUMBER FROM INTERVAL [0.8] ;
              

 

      STEP (@) - COORDINATES OF                  THE SPECIFIED POINT ARE CALCULATED WITH RESPECT TO THE LAST POINT PROCESSED BY GRAPHIC OPERATORS.

               

 

      This operator paints a given point on the screen in the background color.
If ARGUMENT 3 is specified, then the operator turns into a PSET operator - the point is painted in the specified color. The coordinates of point  X   and  Y must be in the intervals [0.639] and [0.263],   respectively, otherwise no action will occur.


      If the color number is out of range, an error message 5 is issued .

 

      Example:

              100 C % = POINT ( X %, Y %)

              110 PRESET (X%, Y%)

              ...

              200 IF POINT (X%, Y%) <> C% THEN PSET (X%, Y%), C%

 

 

 

     4.6.3. POINT function

 

 

      The function returns the color number of the indicated point on the screen.

 

      Format:

              X = POINT (< ARGUMENT1 >, < ARGUMENT2 >)

 

      < ARGUMENT1 > :: = THE WHOLE EXPRESSION ASKING THE X-
                     COORDINATE ;

 

      < ARGUMENT 2> :: = THE WHOLE EXPRESSION ASKING THE Y-
                     COORDINATE .

 

      The POINT function returns a value of an integer type - the color number of a
given point on the screen, a number from 1 to 8. If the coordinates of the point
go beyond the screen, then -1 is returned. If the point does not
belong to any of the objects drawn on the screen, the
background color number is issued.


                              - 53 -

 

                       U1.00031-01 35 01

 

 

      Using the POINT function, you can determine whether something was drawn
in a given location on the screen.

 

      An example :

              100 GOSUB 1000

              110 IF POINT (X0, Y0) = 4% THEN 100

              120 GOSUB 2000

 

 

 

     4.6.4. LINE statement

 

 

 

      The operator is used to draw lines and rectangles on the screen
.

 

      Format:

              LINE [[@] (< ARG1 >, < ARG2 >)] - STEP
                    

 

      [@] (< ARG3 >, < ARG4 >) [, < ARG5 >, [ B ]

       STEP BF                        

 

      < ARG1 > :: = WHOLE EXPRESSION ASKING TO COORDINATE  X

                INITIAL POINT OF OBJECT;

 

      < ARG2 > :: = WHOLE EXPRESSION KEYING Y- COORDINATE 

                INITIAL POINT OF OBJECT;

 

      < ARG3 > :: = WHOLE EXPRESSION ASKING TO COORDINATE  X

                END POINT OF OBJECT;

 

      < ARG4 > :: = WHOLE EXPRESSION KEYING Y- COORDINATE 

                END POINT OF OBJECT;

 

      < ARG5 > :: = WHOLE EXPRESSION DEFINING THE COLOR NUMBER

                OBJECT, NUMBER FROM THE INTERVAL [0,8] ;

 

      B - Draws a rectangle between the given vertices            ;

 

      BF - A PAINTED RECTANGULAR IS DRAWED OUT;

 

      STEP (@) INDICATES THAT THE COORDINATES ARE COUNTED WITH RESPECT TO
               THE LAST POINT PROCESSED BY GRAPHIC
               OPERATORS.

 

      This operator is used to draw lines, outlines of rectangles or filled rectangles on the screen
.

      The first to fourth arguments specify the coordinates of the start
( < ARG1 > and < ARG2 >) and end ( < ARG3 > and < AGG4 >) points of the object (for a
rectangle, these are diagonally opposite angles). If the first
two arguments are omitted, then by default the coordinates of the point specified in the previous graphics operator are taken
.

      If ARGUMENT 5 is omitted, the current color
specified by the COLOR operator is selected .

      If parameter B ( BF ) is specified , a rectangle is drawn


                              - 54 -

 

                       U1.00031-01 35 01

 

 

(filled rectangle). If none of these parameters
are present, a line is drawn.

      The first to fourth arguments can take values ​​from the
interval [-32768,32767] , but only points with X and Y
coordinates in the intervals [0.639] and [0.263], respectively, are displayed on the screen .

      If the color code is out of range, an error message 5 is issued
.

 

      Example:

              10 LINE - @ (SCALE * 3, SCALE * 4) , 2%

              20 LINE (100,100) - (200,200) ,, B

              30 LINE (125,125) - @ (50,50) ,, BF

 

 

 

     4.6.5. CIRCLE statement

 

 

      Used to draw circles, ellipses and arcs of arbitrary size and color on the screen
.

 

      Format:

              CIRCLE [@] (< ARG1 >, < ARG2 >), < ARG3 >

                      STEP

 

      [, < ARG4 >] [, < ARG5 >] [, < ARG6 >] [, < ARG7 >]

 

      < ARG1 > :: = WHOLE EXPRESSION ASKING TO COORDINATE  X

                CENTER OF THE CIRCLE;

 

      < ARG2 > :: = WHOLE EXPRESSION KEYING Y- COORDINATE 

                CENTER OF THE CIRCLE;

 

      < ARG3 > :: = WHOLE  EXPRESSION DEFINING THE RADIUS  

                NEIGHBORHOOD;

 

      < ARG4 > :: = WHOLE EXPRESSION SETTING A COLOR NUMBER;

                NUMBER FROM INTERVAL [0.8] ;

 

      < ARG5 > :: = ARITHMETIC EXPRESSION ASKING POSITIVE-

                INITIAL ARC POINT (IN RADIANS);

 

      < ARG6 > :: = ARITHMETIC EXPRESSION ASKING POSITIVE-

                THE END OF THE ARC POINT (IN RADIANS);

 

      < ARG7 > :: = Arithmetic expression specifying the coefficient

                ELLIPSE COMPRESSION CIENT;

 

      STEP (@) - COORDINATES OF THE INDICATED POINT ARE CALCULATED WITH RESPECT
                 TO THE LAST POINT PROCESSED
                 BY GRAPHIC OPERATORS.

 

      This operator is used to draw circles,
ellipses or their parts (arcs). Only that part of the
circle that is placed on the coordinate plane is displayed on the screen
( X coordinate within [0.639], Y - [0.263]).

      The first two arguments specify the position of the center of the circle on the
coordinate plane.


                              - 55 -

 

                       U1.00031-01 35 01

 

 

      ARGUMENT 3 sets the radius of the circle drawn.

      ARGUMENT 6 and ARGUMENT 6 indicate the beginning and end of the
drawn arc, respectively. If these arguments are
negative, then their absolute values ​​are taken, and the center of the
circle is connected to the corresponding end of the arc. By
default, they are 0 and 2 * PI (6.283185).

      If ARGUMENT 7 is specified, an ellipse is drawn. By default,
this parameter is 1.

      Incorrect arguments can result in a
syntax error or an overflow error. If the color number is
out of range, an error message 5 is issued.

 

      Example:

              10 COLOR 3

              20 CIRCLE (100,100), 75 ,, - 1, -. 001,1.2

              30 CIRCLE (10, -5), 75 ,, -. 001, -1,1.2

 

 

 

     4.6.6. PAINT statement

 

 

      Used to color parts of the screen in one color.

 

      Format:

              PAINT [@] (< ARG 1>, < ARG 2>) [, < ARG 3>] [, < ARG 4>] STEP
                    

 

      < ARG1 > :: = WHOLE  EXPRESSION ASKING TO THE  COORDINATE 

                X INITIAL POINT;

 

      < ARG 2 > :: = WHOLE  EXPRESSION ASKING TO THE  COORDINATE 

                Y INITIAL POINT;

 

      < ARG 3 > :: = WHOLE EXPRESSION, GIVING A COLOR NUMBER ; 

                NUMBER FROM INTERVAL [0.8] ;

 

      < ARG 4 > :: = WHOLE EXPRESSION DEFINING THE COLOR OF THE BORDER 

                TARGETED AREA; NUMBER FROM INTERVAL [0.8] ;
              

 

      STEP (@) - THE COORDINATES OF THE INDICATED POINT ARE COUNTED

                 RELATED TO THE LAST POINT PROCESSED BY
                 GRAPHIC OPERATORS.

 

      This operator is intended for coloring part of the screen in the
specified color. If ARGUMENT 3 is omitted, then the area is painted with the
current color defined by the COLOR operator . If ARGUMENT 4 is
omitted, then an area is taken with the border color shading.

      The point at which staining begins can be any
interior point of the area.

      The boundaries of the region must be clearly delineated, otherwise there will be an exit outside the region. The operator does not perform any actions outside the screen .

      It should be noted that outlines of the region are accepted
not only with the color specified by ARGUMENT 4, but also with the fill color
, therefore, if there is a
closed outline with the fill color inside the area to be painted, then it will remain
unpainted.


- 56 -

 

                       U1.00031-01 35 01

 

 

 

      If the color numbers are out of range,
an error message 5 is issued.

 

      Example:

              100 DRAW A¤

              110 PAINT (105.22), 3

 

 

 

     4 .6.7. DRAW statement

 

 

 

      Executes lines of graphic commands.

 

      Format:

              DRAW < SYMBOLIC EXPRESSION >

 

      < SYMBOLIC EXPRESSION > :: = LINE CONTAINING GRAPHIC
                                COMMANDS.

 

      The operator makes it possible to conveniently manage the graphics. To
do this, there are commands "graphic language", passed to the
operator DRAW through a string of characters. Substring calls with
commands are possible , which frees you from string length restrictions (255
characters).

      The DRAW statement command consists of a letter identifying the
command, followed by arguments. The argument can be an
integer constant from the interval [0.32767] or a call to a variable
(indexed variable):

 

               = < NUMERIC VARIABLE NAME > ;

 

      The value of the variable must be in the range [-32768,32767].

      The screen displays only those argument values
that correspond to the X   and  Y coordinates of the    points in the intervals [0.639] and [0.263], respectively. You can use spaces or semicolons ";" as separators between commands, but they may not be.


      The following DRAW statement commands are available :

 

      U [< LENGTH >]   plotting up from the current point;

      D [< LENGTH >]   down;

      L [< LENGTH >] to the   left;

      R [< LENGTH >] to the   right;

      E [< LENGTH >]   in the upper right corner;

      F [< LENGTH >]   to the lower right corner;

      G [< LENGTH >]   in the lower left corner;

      H [< LENGTH >]   in the upper left corner.

 

      In a graphical representation (all angles are 45 degrees):

 

              Hue

              \ | | /

              L - + - R

               / | \

              Gdf


                              - 5 7 -

 

                       U1.00031-01 35 01

 

 

      To draw with the coordinates of the points, use
the M command .

 

      M [±] < ARG1 >, [±] < ARG1 >

 

 

      The command draws from the current point to the point with coordinates
( < ARG1 >, < ARG2 >) . If the sign "+" or
"-" is indicated before the first argument , then the coordinates are calculated relative to the coordinates of the current
point. The sign before the second argument does not affect this mode. The M
command has a semicolon ";" after the name of a numeric variable in the first argument does not replace the comma.

      There are commands used immediately before the
listed commands that change their action:

 

      B - indicates that the team should move the
          current point, but not draw;

 

      N - after the command is executed, the           former coordinates of the current point are returned .

 

      The following commands change the mode for all subsequent commands
in all subsequent DRAW statements  , excluding the M command    with
absolute coordinates.

 

      A [< TURN >] changes the drawing direction, the
                   values ​​of the argument mean:

                     0 - normal orientation (accepted
                         by default);

                     1 - 90 degrees clockwise;

                     2 - 180 degrees clockwise;

                     3 - 270 degrees clockwise;

 

      S [< ZOOM >] allows you to change the plotting scale;

                   the argument must be within [1,639].  The default                    value is 4. The value 0 also indicates the                    absence of scaling,                    i.e. value 4. The value of the argument is   divided by the DRAW                    operator by 4 and multiplied                    by the arguments of the drawing commands. Thus                    , S 1 means a 4-fold decrease , S 12 - 3-fold increase.
                  






                  

 

      To change the color, there is a C command :

 

      C [< COLOR >] sets the new drawing color, the number of which is
                indicated by the argument and must be
                within [0.8] .

 

      To enable substrings, use the X command :

 

      X < CHARACTER VARIABLE NAME > ;

 

      The variable is interpreted as a substring containing
graphic commands.

 

      The DRAW operator is convenient for drawing various shapes, creating



                              - 58 -

 

                       U1.00031-01 35 01

 

 

fonts and libraries of drawing elements with their subsequent
layout using the X command , placing them anywhere,
direction and scale. Violation of the limits of arguments or
incorrect writing of commands causes error 5.

 

      An example :

              10 A% = 100

              20 B% = 150

              30 A¤ = "E10F10D20L20U20R20"

              40 DRAW " BM = A% ;, 100X = A¤; BM = B% ;, 100S2X = A¤;"

 

 

 

       4 .7. Sound control operator

 

 

 

 

 

     4.7.1. BEEP statement

 

 

 

      The operator emits a short beep.

 

      Format:

              Beep

 

      This operator is used to give a short beep
. The same signal is issued by the system in case of an error.

 

      An example :

              100 FOR I = 1 TO 10

              110 BEEP

              120 NEXT

              130 INPUT MONTH NUMBER ; MN

              140 IF MN> 12 OR MN <1 THEN 100

              150 PRINT MONTH¤ (MN)


                              - 5 9 -

 

                       U1.00031-01 35 01

 

 

       4 .8. Program Trace Operators

 

 

 

 

 

     4.8.1. TRON statement

 

 

 

      Starts tracing line numbers.

 

      Format:

              TRON

 

      In trace mode, the number of each line of the
program being executed is displayed in the format [ NNN ] . The only way to
stop the output of line numbers is to restart the computer or
execute the  TROFF statement . The RUN command    does not cancel
the TRON statement .

      This mode helps to monitor the execution of complex programs, to
establish which of the program branches is being executed.

 

 

 

     4.8.2. operator TROFF

 

 

 

      The operator turns off    the trace mode that the TRON operator has   enabled
.

 

      Format:

              Troff

 

      Example:

              ...

              249 TRON

              250 ...

              ...

              300 ...

              301 TROFF

              ...

              RUN

              [250] [260] [270] [280] [290] [300]

              Ok


                              - 60 -

 

                       U1.00031-01 35 01

 

 

                            5 . FUNCTIONS

 

 

 

 

      Language  BASIC allows you to use the device's features.
Distinguish between standard functions that are predefined in the
system, and internal, which defines the user himself. The standard ones, in turn, are divided into numeric, designed to work with numeric values, and character, designed to act on character strings.


 

 

 

       5.1. Numeric functions

 

 

 

      The results of all numerical functions are single precision numbers.

 

 

 

     5.1.1. SQR function

 

 

      The result of the function is the square root.

 

      Format:

              X = SQR (< ARGUMENT >)

 

      < ARGUMENT > :: = ARITHMETIC EXPRESSION ACCEPTING

                    NON-NEGATIVE VALUES.

 

      The function calculates the square root. Attempting to access
this function with a negative argument value will result in
error 5.

 

      Example:

              PRINT SQR (3)

               1.732051

              Ok

 

 

 

     5.1.2. SIN function

 

 

 

      The function calculates the sine of the angle specified in radians.

 

      Format:

              X = SIN (< arithmetic expression >)

 

      This function calculates the sine of the angle given in radians. In
order to convert degrees to radians, you can use the
conversion X = X * PI / 180 .


                              - 6 1 -

 

                       U1.00031-01 35 01

 

 

      Example:

              PRINT SIN (PI / 2)

               one

              Ok

 

 

 

     5.1. 3 . COS function

 

 

      The function calculates the cosine of the angle specified in radians.

 

      Format:

              X = COS (< arithmetic expression >)

 

      Example:

              PRINT COS (0)

               one

              Ok

 

 

 

     5.1. 4 . Tan function

 

 

 

      The function calculates the tangent of the angle specified in radians.

 

      Format:

              X = TAN (< arithmetic expression >)

 

      Example:

              100 PRINT " DISTANCE = " ; S ; " ANGLE = "; A

              110 PRINT " HEIGHT =" ; S * TAN (A)

 

 

 

     5 .1.5. ATN function

 

 

      Used to calculate the arc tangent (in radians).

 

      Format:

              X = ATN (< arithmetic expression >)

 

      This function calculates the arc tangent of an expression. The result of the
function is indicated in radians and is between PI / 2 and - PI / 2 .

 

      Example:

              PRINT ATN (1) * 4

               3.141593

              Ok


                              - 62 -

 

                       U1.00031-01 35 01

 

 

     5.1.6. PI function

 

 

 

      The result of the function is the number "PI".

 

      Format:

              X = PI

 

      This function is used to indicate the number "PI".

 

      Examples :

               PRINT PI

                3.141593

               Ok

               PRINT SIN (PI / 2)

                one

               Ok

 

 

 

     5.1.7. EXP function

 

 

      The result of the function is E to the specified degree.

 

      Format:

              X = EXP (< ARGUMENT >)

 

      < ARGUMENT > :: = ARITHMETIC EXPRESSION ACCEPTING

                    INTERVAL VALUES

                    [-88.499999999999992.88.029685974121093].

 

      The function will raise  E ( E = 2.7182818284590) to the
specified degree. It is mainly used for scientific
calculations. This function is the inverse of the LOG () function ,
which calculates the natural logarithms (with base E ) , therefore X = EXP ( LOG ( X )).

 

 

      Violation of the specified boundaries causes error 6.

 

      Example:

              PRINT EXP (LOG (3))

               2.999999

              Ok


                              - 63 -

 

                       U1.00031-01 35 01

 

 

     5.1.8. LOG function

 

 

 

      The result of the function is the natural logarithm.

 

      Format:

              X = LOG (< ARGUMENT >)

 

      < ARGUMENT > :: = ARITHMETIC EXPRESSION TAKING
                    POSITIVE VALUES.

 

      The function is used to calculate the natural logarithm.
Applying a function to an argument that has a negative or
zero value causes error 5.

      LOG () can be used to calculate the logarithm with any
base. For example, to calculate the logarithms with base 10,
you can use the formula: LG ( X ) = LOG ( X ) / LOG (10).

 

      Example:

              PRINT LOG (EXP (1))

               .999999

              Ok

 

 

 

     5.1.9. ABS function

 

 

      The result of the function is the absolute value of the argument.

 

      Format:

              X = ABS (< arithmetic expression >)

 

      The result of the function is the value of the argument with a
positive sign.

 

      An example :

              X = -1 / 3

              Ok

              PRINT ABS (X * 2) + 2

               2.666666

              Ok

 

 

 

    5.1.10. FIX function

 

 

      The result of the function is the integer part of the argument.

 

      Format:

              X = FIX (< arithmetic expression >)

 

      The function discards the fractional part of the argument. For
positive arguments, FIX () and INT () are identical,
but for negative argument values, the results of these functions
are different (see INT ()).


                              - 64 -

 

                       U1.00031-01 35 01

 

 

      An example :

              PRINT FIX (-5.3)

               -five

              Ok

              PRINT FIX (6.25)

               6

              Ok

              IF X / N = FIX (X / N) THEN PRINT "X DIVIDED BY N"

              Ok

 

 

 

    5.1.11. INT function

 

 

      The result of the function is an integer value less than the argument.

 

      Format:

              X = INT ( < arithmetic expression > )

 

      The function returns the  value of the nearest integer not
exceeding the argument. The INT () function is similar to FIX () , but,
unlike INT ( ) FIX ( )   simply discards the fractional part of the argument. Differences between functions occur with negative arguments. For the described function, the expressions  X = ABS ( INT ( Z ))   and

X = ABS ( INT ( - Z )) for real Z will give different results.

 

      Example:

              IF ABS (INT (Z)) = ABS (INT (-Z)) THEN PRINT "Z- WHOLE "

              Ok

              PRINT INT (-5.3), FIX (-5.3)

               -6 -5

              Ok

 

 

 

    5 .1.12. SGN function

 

 

 

      The result of the function is minus 1, 0, or 1, depending on the
sign of the argument.

 

      Format:

              X = SGN ( < arithmetic expression > )

 

      The SGN () function is called the sign function. This function gives the
following results:

 

        - if ARGUMENT <0 , the result is minus 1;

 

        - if ARGUMENT = 0 , the result is 0 ;

 

        - if ARGUMENT > 0 , the result is + 1 .

 

      Function can be used, for example, when you want, without
the operator IF assign a variable number 0 only when the
other variable has a value of 0.


                              - 6 5 -

 

                       U1.00031-01 35 01

 

 

      An example :

              100 INPUT A

              110 PRINT B * SGN (A)

 

 

 

    5 .1.13. RND function

 

 

 

      The result of the RND function is a random number from the interval [0,1] .

 

      Format:

              X = RND ( < arithmetic expression > )

 

      The function is used to obtain pseudorandom numbers
having a uniform distribution on the interval [0,1].  It is convenient to
use when creating game programs.

      The values ​​returned by the function depend on the sign of the argument:

        - if the argument value is positive, then the result of RND ()   is the next value from the sequence of           pseudorandom numbers. The sequence itself depends           on the initial value;
         

        - if the argument is negative, then the initial
          value of the sequence of pseudorandom numbers changes .
          Each negative value of the argument corresponds to
          one sequence, and it does not depend on the
          order of the argument;

        - if the argument's zero value is used, then the
          result of the function is the same as in the previous call to
          it.

 

      An example :

              PRINT RND (1), RND (-5), RND (-50)

               .4709943

               .5336828

               .5336828

              Ok

              PRINT RND (3), RND (0)

               .6054241

               .6054241

              Ok

 

 

 

    5.1.14. FRE function

 

 

      Indicates how much free computer memory is left for
the user program.

 

      Format:

              X = FRE [(< ARGUMENT >)]

 

      < ARGUMENT > :: = SYMBOL OR ARITHMETIC EXPRESSION
                    (ITS TYPE IS IMPORTANT, NOT THE VALUE).

 

      If the argument is a number or is absent, then


                              - 6 6 -

 

                       U1.00031-01 35 01

 

 

the amount of memory allocated for the user program is issued.
If the argument is of a character type, then the free amount of
memory allocated for character variables is issued (see section 4.2.3). Thus
, the function is completely independent of the value of the argument,
only its type is important. On the other hand, when accessing the function, the
value of the expression is still calculated, and, in case of
an error (for example, overflow), further
execution of the program stops.

 

      Example:

              PRINT FRE (""), FRE (0)

               200 11000

 

 

 

       5.2. Type conversion functions

 

 

 

 

 

     5.2.1. Cint function

 

 

      The function converts the value type of an arithmetic expression to
a whole.

 

      Format:

              X = CINT (< ARGUMENT >)

 

      < ARGUMENT > :: = ARITHMETIC EXPRESSION ACCEPTING

                    VALUES FROM THE INTERVAL [-32768,32767].

 

      The function discards the fractional part of the arithmetic expression in the
same way as the FIX () function does . If the value goes
beyond the 16-bit integer  [-32768,32767] ,
an overflow error is generated . The function is used by default when the
value of an arithmetic expression is assigned to an integer variable
.

 

      Example:

              PRINT CINT (5.93), CINT (-6.352)

               5 -6

              Ok


                              - 67 -

 

                       U 1.00031-01 35 01

 

 

     5.2.2. CSNG function

 

 

      The function converts the argument to a single precision number,

rounding it up.

 

      Format:

              The X = CSng (< arithmetic expression >)

 

      The function is used to convert the value of an
arithmetic expression into a real    number of single
precision. It is used by default when
assigning a value to a single precision variable. It’s convenient to use the function
when temporarily you need a single precision value,

for example, for printing.

 

      Example:

              PRINT CSNG (PI)

               3.141593

              Ok

 

 

 

     5 .2.3. CDBL function

 

 

      The function converts the result of an arithmetic expression into
a double precision number.

 

      Format:

              The X = CSng (< arithmetic expression >)

 

      The function is designed to convert the values ​​of
arithmetic expressions into double precision numbers, i.e. with a
mantissa of 17 decimal digits. This function is used by
default when assigning a variable to double
precision.

 

      Example:

              PRINT CDBL (2/3)

               .6666667

              Ok


                              - 68 -

 

                       U 1.00031-01 35 01

 

 

       5.3. Memory access functions

 

     5.3.1. Peek function

 

 

      Allows you to read the contents of any memory location.

 

      Format:

              X = PEEK (< ARGUMENT >)

 

      < ARGUMENT > :: = WHOLE EXPRESSION, GIVING THE CELL ADDRESS.

 

      This function allows you to explore any specific
memory location in the address space. With its help, you can read
system variables of drivers and BASIC systems. Also, the PEEK function is convenient for entering data directly from the registers of external devices.

      The result of the function is an integer - the contents of the
memory word , the address of which is specified by the argument. The argument values ​​from
minus 32768 to minus 1 denote addresses from 32768 to 65535,
respectively.

 

      An example :

              PRINT PEEK (& O176), PEEK (& O200)

               100 120

              Ok

      ( coordinates of the graphic cursor are printed).

 

 

     5.3.2. INP function

 

 

 

      Allows reading data in random access memory by mask.

 

      Format:

              X = INP (< ADDRESS >, < MASK >)

 

      < ADDRESS > :: = WHOLE EXPRESSION INDICATING THE PHYSICAL                  ADDRESS OF THE RAM CELL
;

 

      < MASK > :: = WHOLE EXPRESSION INDICATING WHICH
                 BITS ARE COUNTED FROM THE CONTAINED CELL.

 

      Using the INP function,    you can directly read the contents of the memory cells in the same way as the PEEK function  
, and
only the necessary bits can be selected. The function gives a
result of an integer type in which bits corresponding to non-zero
bits of the mask are read from the specified cell, and the other bits are set
to 0.

 

      An example :

              POKE A%, & B10101

              Ok

              PRINT BIN¤ (INP (A%, & B11001))

              10001

              Ok


                              - 6 9 -

 

                       U 1.00031-01 35 01

 

 

      The function is convenient when working with registers of external devices.

 

      An example :

              10 OUT & O177560, & O100.0%

              20 IF INP (& O177560, & O200) THEN 30 ELSE 20

              30 A% = PEEK (& O177562)

              40 PRINT A%

              50 GOTO 20

 

      (the program prints the key codes of the keyboard).

 

 

 

       5.4. Character functions

 

 

 

 

 

     5.4.1. ASC function

 

 

      The function converts one byte of a character string to the code KOI-7.

 

      Format:

              X = ASC (< ARGUMENT >)

 

      < ARGUMENT > :: = NOT AN EMPTY SYMBOLIC EXPRESSION.

 

      This function processes the first byte of a character string.
The value of this function is given as an integer, which is the
code of the corresponding symbol according to the table KOI-7, given in
APPENDIX 3. Therefore, the result of the function belongs to the interval [0.255]. The inverse of the ASC () function is the CHR ¤ () function .   You can use the MID¤ function to get information about further bytes of a character string .


      If the argument is an empty string, then calling the function results in
error 5.

 

      An example :

              ZZ¤ = "ABC"

              Ok

              PRINT ASC¤ (ZZ¤)

               65

              Ok

              PRINT ASC (MID¤ (ZZ¤, 2))

               66

              Ok


                              - 70 -

 

                       U 1.00031-01 35 01

 

 

     5.4.2. CHR¤ function

 

 

 

      The function translates an integer (code KOI-7) into a character
string of one character.

 

      Format:

              X¤ = CHR¤ (< ARGUMENT >)

 

      < ARGUMENT > :: = WHOLE EXPRESSION TAKING VALUES

                    FROM THE INTERVAL [0.255].

 

      When a function is called, the value of the argument is treated as a code from
the KOI-7 table and converted into a character string of one
character corresponding to this code. Thus, CHR ¤ (65) and " A " are
identical. The function CHR ¤ () _ is the inverse of the function ASC () .
If X falls into the required range, and the variable  X ¤ consists
of one character, then it is always true:

 

              X = ASC (CHR¤ (X)) and X¤ = CHR¤ (ASC (X¤)).

 

      If the argument value is outside the specified
interval, then error 5 is fixed.

      The considered function can also be used when working with
multibyte strings, for example:

 

              10 OTVET¤ = ""

              20 FOR I = 1 TO 3

              30 PRINT " SPECIFY THE NUMBER "; I ; " ANSWERS "

              40 INPUT NOMER

              50 OTVET¤ = OTVET¤ + CHR¤ (NOMER)

              60 NEXT

              70 PRINT " ANSWERS = "; OTVET¤

 

      For multi-byte strings, you can also use the MID функцию function . Note that there are characters that can only be entered into a string using the CHR функции function , for example:

 

              10 PRINT CHR¤ (7);

 

      (a beep sounds).

 

 

 

     5.4.3. LEN function

 

 

 

      The result of the function is the length of the character string.

 

      Format:

              X = LEN (< SYMBOLIC EXPRESSION >)

 

      The LEN () function counts the number of characters in a string and
can give any number from 0 (if the string is empty) to 255 (if the
string is the longest). This function allows you to find out the
length of a variable before it is processed. Application of some functions
 


                              - 7 1 -

 

                       U 1.00031-01 35 01

 

 

for "empty" character variables can lead to an error, and
using the LEN function avoids this, for example:

 

              IF LEN (A¤)> 0 THEN T¤ = MID¤ (A¤, 1,1)

 

      An example :

              100 IF LEN (S¤)> 32-POS THEN PRINT CHR¤ (10);

              110 PRINT S¤

 

 

 

     5.4.4. MID¤ function

 

 

 

      The function selects or replaces part of a character variable.

 

      Format:

              X ¤ = MID ¤ (< ARG1 >, < ARG2 > [, < AGG3 >])

      or

              MID ¤ (< ARG4 >, < ARG2 > [, < ARG3 >]) =

      = < SYMBOLIC EXPRESSION >

 

      < ARG1 > :: = SYMBOLIC EXPRESSION;

 

      < ARG2 > :: = WHOLE EXPRESSION TAKING VALUES FROM
                1 TO 255 ​​AND DETERMINING THE NUMBER                 OF SYMBOL FROM WHICH THE PART OF THE SYMBOL STRING
                USED ​​IN
THE OPERATION BEGINS;

 

      < ARG3 > :: = WHOLE EXPRESSION
                TAKING                 NON-NEGATIVE VALUES AND DETERMINING THE NUMBER OF SYMBOLS
PARTICIPATING IN THE OPERATION;

 

      < ARG4 > :: = SYMBOL VARIABLE.

 

      The MID ¤ function allows you to select part of a character variable.
This is the only function that can occur on both
sides of the equal sign.

      In the first version, MID ¤ is used to select a substring from the
result of the symbolic expression  < ARG1 > , starting from the character
indicated by the second argument, and as many characters as are specified by the third argument are selected
.

      The value of the second argument must not exceed the length of the
character expression specified by the first argument . If the third
argument is not specified or is beyond the bounds of the string, then the
part of the character string from the character specified by the second argument to the end is selected
.

      Note that the substring allocated by the MID функцией function is placed in
the memory area reserved for symbol variables.

      In the second variant, when the MID ¤ () function is located on the left
side of the equal sign, additional memory from the area
reserved for symbolic variables is not used. In this
case, the processed symbol data is assigned to a symbol
variable whose value is already in the specified area. In
this case, the arguments < ARG2 > and < ARG3 > indicate the variable location
in the symbol variable and must meet the same
requirements as in the first case.


                              - 7 2 -

 

                       U 1.00031-01 35 01

 

 

      An example :

              100 A¤ = " FILE FIRST "

              110 A1¤ = STRING¤ (20, "")

              120 MID¤ (A1¤, 1) = MID¤ (A¤, 6)

              130 MID¤ (A1¤, 7) = MID¤ (A¤, 1,4)

              140 PRINT A1¤

              RUN

              FIRST FILE

              Ok

 

 

 

     5.4.5. STRING¤ function

 

 

 

      The function initializes a character variable.

 

      Format:

              X ¤ = STRING ¤ (< ARGUMENT1 >, < ARGUMENT2 >)

                                     < ARGUMENT3 >

 

      < ARGUMENT1 > :: = THE WHOLE EXPRESSION TAKING VALUES
                     FROM 0 TO 255 ​​AND DETERMINING
                     THE LENGTH OF THE CREATED SYMBOL LINE;

 

      < ARGUMENT2 > :: = WHOLE EXPRESSION TAKING VALUES
                     FROM 0 TO 255 , CORRESPONDING TO
                     KOI-7                      CODE WHICH IS FILLED WITH THE NEW
SYMBOL LINE;

 

      < ARGUMENT3 > :: = SYMBOL EXPRESSION, THE FIRST CHARACTER
                     OF WHICH IS FILLED WITH THE NEW SYMBOL
                     LINE.

 

      The purpose of the STRING ¤ () function  is to create a
character variable of any length containing the same characters.
You can define this symbol either by specifying it in the KOI-7
code table (see APPENDIX 3), or by specifying the desired character using a
symbol expression, in particular a text constant. The second argument type of the STRING function  ¤ indicates which way the character is determined by which the character variable is initialized . For example, the expressions STRING ¤ (41.32) and  STRING ¤ (41, "") produce the same result.



      Error 5 will be fixed if one of the numerical
parameters goes beyond the interval   [0.255].   If the
character string length you specify is 0, an empty string will be created
despite the initial character.

 

      An example :

              PRINT NAZV¤; STRING¤ (50-LEN (NAZV¤), "."); Nom


                              - 73 -

 

                       U 1.00031-01 35 01

 

 

      5.4.6. VAL function

 

 

 

      The result of the function is the numerical equivalent of the part of the symbol
variable containing numbers.

 

      Format:

              X = VAL (< CHARACTER EXPRESSION >)

 

      The function is applied to a character expression that
supposedly contains a real number written in the
KOI-7 codes. This number may include a sign, a decimal point, and an
order. The VAL ()  function  gives a double
precision value . The result of a character expression is scanned from
left to right to an invalid code number. If the first character of the
string cannot be attributed to a number, then the result will be zero.
For example, the result of VAL (" A 12:") is 0, but VAL ("23 A 12:") is the number
23.

      The VAL function is the inverse of the STR ¤ () function .

 

      An example :

              PRINT VAL (MID¤ ("A12:", 2))

               12

              Ok

 

 

 

     5.4.7. INKEY function¤

 

 

 

      Gives a single character entered from the keyboard.

 

      Format:

              X¤ = INKEY¤

 

      This function reads a character from the keyboard input buffer. If
no character was entered, then  INKEY ¤ returns   an empty
character string (""). If a character has been entered, it is read
from the buffer and issued through INKEY ¤. After accessing this function, the
buffer is cleared, so you need to take care of saving the result.

      This function can be applied everywhere as a character
string. It is necessary to pay attention to the fact that the result of the function
may be an empty string, which in some cases causes an error.
This function is the main way to read key codes.

      The advantages of this function are that it does not repeat
reading the key code, and also does not wait for a character if no
key has been pressed, which provides a non-interactive
keyboard input mode , used, for example, in the INPUT statement  . INKEY ¤ can read not only alphanumeric key codes. Counting does not echo on the screen.

 

      An example :

              10 CH¤ = INKEY¤

              20 IF CH¤ = "" THEN 10

              30 PRINT ASC (CH¤);

              40 GOTO 10


                              - 74 -

 

                       U 1.00031-01 35 01

 

 

      (the program prints the key codes).

 

 

 

     5.4.8. STR function ¤

 

 

 

      Turns numerical data into a string in KOI-7 code.

 

      Format:

              X ¤ = STR ¤ (< arithmetic expression >)

 

      This function translates numbers into a string of characters in the same way
as the PRINT operator . The numerical expression is calculated as usual, and the
result is "printed" into a new temporary line in the string area,
which is the result of the STR ¤ function . (Do not confuse STR ¤ () with the STRING ¤ ()
function ). For example, if  N = 1/3 then  STR ¤ ( N will give the string ".33333333333333333" and each number 3 is actually a character defined as "3" (octal code 63).

      This function is inverse to the VAL function  . For example, the
result of VAL ( STR ¤ ( N )) will be N , and  STR ¤ ( VAL ( NM ¤))  will be the string NM ¤ if NM ¤ contains a real number.

      The function is convenient for formatting numerical data before
displaying it, for composing numbers into text. The function differs from the PRINT operator in that it does not produce a space at the end of the line.

 

      An example :

              A = 123

              Ok

              PRINT MID¤ (STR¤ (A), LEN (STR¤ (A)) - 1)

              23

              Ok

 

 

 

     5 .4.9. BIN function

 

 

 

      Converts integers to binary format characters.

 

      Format:

              X ¤ = BIN ¤ (< WHOLE EXPRESSION >)

 

      The result of the expression is converted to an integer type and turns into a
character string representing its binary code. For example, an
argument with a value of 3 will give the result "11", that is, a string of two
characters "1" (octal code 61). The function does not
generate characters or spaces , insignificant zeros before the number are not processed.
The maximum string length of the result of the BIN ¤ () function  is 16
bytes. Mainly BIN ¤ () is used to print the binary
representation of numbers.

      Example:

              PRINT BIN¤ (44)

              101100

              Ok


                              - 75 -

 

                       U 1.00031-01 35 01

 

 

    5 .4.10. OCT function¤

 

 

 

      Converts an integer to a character string in octal
representation.

 

      Format:

              X ¤ = OCT ¤ (< WHOLE EXPRESSION >)

 

      The value of the argument is converted to an integer type, the
result is converted to a string of characters in accordance with its
value in the octal number system, similar to the BIN ¤ function . No spaces are created; insignificant zeros are discarded. Thus , argument 12 gives the result “14”, that is, a string of two characters “1” and “4” (octal codes KOI-7 are 61 and 64, respectively). The maximum length of a string obtained with OCT ¤ is six characters.




      The function is used to print the octal representation of
numbers.

 

      Example:

              PRINT OCT¤ (& HFFFF)

              177777

              Ok

 

 

 

    5.4.11. HEX function ¤

 

 

 

      Converts a numeric argument to a character string in
hexadecimal notation.

 

      Format:

              X ¤ = HEX ¤ (< WHOLE EXPRESSION >)

 

      The HEX function ¤ translates the argument value into an integer type and turns the result into a character string, the bytes of which represent the argument value, presented in hexadecimal format. Sign and spaces are not generated, insignificant zeros are discarded. This means that argument 43 gives the result "2 B ", in other words, a two-character string with octal codes KOI-7 62 and 102. It follows that the maximum length of the value of the HEX ¤ () function is 4 bytes.






      The function is used to print the hexadecimal
representation of a number.

 

      An example :

              PRINT HEX¤ (& H1A)

              1A

              Ok


                              - 76 -

 

                       U 1.00031-01 35 01

 

 

       5 .5. Auxiliary I / O Functions

 

 

 

 

 

     5.5.1. CSRLIN Function

 

 

 

      The result of the function is the line number of the screen on which the
cursor is located.

 

      Format:

              X = CSRLIN [ (< ARITHMETIC EXPRESSION >) ]

 

      The result of the function is an integer type indicating
which line of the screen the cursor is on. The top line is
number 0, the bottom is 23. The arithmetic
expression enclosed in brackets is not used, although it is calculated, which can
lead to an error.

      CSRLIN together with the POS function    is used to determine the
place on the screen where the information will be displayed. The LOCATE operator can change the location of the cursor.

 

      Example:

              ? CSRLIN

               ten

              Ok

      (the result of the example depends on the location of the cursor ) .

 

 

 

     5.5.2. POS function

 

 

 

      The function gives the cursor position in the print line ( column number
).

 

      Format:

              X = POS [(< Arithmetic Expression >)]

 

      The function allows you to get the number of the column in which the
cursor is located. This function, together with  CSRLIN,   is used to
determine the position of the cursor. The value enclosed in brackets of the
arithmetic expression, although it is calculated, is not used by the function
.

 

      An example :

              1000 X = POS

              1010 Y = CSRLIN

              1020 LOCATE X1, Y1

              1030 GOSUB 2000

              1040 STOP

              2000 LOCATE X, Y

              2100 RETURN


                              - 77 -

 

                       U 1.00031-01 35 01

 

 

     5.5.3. LPOS function

 

 

 

      Gives the position of the head of the printing device.

 

      Format:

              X = LPOS [(< Arithmetic Expression >)]

      The LPOS function   displays the value of the head position counter for the
printer. The first position is numbered 1. Each
printed character increases   the counter value, switching to a
new line clears it by assigning a value 1. The action of the function is
reliable only when displaying text, since the BASIC system does not
control control characters that can affect the
head position.

      The LPOS () function can be used when printing data in
columns.

 

      An example :

              250 IF LPOS> 20 THEN LPRINT

              260 LPRINT TAB (20); A

 

 

 

     5.5.4. EOF function

 

 

 

      Checks for the end of the file.

 

      Format:

              X = EOF

 

      The function checks whether the next    character that has not yet been entered
by the INPUT # operator   is equal to the end-of-file pointer "SU / Z "
(octal code 32). If not, the value 1 ( TRUE ) is returned ; otherwise, 0  ( FALSE ) . If the buffer turns out to be empty when accessing the EOF function , the next block of the file is entered .


      Since reading the end-of-file label causes an error of 55, it is
advisable to   check the end of file before using each  INPUT # using the EOF function . The function gives a logical result, so it is convenient to use it in the  IF statement . If the file is not open, error message 59 is displayed. If the output file is open, then accessing the EOF results in error 52.



 

      An example :

              50 IF NOT EOF THEN 20

              60 CLOSE


                              - 78 -

 

                       U 1.00031-01 35 01

 

 

       5.6. PRINT Operator Functions

 

 

 

     5.6.1. AT function

 

 

 

      The function allows you to organize data output by the PRINT operator
from an arbitrary position on the screen.

 

      Format:

              PRINT AT (< ARGUMENT1 >, < ARGUMENT2 >)

 

      < ARGUMENT1 > :: = WHOLE EXPRESSION
                     WHICH VALUE IS INDICATED BY THE SCREEN COLUMN, FROM WHICH THE
                     DATA WILL BE DISPLAYED;
                     NUMBER FROM INTERVAL [0.255] ;

 

      < ARGUMENT2 > :: = WHOLE EXPRESSION                      WHICH VALUE
IS INDICATED BY A SCREEN LINE;

                     NUMBER FROM THE INTERVAL [0.240].

 

      The actions of the AT ()  function are  similar to those of the LOCATE statement . The difference is that using  AT (),  you can display text in arbitrary places on the screen with a single PRINT statement The value of the first argument specifies the column of the screen, and the value of the second is the string. This sets the position on the screen from which the output of subsequent data begins. Columns of the screen are numbered from 0 to 63 from left to right, lines from 0 to 23 from top to bottom. If the value of the first argument exceeds 63, then column counting continues from the beginning of the same line. Similar actions occur with strings.








      If the argument values ​​are out of range,
an error message 5 is issued.

 

      An example :

        PRINT AT (15.14); "A"

        Ok

        PRINT AT (15.38); "C"

        Ok

 

 

 

     5.6.2. TAB function

 

 

 

      The function helps organize the construction of columns in PRINT
statements .

 

      Format:

              PRINT TAB (< ARGUMENT >)

 

      < ARGUMENT > :: = THE WHOLE EXPRESSION INDICATING THE POSITION NUMBER
                    WITH WHICH THE                     CONCLUSION SHOULD CONTINUE ; NUMBER FROM THE INTERVAL [0.255].


                              - 7 9 -

 

                       U 1.00031-01 35 01

 

 

 

 

      The TAB () function can also be used in the  LPRINT statement It
displays spaces until a column with a
number equal to the value of the argument is reached . If the cursor is at a
position with a higher number than the argument value, then  TAB () is
ignored.

      Screen line items are numbered from 0 to 63 from left to right.
If the argument value exceeds 63, then the column counting
continues on the same line, i.e., TAB (1) coincides with TAB (65) .

      If the value of the argument is outside the permissible limits, then
error 5 is fixed.

 

      An example :

              100 CW = 8

              110 PRINT A; TAB (CW); B; TAB (2 * CW); C; TAB (3 * CW); D

 

 

 

     5.6.3. SPC function

 

 

 

      The PRINT statement displays spaces.

 

      Format:

              PRINT SPC (< ARGUMENT >)

 

      < ARGUMENT > :: = THE WHOLE EXPRESSION MEANING THE NUMBER
                    OF
                    SPACES AND TAKING VALUES OUTSIDE [ 0,255 ].

 

      This function is used in the  PRINT and  LPRINT statements   to output the required number of spaces. It does not use a character area. 

      SPC () can be used to clear the screen ahead and
after the output from the "garbage" that may have remained after the
previous output.

 

      Example:

              220 ZZ = 8

              230 PRINT SPC (ZZ); AX; SPC (ZZ); BX; SPC (ZZ)


                              - 80 -

 

                       U 1.00031-01 35 01

 

 

       5 .7. User Defined Functions

 

 

 

 

 

     5.7.1. FN Functions

 

 

 

      Designate the place where user functions are called.

 

      Format:

              X = FN < NAME > [(< LIST >)]

 

      < NAME > :: = NAME OF FUNCTION DEFINED BY OPERATOR DEF FN ;

 

      < LIST > :: = ONE OR SEVERAL EXPRESSIONS
                  Separated by Commas.

 

      Functions of  the FN   - is a function defined by the BASIC system
user. A function must be defined using
the DEF FN statement before it is called. The expressions in the list are actual parameters and must match the list of formal parameters in the DEF FN statement in terms of number, location in the list and type . The actual parameter values ​​are inserted into the expression in the function definition, and the value of this expression is considered the result of the function.




      If errors occur in a function call, you should check its
definition, since errors are not checked in the DEF FN statement .

 

      An example :

              10 DEF FN LG (X) = LOG (X) / LOG (10)

              20 PRINT FNLG (100)

 

 

 

     5 .7.2. USR function

 

 

 

      Allows access to routines of machine language.

 

      Format:

              X = USR [< NUMBER >] (< ARGUMENT >)

 

      < NUMBER > :: = WHOLE CONSTANT FROM THE INTERVAL [0.9] , INDICATING
                 THE NUMBER OF THE CALLED FUNCTION; UMOL- IN
                 DEFAULT 0;

 

      < ARGUMENT > :: = EXPRESSION WHICH VALUE IS TRANSFERRED
                    TO USR .

 

      Before accessing a function, you must define it
using the DEF USR statement . At the same time, 10 different USR functions with numbers from 0 to 9 can be defined .

      Function calls are made using the JSR PC machine instruction  . The subroutine can be anywhere accessible.


                              - 8 1 -

 

                       U 1.00031-01 35 01

 

 

address space, including also
BASIC subroutines. It is possible to pass directly to the subroutine one
argument of any type and return a single value of the
same type. After transmission control subroutine in a general register
assignment R 5 is e, and  R 3   - type arguments. The type is encoded as follows: a unit in the 15th digit means a character string; information about other types is stored in the low byte and it matters:


 

              -1 is an integer argument,
               0 is a
                   double precision
               floating point number , 1 is a                    single precision floating point number
.

 

      In the case of a character string
, two words are passed as the value of the argument , the first of which stores the length, the
other the starting address of the string.

      At the top of the stack is the return address, followed by the
value of the argument. Thus, the   value SP +2 is stored  in R 5 . It is possible to return control to the calling program using the RTS PC instruction , having previously placed the result of the function in the cells indicated by the R 5 register . If the contents of these cells are not changed, the result will be the value of the argument.



      Using USR functions   allows you to expand the capabilities of the
BASIC system, to perform impossible or slow-moving actions in
it.

      Calling an undefined USR function results in error 5.

 

      An example :

              10 PRINT USR (0%)

              20 A% = USR2 (A%)


                              - 8 2 -

 

                       U 1.00031-01 35 01

 

 

                                                  ANNEX 1

 

 

 

                       ERROR MESSAGES

 

 

 

      The appendix contains error codes, their abbreviated names and
descriptions.

 

 

     1    NEXT without FOR

          NEXT was not preceded by FOR, or the variable used           in  FOR does not match the variable           used in NEXT .

 

 

     2 Syntax error

          Incorrect use of characters, for example, the number of
          opening brackets does not match the number of
          closing brackets , incorrect writing of statements or
          their components, a
          comma, etc.

 

 

     3    RETURN without GOSUB

          When RETURN   was
          executed , it was found that GOSUB was not executed .

 

 

     4 run out of DATA

          When executing the READ statement    , it was found that the
          list of DATA statements has been exhausted.

 

 

     5 Incorrect function call

          The error occurs in the following cases:

          - negative index;
          - invalid argument for LOG , SQR ;
          - incorrect argument values ​​for graphic
            and other operators;
          - USR function, undefined with DEFUSR , etc.

 

 

     6 overflow

          The result of the arithmetic operation is too large
          in absolute value and cannot be written
          in the format accepted for numbers in the BASIC
          system. (In case of too small values, the
          result is equal to zero and no errors are
          generated).

 

 

     7 memory overflow

          The program does not fit in memory, or
          too many nested FOR , GOSUB statements are used too many variables, too
         


                              - 8 3 -

 

                       U 1.00031-01 35 01

 

 

          a lot of memory is required for an array or a region of
          strings; the free region is too small for
          generating the code of directly executed
          operators .

 

 

     8    Undefined line number

          The GOTO, GOSUB, IF, RESTORE,  RENUM, AUTO, ON , or DELETE used number nonexistent line .
         

 

 

     9 Invalid index (outside)

          A reference to an array element with an index that
          goes beyond the dimension of the array, or an
          incorrect number of indices is specified.

 

 

    10 Redefining an array

          An array is defined by two DIM statements    ,
          or an array is defined by a DIM statement    after
          the default           dimension of 10 has been set for this array
.

 

 

    11 Division by zero

          The expression encountered division by zero,
          or zero was raised to a negative degree.

 

 

    12 Unable to execute

          Invalid statement in direct           execution mode
.

 

 

    13 Type error

          An attempt to assign a numerical
          value to a symbol variable   or vice versa; a function using a
          numeric argument is passed a character argument
          or vice versa.

 

 

    14 Not enough space for character variables

          Exceeded the amount of remaining memory that
          was allocated to the default character variable
          or CLEAR statement .

 

 

    15 Line too long

          An attempt was made to create a string longer
          than 255 characters.

 

 

    16 Undefined

 

 

    17 Continuation impossible

          An attempt was made to continue executing a
          program that:


                              - 8 4 -

 

                       U 1.00031-01 35 01

 

 

          1. It was interrupted due to an error;

          2. Has been changed;

          3. Does not exist.

 

 

    18 User function not defined

          An attempt to access the FN function before it is defined by
          the DEFFN operator .

 

 

    19 I / O device error

          It occurs when the input / output device.

 

 

    20 Undefined

 

 

    21 Undefined

 

 

    22 Undefined

 

 

    23 Undefined

 

 

    24 Missing operand

          The expression contains an operator without an operand,
          or there are no required           parameters in the operator (command)
.

 

 

    25 Input buffer overflow

          An attempt was made to enter a string longer
          than 255 characters.

 

 

    26-51 Not determined

 

 

    52 Invalid file number

          An operator or command refers to a file that
          is not open or opened for another purpose
          (not for writing or reading).

 

 

    53 Not defined

 

 

    54 File is already open

          The OPEN statement is  applied    to a file that is
          already open.

 

 

    55 End of file

          An attempt to read the end of file entry
          by the INPUT # statement    was performed after
          all the data from the file was entered, or applied


                              - 8 5 -

 

                       U 1.00031-01 35 01

 

 

          For an empty file. To avoid this error,
          to detect the end of the file, use function
          tion the EOF .

 

 

    56 Invalid file name

          The LOAD , SAVE, or OPEN statements   used the           wrong file name (the file name consists of           too many characters).

 

 

    57 String without number

          The command is directly executed in the program
          while downloading the KOI-7 file. Download is interrupted
          .

 

 

    58 Undefined

 

 

    59 File not open

          An I / O statement is applied to a file that has
          not been opened.

 

 

    60 Not determined

 

 

    61 Undefined

 

 

    62 Invalid device name

          An invalid device name was used
          (missing in this version of the language).


                              - 8 6 -

 

                       U 1.00031-01 35 01

 

 

                                                  APPENDIX 2

 

 

 

                LIST OF TEAMS, OPERATORS AND FUNCTIONS

 

 

 

 

 

 

      The application contains the commands, operators and functions of the BASIC
system (version 08.07.1987), grouped by purpose.

 

 

 

               Modification of program text in memory

 

 

 

   AUTO       Automatically numbers lines when entering              program text
.

 

   DELETE     Removes line groups from program text.

 

   NEW        Deletes the entire program and executes the CLEAR statement .
            

 

   LIST       Displays the program text on the screen.

 

   LLIST      Prints program text to a printing
             device. On the RMP.

 

   RENUM Renumber      lines of program text.

 

 

 

 

                Tape storage

 

 

 

   BLOAD Loads              binary codes from tape to RAM .    

 

   BSAVE Writes a block of memory to tape in              binary.    

 

   CLOAD      Loads the program from the cassette
             tape in the internal format of the BASIC system.

 

   CSAVE      Writes a tape program in
             internal format.

 

   LOAD Loads a program from tape     

             (KOI-7 format).


                              - 8 7 -

 

                       U 1.00031-01 35 01

 

   SAVE Writes the program to tape              (KOI-7 format).     

 

   MERGE      Loads a program (file in the KOI-7 format) from a
             cassette tape and combines it with the
             program in RAM.

 

   FILES Fictitious reading or searching for a file with the specified              name.    

 

 

 

                 Initializing System Variables

 

 

 

   CLEAR      Clears all variables, closes files, etc.
             It reserves memory for symbolic variables,
             determines the upper RAM address for BASIC.

 

   KEY        Overrides function keys.

 

   TRON      Turns on trace mode.

 

   TROFF     Turns off trace mode.

 

 

 

             Commands Affecting Program Execution

 

 

 

   CONT       Continues to execute the program after
             the STOP statement or the STOP key.

 

   RUN        Starts a program.

 

   SYSTEM     Enters machine monitor mode.

 

   < CU > A      Implements the step mode of              program execution
.

 

 

 

                   Defining system parameters

 

 

 

   CLEAR      Sets the size of the data area for
             character variables, clears all
             variable values , sets the upper              memory address
available to the system.

 

   DIM        Defines, reserves memory, and initializes
             arrays.

 

   DEF FN     Define custom functions.

 

   DEF USR    Defines the start addresses of user


                              - 88 -

 

                       U 1.00031-01 35 01

 

 

             machine routines functions.

 

 

 

               Operators that change the values ​​of variables

 

 

 

   FOR        The loop operator. Changes the value of a              loop variable
.

 

   LET        The main operator for assigning new values ​​to
             variables. The word LET is optional.

 

 

 

                           Numeric functions

 

 

 

   ABS () The    absolute value.

 

   ATN ()    Arc tangent. The result is given in radians.

 

   CDBL ()   Converts the result of an expression to a              double precision type
.

 

   CINT ()   Converting the result of an expression to an
             integer type.

 

   COS () The     cosine of the angle given in radians.

 

   CSNG ()   Converts the result of an expression to a              single precision type
.

 

   EXP ()    Raising an E to a power.

 

   FIX ()    Discards the fractional part of the argument.

 

   FRE ()    The result, depending on the type of argument, is FRE the        amount of free memory space (              arithmetic argument or absent) or free              memory space reserved for character variables (character argument).
  


           

 

   INT ()     Rounds the argument to an integer not
             exceeding the argument.

 

   LOG () The     natural logarithm.

 

   PI         The number of "PI".

 

   RND () A pseudo-random number.

 

   SGN ()    Sign function.

 

   SIN () The    sine of the angle given in radians.


                              - 89 -

 

                       U 1.00031-01 35 01

 

 

   SQR ()    Square root.

 

   TAN () The     tangent of the angle given in radians.

 

 

 

                         Character functions

 

 

 

   ASC ()    Converts a character to an ASCII numeric code .

 

   BIN ¤ ()   Converting an integer to a string
             containing a binary representation of a number.

 

   CHR ¤ () Converts an ASCII numeric code to a character.

 

   HEX ¤ () Converts an integer to a string
             containing a hexadecimal representation of a number.

 

   LEN () _   The current length of the character expression.

 

   MID ¤ ()    Selects a portion of a character expression.

 

   MID ¤ () = Assignment of the result of a character expression of a
             part of a character variable.

 

   OCT ¤ () Converting an integer to a string
             containing the octal representation of a number.

 

   SPC ()    Function included in the PRINT command . Displays the
             specified number of spaces.

 

   STRING ¤ () Forms a string of the repeating specified
             character.

 

   STR ¤ () Converts a number to a character string
             containing a number.

 

   TAB ()    Function included in the PRINT command . Displays
             spaces to the specified position.

 

   VAL ()     Converts a portion of a character variable
             containing numbers to a number.

 

 

 

            Program Control Operators

 

 

 

   END        Terminates program execution.

 

   FOR       Starts a loop.

 

   GOSUB      subroutine call.


                              - 90 -

 

                       U 1.00031-01 35 01

 

 

   GOTO      Go to a new line of the program.

 

   IF         Depending on the condition
             , one of the branches of the IF statement is executed .

 

   NEXT       Ends the loop started by the FOR statement .

 

   RETURN Ends the subroutine and returns              to the next statement after GOSUB .   

 

   ON         A select statement that performs an unconditional
             jump or calls routines,
             depending on the value of the expression.

 

   STOP       Temporarily pauses program execution
             and displays a message.

 

 

 

                Variable Initialization Operators

 

 

 

   DATA Defines a list of internal data.     

 

   READ       Entering data from DATA statements into variables.

 

   RESTORE Sets input from a specific DATA statement .  
            

 

 

 

                       Comment Operators

 

 

 

   REM        Operator for comment.

   '         All text in a line after this character is
             considered as a comment.

 

 

 

          Work with memory and registers of external devices

 

 

 

   INP ()     Read mask data.

 

   OUT Records mask data.      

 

   PEEK ()   Read data from memory.

 

   POKE Write data to memory.     

 

   USR ()    Calls a user-defined function routine
             in machine codes.


                              - 91 -

 

                       U 1.00031-01 35 01

 

 

                     Display screen control

 

 

 

   CLS       Screen cleaning.

 

   COLOR Toggles the background color and the current              letter color .    

 

   LOCATE Moves the cursor, highlighting or              extinguishing it.   

 

   PRINT      Displays data on the screen.

   ?

 

 

 

                    Cursor Control Functions

 

 

 

   AT ()     Function included in the PRINT command . Puts the
             cursor at an arbitrary position on the screen.

 

   CSRLIN () The line number on which the cursor is located. CSRLIN    The parameter is dummy.
  

 

 

   POS () The    number of the column on which the cursor is located. POS   The parameter is dummy.
      

 

   SPC ()    Function included in the PRINT command . Displays the
             specified number of spaces.

 

   TAB ()    Function included in the PRINT command . Displays
             spaces to the specified position.

 

 

 

                         Graphics Operators

 

 

 

   CIRCLE Draws circles, ovals, arcs.   

 

   DRAW       Executes lines of graphic commands.

 

   LINE       Draws lines and rectangles.

 

   PAINT      Fills a closed area with any color.

 

   POINT ()   Gives the color number of the specified point on the screen.

 

   PRESET     Stains the specified point in the              background color
.

 

   PSET Stains the specified point in the specified              color.     


                              - 92 -

 

                       U 1.00031-01 35 01

 

 

                         Sound control

 

 

 

   BEEP       Beeps.

 

 

 

                      Work with data files

 

 

 

   CLOSE Ends input (output) operations              with a file in ML.    

 

   EOF        Functions for checking the end of the input              tape file
.

 

   INPUT #    Entering data from a tape file.

 

   OPEN       Initialization of data exchange with a file
             in ML for input (output).

 

   PRINT #     Output data to a tape file.

 

 

 

                       Keyboard control

 

 

 

   INKEY ¤    Result - the entered character or an
             empty string.

 

   INPUT      Enters a string of characters.

 

 

 

                  Output to a printing device

 

 

 

   PRINT Print data on a printing              device.    

 

 

 

 

                             Operations

 

 

 

   AND, OR, NOT, EQV, IMP, XOR

            Logical operations

   ^, *, /, +, -, MOD , \

            Binary arithmetic operations

   -, + Unary arithmetic operations


                              - 93 -

 

                       U 1.00031-01 35 01

 

 

   + Binary symbolic operation (concatenation)

 

   = , <>,> <, <,>, <=, = <, =>,> =

            Logical Relationship Operators


                              - 94 -

 

                       U 1.00031-01 35 01

 

 

                                                 APPENDIX 3

 

 

 

            TABLE OF CODES KOI-7 "ELECTRONICS MS 0511"

 

 

 

=================================================== =========
  0 1 2 3 4 5 6 7 8 9   A B C D E F =========================== ================================== 0 SBR PRO   0 @   P    '          STEP - YU P      TAB BEL ----- -------------------------------------------------- --- 1          !    1   A Q REP TO - - And I                                  ** -------------------------------------- -------------------- 2 "2   B R ISU З      #         Б Р                                  * ------------------- --------------------------------------- 3 GT!   # 3   C S С    -!        Ц C ------------------------------------------------- --------- 4      ! ¤ 4   D T BLR H = D T ------------------------------ ---------------------------- 5     -   % 5   E U GRAPH - - E U ---------- ------------------------------------------------ 6     - -   & 6   F V ZAP - !! F W --------------------------------------- ------------------- 7 ST - / 7   G W STIR =! GV ------------------ ---------------------------------------- 8 - - (8   H X                   =           X b ------------------------------------------------ ---------- 9     -) 9   I Y TAB SBR-     - AND S                                 ** ------------------------- --------------------------------- A ENTER! *   :   J Z GACH - = Y Z                                    CURSOR                                     * --- -------------------------------------------------- ----- B      ! +   ;   K    [32 / - -        K W                                     64 --------------------------------------- ------------------- C SBR      , <   L    \         RP INVS - = L Э ------------------- --------------------------------------- D SET - =   M    ]             INVE! = M SH TAB ** -------------------------------------------- -------------- E RUS      . >   N    ^             SET - - N H ** IND                                      * ------------------------------------- --------------------- F LAT /   ?   O _    ST. SUBCHANGE !! O ** ================================================ ============       

   


          


           


                

           

               

                   

               

  

           


               
















      


                              - 95 -

 

                       U 1.00031-01 35 01

 

 

      P_R_I_M_E_CH_A_N_I_E .   * - codes are transmitted from the
keyboard driver to the TV receiver driver, bypassing the external program. **
- codes are used only by the keyboard driver.


                              - 96 -

 

                       U 1.00031-01 35 01

 

 

                                                  APPENDIX 4

 

 

             RESERVED IN THE BASIC SYSTEM OF WORDS

 

 

 

      The words in the list are key words in the
BASIC system, so they cannot be used as
variable names . Next is the page where the word is described
.

 

 

       ABS 63 BEEP 58

       AND 15 BLOAD 23

       ASC 69 BSAVE 24

       AT 78 BIN¤ 74

       ATN 61

       AUTO 27

 

 

       CDBL 67 COLOR 48

       CHR¤ 70 CONT 19

       CINT 66                COS       61

       CIRCLE 54 CSAVE 22

       CLEAR 38 CSNG 67

       CLOAD 22 CSRLIN 76

       CLS 48 CLOSE 46

                                 SCREEN 49

 

 

       DELETE 26 ELSE 31

       DIM 37 END 35

       DRAW 56 EOF 77

       DATA 39 EXP 62

       Def 41

 

 

       FILES 22 GOSUB 29

       FIX 63 GOTO 29

       FOR 32

       FRE 65

 

 

       HEX¤ 75 IF 31

                                 IMP 68

                                 INKEY¤ 73

                                 INPUT 44

                                 INT 64

 

 

       KEY 37 LEN 70

                                 List 25

                                 LLIST

                                 LOAD 20

                                 LOCATE 50

                                 LOG 63

                                 LET       28


                              - 9 7 -

 

                       U 1.00031-01 35 01

 

 

                                 LPOS 77    

                                 LINE 53

 

 

       MID¤ 71 NEW 28

       MOD NEXT 32

       MERGE 21 NOT 44

 

 

       ON 33 PAINT 55

       OR 15 PEEK 68

       OUT 47 PI 62

       OPEN 45 POINT 52

       OCT¤ 75 POKE 46

                                 POS 76

                                 PRESET 52

                                 PRINT 43

                                 PSET 51

 

 

       REM 36 SAVE 21

       RENUM 26 SGN 64

       RETURN 30 SIN 60

       RND 65 SQR 60

       RUN 18 STEP

       READ 40 STOP 34

       RESTORE 40 STR¤ 74

                                 SYSTEM 20

                                 STRING¤ 72

                                 SPC 79

 

 

       TAB      78 VAL 73

       Tan 61

       THEN 31

       TO

       TROFF 59

       TRON 59

 

 

       XOR 15

 

 

      P_R_I_M_E_CH_A_N_I_E . In later versions of the BASIC system
, there may be more reserved words.


                              - 98 -

 

                       U 1.00031-01 35 01

 

 

  -------------------------------------------------- ----------------
! CHANGE REGISTRATION SHEET!
! ------------------------------------------------- -----------------!
! ! NUMBERS OF SHEETS (PAGES)! TOTAL ! ! INCOMING! ! !
! ! -------------------------! SHEETS!   N     ! N BACK! SUBP! YES!
! ! MEASURES! REPLACEMENT! NEW! ANNULES -! (PAGES)! DOCUMENT-! DIVING-! ! TA!
! ISM! NEN! NEN! ! ROWAN-! IN THE DOCUMENT. ! TA. ! GO DOCUMENT! ! !
! ! NEW! NEW! ! NEW! ! ! AND DATE! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
! ! ! ! ! ! ! ! ! ! !
! ---! -----! -----! -----! -------! ---------! --------! ---------! ----! -!
 

Original text