APPROVED

 

  .00031-01 33 01-LU

 

 

 

 

 

 

 

 

 

 

                    SOFTWARE

              COMPUTER EDUCATIONAL COMPLEX

                    "ELECTRONICS MS 0202"

 

 

                            BASIC

 

                    PROGRAMMER'S GUIDE

 

                         .00031-01 33 01

 

                           SHEETS 14

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

                             1987

                                                         LITERA A


                              - 2 -

 

                          .00031-01 33 01

 

 

                             ANNOTATION

 

 

 

 

 

      This document is the programmer’s manual for
working with the BASIC system and contains general information necessary
for the programmer to work with the BASIC language on a microcomputer "Electronics
MS 0511".

 

      The document contains information about the basic characteristics of the
BASIC system, the method of use, as well as messages to the
programmer and operator.


                              - 3 -

 

                          .00031-01 3 3 01

 

 

 

 

 

 

                            CONTENT

 

 

 

 

1. PURPOSE AND TERMS OF APPLICATION OF THE PROGRAM ................. 4

 

 

2. PROGRAM CHARACTERISTICS ................................... 5

 

2.1. Memory allocation ................................... 5
2.2. Operating mode ........................................... 7

 

3. APPEAL TO THE PROGRAM ..................................... 8

 

 

4. INPUT AND OUTPUT DATA ................................. 8

 

 

5. MESSAGES ..... .......................................... .. 9

 

5.1. Message Format ....................................... 9

5.2. Error Messages ................................... 10


                              - 4 -

 

                          .00031-01 3 3 01

 

 

           1. PURPOSE AND TERMS OF USE OF THE PROGRAM

 

 

 

 

      BASIC system for micro-computers "Electronics MS 0511"
is a single set of programs. It is intended
for the direct execution of commands and language operators, as
well as for the execution of BASIC programs with their previous compilation.
The system allows you to create programs in the BASIC language, has
great ability to edit and debug programs.

 

      To work with the BASIC system, the
Electronics MS 0511 microcomputer (1.700.016) with a
monitor connected to it with a screen dimension of 640 x 264 is required
. A household television receiver can be used as a monitor . To store
programs, a household cassette recorder can be connected to the microcomputer
.

 

      The BASIC compiler program is recorded on the .00031 MD
01 disc and transferred to the microcomputer via a local network from the
teacher's machine . In the future, it will be possible to
load the BASIC system from the ROM cassette.


                              - 5 -

 

                          .00031-01 3 3 01

 

 

                    2. PROGRAM CHARACTERISTICS

 

 

 

 

 

 

       2.1. Memory allocation

 

 

 

      The total amount of directly addressed CPU memory is
56 Kbytes (1KB = 1024 bytes). The BASIC system size may vary
depending on the language version, but does not exceed 28KB.
The rest of the address space is used by the BASIC system.
Addresses below 2000 are reserved for the general system stack (
return addresses from subprograms, temporary data storage, etc.). Below the
executive part of the BASIC system is the area of ​​system
variables, counter flags, buffers, etc. Above this area, the
text of the input lines of the user program is stored in the internal representation
.

 

      Above the text of the program is the object code of the program
obtained by executing the RUN command . User input of new
lines or correction of old ones leads to corruption of object code.
therefore, attempts to access the object code of the
program in this case leads to the error "Program execution
cannot continue ." Only after successful compilation (by the RUN command  )
does it again become possible to execute   GOTO ,   CONT , step-by-step program execution, etc.

 

      Above the object code, 200 bytes are allocated for character
variables. The value of this area can be changed with the CLEAR operator
(see BASIC. Description of the language. U1.00031-01 35 01).

 

      Above the row area, memory is reserved for index
