Download The Os++ User`s Manual
Transcript
the RS232 interface software into RAM; optionally, the file can be replaced or extended by a handlers file that loads the disk-based tape handler, see section 14. Third, Fms++ scans the disk for a file named AUTORUN.SYS. The purpose of this last file is to run user application programs, games and other miscellaneous programs. The Os++ system disk contains the BASIC extension DiskIO as AUTORUN.SYS file. 7.5 Loading and Saving Programs from BASIC The disk handler provides a convenient way to load and save BASIC programs from and to disk. The following command saves the current BASIC program in memory to the disk, storing it for later. It gets the file name TEST.BAS under which it will be listed in the disk directory. SAVE "D:TEST.BAS" The program can be restored later on, for example after the computer has been turned off for a while, by LOAD "D:TEST.BAS" The file name TEST.BAS identifies the file on the disk. The SAVE and LOAD command operate on BASIC programs in their tokenized form, where every BASIC instruction has been replaced by a very compact short token. The format is not human readable, but binary, though very compact. Besides in tokenized format, BASIC programs can also be stored in clear-text. This is done by LIST "D:TEST.LST" which is, however, much slower than SAVE because the BASIC interpreter has first to convert the program back from its tokenized form into clear text. The reverse of LIST is ENTER which reads tokenized programs back from disk. However, unlike LOAD, it does not erase the current program from memory, but rather merges the current program with the new program from disk, i.e. lines present on disk will replace the same lines in memory, lines present in the disk version and not present in memory will be added, and lines not available in the disk version stay intact. Usually, this creates a mess, and it is advisable to clear the program memory first by NEW before using ENTER. ENTER "D:TEST.LST" restores a LISTed program from disk. Note that I use here the convention to give LISTed programs the extension .LST. 7.6 File Operations in BASIC BASIC not only allows you to load and save programs from disk, it also allows you to store your data on disk, and retrieve this data later. To this end, you first need to open an I/O channel to a file on disk by means of the OPEN command: OPEN #1,4,0,"D:TAX.DAT" opens channel number one to the file TAX.DAT on disk for reading. A single decimal number can be read from the file by means of the INPUT # instruction: INPUT #1,A This will read the next number from the file to which channel one was opened, and will place this number in the variable A. Finally,