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. CTRL slows.
$*=p - display ONLY prg files on disk.
$*=s - display ONLY seq files on disk.
$*=u - 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 cpmmand 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), 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.
>i0 - initialise disk in drive. (Reads DIR/BAM info)
>v0 - validate disk in dirive.
>(RETURN) - (or @ (RETURN)) read/display error status
>n0:diskname,01 - Format disk. Use id of "01"
>n0:cleardisk - clear 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.