r:: r:: r:: r::: r::: r::: r::: r::: r::: r::: • - 1 Personal Computer IIIZ - b'illHID DISK BASIC MANUAL SHARP
DISK BASIC Manual
Introductory Note This manual is based upon the DISK BASIC Interpreter MZ-2Z009, the system software of the MZ-700 personal computer. (1) The DISK BASIC interpreter MZ-2Z009 includes all commands of the MZ-700 BASIC 1Z-013B. In other words, the DISK BASIC is an expansion of the BASIC 1Z-013B. (2) For the multi-purpose MZ-700 personal computer, the system software is completely supported by a software pack (cassette tape, floppy disk, etc.) in the file form.
Introduction We want to take this opportunity to thank you for purchasing the Sharp DISK BASIC system software. The manual provides a general explanation of the use and programming of the DISK BASIC system software for the personal computer. This system software is provided in the floppy disk format, and careful attention should be given to the proper use and handling of the disk drive and the disks themselves.
• Difference between the CASSETTE TAPE BASIC and DISK BASIC. The following commands are extended and supplemented in the difference between the CASSETIE TAPE BASIC and DISK BASIC. Extension Page Supplement Page Supplement Page RUN ....................... 36 DIR ........................ 35 XOR ....................... 65 LOAD ..................... 37 LOCK ..................... 40 N()T ....................... 65 SAVE ...................... 38 UNLOCK ................ 41 OR ........................
CAS·SETTE TAPE BASIC DISK BASIC CONT is possible after execution of END statement. CONT is not possible after execution of END statement. IcrRLI + I]] has not effect. IcrRLI + I]] initialize the color and console, Neglects space between reserved words; considers GO~TO~lO as GOTO~ 10. aaQ il!iIlIilW~iI PbS:;r 8~. Does not neglect space between reserved words. Does not consider GO~TO~lO as GOTO~lO.
• Increase of floppy 'disk interface- ROM • Floppy disk drive control ROM If the DISK BASIC controls the floppy disk drive (MZ-1F02), connect the ROM chip (see below) which is packed together with the DISK BASIC to the socket of the floppy disk interface (MZ-IEOS: optional). If this ROM is not connected to the floppy disk interface, the floppy disk drive cannot be controlled. Note the following points when connecting the ROM to the interface: • Take care not to drop, scratch or otherwise damage the ROM.
Contents What the DISK BASIC is .................................................................... : ....... 10 Section 1: DISK BASIC Outline ................................................................. 13 1.1 Starting the DISK BASIC ................................................................. 14 1.2 How to Copy the DISK BASIC ......................................................... 15 1.3 File Control ...................................................................................
CLOSE # ................................................................................................ 53 KILL # ................................................... :............................................... 54 DEFAULT .............................................................................................. 55 EOF(#) .................................................................................................. 56 LABEL ........................................................................
5.1.4 BRD control statements ................................................................... 87 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.10 5.1.11 Error processing statements .............................................................. Substitution statements .................................................................... Input/output and color control statements ............................................ Loop statements .......................................................................... : .
10 What the DISK BASIC is The DISK BASIC has a strong file control function relative to the cassette base . BASIC. For example, it makes the most of the features of a disk base which has high-speed read-outlwrite-in capabilities, and, more than simply serving for data storage, the file makes it possible to use the data area directly connected to the computer system.
11 • Data file control There are two types of data files, depending upon the format of file access (the method of data read-out and write-in). One is called the sequential access file and the other is called the random access file. With the sequential access file, the file data access is treated as one sequential block. The file name is specified for one group of data, and such data are accessed in order from the heading at the time of registration or read-out of the file.
12 • Program file control The BASIC program file control commands CHAIN (page 44) and SWAP (page 45) are for read-out of another program in the memory during the execution of one program and moving the control to that program. As shown in the figure below, CHAIN has the same function as the . (For detailed information, please refer to page 26.) file "DEF" file "ABC" PRINT "MZ-700" 10 20 ,.
Section 1 DISK BASIC OUTLINE This section explains the features of the DISK BASIC and outlines the file controls. First of all is an explanation of the DISK BASIC starting method. Section 2 includes a syntax explanation of the new commands and statements which the DISK BASIC has, and Section 5 includes a summary of all commands, statements, functions and operations which it has.
14 1.1 • Starting the DISK BASIC To make the DISK BASIC run, first perform initial loading by the IPL (Initial Program Loader). The initial loading is easily executed. With the floppy disk drive connected to the computer, switch the power supply ON and then set the disk in which the DISK BASIC is included to drive number 1 (FDl). After making the setting, the DISK BASIC will start when the power supply of the computer is switched ON and F is input.
, 15 key is registered by this file name on the supported master disk. In addition, because the NEW command is at the end of this program, "READY" is displayed after execution, and the text is erased before the cursor begins flashing. (Here, try the execution of LOAD "AUTO RUN" and check the list.) If you want to start a certain program after the start of the DISK BASIC, the file name of that program should be saved on the master disk as "AUTO RUN." 1.
16 FD For mat I Copy Ut i l i t Y [ Funct i on I di s k For mat F Copy d i s k C Bo ot I [ Co mma n d *- are a VX. xx I Insert the floppy disk prepared into drive number 2. When "F" is pressed, the screen becomes as follows and the drive number is asked, so specify number 2. *F .............................. .. Drive No.?2 OKI Input the drive number. In this instance, the drive number is 2. When the drive number is input, the *_. . . . . . . . .. . . . .. .. .
17 *111.................................... If N is input, changes to the condition of awaiting the next command, and, if Y is input, the floppy disk is initialized and changes to the condition of awaiting the next command. If C is input, the screen becomes as follows: * C ............................. Copies the entire floppy disk. Source Drive NO.?1 ............ Specifies the drive of the inserted source disk (original disk) (drive number 1, in this instance). De s t n a t ion D r i ve No.? 2 ...
18 Sequential Access File } data file DISK BASIC BASIC Text Files --:---r-------. L .. _ _ _ } program file. Machine Language Program Files As the various file control commands are explained, first the preparation method, the use, and the features of the 2 types of data files will be explained, followed by an explanation of the use of the CHAIN and SWAP commands of the program files. 1.
19 i File call (data read-out) DISK BASIC CASSETIE BASE BASIC ROPEN #n, "fjJename" INPUT #n, variable CLOSE #n IF EOF (#n) THEN File open command Data read-out command File close command File end detection ROPEN "fjJename" INPUTfT variable CLOSE -- As you can see, comparison of the various commands shows an almost I-to-l relationship. Note, however, that DISK BASIC commands always include elements #n. These numbers are called logical numbers, and must always be designated for DISK BASIC file access.
, 20 The reason that the space used for each name and each address is of various lengths is because the data registered by sequential access are not usually of a fixed length; the length varies according to the data. For the random access files, to be explained later, all data are stored in boxes of a fixed length of 32 bytes.
• 21 • To find the data end What would happen if the data being read-out in order from the file surpass the number of data registered? In this case, an error does not occur. And a zero or blank is set in the read-out variable, but there is a special function EOF (#n) (page 56) which can detect the data end. When there is a data read-out by an INPUT command, EOF (#n) becomes a true condition when there is no data.
22 Problem 2 Divide, and re-register, the BSD file "ADDRESS LIST" into two: a BSD file which registers names only and a BSD file which registers addresses only.
23 i 1.5 Random Access File Control Random access files are data files in which the registration or read-out of data is in the random access format. The randoll\ access format is the format in which the access is done by specifying the array format. In other words, compared to the sequential access format in which access must be from the heading of the data, the random access format can be used for access to any data in the file at random.
24 11 may be once closed and in the registered.condition, that same file can be made larger. The random access file "RND 1", for example, in which up to 20 expressions have been registered, can be enlarged to a file with 30 "boxes" by registering data as 30 new expressions. "RND I" 1 2 3 a In addition, . data are registered by -----1~ expression = 30.
25 The random access file prepared in that way would be as follows. If product no. K=12, 5 data are registered in elements corresponding to array expressions 56 - 60. Data position a expression KJl:5-4} _ _ _ K=12 d ata ~ 55 56 57 N$ ..... product name p ..... unit price S ..... inventory count T ..... total amount C$ ..... comment 58 59 60 BRD file "STORE LIST" 61 In this way, then, data can be set in any specified array in the file.
26 1.6 Program Chain (CHAIN) Next, following the data file control commands, will be an explanation of program file controls. The commands explained here are CHAIN (page 44) and SWAP (page 45). When these commands are used, the program is registered on the floppy disk in job units and, while the program is being run, a separate program can be read-out and control moved to it, i.e.
27 1.7 Program Swap (SWAP) Program files on the floppy disk are read-in to the memory, and control is moved to this program, by SWAP command but, when this program is finished, the original program (the program which did the SWAP command) can be reset. This movement is exactly in the same way as the sub-routine in the program, and the reset to the original program becomes a return to the next command, which did the SWAP command. As a result, the SWAP command can be taken as .
28 Program file "PLAYER" 10 REM 20 MUSI C CELLO 30 PRI NT"OK7" 40 E NO PLAYER M1$, M2$, M3$ On slave disk in drive number 2 First, "COMPOSER" is within text area and is executed. Dr:ve ~ Text area 2 File Corn oser "PL:'{'y THE CELLO" "PLAYER" The text is first shunted to the disk in FDl taking DIR by the SWAP command of line number 60, and the area is made NEW. r----------,~r-l~lr(C~O-M-P-O~SE~R~)1 I I2 1--_NEW _ _- - ' . "PLAYER" . Next, BTX "PLAYER" is overlaid and executed.
29 161 ABS ............................... MZ K] GET ............................... MZ AND ................................ 65 GOSUB .......................... MZ ASC ............................... MZ GOTO ............................ MZ ATN ............................... MZ GPRINT ......................... MZ AUTO ............................ MZ !HI HSET ............................ MZ AXIS .............................. MZ rn IF .................................. MZ !HI ByE· .........
30 MOVE ............................ MZ 1Nl RLINE ........................... MZ MUSIC ........................... MZ RMOVE ......................... MZ NEW .............................. MZ RND .............................. MZ NEXT ............................. MZ ROPEN # ......................... 46 NOT ................................. 65 IQ] ~ ON ................................. MZ SAVE ............................... 38 OR ................................... 65 SEARCH ..................
31 ~----------------------~--------------------------~--~~ 1.9 Table of File Input/Output Devices Indicates the DISK BASIC descriptors .' Floppy disk Cassette tape RS232C FDl: - FD4: CMT: RS1: - RS2: CHAIN CLOSE # DEFAULT DELETFlRENAME DIR INIT INPUT # KILL # LOAD/SAVE LOCKlUNLOCK MERGE PRINT # ROPEN # RUN SWAP WOPEN# XOPEN # 0 0 O· 0 0 x 0 0 0 0 0 0 0 0 0 0 0 O. 0 0 x 0 0 x x 0 0 OPEN limit OPEN is possible for as many as 10 devices.
32 DEF KE Y( 1 ) =" RUN DEF KE Y( 2) =" II ST" DEF KE Y( 3) =" AUTO" +CHR$(13) DEF KEY(4) ="RENUM" DEF KE Y( 5) =" 01 R" DEF KE Y( 6) ="CHR$( " DEF KE Y( 7) ="DEFKEY(" DEF KE Y( 8) ="CONT" DEF KE Y( 9) =" SAVE DEF KEY( 10) ="lOAD • eRT display related 1) Character display mode: normal (background: black) 2) Character display digit count: 40 characters/line 3) Character display scrolling area: maximum (from line 0 to line 24) • Internal clock Starts at TI$="OOOOOO" initialization • Mus
Section 2 DISK BASIC EXPANSION, NEW COMMANDS AND STATEMENTS
34 In this section each statement, function and system variable is explained. How to describe is explained in FORMAT. This symbols have the following meanings: < > : Indicates the general description, such as, variables and data. Describes the most generic meaning. Notes: includes . includes and . includes and . [1 : Indicates that tlie part enclosed by [ 1can be omitted. [ 1 ...
35 DIR (directory) Displays directory contents. i Format: i, DIR [/P] [] II Note: Only FDn device name. 11 Abbreviated form: !II DI. i I' Explanation: • Displays information, i.e., directory contents, relative to files registered in each device. • When the is abbreviated, the device is considered to be designated by DEFAULT statement. • When JP is described, the contents of the directory are output to the printer.
36 I RUN (run) Executes the I!rogrilm. Format: RU N " [ :] " [{ ~:~~f ] Note: Only FDn or CMT device name. Abbreviated form: R. Explanation: • When a description of the follows the RUN command, BASIC is initialized (same as NEW command), the BASIC program memorized as a file is read out, and then the program from the heading is executed, continuing to the floppy disk, etc. • For RUN only, the program within the text area is executed.
37 LOAD (load) Reads out the program file. Format: LOAD" [ :] " [<,A>] Note: Only FDn or CMT device name Abbreviatied form: LO. Explanation: • Reads out program from external memory device. • Specifies the file to be read out depending upon the and description. • If the device specified by the DEFAULT statement is designated, the can be omitted.
38 SAVE (save) Registers the program as a file. Format: SAVE" [ :] " [<,A>] Note: Only FDn or CMT device name. Abbreviated form: SA. Explanation: • Registers the program as a file on the floppy disk, etc. • If the device designated by the DEFAULT statement is specified, the can be omitted. • If option "A" is applied, the SAVE is as ASCiI format.
39 DELETE (delete) Deletes desianated file. Format: DELETE" [ :] n Note: Only FDn device name. Abbreviated form: D. Explanation: • When the device name is omitted, processing proceeds relative to device designated by DEFAULT statement. Example: DELETE "FD1: SAMPLE" ..... Deletes "SAMPLE" file of floppy disk (drive number 1).
40 LOCK (lock) Perform the protection (lock) of the file. Format: LOCK " [ : ] " Note: Only FDn device name. Abbreviated form: LOC. Explanation: • If the file is locked, this file is fixed on the floppy disk and it will not accept any change commands. For instance, DELETE and RENAME commands and data write-in are prohibited. Put a lock on any file which you don't want to destroy or change.
41 UNLOCK (unlock) Unlocks the specified locked file. Format: UNLOCK" [ :] " Note: Only FDn device name. Explanation • Unlocks the specified locked file. Example: UNLOCK "SAMPLE" .....
42 I RENAME \rename) Changes the filename. - Format: RENAME • [ :] • " " , " " Note: Only FDn device name. Abbreviated form: RENA. Explanation: • The file name change specifies the current filename and the new filename, in that order. • The new file name becomes an error if a file of the same name exists in that device. Example: RENAME "F01: OLOPROG", "NEWPROG" ..... The filename "OLDPROG" in the floppy disk file is changed to "NEWPROG".
43 MERGE (merge) A-,»rogram in the file is added to a program in the memory.. Format: MERGE [" [ :] < filename > "] [<,A>] Note: Only FDn or CMT device name. Abbreviated form: ME. Explanation: • Reads in the program in the file designated by the , adding it after the progra~ currently in the memory. • If the is omitted, the file of the device designated by the DEFAULT statement will be read in.
44 CHAIN (chain) Movement of execution from active program to program in file Format: CHAIN" [ :] " Note: Only FDn or CMT device name. Abbreviated form: CH. Explanation: • The execution of the program is moved from the currently active program to a different program in the file. • The CHAIN statement is also considered to be a file opening. • Although the CHAIN statement has a function similar to the execution of the RUN command in a program, the variables, arrays, etc.
45 SWAP (swap) Calls out a program in the file during execution of the program. Format: SWAP 11 [ :] 11 Note: Only FDn device name. Abbreviated form: SW. Explanation: • Subroutine calls separate program in file from program being executed. Program in program area is temporarily evacuated to vacant area in floppy disk, and called program is read into text area. The original variable in the text area at this time is transferred to the called program. (See page 27.
46 ROPEN # (read open) Opens the BSO file for read-out. Format: ROPEN # , "[:] < filename> " Note: Only FDn, CMT, or RSn device name. Abbreviated form: RO.# Explanation: • Opens the file so that filed data can be read out. • The ROPEN # statement has an order for data read-out; it specifies the file to be read out, specifying by and . • When the is omitted, the device designated by the DEFAULT statement is specified.
47 INPUT # (Input) Reads out data from BSO file. Format: INPUT # ,,, ..... Abbreviated form: 1.# Explanation: • Reads out data in sequence from heading of file opened for read-out by ROPEN # statement and is set to . • may be array element. • The file which reads out the data becomes the file set to by ROPEN # statement.
48 WOPEN # (write open) Opens the files for write-in. Format: WOPEN # , " [ :] " Note: Only FDn, CMT, or RSn device name. Abbreviated form: WO. # Explanation: • This is a statement to prepare for file write-in; it specifies the file's logical number and name. • If the is omitted, processing occurs relative to the device specified by the DEFAULT statement. • When RS is specified for the device' name, the filename can be omitted.
49 PRINT # (print) Writes data in BSD files. Format: PRINT # , [, ] ... Abbreviated form: R.# Explanation: • Writes data in order into files opened by the WOPEN # statement for write-in. • Files into which data are to be written are to be correctly specified by the logical number when opened. • (Data) are numerical value data or character data. Example: 10 WOPEN # 1 , " DATA" 20 PRI NT # 1 , 1 , 2, 3 30 CLOS 40 END #1 .....
50 XOPEN # (cross open) Opens BRD file for read-out and Format: XOPEN # ," [ :] " Note: Only FDn device name. Abbreviated form: X.# Explanation: Opens the random access data file (BRD), and opens (cross opens) theread-out/writein of the random access data. Newly registers BRD files, prepares for data read-out from, and new data write-in to, the BRD file, and defines the logical number for file access.
51 INPUT # ( )(input) Reads out data from BRD file. Format: INPUT # , «data element number», [,, ... ] Abbreviated form: 1.#( ) Explanation: • The data of the position designated by the data element number are read from the file cross-opened by the XOPEN # statement into the designated variable. It makes no difference if the variable is an array variable. • The file which reads out the data becomes the file set to by the XOPEN # statement.
52 PRINT # ( ) (print) Writes in data to BRD files. Format: PRINT # , «data element number», [, , ... ] Abbreviated form: P.#( ) Explanation: Writes in contents specified by variable or numerical value to data position specified by data element number from file cross opened by XOPEN # statement. Variable may be array variable. The file which writes in the data becomes the file specified to (logical number) by the XOPEN # statement.
53 CLOSE # (close) Closes the file. Format: CLOSE [# ] Abbreviated form: CLO.# Explanation: • Closes the data file opened by the logical number; returns this number to the non-define a condition. • CLOSE relative to XOPEN # Closes the BRD file opened for read-outlwrite-in and returns all logical numbers used to the non-defined condition. • CLOSE relative to WOPEN # Registers formally the BSD file opened for write-in; and returns the logical number used to the non-defined condition.
54 I KILL # (kill) Stops file registration. Format: KILL [# ] Abbreviated form: KI.# Explanation: • Stops registration of the file opened to . In other words, the file making is prepared by the XOPEN # or WOPEN # statement, or stops, during registration, the formal registration of the file thereafter executing the PRINT # ( ) or PRINT #.
55 DEFAULT (default) Sets device names. Format: DEFAULT" : " Note: Only FDn, CMT, or RSn device name. Abbreviated form: OEF. Explanation: • Defines available device name if is omitted by command statement. • The device name reading DISK BASIC is defined in FDl. • Device names are as follows. F On : floppy disk (n = 1 - 4) C MT : cassette tape RS{; \: RS-232C interface (n = 1 - 2) Examples: DEFAULT "CMT:" .....
56 EOF (#) (end of file) Function to locate end of data file data. Format: EOF (#
57 LABEL (label) Sets the label. Format: LABEL"
58 WAIT (wait) Interrupts the program execution for a definite time. Format: WAIT Abbreviated form: W. Explanation: • Interrupts the program execution for the time period specified by (numerical data). The unit is 111000 second. Example: 10 WAI T 100 ..... Interrupts the program execution for 0.1 (100/1000) second.
59 SEARCH (search) Searches the character data through the text. Format: SEARCH [IP) Abbreviated form: SE. Explanation: • Searches for and finds the character data specified in the through the program text and displays it on the screen. • When the space key is pressed during execution, the display stops temporarily; when the key is pressed once again, the execution is started again. • The execution is stopped by ISHIFTI + IBREAKI .
60 INIT (Initialize) Sets the RS mode. Format: INIT"RS{~ } , (,] " Explanation: • Sets the mode of RS-232C 7 6 5 lID DCD reception monitoring DCD transmission monitoring CTS transmission monitoring Not used. Usually O. RTS OFF transmission enable. All character transmission out monitoring. 5 4 3 2 o 1..-_ _ _ p . anty L _______ .
61 To exchange information between two MZ-700s, prepare a cable provided with the following connections: Signal name Pin number TXD 2 RXD 3 RTS 4 ers 5 DTR 6 DCD 7 Ground 1,8 --~-- Pin number Signal name 2 TXD 3 RXD 4 RTS ~-- 7~ 5 crs 6 DTR 7 DCD 1,8 Ground • Both are used in the terminal mode. (Refer to RS-232C user's manual.
62 USR (user) Calls out and executes in BASIC the machine language program. Format: USR «address> , ,
63 INP@ (input) Inputs data at 110ports to variables. Format: INP@ , Abbreviated form: I.@ Explanation: • Inputs 8-bit data from input port and sets to the value (0 - 255) converted to a decimal number . • From 0 to 127 ($00 - $7F in hexadecimal), the can be determined freely. From 128 to 255 ($FO - $80 in hexadecimal), the use is exclusively as ports for external devices.
64 IOUT@(OUT) Outputs data to 1/0 ports. Format: OUT @ , Abbreviated form: OU.@ Explanation: • Converts values (0 - 255) to binary numbers and outputs to the output port. • From 0 to 127 ($00 - $7F in hexadecimal), the can be determined freely. From 128 to 255 ($FO - $80 in hexadecimal), tne use is exclusively as ports for external devices. • For control of peripheral devices, etc., data are output to 110 ports.
65 • Logical operation Logical operation The task of giving YES or ON results, by judgment, are not few in computers. Here let us consider some logical expressions used to judge some conditions. The logical operators NOT, AND, OR and XOR are used in logical expressions.
Section 3 BASIC MONITOR FUNCTIONS
In order to make the input of machine language programs easier, the DISK BASIC has a monitor section following the IOCS section. As the stack work area, $FFOO - $FFFF (hexadecimal) are used. This monitor, in the same way as the BASIC, has a built-in screen editor, and, by using the editing format described below, any address of the main memory 64K bytes can be rewritten. 3.1 EDITING FORMAT : Address = dataL-JdataL-Jdata : (Colon) ..... a symbol which indicates an editable line Address .....
3.3 DUMP CD Command} * D J> Displays the memory contents. When the final address is omitted, 128 bytes from the heading address are displayed. When the heading address is omitted, 128 bytes from the subsequent address are displayed. Dumping is by the following format. : HHHH=HH'-JHH'-JHH HH HH HH HH HH t ~--------------~v---------------~ Heading address 8-byte hexadecimal data I ABCDE. G.
3.5 FIND (F Command) *F L.JL.JL.J[] Searches from the heading address to the final address for continuous data of the number specified by the data, and, if found, outputs that address and data at the dump mode. Stopped by ISHIFrI + IBREAKI. 3.6 GOSUB (G Command) *G Sub-routine calls the designated call address. Stack pointer is at FFFE (hexadecimal). 3.7 TRANSFER (T Command) *T L.
3.9 LOAD (L Command) * L [ : fllaname) Loads the designated file from the designated device name. When the heading address is specified, loading is from that address; if not specified, loading of information is done exactly as it was saved. If filename is not specified, the first file found is loaded. When there is BREAK or if check sum error appears, ERR? is displayed, and returns to awaiting command; if no error appears, returns to awaiting command. 3.
Section 4 APPLICATION PROGRAMS
74 Use of the File Converter • The file converter is registered on the DISK BASIC floppy disk by the "TRANS" file name. To execute this, press the following keys (RUN: refer to page 36) RUN "TRANS" ICRI The specification items which appear on the initial screen are specified in order from the top. Choose the right item number from the menu area specification contents and make the key input. The specification item and the initial screen become as follows. F i le Convert [Source) Specification items '.
75 • Explanation of contents and specification method of menu area display * System menu • Specify the source system (the destination system is fixed in the MZ-7(0). The source program specification inputs: Which MZ series machine was the program made for? For instance, if the program file converter is for the MZ-SOK, and moreover if it is made by double precision the DISK BASIC (W-PREC), key input "3".
76 * Device menu • Specifies the device name (source device, destination device) to perform conversion. Display contents Menu display area {Devi ce menu] 5. CMT ~ 1 . F D1: 2. F D2: 3. F D3! 4. F D4: * File mode • Displays the file mode conversion possibilities specified in the system menu and device. However, the destination file mode is made automatically possible file mode from the specification of source file mode. Display contents Menu display area {F i I e MOde] 1. OBJ ·... ,t·, 2. BTX 3.
77 Display contents Menu display area * Fi I e Co~~rol -A J£:):r.cz.c..~or1 i n put ? n a me ==> Display mode Example of display when I CTRL I + refe, ~o File 01 RECTORY OBJ f "t key input and device ''1'' (FD) is specified. Convert OF Ut lity Any key. FD: "DATAl" Funct i on Next and, 1 ~age" ..I. Anv, .k.;8)1' Error •• ssale COlYert * Related IIii is pc;..'11L J '-i alain, [Y/N] ? to the message Funct i on and, 1 Any Returns to the file name input waiting key.
78 Reference: If, for file conversion, the source drive and destination drive are the same, the following display is added. Display: SeJ I 1. 1~1"""t source, I<.~t dest i nat ion, Any key a:!Il or ~Q•.\' [ 1. An y key a:!Il J Explanation: The above display occurs if the input of the destination file has ended. First, there will be a display meaning "insert the source disk", and then, after the source disk is inserted into the disk drive, press a key (any key).
79 After the end of either message display, there will be a display meaning "will conversion be made again? or will conversion be ended?". If conversion will be made again, input "Y", if the end, input "N". When "Y" is input, there will be a return to the initial screen used for convert execution, and, when "N" is input, there will be a return to the monitor condition. , . ....
Section 5 DISK BASIC SUMMARY
82 5.1 Summary of DISK BASIC Commands, Statements, Functions and Operations 5.1.1 Commands DIR DIR Displays floppy disk directory. Information indicated at directory display is as follows: Registered filemode, registration condition (locked or not) and filename Note: For the directory display on the CRT screen, there is a stop when one screen amount is displayed, and the cursor appears. To continue the directory display the ~ key can be pushed, or it is possible to move to another command.
83 SAVE SAVE" FDl : DAY" Names the BASIC text currently in the text area "DAY" and writes in to floppy disk. One file with filename "DAY" and file mode BTX is registered. SAVE "CMT:E" Names the BASIC text currently in the text area "E" and writes in to the cassette tape. RUN RUN Executes the program from the heading of the BASIC text currently in the text area. Note: At the RUN command, all variables become 0 or null immediately prior to program execution.
84 RENUM RENUM Changes statement number of the program. RENUM 100 Renumbers all statements beginning with first statement number 100, and in steps of 10. SEARCH SEARCH NEW NEW n ABC 11 Searches for and finds lines including "ABC" character data in program text, and displays on screen. Erases BASIC text currently in text area and clears variable area. Machine language area specified by LIMIT command is not cleared. CONT CONT Continues program execution.
85 RENAME RENAME· FD1 :A.B • Changes file name of file "A" in floppy disk drive number 1 to filename "B". DELETE DELETE HA" Deletes file "A" from disk in default drive. CHAIN CHAIN "FD1 :TEXT Chains program execution to BASIC text "TEXT B" in BH floppy disk. In other words, "TEXT B" is read out to BASIC text area, and program execution contin'ues from that heading.
86 5.1.3 BSD (BASIC Sequential Access, Data File) Control Statements Note: For file descriptors FD and CMT WOPEN # WOPEN #3 "FD2:S Opens the file for write-in so that one BASIC sequential EO DATA 1" access file (BSD) can be made. In other words, it defines the filename of the BSD being made as "SEQ DATAl", and opens, as logical number 3, a file in floppy disk drive number 2. PRINT # PRINT #3. A.
87 CLOSE # CLOSE #4 Closes the BSD; the file opened in logical number 4 by (Corresponding to the ROPEN # statement. ROPEN #) Logical number 4 becomes undefined once more. 5.1.4 BRD (BASIC Random Access, Data File) Control Statements Note: For file descriptor FD only. XOPEN # XOPEN #5 "FD3:D Opens (cross opens) for data write-inlread-out to the ATA R1 BASIC random access file (BRD).
88 KILL # Kills the BRD opened in logical number 5 by the XOPEN KILL #5 # statement. IFEOF (#) KILL Kills all files opened by WOPEN, ROPEN or XOPEN. IF EOF (#5) THEN If the file end occurs during execution of the INPUT # 700 statement relative to BSD, or during execution of the INPUT # ( ) statement relative to BRD, this is a branch statement that commands to jump to the processing routine in statement number 700. 5.1.
89 5.1.1 Substitution Statements LET LET A=X+3 Substitutes sum results of numerical variable X and numerical data 3 to numerical variable A. LET can be omitted. 5.1.7 Input/Output and Color Control Statements COLOR 10 CaLOR .•. 2 Changes all screen background color to red. 20 CaLOR 3.2.7 Changes the color of characters at coordinates (3,2) to white. 30 CaLOR 4.204.2 Makes the color of characters at coordinates (4,2) green, and the background color red.
90 40 INPUT X, XS, y, YS Numerical variables and string variables can be combined by using the comma ( , ) to separate them, but it is necessary to match the type of variable at the time of input. SET RESET GET SET 30,15 Illuminates the position of coordinates (30,15). RESET 30,15 Er!Ules the position of coordinates (30,15). 10 GET N Inputs one numerical character from the keyboard relative to numerical variable N. If the key is not pressed at that time, 0 is input.
91 5.1.8 Loop statements FOR- TO NEXT 10 FOR A == 1 TO The statement number 10 is a command to change variable A and substitute for values from 1 to 10; the 10 20 PRINT A value of the first A becomes 1. Because the value of A is 30 NEXT A displayed on the eRT screen by statement number 20, the numeral 1 is displayed. Next, the value of A becomes 2 by statement number 30, and this loop is repeated. The loop is repeated in this way until the value of A becomes 10.
92 5.1.9 Branch Statements GOTO 100 GOTO 200 Jumps to statement number 200 (= movement of program execution). GOSUB - 100 GOSUB 700 Branches to statement number 700 subroutine (calling of subroutine). Ends subroutine execution by RETURN RETURN statement, and returns to statement following GOSUB 800 RETURN command in the main program. IF - THEN 10 IF A>20 THEN Jumps to statement number 200 if variable A is larger than 20. Executes next statement if A is 20 or less.
93 5.1.10 Definition Statements DIM 10 DIM A(20) For one-dimensional numerical array variable A( ), 21 array variables become available, from A(O) to A(20). 20 DIM B(79,79) For two-dimensional numerical array variable 8( ),6400 array variables become available, from 8(0, 0) to 8(79, 79). 30 DIM C1$(10) For one-dimensional string array variable C1$( ), 11 array variables become available, from C1$(0) to C1$(10).
94 DEF KEY 15 DEF KEY(1) = "L The DEF KEY statement of statement number 15 defines 1ST" -+- CHRS(13) the function LIST IQY to 25 DEF KEY(2) =" L function key number 1, and statement number 25 defines OAD:RUN" + the function LOAD:RUN IQY. CHRS (13) INIT INIT" RS1:" Sets the RS-232C mode. LABEL 210 LABEL "SUB" Defines subroutine name beginning from statement number 210 as "SUB". 220 5.1.
95 CONSOLE 10 CONSOLE 0, 25, The scroll range covers the whole screen. 0, 40 20 CONSOLE 5, 15 Specifies the scroll range from the 5th line to the lOth line. 30 CONSOLE 0, 25, Specifies the scroll range from the 5th line to the 30th 5,30 line. 40 CONSOLE 0, 10, Specifies the scroll range to a 10x 10 range. 0, 10 50 CONSOLE 2, 20, Specifies the scroll range to the scroll range shown in the 2, 35 figure below.
96 5.1.13 Machine Language Program Control Statements Substitutes data at port number $E8 for variable A. INP@ INP@ $E8,A OUT@ OUT@ $E8,A Outputs variable A to port number $E8. LIMIT 100 LIMIT 49151 Limits the area used by the BASIC program to the 49151 address (BFFF with hexadecimal notation). 100 LIMIT A Limits the area used by the BASIC program to the address of variable A. 100 LIMIT $BFFF Limits the area used by the BASIC program to the address BFFF in hexadecimal notation.
97 5.1.14 Printer Control Statements Valid in GRAPH mode. AXIS 30 AXIS O. -10. 48 Adds a scale of 48 graduations in increments of 10 to the Y-coordinate axis from the current pen position. 50 AXIS 1. 10. 48 Adds a scale of 48 graduations in increments of 10 to the X-coordinate axis from the current pen position. Valid in GRAPH mode CIRCLE 50 CIRCLE O. O. 240. Draws a circle (radius 240) from coordinates (0,0). 0.360. O. 2 Valid in GRAPH mode. GPRINT 30 GPRINT (2.2).
98 RMOVE Valid in GRAPH mode. 20 RMOVE -240. 240 Moves the pen upward relatively from the current pen position by -240 (X direction) and 240 (Y direction). PAGE Valid in TEXT mode. Specifies 30 lines per page. 10 PAGE 30 Valid in both TEXT and GRAPH mode PCOLOR Prints "ABC" to the plotter printer in blue. 10 PCOlOR 1 20 PR INT/P "ABC" Moves the pen upward from the current pen position and PHOME returns to the starting point.
99 LN 100 A = LN (X) Regarding the value of '9ariable X, gets natural logarithm IO!!e X and substitutes for variable A. X must be a positive value. 110 A = LOG (X)/L OG(Y) 120 A = LN (X)/LN In order to obtain logy X when the logarithm base is Y, it can be obtained by statement number 110 or statement number 120. (Y) RND 100 A=RND (1) When there is a positive integral number in parentheses, 110 B=RND (10) such as in statement number 100 or 110, generates a random number using values from 0.
100 5.1.15 String Control Functions LEFfS 10 A$ = LEFT$ (X$, Substitutes string variable XS (from beginning to Nth character) for string variable AS. It doesn't matter N) whether N is a constant, variable or numerical formula. = MID$ (X$, Substitutes string variable XS (from Mth character to N N) character) for string variable SS. = RIGHT$ (X Substitutes string variable X$ (from end to N character) MIDS 20 B$ RIGHTS 30 C$ SPC = SPC (N) 60 F$ = CHR$ (A) M.
101 5.1.16 Tab Function TAB 10 PRINT TAB (X);A Displays the value of variable A at the X + 1 character position counting from the left edge of the screen. 5.1.17 Arithmetic Operations The calculation priority is of white figures on dark background at left side, but the calculation of figures in parentheses ( ) has even higher priority. t 10 A = X t Y Substitutes the X t Y calculation result for variable A.
102 < 10 IF A or >< 10 IF A<>F THEN ... If variable A and X are not equal, executes commands from THEN onward. >=or=< 10 IF A>=X THEN <=or=< 10 IF A<=X THEN If variable A is greater than or equal to X, executes commands from THEN onward. * If variable A is smaller than or equal to X, executes commands from THEN onward. * 40 IF (A>X) (8) + 50 IF (A>X) + (8) Y) THEN .......... Y) THEN ..........
103 300 DIM A(20), as J.n,exal1pleUsedin punctU!ltionof,avariable,:. (3,6) " " 320 AS = "DISK BA " "indicates a string content SIC" 330 BS = "MZ-7oo· $ 340 CS = • ABC· + Indicates a string variable. CHRS(3) 500 LIMIT SBFFF Indicates hexadecimal number. 550 S '" SIN The approximate value of pi (3.1415927) is expressed by (X*nl180) l't.
104 5.2 Error Message List (DISK BASIC) Error display number Statement Content 1 Syntax error Error in syntax 2 Overflow error Numerical data outside the range, operation result overflows. 3 Illegal data error Illegal number or variable used. 4 Type mismatch error The data type and variable type do not match. 5 String length error String length exceeds 255 6 Memory capacity error Insufficient memory capacity 7 Array def.
105 Error display number Content Statement 21 Resume error Attempt to use RESUME although no error 24 Read error Use of READ statement withOl(t corresponding DATA statement 25 SWAP JMoeI error Swap level exceeds 1 28 System id error Trying to access file other than DISK BASIC.
106 Error display number Statement Content 61 Illegal file mode error File mode error 63 Out of file error Out of file (file data read-in) 64 Logical number error Non-regulation logical number 65 LPT: not ready Printer not connected 68 Dev.
107 5.3 Memory Map Monitor + 10CS BASIC interpreter . Start address when NEW command is executed Text ~ Text end code "00 00" I/O work area I/O work end code "00" ~ Variable area .. Variable end code "00" String data buffer Temporary String Area t • Free area Stack Calculation work area Free area for user FFOO FFFF Work area for IPL .. ..
... 108 5.4 Use of the Floppy Disk For information regarding the method used for setting the floppy disk and the method of floppy disk drive operation, please refer to the Operation Manual for model MZ-IF02. It should be remembered that a master disk should be handled and used very carefully. Moreover, because Sharp optional floppy disks are not initialized, please initialize them by a utility program before use.
109 • Write information on the index label before attaching it to the jacket. If something must be written on a label which is already attached, use a felt marking pen or similar soft-tip instrument; do not use a pencil or ball-point pen. • Smoking, eating or drinking in the vicinaty of the floppy disk drive or floppy disks should be discouraged, or should be done only if great care is taken that ashes, food particles or liquids do not get into the floppy disk drive or on the floppy disks.
110 A storage box for the master disk is not included. To store it, use a box which is applicable, keeping in mind the conditions stated above . • Avoid holding floppy disks with pager clips, spring clips or any other similar instrument. • Never place any heavy item on top of a floppy disk. Also do not carelessly place them on a desk top, etc. Be sure to always return all floppy disks to their prescribed place for storage immediately after use.
Printed In Japan Gedruckt In Japan Imprlme' au Japon Stampato In Glapporf" SHARP CORPORATION OSAKA, JAPAN 4C