Classic Computer Magazine Archive START VOL. 4 NO. 10 / MAY 1990

Programminig In BASIC

Christen disks with impunity using NAMEDROP.ARC on your START disk.

GEM's disk-labeling ability is great. It lets you check the disk's name from the Desktop without taking the floppy out of the drive. It's also useful for cataloging disks; magnetic labeling isn't easily defeated. The only problem with GEM's scheme is that you can't change the label from the Desktop without reformatting your disk. Name-Dropper, written in GFA BASIC 2.0, fixes that limitation.

We have to cheat a little to get around GEMDOS limitations.

Using Name-Dropper
To use Name-Dropper, copy the files NAMEDROP.ARC and ARCX.TTP onto a blank, formatted disk and un-ARC NAMEDROP.ARC by following the Disk Instructions elsewhere in this issue. Two files will appear: NAMEDROP.PRG and NAMEDROP.LST. Name-Dropper runs in all resolutions.

Run the Name-Dropper utility by double clicking on NAMEDROP.PRG. The program firsts asks you for the floppy drive, either A or B (no other designators are accepted). It then reads and displays the volume label of the disk in the specified drive and asks if you want to modify the label. If the disk is unlabeled, it says so. If you choose to change or add a label, you'll be asked to supply a new name. Name-Dropper will accept only GEM-legal characters.

Use [Backspace] to correct your mistakes. You may also delete the floppy's label. Delete has no effect if the disk is unnamed. Once the modified label is written to the disk, you may either quit the program or repeat the operation.

Let's Look at the Code
The GFA BASIC 2.0 source code is in the file NAMEDROP.LST.

Name-Dropper displays the volume name and then asks if you want to modify it.

A disk's volume label is stored as a file on the disk itself. It's distinguished from data files by having the label attribute set. So the obvious solution to changing the volume label is to delete the old file with a GEMDOS(65) call and create a new one containing the modified name. The instruction


will create the file; the final parameter, 8, sets the label attribute.

Good idea, but the GEMDOS(65) call will delete regular files, not those with the label attribute set. So we cheat. We use the GEMDOS(60) call as before to create a file, except we keep the same filename as that of the existing volume label and we use 0, not 8, as the last parameter. This overwrites the volume label file and changes the attribute to that of a normal, deleteable, file. So we delete it and then call


Tricky, eh?

The other part of this program that may be of interest is the procedure GET_INPUT. This procedure acts as an input filter for the keyboard by checking an input character against a list of allowable characters, found in Test$. Valid characters are printed on screen in uppercase. It inserts a period after eight characters are entered. It allows only three characters to be entered after a period, whether the period was placed by the user or the program. In this way only legal GEM filenames are accepted by Name-Dropper.

Indispensable When Needed
As I mentioned before, Name-Dropper isn't complex, but it's indispensable when needed. The code also points out one thing to remember when you are writing any program: if it appears impossible to do what you want, cheat (or look at things in a different way).

Al Hubbard wrote Putmaker for the November 1988 issue of START. He lives in Toronto, Canada.