Disk Utilities | Everygamegoing

Personal Computer News


Disk Utilities

 
Published in Personal Computer News #093

Get your C64's files under control with these powerful disk utilities. David Jones' package performs simple and difficult tasks.

Disk Manager Goes On File

Get your C64's files under control with these powerful disk utilities. David Jones' package performs simple and difficult tasks

Here is a collection of powerful disk utilities for the Commodore 64 and 1541 disk drive. The utilities are strung together in one package, very much like the Apple FID program or Atari DOS. Some of the options allow you to perform simple tasks (rename, validate, etc) but some perform functions that would otherwise be difficult, e.g. restoring deleted files.

There are 11 main options excluding Q-uit manager, A, I and J are self-explanatory, and the following are the more exotic commands:

B - restores previously scratched files. It searches the disk for all scratched files, and if they can be retrieved, you are asked if you want to regenerate each file in turn. If one or more files has been reclaimed, the B option will validate the disk to fix the BAM (Block Availability Map) before exiting.

C - copies one or more files on a single disk system. It uses memory from $1000-$FFF for storing the file before copying it. This means it copies files of 96 blocks or less, although this limit can be altered by adjusting the buffer value in line 100. If Disk Manager is asked to copy a file when the filename already exists it asks for a new name, or gives you the option to skip that particular file.

D - scratches files from the disk, but unlike the normal wildcard scratch it asks for permission before scratching each file.

E - is a useful option that displays the start/end addresses for PRG files, or just the exact file length for USR and SEQ files.

F - has four sub-options, and allows the user to format the whole disk, erase just the sub-directory, and test the disk surface for bad blocks.

G and H - are exact opposites, locking and unlocking disk files respectively. This is a little-known feature of the 1541 disk drive, and normally difficult to implement. Locked files are displayed with a '<' next to the file type, e.g. 'PRG<'. When a file has been locked any attempt to scratch it is ignored, although SAVE@ is stil effective.

K - is almost a self-contained program. It is a simple block editor that allows the user to edit any disk block in either ASCII or Hex. When executed, the option displays the entire 256-byte block, and using the cursor allows the user to type over bytes. As with the Basic editor, Return must be pressed to fix the changes. To change the disk block the cursor must be positioned over the 'Write Block' phrase, and again Return must be pressed. The Quit option works just the same.

When in Hex mode, inverse text mode is used to show where individual bytes start - apart from this visual aid it has no other function. In ASCII mode solid circles represent characters that cannot be displayed (non-ASCII codes). A hollow circle is used to show CHR$(160), which DOS V2.6 uses to pad out filenames - a useful character to be able to enter/display.

L - does three things: tidies up a disk directory; purges deleted files and sorts the directory alphabetically or by file type. The purge option erases all trace of previously deleted files from the directory - purged/sorted files cannot be recovered with utility B. The sort used is a crude bubblesort - more than adequate for an application like this.

How It Works

Disk Manager relies on the U1 and U2 disk commands for reading and writing sectors. Options B, G and H modify the file type marker (the first byte of a directory entry). This is set to zero when a file is deleted, and when ORed with 64 causes the file to be locked. The copy command merely treats PRG, SEQ and USR files as sequential files and reads them as just a string of characters.

Any sequential type file can be read by opening the file and using INPUT # commands e.g. OPEN 2,8,2,"filename,P,R" will open a PRG file for reading.

Note that Disk Manager is set up for 1541 drives using device 8. It can send outputs to device 4 (CBM printer), and these values can be altered by editing line 100.

The machine language routines are used by options A and C for reading and writing sequential disk files into the temporary buffer - they are poked into memory at $C000.

[ In ASCII mode, solid circles represent characters that cannot be displayed (non-ASCII codes). ]

David Jones