However, in the event that you should notice any errors or ambiguities, please feel free to contact your local Sharp representative or your nearest dealer for clarification. All system software packs provided for the MZ-808 are original products, and all rights are reserved.
Introduction The greatest care must be taken in handling disk drives diskettes. Carefully read the notes in "Handling Diskettes" on page 69 . The master diskette and blank diskette will not be exchanged for new ones after purchase. I t is recommended that the master diskette be copied using the disk copy utility (refer to page 36) to Be sure to keep the generate a submaster diskette, and that the submaster diskette be used generally.
Chapter 1 Outline of double precision DISK BASIC SB-661 This chapter outlines programming procedures and use of the double precision DISK BASIC interpreter SB-667 0. The chapter begins with a description of the procedure for activating the BASIC SB-6610, fol lowed by general file control concepts.
1 . 1 Activating the DISK BASIC interpreter SB-6610 DISK BASIC SB-66 1 0 is st ored (along wi t h MONITOR SB- 1 5 1 0 ) on a diskett e file and mu st u ndergo init ial program loading whenever it is t o be u sed. Loading is easily performed. Ready t he disk drive u nit, place t he mast er diskett e (or su bmast er diskett et , if available) in disk drive and simply tum on t he p ower of t he MZ-80 B.
1.2 Introduction to file control The DISK BASIC interpreter SB-66 1 0 is a system software which has a su perb file control f u nc tion . It f u lly u tilizes the large capacity and high speed accessing featu re of the floppy disk file system ·s o th at files can be u sed not only for data storage bu t also as a random access data area connected to the system program .
The file to which the specif ied logical file number has been assigned is accessed by the write or read command issued by a PRINT # or INPUT # statement or by a file close statement. CHAIN and SWAP are statements which overlay a program up on another program in the m emory and transfer control to the overlying program.
1. 3 Control of sequential access files A sequ enti al access file i s a dat a file whose dat a i s recorded or read wit h sequ enti al access proce du res, whi ch accesses dat a sequ enti ally st arti ng wit h t he first dat a it em . You already know how t o handle dat a files on cassett e t ape u si ng BASIC SB-5 5 1 0.
As a simple example of sequ ential access file control, let ' s discu ss the recording of names and addresses o f persons' homes in a sequ ential access file. Ou r file, an address list in this example, mu st be made in the following form .
1 . 4 Control of random access files A random access f ile is a dat a file which permit s dat a t o be recorded or recalled u sing t he "random access" met hod. The t erm "random access" refers t o t he process of recording or recalling each dat a it em by specifying it as an array element .
"RND 1 " "RND 1 " When data is added with � the "expression" set to 30. Now , J et' s try to device a program for making a simple inventory J ist u sing a random access file. It is assu med that individu al articles are given fixed item nu mbers from 1 to 5 0 and that the inventory J ist inclu des five fields of information : item name, u nit price, nu mber of u nits in stock, valu e (u nit price X nu mber items in) and comments.
1. 5 File access cancellation and how to detect file end 1.5.1 KILL This st at ement, when i t follows t he WOPEN st at ement, cancels t he WOPEN command. The execut ion of KILL st at ement cancels t he WOPEN and prevent s t he dat a array, even if it is u nder const r u ct ion, from being recorded in t he sequ ent ial access file.
1. 6 Making a chain of programs The t opic of t his sect ion is t wo program file cont rol st at ement s. These are t he CHAIN are SWAP st at ement s. When some programs are recorded on a diskett e, t he u se of t hese st at ement s enables you t o call anot her program while ru nning t he recorded programs and moves t he cont rol t o it .
1. 7 Swapping programs The SWAP st at ement reads a program from a diskett e file, overlays anot her program wit h it or links t hem, and leaves cont rol t o t hat program t ext, resu ming cont rol by t he original program t he inst ant t he execut ion of t he t ext h as been complet ed .
Text area Initially , the text "CO M POSER" , Composer "PLAY THE CELLO" present in the text area, is exe cuted. First the SWAP statement, line Sheltered No. 6 0, shelters the text on the diskette present in the drive FD 1 that has executed the DIR com- mand, and renews the text area.
1. 8 USR function in a logical open statement T he USR function generally calls a subroutine coded in machine language. When it is used in a logical open statement (WOPEN or ROPEN) , however, logical open is performed with the assump ti on that the USR function is a logical file which is executed when a subsequent PRIN T # or INPU T # statement is executed.
(Read) 200 ROPEN # 1 1 , USR (n) 2 10 INPUT # 1 1 , B $ 2 20 CLOSE # 1 1 200 : Assigns logical file number # 1 1 t o US R (n) and logically opens it . 2 10 : Execu t es US R (n).
Chapter Instructions Unique to SB-661 This chapter describes SB-667 0 direct commands, statements, updated commands and utilities which are not supported by the ordinary cassette BASIC interpreter SB-5570. Command and statement format Commands and statements must be coded accordin g to the following conventions. •...
2.1 Direct commands 2 . 1 . 1 DIR < FD d > Format d ..drive number : 1 through 4 Displays the file directory of the diskette specified. Function When FDd is omitted, the value defaults to the number of the drive against which Description the last DIR F D d com mand was executed.
2. 1 .3 SAVE SAVE < FD d @v, > "file name" Format d ..drive number 1 through 4 v ..diskette volume number Assigns the specified file name to the BASIC text contained in the text area and Function stores it on the diskette in the specified drive.
2. 2 File control statements LOCK 2.2.1 LOCK < FD d @v , > "file name" Format d ..drive number 1 through 4 v ..diskette volume number This statement locks a specified file. Function When a file is locked, requests to modify it will be denied.
2.2.4 DELETE DELETE < FD d @v,> "file name " Format d ..drive number 1 through 4 v ..diskette volume number This statement deletes a specified file from the diskette. Function This statement is prohibited for any locked file.
2.2.6 SWAP SWAP < FD d @v ,> "file name" Format d ..drive number : 1 through 4 v ..diskette volume number This statement swaps the program execution to BASIC text on the diskette. Function SWAP F D2@7, "TEXT S-R"...
2. 3 Error processing control 2.3 .1 ON E RROR GOTO ON E RROR GOTO lr Format lr ..reference line number : error processing routine This statement declares the number of the line to which program execution is to Function be moved in order to correct errors.
The statement shown below causes program execution to jump to line 1 200 when Example Error 5 (String Overflow) occurs, indicating that the string length exceeded 2 5 5 characters. 800 IF E RN = 5 THEN 1 200 2.3 .3 IF ERL IF ERL expression THEN lr Format...
2.3.4 RESUME RESUME < NEXT > Format RESUME lr lr ..reference line num b er or 0 This statement returns program execution to the main program after correction of Function an error. The system holds the number of the line on which the error occurred in memory Description and returns program execution to that line or to another specified line after t1:1e error is corrected.
2.4 Updated commands 2 .4 . 1 PRINT USING PRINT USING format ; variable name list Format format ..string variable consisting of special characters variable name list . . . numeric variables and/or numeric expression This statement displays the contents of the numeric variable indicated by h he Function variable name list operand in the specified format.
Format Over Display • When the data length is longer than that specified, preceeds the data displayed. PRINT USING "##,###" ; 1 23456 % 1 23,456 Other Characters except Format • When any other characters are specified at the beginning or end of the format operand, they are displayed as they are.
You obtain the object file (OBJ) "BASIC SB-5 5 1 0" on the diskette in drive 2 . Therefore, to call BASIC interpreter SB-5 5 1 0 from the diskette file , simply enter RUN "BASIC SB-5 5 1 0" 2.5 .2 U s e of utility program "Utility"...
S command assigns a volume number t o a initialized diskette for making a slave diskette. Figure 2 . 5 shows an example where the slave diskette in drive 1 is made with volume number 2.5 assigned. [ COMMAND TABLE ] DISKETTE INIT SLAVE-DISK INIT D ISKETTE COPY...
Any number of submaster diskettes can be made by copying the master diskette using this diskette copy command explained above. However, submaster diskettes cannot be made by copying another submaster diskette. FIGURE NOTE : It is recommended that a write protect seal be placed on the original diskette to prevent it from being accidentally erased.
3. 1 List of DISK BASIC interpreter SB-6610 commands, statements and · functions 3 . 1 . 1 Commands DIR FDd Displays the file directory of the diskette in drive d (d= 1 �4). The contents of the directory are as follows : 1 ) Volume number 2) Number of unused sectors 3) Mode, l ock condition and file name of each file on the dis...
Transfers system control from the BASIC interpreter to the MONI TOR. To transfer system control from the MONITOR to the BASIC interpreter, execute monitor command J . Activates the MZ-80B system initial program loader. BOOT BOOT Displays a complete list of string definitions for special function...
3 . 1 .2 File control statements Locks file "ABC" on the diskette in the active drive. LOCK LOCK "ABC" Locks file "ABC" on the diskette (whose volume number is 7), in LOCK FD4@7 "ABC " drive 4 . The locked me cannot be updated o r deleted. When the me directory is listed, the locked file name is indicated with an asterisk.
3 . 1 .3 BSD (BASIC Sequential access Data file) control statements Defines the file name o f a BSD (BASIC sequential access data file) WOPEN # WOPEN #3, FD2@7 , to be created as "SEQ DATA 1 " and opens it with logical number "SEQ DATA 1 "...
PRINT #( ) PRINT #5 (20), AR$, AS$ Writes the contents of string variables AR$ and AS$ on field 20 and field 2 I of the BRD assigned logical number 5 , respectively. All BRD fields have a fixed length of 32 bytes and , if the length of string variable exceeds 32 bytes, the excess part is discarded.
Returns program execution to the statement just after the one in 700 RESUME NEXT which the error occurred. 750 RESUME 400 Returns program execution to line number 400 . 800 RESUME 0 Returns program execution to the beginning of the program. 3.
3.1 .8 Input/outpu t statements PRINT 10 PRINT A Displays the numeric value of A on the CRT screen. Displays the character string of variable A$ on the CRT screen. 1 00 PRINT A ; A$, B ; B$ Combinations of numeric variables and string variables can be spe cified in a PRINT statement.
10 A$= "###.##' The format operand can be specified with a string variable as shown at the left. 20 PRINT USING A$ 1 .5 8 Displays 1 .5 8. 30 PRINT USING A$ 28.3 Displays 28.30. 10 INPUT A Obtains numeric data for variable A from the keyboard. INPUT 20 INPUT A$ Obtains string data for string variable A$ from the keyboard.
Jumps to the subroutine starting on line number 700 when the IF - GOSUB 3 0 IF A=B* 2 GOSUB 90 value of variable A is twice the value of B ; otherwise the next state ment is executed. (When other statements follow a conditional statement on the same line and the conditions are not satisfied, those following an ON statement are executed sequentially, but those following an I F statement are ignored and the statement on the next line i s exe...
DEF KEY 1 5 DEF KEY ( l )=LIST A DEF KEY statement def mes a function for any of the ten special 25 DEF KEY (2)=LOAD ! function keys. The statement on line number 1 5 defines special function key 1 as LIST. The statement on line number 25 defines special function key 2 as the multi-command LOAD: RUN.
3 1 0 MUSIC "DE#FGA" MUSIC statement on line number 3 1 0 generates a melody consist ing of D, E, F sharp, G and A. Each note is a quarter note. When the TEMPO statement is omitted, default tempo is set.
Sets a dot in the specified position ·in a graphic area operating in the input mode. The first operand specifies the X-coordinates (0-3 19) and the second operand specifies the Y-coordinates (0- 1 99). 300 SET 1 60, 1 00 Displays a dot in the center of the screen.
System variable indicating the X-coordinate (horizontal location) POSH of the position pointer. System variable indicating the Y-coordinate (vertical location) of POSY the position pointer. 3 . 1 . 1 5 Machine language control statements Limits the area in which BASIC programs can be loaded to the area LIMIT 100 LIMIT 49 1 5 1 up to address 49 1 5 1 ($BFFF in hexadecimal).
600 WOPEN #8, USR The statement on line 600 opens a file which is to be written by ($COOO) the machine language program called by USR ($COOO) with logical 6 1 0 PRINT #8, A $ number 8 assigned . At this stage of program execution the USR 620 C LOSE #8 function is not executed.
PRINT /P CHR$ ( 1 9) Cancels the double size mode. Returns to the 80 digit mode or 1 36 digit mode . PRINT/P C H R$ (20) Sets the printing mode as reduced characters of the normal size printing (80 digit mode). It is called reduced mode or 1 36 digit mode.
3. 1 . 1 8 Arithmetic functions Substitutes the absolute value of variable X into variable A . X may 1 00 A = ABS (X) be either a constant or an expression. ABS (-3) = 3 ABS ( 1 2 ) = 1 2 1 00 A = INT (X) Substitutes the greatest integer which is less than X into variable A.
Substitutes the N characters following the Mth character from the MID $ MID$ (X$ , M, N) beginning of string variable X$ into string variable B$. C$ = RIGHT$ (X$, N) Substitutes the last N characters of string variable X$ into string RIGHT $ variable C$.
3.1 .21 Arithmetic operators The number to the left of each operator indicates its operational priority. Any group of operations enclosed in parentheses has first priority. x · y • · 1 0 A = (power) Substitutes into variable A. (If X is negative and Y is not an integer, an e rror results.) (j - Note that "-"...
A comma is used to separate two variables. 320 A$ = "SHA RP BASIC" Indicates that characters between double quotation marks form a 330 B$ = "MZ-80B" string constant . 340 C$= "ABC " + "C HR$ (3) Indicates that the variable followed by a dollar sign is a string vari...
3. 2 Specifications of double precision BASIC SB-6610 interpreter • Type Interpreter system Program siz e : about 1 6 . 5K bytes Start address: $ 1 2 20 (hexadecimal) • Numeric d ata BCD floating point system Real num ber : + l E-4 8 +9 .
• S tring variable Kinds of string variable s : String variable One-dimension al string variable Two-dimensional string variable Format : A string variable is expressed by a name following $ . Requirements for string variable name are the same as those for numeric variable. Example : A $ , ST$ and Nl $ are normal string variables.
APPENDIX The Appendix includes the follo wing; • ASCII Code Table ..Table A. 7 • DISK BASIC interpreter SB-667 0 Error Message Table ..Table A . 2 This table list all the possible errors which may occur during program execution. The interpreter notifies the operator of occurrence of an error during program execution or operation in the direct mode with the corresponding error number.
ASCII Code Table Code in parentheses represents a hexadecimal code. (34) 1 0 4 (68 ) (00 ) ( I A) (4E) [§] ( 69) (3 5 ) (0 1 ) (4F) ( I B) 1 0 5 [!_] 1 06 ( 6A) ( 3 6 ) (02)
A 2 . Error Message Table Syntax error Operation result overflow Illegal data Data type mismatch String length exceeded 2 5 5 characters Insufficient memory capacity The size of an array defined was larger than that d efined previously. The length of a BASIC text line was too long. The num ber o f levels of GO SUB nests exceeded 1 5 .
OBJ file "Utility" on the master diskette. Be s � re to keep the m aster diskette in a safe place . All optional blank diskettes supplied by the Sharp Co. are not initialized. Be sure to initialize them before use.
T I N S E 00 1 8PAZZ 8 1 0429-500-K Pri nted in Japan SHAR P COR PORATION...
Dl R instruction. If the disket is replaced SAVE SAVE with another one immediately after the instruction and the instruction is executed again, the contents of the replaced new disket will be destroyed. SHARP CORPORATION Printed in Japan...