Everything You Always Wanted to Know About DOS but didn't know where to look! Reprinted from CAMS Newsletter To send disk commands: Type - open15,8,15,"command" To send additional commands once the command channel is open: Type - print#15,"command" To close the command channel when finished: Type - close 15 Command examples: print#15,"s0:file1,file2,file3" - scratchs (erases) file1,file2 and file3 from the disk. print#15,"n0:diskname,id" - formats a new disk. Names it "diskname". Assigns each sector an id of "id". diskname max chrs = 16. id = 2 chrs. print#15,"r0:newname=oldname" - renames "oldname" file to "newname" print#15,"v0" - validates/cleans up the disk. print#15,"c0:newfile=oldfile" - copy's/rename's "oldfile" to "newfile" print#15,"n0:cleardisk" - clears already formatted disk. print#15,"i0" - initialize disk. (Reads disk DIR into DOS) Other miscellaneous disk oriented commands: To load a disk directory: load "$",8 - loads DIR from drive 8 into ram. list - lists DIR (or program) in RAM. save"prgname",8 - saves program from ram to drive. (BASIC prg) verify"prgname",8 - double checks/verify's the prg was saved okay. load"filename",8,1 - load a machine language program. WEDGE Commands: A DOS (Disk operating System) or disk drive "wedge" program makes it easier to send disk commands and read the error channel: $ - display disk directory. STOP will BREAK.N CTRL slows. $*=p - display ONLY prg files on disk. $*=s - display ONLY seq files on disk. $*= - display ONLY usr files on disk. $*=r - display ONLY rel files on disk. The C64/C128 uses 4 filetypes: PRG = Program. These generally contain BASIC or ML (machine language) program data but CAN hold othe misc or text data as well. SEQ = Sequential. These files generally hold TEXT data but can also hold misc data. USR = These are similiar to SEQ and can hold program, text and/or misc data. REL = These are a SPECIAL form of file. They are normally used for keeping RECORD's of data. This type of file holds my BBS user file info/data. Back to the wedge commands: Basically the rest of the wedge commands are sent the same as the above print#15 examples EXCEPT that your preface your command text with either a ">" symbol or a "@" symbol. To READ the disk error status (when the red light blinks) hit @ (return) alone and it will display the error message. The error message looks like this: 62, file not found, 00, 00 The 1st # is the DOS error number (2-20 can be ignored[0;31m),[0;37m the 2nd text is the error message, the 3rd field is the TRACK that the error occured @ (if applicable) and the 4th field is the SECTOR the error occured at. (If applicable.) Here's a few examples for sending DOS commands: >s0:file1 - scratch (erase) "file1" from disk. >s0:file1,file2 - scratch up to 3 files this way. >s0:file* - scratch with a wildcard >i0: - initialize disk in drive. (Reads DIR/BAM info) >v0: - validate disk in drive. >(RETURN) - (or @ (RETURN) read/display error status >n0:diskname,01NN - Format disk. Use id of "01" >n0:clerdiskN - c]ear already formatted disk. Disk Doctor programs come in handy as well. These allow you to actually modify data directly on the disk itself, sector at a time. Some quick disk format info: A CBM sector = 256 bytes of data. The 1541 has 35 tracks of data. Each track has 17-21 sectors dependant on whether it's an outside or inside track. (Outside tracks have more room.) The BAM (Block allocated Memory) is track 18, sector 0. The BAM is where the disk keeps track of what track and sectors are being used by programs, data etc. At position 144 on 18/0 is your disk name. This can be changed via a disk doc. (See your GREATEST HITS #1 disk.) Track 18, sector's 1 thru 18 keep the DIRECTORY data. Sectors (also called BLOCKS) use the 1st two bytes to point to the next sector if it is linked. (As with a file of more than 1 block.) A 1541 disk when freshly formatted has 664 blocks. The BAM reserves the DIR sectors so they won't be written to. By using a DISK DOC program (or Sector Editor etc) you can trace files directly on the disk an alter them. Each DIRectory sector holds 8 filenames and data. The data bytes are assigned as follows: Byte 0 (Generall a reverse) a-d denotes the filetype. Bytes 1 and 2 denote the 1st sector link of the file. Bytes 3 thru 18= filename + reverse spaces for padding (16 chrs) Bytes 19 thru 21 are used for REL files. 22 - 25 are unused. 26 and 27 = track and sector for save with replace.N * 28 and 29 = filesize in HEXadecimal. Lo byte/Hi Byte order. * To save with replace use: save "@0:filename",8 Ensure that you have enuf HOST room because the file is FIRST saved then the old file deleted. That about wraps these helper pages up!