![]() S-Basic operating
( Introduction )
|
||||||||||||||||||||||||||||||||
How to load the BASIC interpreter
To execute a BASIC program you have to start the BASIC interpreter first. The procedure is as follows:
|
||||||||||||||||||||||||||||||||
How to execute a BASIC program
Found "MZ-700 DEMO"
Break in 250
You can pause a complex listing by pressing the space bar. You can break the listing by pressing SHIFT and BREAK coincidentally. |
||||||||||||||||||||||||||||||||
The direct mode
Several BASIC commands can be executed immediately by the interpreter. To this, no BASIC program is to type in, the commands can be typed in direcely and will be executed immediately after pressing the CR key. For example, you can use the MZ-700 to compute 234 / 5. To this type in: PRINT 234/5. The response will be 46.8. You can use the following mathematical operators:
If you use multiple operators in an arithmetical expression, the order of the computation is dependent of the priority / precedence of the operators given by the design of the arithmetical routines of the BASIC interpreter. Normally it works like an electronic calculator for technical computations. If you use bracketing in your arithmetical expressions by parenthesis,
these expressions will be computed first like known by algebra. If parenthesis
are nested, the operations enclosed in the innermost set of parenthesis
are performed first. Within the parenthesis the following rules take effect:
The exponential function has the highest priority of 1 and will be computed first by the interpreter. The multiplication and the subtraction have the same priority ( 3 ) and the addition and the subtraction have the same priority ( 4 ). A negated number or a negated numeral expression will be negated using a priority of 2, this means, after an exponential function but before all others. Operations with the same precedence are performed from left to right,
with operations enclosed in parenthesis performed first. To the example above ( 234 / 5 = 46.8 ) try the following command: PRINT "234/5=";234/5 The response now will be: 234 / 5 = 46.8. You have entered now a character string and this string within the quotation marks is printed in addition to the computation. Please take note of the printed space character between the equation mark and the result. This space character is a place holder for the sign. If you type in PRINT "1-3=",1-3 then no space character will be printed, but the sign: 1 - 3 =- 2. If you use PRINT/P instead of PRINT, the output will be printed by the plotter. |
||||||||||||||||||||||||||||||||
Programming
If you want to type in a new BASIC program, then type in first NEW to be sure that the program area is clean. NEW deletes an existing program unrecoverable and cleans the variable's area. Please type in the following example: 10 A=23 assign the numerical value of 23 to the numerical variable A 20 B=48 assign the numerical value of 48 to the numerical variable B 30 C=A+B adds B to A and the result is stored into C 40 ? C print the contents of C on the screen 50 END end the program
Each BASIC line is ordered by a line number ( 10, 20, 30... ). A BASIC line number must be an integer. The valid range of line numbers is from 1 to 65,535. To change an erroneous line you can review the program you've typed in by using the LIST command. This command lists all the lines you've typed in. You can execute the program you've typed in by the RUN command. The result of the executed program will be printed on the screen, in this example the addition of 23 + 48: 71. If you want to change the program now at line 20, for example, you want to add another value to the variable A instead of the value 48, type in first LIST 20. The line 20 will be printed on the screen and you can change this line now by using the cursor control keys to move the cursor to the position of the value of 48. Now you can over type it with the new value. Don't forget to press CR afterwards to update the line 20. Type in LIST again, to view the updated line. While editing a line you can use the INST key to insert any character at the current cursor position or you can use the DEL key to delete a character before the current cursor position if required. To clear the screen press the SHIFT key and the INST key coincidentally ( CLR key ). If you want to store your program on tape, type in SAVE "MYPROG" and the program will be stored on the tape you've put into the data recorder. The MZ-700 will prompt you to push the RECORD/PLAY buttons at your data recorder. The interpreter response will be: Writing MYPROG and at the end of the process the message Ready is printed on the screen. To the procedure how to use the data recorder click here. If you ever have saved a program by the monitor, then you know what is to do, else take a note of the actions and the responding messages ( of course, you don't try to use the monitor's save command syntax described there while you work in BASIC ). If you want to load a program type in LOAD. This will load the next BASIC program found on tape by the interpreter into the program storage. If you want to load a specific BASIC program from tape type in LOAD followed by the name of the program you want to load and enclose the name in quotation marks. For example: LOAD "MYPROG". If you ever have loaded a program by the monitor, then you know what is to do, else take a note of the actions and the responding messages ( again, of course, you don't try to use the monitor's load command syntax described there while you work in BASIC ). |