Sharp logo
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:

  • The computer is to connect to a colour screen or a colour TV.
  • If the power is turned on the following message is printed on the screen:
MZ-700 first screen
  • Put your BASIC interpreter tape into the data recorder.
  • Type in L and press CR. The MZ-700 displays: press key at data recorderPLAY.
  • Press the PLAY button at your data recorder and wait.
  • The response of the MZ-700 will be: LOADING S-BASIC. It takes a few minutes now while the interpreter is loaded into the storage.
  • When the interpreter becomes active the screen will look like this:
S-Basic is loaded/active
  • Your BASIC is now active and ready for work.
How to execute a BASIC program
  • Put the tape containing the BASIC program you want to let execute into the data recorder.
  • Type in LOAD and press CR. Press the play button of the data recorder if you are prompted to do this. Wait.
  • Then the response will be:
Found "MZ-700 DEMO"
LOADING "MZ-700 DEMO"
Ready
cursor

"MZ-700 DEMO" is the name of the program ( for example ) found on tape by the BASIC interpreter. The program is now loaded into the interpreter's storage area for BASIC programs.

  • To execute the program type in RUN and press CR. The program becomes active now.
  • A running BASIC program can be stopped by pressing SHIFT and BREAK coincidentally. In this case the response will be:
Break in 250
Ready
cursor

In the example above the program was stopped by pressing SHIFT and BREAK coincidentally while the BASIC interpreter was executing the line number 250.

  • If you want to load and execute another BASIC program now repeat this procedure.
  • If you type in LIST and then you press CR, the BASIC interpreter lists the BASIC program you've loaded, line by line on the screen.

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:

operator
function
+
addition
-
subtraction
*
multiplication
/
division
exponential
exponential

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:

priority operator operation format
1
exponential function
exponential function Xexponential functionY ( e.g. 216 )
2
-
negation - X ( negative X )
3
*, /
multiplication,
division
X * Y ( X multiplied by Y )
X / Y ( X divided by Y )
4
+, -
addition,
subtraction
X + Y ( add X to Y )
X - Y ( subtract Y from X )

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

Note The "?" ( question mark ) used in the line 40 is an abbreviation, is a short form, of the PRINT command. To see all short forms of the available BASIC commands click here.
( Don't type in my comments on each line above )

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 ).


Go to the top of this page Home

last updated August 4, 2002
sharpmz@sharpmz.org