Chapter 6 Cassette Operating System This is a 2K byte program resident in ROM on the 6502 C.P.U. card. It provides support for other programs e.g. a BASIC interpreter by dealing with peripheral devices and allowing programs to be filed on cassette tapes. It is specifically written for the system 2 and it interfaces to the teletext Visual Display Unit interface, a parallel ASCII keyboard and a centronics parallel printer. To start system 2 enter the COS by pressing the reset button (break) on the keyboard. If the system is working the COS will display on the V.D.U. : - Acorn Cos * The star is the COS prompt indicating that it is waiting for the user to type in a command. To the right of it is the flashing cursor at which the characters typed are displayed. Commands must be typed in capital letters only and many keyboards feature a Capital Lock button so that the alphabetic keys always produce an upper case output whilst the numeric and symbolic keys continue to work in shifted or un-shifted mode as usual. On typing a character the V.D.U. will display that character and advance the cursor along one position to the right. Another character may then be entered. Should a character be typed in error it may be corrected by pressing the delete (back space or rub out) key in which case the character to the left of the cursor is erased and the cursor moved back to that position. If desired the whole line may be thrown away by entering control X ie. pressing the control key and X together. A new cursor is displayed and a new line of text can then be entered. After typing a word or some words separated by spaces the displayed text may be entered to the COS by typing return. 6-1 If the text is not a command recognised by the COS it will respond with Com? * The user may then type in more text. If the COS recognises the command but it is not presented in the correct way i.e. its syntax is wrong the display will show Syn? *The COS recognises the following commands any of which may be abbreviated by entering enough of the characters to distinguish it from any other command followed by a full stop. Spaces are used to separate the arguments, unless otherwise stated leading zeroes are not required. The commands are listed giving the command, its full name and its shortest possible abbreviation:- BASIC This command causes execution of the Acorn BASIC interpreter if it is present. Refer to the BASIC manual for explanation of how to use it. If BASIC is not present either in ROM or RAM then the system crashes and must be re-set. LOAD Load from Tape L. The syntax of this command is as follows:LOAD "FILNAME" XXXX The name of the file to be loaded is inside double quotes and may be up to sixteen characters long. Files are normally loaded to where they were originally saved from. The optional four digit hexadecimal address allows relocation to a new section of memory starting at the address specified. On pressing RETURN the COS will respond with 6-2 Play drive 0 The user should now start the cassette recorder in play mode at the desired position on the tape and press the space bar on the keyboard to indicate to the COS that this has been done. The COS will display the names of any files that are on the tape between the starting position and the file that it is searching for. When the file to be loaded is found it is loaded and the COS will then display the * prompt indicating that the loading process is complete and that the recorder may now be stopped and that new commands may now be entered. Files are stored as a number of 256 byte blocks each of which is identified on the tape. If the file to be loaded is part way past the tape heads this is detected at the start of the next block. Loading ceases and the COS displays Rewind drive 0 The user should then stop the tape, rewind it and then press the space bar to which the COS will respond with Play drive 0 The loading process should then be repeated. One error message may be produced sum This indicates that the checksum has failed at the end of a block i.e. a byte or some bytes have not loaded correctly. The * prompt is displayed and the user may rewind the tape and try to re-load if desired. The loading operation may be aborted by pressing the spa ce key. When the COS reaches the end of the block it is loading, loading ceases and the * prompt appears. 6-3 When entered program execution is transferred to the address specified which is obligatory. SAVE Save on Tape S. The syntax of this command is as follows:SAVE "FILNAME" XXXX YYYY ZZZZ The name that the file is to be saved under is inside double quotes and may be up to sixteen characters long. This must be followed by two hexadecimal addresses, the start address and the end address plus one of the section of memory to be saved. The optional third address specifies where execution is passed to after loading the file back using the RUN command. On pressing return the COS will respond with Record drive 0 The user should now start the cassette recorder in record mode at the desired position on the tape and press the space bar on the keyboard to indicate to the COS that this has been done. After the COS has finished outputting to the tape it will respond with the * command and the recorder may then be stopped. The escape does not allow the save sequence to be aborted. Tapes may be created in the system 1 format by omitting the filename, the third address has no significance in this case SAVE XXXX YYYY DRIVE Drive select D. The syntax of this command is DRIVE N where N is 0, 1, 2 or 3. This command is included to maintain compatibility with more advanced operating systems and has no effect in the COS except to change the number printed on the screen which is initially set to 0. 6-5 MON Messages on MO. When entered this command allows messages from the COS to appear in the output stream to the V.D.U. and printer. This is the usual condition after reset. Possible messages are:Rewind drive N Play drive N Record drive N F ILNAME NOMON Messages off N. This command turns off the messages enabling the V.D.U. contents to be preserved and stopping unwanted printouts. CAT Catalogue I. This command allows the display of information about the files on a cassette tape. When entered it will respond with Play drive 0 and after starting the recorder in play mode and pressing the space bar the following display format is produced FILNAME AAAA ZZZZ BBBB CC This is produced everytime the COS enounters the start of a block. AAAA is the start address of the block. ZZZZ is the execution address of the file as used by RUN. BBBB is the block number, blocks are numbered in a file starting at zero. CC is the number of valid bytes in the block, minus one. All these are, of course, in hexadecimal. When a system 1 file is encountered the display is XXXX YYYY 6-6 Here XXXX is the start address and YYYY the end address plus one of the file as used in SAVE. To stop the flow of information press the space bar and stop the recorder. FLOAD Finish loading F. The syntax of this command is FLOAD "FILNAME" XXXX The normal LOAD demands that files are loaded from the start of the first block and will request that the tape is re-wound if started in the middle of the file. FLOAD allows loading to commence from the start of any block in the file. The optional hexadecimal address XXXX specifies the memory address to which the start of the first block is loaded if relocation is required. This is useful after a checksum error has been encountered. The tape may be stopped and re-wound to anypoint prior to the block which produced the error. FLOAD is then used to allow loading to continue and the block identifiers will ensure that blocks are loaded in the correct place. However if the file was being relocated the block identifiers do not specify the correct memory address for that block. In this case CAT can be used to find out which block is next on the tape. Knowing how many 256 byte blocks have been loaded the optional start address for the next block can be calculated and entered in the FLOAD command. USE Use qualifier U. The syntax of this command is USEQ This command is included to maintain compatibility with other operating systems and has no effect at all in the COS Note that the syntax demands that there is no space between USE and the specified qualifier which may be any ASCII character. 6-7 MEM Memory examine-edit M. The syntax of this command is MEM XXXX On pressing return the display will show the address followed by its contents in hexadecimal. If the specified address is in RAM new hexadecimal data may be entered or the return key may be used to obtain a * prompt. Also after MEM either U or V may be entered which increment or decrement the address being examined. In this way machine code programs such as the cassette test may be entered and then executed using the GO command. 6-8