  MZ-700 / MZ-800 Basic Instructions Overview Commands specific to S-Basic are marked 700 and those specific to BASIC MZ-1Z016 are marked 800. Unmarked commands are common to both BASICs.

Command Description
ABS Used in form X = ABS(Y) it gives variable X the absolute value of variable Y. The item in parenthesis can be a constant or an equation.
AND
800
Logical AND. Used in the form IF X = A AND Y = B THEN... The statement following THEN is only executed if X is equal to A and Y is equal to B. If neither, or only one of the statements is true, control passes to the next line of the program. ( Note: AND must be preceded by a space. ) See also Logical Operators.
Arithmetical
Operators
The Arithmetical Operators used in programming are shown below. Note particularly the signs used for raising to a power, multiplication and division, which differ from those you are accustomed to use.
( ) Parenthesis - used to vary the priority of operation ( operators within parentheses have priority )
^ Exponentiation - raise to a power ( Priority 1 )
- To indicate negative numbers only ( Priority 2 )
* Multiplication ( Priority 3 )
/ Division ( Priority 4 )
+ Addition ( Priority 5 )
- Subtraction ( Priority 6 )
Note that the + (addition) sign is also used for concatenation of strings.
The equals sign ( = ) is not used in its normal arithmetical sense but simply to assign values to variables.
The plus ( + ) and minus ( - ) signs are also used in MUSIC strings to denote the upper and lower octave respectively.
The multiplication ( * ) and plus ( + ) signs are also used with relational statements after IF-THEN as logical AND and OR.
ASC Used in form X = ASC(“A“) it gives the ASCII code for the character to variable X.
If used in the form X = ASC(B\$) it assigns to X the ASCII code of the first character within B\$.
ATN Used in the form X = ATN(Y) it assigns to variable X the angle in radians that is the arc tangent of Y.
AUTO
( A. )
This command automatically produces line numbers to assist in entering BASIC programs. If used alone it starts at line 10 and increments line numbers by 10. Either the starting number ( S ) or the increment ( I ) or both can be defined if the following forms are used:
AUTO S ( Start number )
AUTO,I ( Increment )
AUTO S,I ( Start number and increment )
AXIS
( AX. )
Plotter-printer command
Used in the form AXIS x,p,r it plots the X-axis of a graph when x = 1 and the Y-axis when x = 0. The number of scale markings is specified by r and the pitch, or distance apart, is specified by p. Can be used in graphics mode only.
BLINE
( BL. )
800
Erases lines by changing their colour to match the background. It can be followed by a colour specification in the form [palette code, superimpose mode]. If this is omitted, the colour specification made in the current COLOR statement is assumed. It must be followed by the relevant x,y coordinates for the line(s) concerned. Compare LINE.
BOOT Used in direct mode it has the same effect as pressing the Reset button, returning control to the ROM monitor. Compare BYE.
BOX
( BO. )
800
This draws a rectangle, using the given pairs of coordinates to locate the corners of the box. It can be followed by a colour specification in the form [palette code, superimpose mode]. If this is omitted, the current colour specification is assumed. It must be followed by two pairs of x,y coordinates, and may be followed by the final
palette code, which will be used to paint the interior of the box. It is used in the form:
BOX [pc,sm],xl,yl,x2,y2,PC
BYE
( B. )
Returns control of the computer from BASIC to the machine code monitor in RAM. Can be used during program execution. Compare BOOT.
CHAIN
( CH. )
800
This command has a similar effect to executing the LOAD and RUN commands. It can be used from within one program to transfer control to another program on the same tape or disk, or in the optional RAM file. Variables or arrays can, however, be passed from the current program to the program called. It is used in the form CHAIN “Device name: Filename", although the device name ( and separating colon ) can be omitted, which means that the default device will be used.
CHR\$ This is the inverse of ASC. The function CHR\$(X) returns the character whose ASCII code corresponds to the numeric value of X.
CIRCLE
( CI. )
700
Plotter-printer command
Used in the form CIRCLE x,y,r,s,e,d it is used to draw a circle whose center is at coordinates x,y. The radius is defined by r and the starting and ending angle by s and e in degrees. The number d defines the stepping angle, and should be as small as possible to give a smooth curve - the smallest practical -value is 0.2. Can be used in graphics mode only.
CIRCLE
( CI. )
800
Used in the form CIRCLE [PC,sm]x,y,r,a,sa,ea,0 it draws an ellipse, circle, arc or fan on the screen, depending on the setting of the parameters. The colour specification may be given in the form [palette code, superimpose
mode]. If omitted, the current colour specification is assumed. The x, y coordinates mark the center of the circle, and are followed by the radius. The aspect (a) sets the ratio of the x radius to the y radius, and the starting angle and the end angle ( given in radians ) specify where the drawing of the shape is to begin and end. If the final 0 is omitted, an arc is drawn; if it is included, a fan is drawn ( i.e. lines are drawn from the tips of the arc to the center point ).
CLOSE
( CLO. )
700
Closes a cassette data file after it has been opened with either WOPEN or ROPEN. Failure to use CLOSE when WOPEN or ROPEN has been used results in an error occurring.
CLOSE#
( CLO.# )
800
Used alone, this command closes all open files and frees all logical numbers. If followed by # and a logical number it closes only that file.
CLR Clears all numeric variables to 0 and all string variables to a blank string. All previously executed DIM statements are nullified, and so before arrays can be used again fresh DIM statements have to be executed.
CLS Clears screen and moves cursor to the home position.
COLOR
( COL. )
700

Sets foreground and background colours at a specific position on the screen. Choice of 8 different colours for both foreground and background, as shown below:

 Colour No. Colour 0 Black 1 Blue 2 Red 3 Purple 4 Green 5 Light blue 6 Yellow 7 White

The X ( 0 to 39 ) and Y ( 0 to 24 ) coordinates may be stated, followed by the number for the foreground colour, then the number for the background colour. If it is desired to set the colour for the whole screen, the X and Y coordinates are omitted although the commas must still be shown e.g.
COLOR ‚‚7,1 produces white characters on a blue background ( the standard setting ).

COLOR
( COL. )
800
Specifies the palette code and optional superimpose mode which will be used by succeeding PRINT, SET, RESET, LINE, BLINE, BOX, CIRCLE, PAINT, PATTERN and SYMBOL commands. Used in the form
COLOR [PC,sm.]
CONSOLE
( CONS. )
700
Specifies size of scroll area ( that is, area cleared by CLS ). It takes the form CONSOLE SL,NL,SC,NC where SL is the starting line for the scroll area and NL is the number of lines within the scroll area. SC and NC represent the starting column and number of columns within the scroll area. CONSOLE used alone returns to normal operation i.e. full screen scrolling.
CONSOLE
( CONS. )
800
Specifies size of scroll area ( that is, area cleared by CLS ). It takes the form CONSOLE SL, NL where SL is the starting line for the scroll area and NL is the number of lines within the scroll area. CONSOLE used alone returns to normal operation ( i.e. Full screen scrolling ).
CONT
( C. )
Restarts execution of a program which has been stopped by using SHIFT / BREAK, or by a STOP or an END statement. Program restarts from the point where it was stopped. The CONT command cannot be used:
1. Before a program has been started using RUN.
2. If an error occurs and Ready appears.
3. If an operation using the cassette tape bas been stopped.
4. If the program was stopped during a MUSIC statement.
5. If 'Ready' appears after the execution of an END statement.
COS When used in the form X = COs(Y), this function assigns the cosine of Y ( where Y is in radians ) to variable X. ( Y can either be a constant or an equation. )
CSRH
800
System variable which contains the current column position of the cursor ( horizontal location )
CSRV
800
System variable which contains the current line position of the cursor ( vertical location )
CURSOR
( CU. )
Used to move the cursor to any chosen point on the TV screen, it can be used in conjunction with the PRINT and INPUT statements to position characters on the screen. The X ( 0 to 39 ) and Y ( 0 to 24 ) coordinates of the required location must be specified, separated by a comma, e.g. CURSOR X,Y
DEF FN This command defines a function which can be named by a single letter ( A to Z ). The definition can be made up from combinations of other BASIC functions. For example, DEF FNA (X) = X * X sets up a function called A which, whenever called, returns the square of the number to which it is applied. Subsequently FNA(X) can be called and the computer will return the square of the number X.
DEF KEY Assigns character string up to 15 characters long to any one of the ten function keys so that the string can subsequently be entered by pressing that key.
DEFAULT
( DEF. )
800
Defines device name to be assumed when the device name is omitted from commands which may take it as a parameter. It is used in the form DEFAULT “Device:"
DELETE
( D. )
Deletes specified program lines.
DELETE 50 deletes line 50 only
DELETE 50- deletes line 50 to end of program
DELETE 50-100 deletes lines 50 to 100 inclusive
DELETE -50 deletes from the beginning of the program up to and including line 50
DELETE
( D. )
800
If you have the optional RAM file card this command can be used to delete files. It is used in the form
DELETE "RAM: Filename"
DIM Used to define arrays of one to four dimensions, with the space reserved in the memory for the number of dimensions selected. The array name may consist of up to two characters and the dimension sizes may be defined by subscripts of any value subject only to the limitations of memory capacity, or can be declared by a variable or equation. Variable or string arrays can be declared.
DIR
800
If you have the optional RAM file card, this command can be used to display the names of the files it currently holds. It can be used in the form DIR RAM for display to the screen, or DIR/P RAM to send output to a printer.
END
( E. )
Ends program execution and displays 'Ready' to show that the BASIC interpreter has been returned to the command mode and that Direct Mode commands can be input. When the END statement is used all open files are closed.
EOF(#)
( EO.(#) )
800
Used to find the end of a file, but cannot be used with the data recorder.
ERL System variable which, when an error occurs, holds the line number of the error.
ERN System variable which, when an error occurs, holds the appropriate error number.
( MZ-700 error numbers are explained here ).
EXP Used in the form X = EXP(Y), this function assigns to X the original number of which Y is the natural log. Compare LN.
FOR-NEXT
( F.-N. )
Repeats instructions given in lines between FOR and NEXT the number of times specified in the line commencing with FOR.
GET When used during the running of a program, the keyboard is surveyed, and if any key is pressed, the corresponding value is assigned to a specified variable. The variable can be a numeric or string variable. If no keys are pressed the variable is left empty.
GOSUB -
RETURN
( GOS. -
RET. )
Transfers program execution to a BASIC subroutine beginning at a specified line number <<or label>>. On completion of the subroutine, the end of which is marked by RETURN, the program continues from the statement immediately following the GOSUB statement.
GOTO
( G. )
Program execution jumps to a specified line number <<or label>>. The program continues from that line.
GPRINT
( GP. )
Plotter-printer command
Used in the form GPRINT [s,d],A\$ it prints the specified string in the character size defined by s ( 0 - 63 ) and in the direction defined by d ( 0 - 3 ). Can be used in graphics mode only.
HCOPY
( HC. )
800
Copies the contents of the screen to the printer. Can only be used with the MZ-80P5(K) printer, not with the plotter-printer.
HEX\$ Used in the form HEX\$ (X) it converts the decimal number X into hexadecimal. Compare \$.
HSET
( H. )
Plotter-printer command
Sets current position of the pen as the new origin. This can be the position that best facilitates the drawing of figures. A MOVE statement is often used before this command. Can be used in graphics mode only.
IF - ERL ERL gives the number of a line in which there is an error. It is used with IF - THEN or IF - GOTO to direct control to an error trapping or other routine.
IF - ERN ERN returns a number specifying the kind of error which has occurred. It is used with IF - THEN or IF - GOTO to send control to an error trapping or other routine.
IF -
GOSUB
( IF -
GOS. )
Specifies conditions under which program execution is transferred to a BASIC subroutine.
IF - GOTO
( IF - G. )
Specifies conditions under which the program execution jumps to a given line number <<or label>> from which the program then continues.
IF - THEN
( IF - TH. )
Specifies conditions required before certain statements ( those following THEN ) are executed.
IF - THEN -
ELSE
( IF - TH. -
EL. )
800
If the conditions specified by the IF statement are true, the statements following THEN are executed; otherwise the statements following ELSE are executed.
INIT
800
Defines initial settings and modes for external devices. Used in the form INIT "Device: parameter(s)"
INP Allows input of data from an external device via an optional interface board. Used in the form INP# P,D <<INP@ P,D>> it reads 8-bit data from port P ( 0 - 239 <<0 - 127>> only ) ‚ converts it into decimal and assigns the result to variable D.
INPUT
( I. )
Used for entering data from the keyboard for assignment to variables during program execution.
INPUT/T
( I./T )
700
Same use as INPUT (I.) but data is read from tape. If a ROPEN statement has not been used to open a data file, an error occurs.
INPUT#
( I.# )
800
Sequentially reads data items into a program from the file opened with the ROPEN# statement. If followed by a logical number, this must correspond with that following the ROPEN# command.
INT Used in the form X = INT(Y) it assigns to variable X the greatest integer value which is less than or equal to the value of variable Y ( i.e. it removes the decimal part of a number by rounding down ).
JOY
700
Joystick command ( MZ-700 only )
Used in the form JOY(n) where n is a number from 0 - 8. When n = 0 it reads the input for the X axis of joystick 1. This input can be in the range 0 - 255. When n = 1, the Y axis of joystick 1 is read. 2 and 3 respectively read the X and Y axes of joystick 2. When n has a value of 4 the state of switch 1 of joystick 1 is returned in the form 0 = OFF, -1 = ON. When n = 5, switch 2 of joystick 1 is scanned. 6 and 7 relate respectively to switches 1 and 2 of joystick 2.
KEY LIST
( K.L. )
Lists the character strings corresponding to the definable functions keys.
KILL#
( KI.# )
800
Stops writing of data into the file specified by the logical number following #‚ but if no logical number is specified it stops all current data writing. It also closes the file(s) concerned and frees the logical number(s) for reuse.
LABEL
( LA. )
800
Used in the form LABEL "NAME" it defines a label which can then be used instead of a line number for the destination of a GOTO or GOSUB command.
LEFT\$ Used in the form A\$ = LEFT\$(X\$,N) this function replaces A\$ with N characters from the left hand end of string variable X\$. (N can be a constant, variable or equation.)
LEN Used in the form LEN(X\$) this function gives the number of characters contained in the string or string variable represented by X\$. Spaces and control characters are counted, as well as letters, numbers or symbols.
LET Assigns a numeric or string value to a specified variable or array element e.g. LET A = 10. LET may be omitted e.g. A = 10.
LIMIT
( LIM. )
Specifies the upper limit of the memory area which can be used by the BASIC interpreter. Memory area above that specified by LIMIT statement can be used for particular data or for machine code programs. LIMIT is used either with a decimal number from 0 to 65279 or a 4 digit hexadecimal number from \$0000 to \$FEFF, and must be used at the beginning of a BASIC program. LIMIT MAX is used to cancel LIMIT.
LINE
700
Plotter-printer command ( 700 only )
Used in the form LINE %n,x,y,a,b. The number n specifies the type of line drawn in the range 1 - 16 and the coordinates x,y define the starting point and a,b the finishing point. ( If %n is omitted, the previous value of n is used.) Can be used only in graphics mode.
LINE
( LIN. )
800
Draws lines connecting given points. It can be followed by a colour specification; if this is omitted the current colour specification is assumed. It must be followed by the x,y coordinates of all the points to be connected. It is used in the form
LINE [PC,sm] x1,y1,x2,y2...
The lines drawn can be erased by BLINE.
LIST
( L. )
Lists all or part of the program stored in the computer on the display screen.
LIST 50 lists line 50 only
LIST 50- lists line 50 to end of program
LIST 50-100 lists lines 50 to 100 inclusive
LIST -50 lists from beginning of program to line 50
LIST/P
( L./P )
Lists all or part of the program stored in the computer on the printer. See LIST for various methods of use.
LN Used in the form X = LN(Y) it calculates the natural log of Y and assigns the result to variable X. Compare EXP.
( LO. )
Loads a BASIC source program or machine code program from cassette tape into RAM. If no file name is specified, the first program found is loaded. If a file name is specified e.g. LOAD "Filename" only the program specified by that file name is loaded. A file name may contain up to 16 characters.

<<With the MZ-800 you can use the form LOAD "CMT:Filename" or LOAD "RAM:Filename" to load from a cassette tape or the optional RAM file card respectively.

LOG Used in the form X = LOG(Y) it calculates the common log of Y and assigns the result to variable X.
Logical
Operators
Logical operators can be used with two or more relational expressions in an IF - THEN statement to give the effect of logical AND and OR. The relational statements must be in parentheses.
* Logical AND. Used in the form IF (X=A) * (Y=B) THEN... The statement following THEN is only executed if X is equal to A and Y is equal to B. If neither, or only one of the relational statements is true, control passes to the next line of the program.
+ Logical OR. Used in the form IF (XA) + (YB) THEN... The statement following THEN is executed if either X is equal to A or Y is equal to B. If neither of the relational statements is true, control passes to the next line of the program.
MERGE
( ME. )
Appends program read from cassette tape <<or other device name specified>> to the program in the memory. MERGE can be used with or without a filename ( See LOAD ). If used without a filename, the computer appends the first program found. If any line numbers in the program appended are the same as those in the program in the memory, the lines in the program appended replace the corresponding ones in the program in the memory.
MID\$ Used in form A\$ = MID\$(X\$,M,N) this function replaces A\$ with the N characters from the Mth character of string variable X\$. ( N can be a constant, variable or equation. )
MOD
800
Used in the form X MOD Y it gives the remainder which is left when X is divided by y.
MODE GR
( M.GR )
700
Plotter-printer command ( 700 only )
Switches printer to graphics mode for printout of graphs and charts. When used, every state excluding pen colour and print size returns to its original state.
MODE TL
( M.TL )
700
Plotter-printer command ( 700 only )
Returns the printer from the graphics mode to the text mode. The character size is set at 26 characters per line ( large size ).
MODE TN
( M.TN )
700
Plotter-printer command ( 700 only )
Returns the printer from the graphics mode to the text mode. The character size is set at 40 characters per line ( normal size ).
MODE TS
( M.TS )
700
Plotter-printer command ( 700 only )
Returns the printer from the graphics mode to the text mode. The character size is set at 80 characters per line ( small size ).
MOVE
700
Plotter-printer command ( 700 only )
Lifts and moves the pen to a specified location. Can be used in graphics mode only.
MUSIC
( MU. )
700
The statement MUSIC X\$ performs music or sound effects as specified in X\$. Octave, scale and duration are assigned through characters in the string variables.
MUSIC
( MU. )
800
Generates melody or sound effects as specified by the parameters which follow. Three-part music can be played. Octave, scale, duration, tempo, volume, envelope shape and rate of change can all be specified.
MUSIC INIT
( MU.INIT )
800
Initializes the music and noise settings.
MUSIC
STOP
( MU.S. )
800
Stops sound generation.
MUSIC
WAIT
( MU.W. )
800
Suspends program execution until all notes in the current MUSIC statement have been played.
NEW Clears program currently in memory. All variables become 0 or a space. This statement does not reset the clock nor does it clear the machine language area set by the LIMIT statement. NEW should be used to clear the program in memory before entering another. It is not necessary to use NEW before loading a BASIC program from tape as the LOAD command automatically clears the BASIC text.
NEW ON
800
Expands area available for BASIC programs by deleting the part of BASIC which controls the plotter-printer. It cannot be used prior to running programs which require the plotter-printer. It also clears the BASIC program area in the same way as NEW.
NOISE
( NO. )
800
Generates white noise as specified by the parameters which follow the command and which are similar to those used in MUSIC statements.
NOT
800
Logical negation. Used in the form IF NOT X=A THEN... The statement following THEN is only executed if X is not equal to A; otherwise control passes to the next line of the program.
ON ERROR
GOTO
( ON ERR.
G. )
If an error occurs, program execution jumps to the specified line number <<or label>> which would be the beginning of an error trap or other routine.
ON -
GOSUB
( ON - G. )
After a specified numeric variable, array element or expression, program execution is transferred to a BASIC subroutine beginning at a given line number <<or label>>. On completion of the subroutine indicated by RETURN, the program continues from the statement immediately following the ON - GOSUB statement.
ON -
GOTO
( ON - G. )
After a specified numeric variable, array element or expression, program execution jumps to a given line number <<or label>>. The program continues from that line.
OR
800
Logical OR. Used in the form IF X=A OR Y=B THEN... The statement following THEN is executed if either X is equal to A or Y is equal to B. If neither of the relational statements is true, control passes to the next line of the program.
Other
Symbols
Other certain characters act as instructions to the computer, as well as their normal literal or punctuation function, as follows:
# Hash. Used as a 'mask' to format numerical output with PRINT USING. Also used as a separator with OUT and INP commands ( 700 only ).
. Full stop. Signifies decimal point in number, or position of decimal point required in a format mask.
, Comma. Used to format strings or variables printed to the screen, it acts as a tabulating instruction spacing output in columns 10 characters wide. It is also used as a separator between items of data, and can be used to indicate the position of commas required in a format mask.
! Exclamation mark. After PRINT USING command it causes only the first character of the following string to be printed.
& Ampersand. After PRINT USING command it can be used to cause a specified number of characters from a string to be displayed.
** Asterisks. A pair of asterisks at the beginning of a format mask after a PRINT USING command means that leading zeros will be replaced by asterisks.
££ Pounds. A pair of pound signs at the beginning of a format mask after a PRINT USING command means that a £ sign will be displayed immediately to the left of the number. A single £ sign would be displayed to the left of the formatted area.
\$\$ Dollars. When used in a format mask after a PRINT USING command operates in similar fashion to the £ sign ( see above ).
\$ Dollar - also read as 'string'. When used as a suffix ( e.g. A\$ ) it indicates that the variable it follows is a string variable. It also indicates certain commands as related to string handling ( e.g. LEFT \$ ). If used before a number, it indicates that the number is in hexadecimal form. The command PRINT\$FF will print the hexadecimal number FF in decimal form.
↑↑↑↑ Exponential operators. May be included at the end of a format mask after a PRINT USING statement to control display of numbers in exponential form.
: Colon. Used as a separator where two or more BASIC statements are included in one program line.
; Semicolon. Used in PRINT statements to indicate that following PRINT output must be displayed next to the present output, and must not start a new line.

Reverse
Arrows

Cursor control symbols used in PRINT statements ( see also CURSOR ).
Reverse 'C' Clear screen instruction used in PRINT statements ( see also CLS ).
Reverse 'H' Cursor to Home position instruction used in PRINT statements ( see also CURSOR ).
OUT Allows the output of data to an external device via an optional interface board. Used in the form OUT# P,D <<OUT@ P,D>> it converts the decimal number D into binary and outputs it to port P < 0 - 239 <<0 - 127>> only ).
PAGE
( PA. )
Plotter-printer command
This command gives the number of lines per page ( between 1 and 72 ). Can be used in text mode only.
PAI Used in the form X=PAI(Y) it assigns to variable X the result of Y multiplied by pi ( 3.1415297 ).
PAINT
( PAI. )
800
Fills in an area on the screen in a specified colour. Used in the form PAINT [PC],x,y,bc this command fills in the area in which coordinates x and y designate a convenient point, and which is surrounded by the boundary colour specified in BC, with the colour specified by the palette code PC Note that if the coordinates given lie on the border, filling in will not take place. It is also essential that the designated area is fully enclosed by the border, or painting will 'spill over' on to the rest of the display.
PAL
800
Used in the form PAL PC,cc it assigns a colour code to a palette code, thus making it possible to change the selection of colours currently available.
PATTERN
( PAT. )
800
Allows the user to define his own graphics pattern. It is used in the form PATTERN [PC,sm]n,text data
The colour specification consists of palette code and superimpose mode, although this can be omitted, in which case the current colour specification will be used. The command must be followed by the number of rows of 8 dots, and the actual format of each row is controlled by the text data which must correspond to the binary representation of the dot patterns.
PCIRCLE
( PCI. )
800
Plotter-printer command ( 800 only )
PCIRCLE operates in identical fashion to the MZ-700 plotter-printer command CIRCLE ( q.v. ) but has to take the form PCIRCLE to distinguish it from the screen graphics command CIRCLE.
PCOLOR
( PC. )
Specifies which colour pen is to be used when characters or graphics are printed out. The command is used in the form PCOLOR n where n is a number from 0 to 3. 0 = black, 1 = blue, 2 = green, 3 = red.
PEEK
( PE. )
Used in the form PEEK (address) this function gives the value held in a specified address as a decimal number from 0 - 255.
PHOME
( PH. )
Plotter-printer command
Returns the pen to its origin. Can be used in graphics mode only.
PLINE
( PLI. )
800
Plotter-printer command ( 800 only )
Operates in identical fashion to the MZ-700 plotter-printer command LINE ( q.v. ) but has to take the form PLINE to distinguish it from the screen graphics command LINE.
PLOT OFF
( PL.OFF )
Plotter-printer command
Cancels use of plotter-printer as a display unit ( see PLOT ON ).
PLOT ON
( PL.ON )
Plotter-printer command
Enables the plotter-printer to function as a display unit so that a television is not required. Can only be used when in MODE TN <<PMODE TN>>. Canceled by PLOT OFF.
PMODE
( PM. )
800
Plotter-printer command ( 800 only )
Used in the forms PMODE TN, PMODE TL, PMODE TS, PMODE GR, it operates in identical fashion to the MZ-700 plotter-printer MODE commands ( q.v. ) but has to take the form PMODE to distinguish it from the function MOD.
PMOVE
800
Plotter-printer command ( 800 only )
Operates in identical fashion to the MZ-700 plotter-printer command MOVE ( q.v. ).
POINT
( PO. )
800
Used in the form A = POINT x,y it assigns to variable A the palette code of the colour displayed at the screen coordinates x,y.
POKE
( PO. )
Used in form POKE A,N this command inserts a number N ( between 0 and 255 ) into a memory address assigned by variable A. Any memory address can be used regardless of any limit set by the LIMIT statement, and so care should be taken that no POKEs are made to the monitor or the BASIC interpreter.
POSH
800
System variable which contains the horizontal coordinate of the graphics position pointer.
POSITION
( POS. )
800
Used in the form POSITION x,y to move the position pointer to the required coordinates where a PATTERN command ( q.v. ) is to be executed.
POSV
800
System variable which contains the vertical coordinate of the graphics position pointer.
PRINT
( ? )
Displays on TV screen the numeric variable, string variable and / or expression value following PRINT. ( See also PRINT USING, PRINT/P, PRINT/T, PRINT [f,b]).
PRINT
USING
( ? USI. )
Displays data in a specified layout which is controlled by format masks. ( SeeOther Symbols ).
PRINT/P
( ?/P )
Performs same function as PRINT but directs output to printer.
PRINT/T
( ?/T )
Performs same function as PRINT statement, but outputs data to cassette tape.
PRINT#
( ?# )
800
Writes data sequentially from a program to the file opened with the WOPEN# statement. If followed by a logical number, this must correspond with that following the WOPEN# command.
PRINT [f,b]
( ?{f,b] )
700
Used to add colour to PRINT and PRINT USING [f,b] statements. f = foreground colour, b = background colour. Colours are specified using a number from 0 to 7.
PRINT [PC]
( ?[PC] )
800
Used to add colour to PRINT and PRINT USING statements. The colour of the characters is specified by the palette code (PC) but the background colour will be the current screen background.
PSKIP
( PS. )
800
Plotter-printer command ( 800 only )
Operates in identical fashion to the MZ-700 plotter-printer command SKIP (q.v.).
PTEST
800
Operates in identical fashion to the MZ-700 plotter-printer command TEST ( q.v. ).
RAD Used in the form X = RAD(Y) it converts the value of Y ( where Y is in degrees ) to radians, and assigns the result to variable X.
DATA
( REA. -
DA. )
READ submits data stored in the program in DATA statements to the computer. The DATA statement is followed by a list of values which are assigned to the variables which follow the READ statement.
Relational
Operators
Used with IF - THEN to control subsequent program execution depending on the result of a relational expression. If the condition in the relational expression is not true, then control passes to the next line of the program.
= Equal to. Used in the form IF X=Y THEN... If value of X is equal to the value of Y the statement following THEN is executed.
> Greater than. Used in the form IF X>Y THEN... If the value of X is greater than the value of Y the statement following THEN is executed.
< Used in the form IF X<Y THEN... If the value of X is less than the value of Y the statement following THEN is executed.
<> or >< Not equal to. Used in the form IF X<>Y THEN... If the value of X is not equal to the value of Y the statement following THEN is executed.
>= Or => Greater than or equal to. Used in the form IF X>=Y THEN... If the value of X is greater than or equal to the value of Y the statement following THEN is executed.
<= Or =< Less than or equal to. Used in the form IF X<=Y THEN... If the value of X is less than or equal to the value of Y the statement following THEN is executed.
REM
( ' )
Allows comments or explanatory notes to be included in the program listing without any effect on the program execution.
RENAME
( RENA. )
800
If you have the optional RAM file card this command can be used to rename a given file. It is used in the form RENAME "RAM:AFILE","ZFILE".
RENUM
( REN. )
Renumbers lines of a BASIC program. Used alone it renumbers program lines starting with 10 and incrementing by 10. If a single number follows the command, it starts renumbering with that as the first number and increments by 10. It can also be followed by three numbers separated by commas. The first is the new first line number, the second is the old line number from which renumbering is to start, and the third is the increment.
Thus RENUMBER 10,5,1 starts with old line 5, which becomes the new first line 10, and lines thereafter are incremented by 1.
RESET Used to turn off dot at a point on the screen by x, y coordinates in the ranges x = 0 to 79 <<0 to 319 or 639>>, y = 0 to 49 <<0 to 199>>.
RESTORE
( RES. )
Restores a pointer in the BASIC interpreter, which is used when a READ statement is executed, to the first entry in the first DATA statement in the program or to a specified line number <<or label>>.
RESUME
( RESU. )

Returns control to the main program after an error has been processed. There are four forms in which the error statement can be used:

 RESUME Returns to line where error occurred. RESUME NEXT Returns to line after line where error occurred. RESUME L Returns to line number L. RESUME 0 Returns to start of main routine.

RIGHT\$ Used in form A4 = RIGHT\$(X\$,N) this function replaces A\$ with N characters from the right hand end of string variable X\$. ( N can be a constant, variable or equation. )
RLINE
( RL. )
Plotter-printer command
Used in the form RLINE %n,x,y,a,b this command draws a line from the current pen position to a position specified by means of relative coordinates ( x,y ) and then continues the line to a position specified through a second pair of relative coordinates ( a,b ) and so on. The type of line drawn can be specified by %n where n is between 1 - 16. If %n is omitted, the previous value of n is used. Can be used in graphics mode only.
RMOVE
( RM. )
Plotter-printer command
Used in the form RMOVE x,y this command lifts the pen and moves it to a position specified using relative coordinates x,y. Can be used in graphics mode only.
RND Used in the form RND(X) where X is a positive number it returns a pseudo-random number in the range from 0.00000001 to 0.99999999, each number being generated from the previous pseudo-random number in a given series. If X is zero or a negative number, the pseudo-random number generator is initialized to the beginning of the series, thus allowing the series to be repeated.
ROPEN
( RO. )
700
Opens file for reading numeric variables and string variables stored on cassette tape.
ROPEN#
( RO.# )
800
Opens a file for input. It is used in the form ROPEN#n, "Device:Filename" where n represents the logical number assigned to the combination of Device name and Filename. The Device name does not have to be specified, if the current or default device is to be used. ( See also INPUT# and CLOSE#. )
RUN
( R. )
Executes BASIC program stored in computer. May start from specific line number e.g. RUN 100. This command clears all variables and arrays before commencing execution.

<<With the MZ-800 you can use the form RUN "CMT:Filename"or RUN "RAM:Filename" to load and run a program from tape or from the optional RAM file card respectively.>>

SAVE
( SA. )
Stores BASIC program on cassette tape. When used in the form SAVE "Filename", the filename is entered on to the tape before the program.
<< «With the MZ-800 it is possible to use the format SAVE "CMT:Filename" which directs the computer to save the program to the cassette tape or SAVE "RAM:Filename" which stores the program on the optional RAM file card.>>
SEARCH
( SE. )
800
Used in the form SEARCH "text data" it searches the BASIC program currently in memory for every occurrence of the specified string, and displays the lines containing the string. Output can be directed to the printer by using the form SEARCH/P.
SET
700
Used to turn on a dot at a point on the screen specified by x,y coordinates in the ranges x = 0 to 79, y = 0 to 49. The colour of the dot can be specified by following the coordinates with a code from 0 to 7. ( See COLOR for explanation of code. )
SET
800
Used to turn on a dot at a point on the screen specified by x,y coordinates in the range x = 0 to 319 ( or 639 in Mode 2 ) ‚ and y = 0 to 199. The colour of the dot can be controlled by specifying the palette code ( and superimpose mode if required ); otherwise the current colour specification is assumed. It is used in the form SET [PC,sm]x,y
SGN Used in the form X = SGN(Y). If Y is negative, -1 is assigned to X; if positive, 1 is assigned to X. If, however, Y equals zero, then zero is assigned to X.
SIN Used in the form X = SIN(Y) it assigns to variable X the sine of Y ( in radians ).
SIZE Used in form PRINT SIZE, this function states the number of bytes still available for storage of BASIC programs and data in the memory.
SKIP
( SK. )
700
Plotter-printer command ( 700 only )
Feeds paper specified number of lines in the range -20 to 20. The paper is fed forward when a positive number is entered and backwards when a negative number is entered e.g. SKIP 4 or SKIP -16. Can be used in text mode only.
SOUND
( SO. )
800
Used in the form SOUND p,d it generates sound as specified by the pitch and duration parameters which follow it. It can also be used in the form SOUND = (r,d) where the parameters in brackets represent the number of the sound register and data respectively. This allows direct control of the sound generator.
SPC Used in form PRINT SPC (n); this function creates n spaces on the screen and moves the cursor n character positions to the right of its current location.
SQR Used in the form X = SQR(Y) it calculates the square root of Y and assigns the result to X. Y must be greater than or equal to zero ( i.e. Not a negative number).
STICK
( STI. )
800
Used in the form X = STICK (n)it assigns to variable X a value between 1 and 8, which indicates the position of the joystick lever, or cursor key(s) being pressed. When n = 0 the cursor keys are read, whereas values of 1
and 2 check the input from joystick ports 1 and 2 respectively.
STOP
( S. )
Stops running of program temporarily. Program normally continues after CONT has been entered. ( See CONT )
STR\$ Used in form STR\$(X) this function creates a string of ASCII characters using the numeric characters which represent the value of X. ( Compare VAL )
STRIG
( ST. )
800
Joystick / keyboard command ( 800 only )
Used in the form Y = STRIG (n) it assigns to variable Y a value of 1 or 0, which indicates whether the 'Fire' button is being pressed (1) or not (0). When n = 0, the space bar is used as the 'Fire' button, whereas values of 1 and 2 respectively relate to the 'Fire' buttons of joysticks 1 and 2 respectively.
SYMBOL
( SY. )
800
Draws a character on the screen in varying degrees of magnification and at various angles. It can be followed by a colour specification in the form [palette code, superimpose mode]. Otherwise the current colour specification is assumed. It is used in the form SYMBOL [PC,sm]x,y,text,h,v,a where x and y are the screen coordinates, text signifies the character(s) to be represented, h and v are the horizontal and vertical magnifications respectively ( in a range from 1 to 255 ) and a is the angle code. The angle code can take a value from 0 to 3, where 0 represents normal orientation, 1 is turned through 90 degrees, 2 is 180 degrees and 3 is 270 degrees.
TAB Used in form TAB(X); with PRINT statements, this function moves the cursor to character location X + 1 positions from the left side of the screen.
TAN Used in the form X TAN(Y) it assigns to variable X the tangent of Y ( in radians ).
TEMPO
( TEM. )
Sets tempo of music effected by subsequent MUSIC statements. It is used in form TEMPO X where X is a numeric value from 1 ( slow ) to 7 ( fast ). If it is not used, TEMPO 4 is assumed.
TEST
( TE. )
700
Plotter-printer command ( 700 only )
Normally used in direct fashion, this command causes the printer to draw squares in each of the four ink colours so as to check operation of the printer and whether any of the pens requires changing. Can be used in text mode only.
TI\$ System variable which contains the hours, minutes and seconds which have elapsed since the computer was switched on. This is the computers built-in clock and it can be set to the current time of day by assigning a string to it giving the current hours, minutes and seconds e.g. TI\$ = "145500" - the clock restarts at this time when CR is pressed after entering this in Direct Mode.
TROFF Trace off. This command turns off the TRON function.
TRON Trace on. This command turns on a trace facility which prints to the screen the current BASIC program line number as it is executed.
<<With the MZ-800 you can also use the form TRON/P to direct the output to the printer.>>
USR
( U. )
Used in the form USR (address) this function shifts program control to a machine language routine at the given memory address.
VAL Used in form VAL (X\$) this function gives the numeric value of characters representing the number within the string. ( Compare STR\$ )
VERIFY
( V. )
Used to check that a program has been recorded accurately on tape by the SAVE command. Can be used in form VERIFY "Filename". If used alone, verifies first program encountered on tape.
<<With the MZ-800 you can use the form VERIFY "CMT:Filename" or VERIFY "RAM:Filename" to check programs saved to the data recorder or optional RAM file card respectively.>>
WAIT
( W. )
800
Used in the form WAIT n where n is a number in thousandths of a second, it suspends program execution for the specified time e.g. WAIT 2000 pauses for 2 seconds.
WOPEN
( W. )
700
Opens file on cassette tape before inputting numeric variables and string variables for storage on tape.
WOPEN#
( WO.# )
Opens a file for output. It is used in the form WOPEN#n, "Device:Filename" where n represents the logical number assigned to the combination of Device name and Filename. The Device name does not have to be specified, if the current or default device is to be used. ( See also PRINT# and CLOSE# )
XOR
800
Exclusive OR. Used in the form IF X=A XOR Y=A THEN... The statement following THEN is executed if either X is equal to A or Y is equal to A but not if both are equal to A. If neither or both are equal to A, then control passes to the next line of the program.  last updated December 30, 2003 sharpmz@sharpmz.org