variables of all types. This area also stores the
maximum values ​​of array indices. The area of ​​arrays is always
located starting from an even address, therefore the value of the
area of ​​lines is always an even number. In the case when
the CLEAR operator    indicates an odd number of bytes for
strings, it automatically increases to an even number.

 

      The memory allocation is shown in fig. one.


                              - 6 -

 

                          .00031-01 3 3 01

 

 

              -------------------------------
     157777! NETWORK DRIVER!
              ! !
              ! ------------------------------!
     150,000! USER MEMORY!
              ! !
              ! ------------------------------! HIMEM     ! CONTROL UNIT FOR FILE!               ! DATA WITH BUFFER (256 + 18BYtes)!               ! ------------------------------!               ! BUFFER FOR SAVE , LOAD AND ENTRY!               ! KEYBOARD (256 BYtes)!               ! ------------------------------!               ! COMMUNICATION TABLE (FOR EVERYONE               !! LINE 3 WORD)!               ! ------------------------------!               ! TABLE OF NAMES AND VALUES!               ! SIMPLE VARIABLES!               ! ------------------------------!               ! STACK OF CYCLES FOR AND!               ! GOSUB SUB- PROGRAM             !               ! ------------------------------!               ! Free area (SIZE!               ! Outstanding features FREE [( of N )]!               ! ------------------------------!               ! MEMORY ARRAYS !!               ------------------------------!!               MEMORY OF STRING VARIABLES               !! (200 BYtes)               !! ----- -------------------------!!               OBJECT CODE               !! ------------------- -----------!!               TEXT OF LINE PROGRAMS               !! ------------------------------               !!               BEYS AND K!!               ------------------------------ !! SYSTEM VARIABLES, FLAGS               !! ETC!!               ------------------------------!      2000      ! S T E K               !! ---- --------------------------!!               VECTOR!       0! ------------------ ------------!
    


































 

 

 

                           Fig. one


                              - 7 -

 

                          .00031-01 3 3 01

 

 

       2.2. Mode of operation

 

 

 

      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 or
direct.

 

      To execute a program in indirect mode, each line of
this program must begin with a line number. A
line number is followed by an operator. The minimum line number is 0, the maximum
is 65535. Entering program statements can be performed in
any order. Operators are executed in ascending
order of line numbers after issuing a RUN command .

 

      To work in  direct mode, the line number is not
entered. Operators without a line number are executed immediately
as they are entered into the system. The BASIC system's direct mode
allows you to use the computer as a very powerful
calculator.

 

      Only in direct mode are the commands of the BASIC system executed
. These include:

 

       1) program start commands ( RUN , CONT , SYSTEM );

 

       2) commands for loading and storing programs ( LOAD , SAVE , MERGE , CLOAD , CSAVE , FILES , BLOAD , BSAVE );
         

 

       3) commands for working with program texts ( LIST , DELETE , RENUM , AUTO , LLIST ).
         

 

      More commands are described in the document:

 

               BASIC. Description of the language. U1.0 0031-01 35 01.


                              - 8 -

 

                          .00031-01 3 3 01

 

 

                     3. APPEAL TO THE PROGRAM

 

 

 

 

      BASIC system loading through a local network is performed
according to U1.00031-01 34 03 Local network. Operator's manual.

 

      A sign of normal operation of the system is the
following actions:

 

        - cleaning the TV screen

 

        - formation of the service line on the screen:

 

                                          LAT

 

        - output of the initial message:

 

       BASIC UK-NTs (Voronezh State University, 1987.07.08)

 

       Ok

 

      The Ok prompt means that the system is ready to work and
waiting for the input of commands or programs in the BASIC language.

 

 

 

 

                   4. INPUT AND OUTPUT DATA

 

 

 

      A BASIC source program consists of lines of
statements. 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.

 

      The main operators include:

 

       1) assignment operators ( LET) ;

 

       2) operators of unconditional and conditional transition ( GOTO , IF ) ;

 

       3) operators of the call to the subprogram and return from it ( GOSUB , RETURN );
         

 

       4) loop operators (FOR, NEXT);

 

       5) I / O operators ( PRINT , INPUT , OPEN , etc.), etc.

 

      These and other BASIC language operators are described in detail in the
document: BASIC. Description of the language. U1.00031-01 35 01.

 

      The input and output data can be stored on magnetic tape
or on the disk of the teacher’s machine, if the micro-computer Electronics MS
0511 is connected to the local network.


                              - 9 -

 

                          .00031-01 3 3 01

 

 

      The BASIC system allows working with three types of files:

 

       1) information in KOI-7 codes with lines of no more than 255 characters
          (the default type is ASC if the file was created by the SAVE command  ,
          or DAT if the file was created by means of the BASIC system
          for working with data files);

 

       2) BASIC programs in the internal code of the system (
          default type is COD );

 

       3) Files with binary information (the default type is BIN ).

 

      When exchanging information, the following BASIC system commands are
used:

 

       1) for receiving and transmitting BASIC system programs in text
          format - LOAD and SAVE ;

 

       2) for receiving and transmitting programs in the internal code of the
          system - CLOAD and CSAVE ;

 

       3) for the exchange of binary information - BLOA D and BSAVE .

 

      For data exchange, the OPEN PRINT #, INPUT #, CLOSE operators are used  .

 

 

 

 

                           5. MESSAGES

 

 

 

 

 

 

       5.1. Message format

 

 

 

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

 

       < ERROR > in the line YYYYYY,

 

where < ERROR > is the abbreviated name of the error;

     YYYYYY - line number in which an error was detected.

 

      If the work is performed in direct mode, then the line number is
not issued.

 

      When the STOP statement is executed or when the < STOP > key is pressed, the message appears:

 

         Stop in line YYYYY

 

      where YYYYY is the line number running at this time.


                              - 10 -

 

                        .00031-01 3 3 01

 

 

       5.2. Error messages

 

 

 

 

     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           much memory is required for the array or area of           lines, the free area is too small for           generating the code of directly executed           operators.
         



 

 

     8    Undefined line number


                              - 11 -

 

                        .00031-01 3 3 01

 

 

          In the GOTO , GOSUB , the IF , the RESTORE , RENUM , the AUTO , the 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 the execution of the
          program, which:
          1. 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


                              - 12 -

 

                        .00031-01 3 3 01

 

 

          statement 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
          to an empty file. To avoid this error,
          to detect the end of the file, use function
          tion the EOF .

 

 

    56 Invalid file name

LOAD , SAVE, or OPEN           statements   used


                              - 13 -

 

                        .00031-01 3 3 01

 

 

          Incorrect file name (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).


                              - 14 -

 

                        .00031-01 3 3 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