14

Inspired by this question, it got me thinking about how DOS 3.3 for the Apple II had the 'DISK VOLUME 254' at the top of every CATALOG listing. The default was always 254, but you could make your floppy disk have a different number by specifying something like INIT HELLO,S6,D1,V123 to make it show 'DISK VOLUME 123' on that disk.

That aside, I'm curious what the intent and actual implementation of the feature was. On a 5.25" Disk ][ floppy, it made no difference it would seem - trying to CATALOG,S6,D1,V123 on a floppy formatted for V254 would still happily display 'DISK VOLUME 254' despite the 'V123' command argument.

On a hard disk, however, I recall having 4 DOS 3.3 volumes (of 400KB size FWIW) on my Sider HDD and using the volume argument would access specifically volumes 1 through 4. (I don't recall what would happen if I didn't specify the volume argument.) That being said, I also don't believe I used a special version of DOS 3.3 to get this behavior from my Sider hard drive.

So I can presume the intent was for hard disks, but why then did it not mean anything when using another media such as a 5.25" floppy? Was the code more in DOS or the controller?

1 Answer 1

18

I'm curious what the intent and actual implementation of the feature was.

It's meant to identify diskettes. Much like volume names on DOS or similar on other OSes. In fact, Apple DOS was ahead, as automated checks were built in.

(For implementation details see below)

All commands will check the volume parameter, as the DOS 3.3 manual states on page 23:

All DOS commands can specify the volume number, if you wish DOS to check that the volume number on the diskette agrees with the V option. If you do not specify any volume number, or if you specify volume zero, or if you type "Vn without a number, DOS will ignore the diskette's volume number. If you accidentally specify an incorrect volume number, the system will reject it with the message VOLUME MISMATCH

trying to CATALOG,S6,D1,V123 on a floppy formatted for V254 would still happily display 'DISK VOLUME 254' despite the 'V123' command argument.

Well, CATALOG is the exception to the rule. After all, it's always rather useful to see what disk one has. To learn this one would need to turn to page 24:

Volume mismatch errors cannot occur when you ask to see the CATALOG. In case you wish to know the volume number of a diskette, it is given at the head of the CATALOG listing.

On a hard disk, however, I recall having 4 DOS 3.3 volumes (of 400KB size FWIW) on my Sider HDD

Only 4 seems little. A 10 MB Disk would literally use up all volume numbers when set up for DOS :) Sure you're not referring to the partition? Sider disks had the speciality of having to have 4 partitions, one each for DOS, ProDOS, Pascal and CP/M. They could be made smaller if not needed, but had to be present.

and using the volume argument would access specifically volumes 1 through 4.

Yes, a SCSI driver interprets the volume number differently. Standard DOS diskette RWTS compares it to the one on disk and rejects operation if not the same, while the SCSI RWTS takes it as parameter for volume selection. It will only return a volume error if the one specified doesn't exist - i.e. higher than the max volume number for that disk.

That being said, I also don't believe I used a special version of DOS 3.3 to get this behavior from my Sider hard drive.

No. It's standard behaviour, just with the volume parameter interpreted different by the driver.

So I can presume the intent was for hard disks,

No, DOS was written strictly with Disk II type floppies in mind, that is the original 114 and later 140 KiB formats. Already later 640 KiB drives had to add specific enhancements.

Was the code more in DOS or the controller?

Basic DOS was fully RAM based, after all, the 256 bytes of boot ROM weren't something to consider. Hard disks had their own, manufacturer specific ways.


Implementation

and actual implementation of the feature was.

For high level access the volume number is stored as part of the disk description in the VTOC sector (byte 7 of sector 1 of track 17).

enter image description here (Picture taken from Beneath Apple DOS, May 1982, p.4-2)

With DOS formatted diskettes volume marking is ingrained into the basic track formatting as it's encoded in each and every sector header:

enter image description here (Picture taken from Beneath Apple DOS, May 1982, p.3-7)

The volume check itself is handled by the device's low level driver via the RWTS API. RWTS stands for Read or Write Track and Sector (*1).

RWTS operation is based on filling an Input/Output/Block (IOB) with desired function number and their parameters. On entry the intended volume number is put at offset 3. On Return the found volume number is at offset 14. If those don't match the operation will be aborted and returned with an error code of $20 at offset 13.

Catalog will always store $00 which acts as wild card, while all other commands use whatever was given or $00 as default.


*1 - It's the very code Steve Wozniak wrote for the Disk II drives - and improved for the Pascal System.

7
  • Does DOS 3.3 make any effort to guard against volume swaps while a file is open, or does it re-check available space each time it writes a sector? The fact that the volume ID is repeated on every sector would allow zero-cost checking, but the effectiveness of such checks would have been greatly enhanced if volume IDs were random, rather than being set to 254 on 99.9% of disks. Commented Apr 8, 2023 at 14:30
  • @supercat The volume check is (as shown) part of the RWTS, thus will be done with each and every sector read - the very reason why the volume number ist (a shown) part of each sector header. Next, Volume numbers are intended to organize multi volume data sets. But you're ofc free to make them random. Commented Apr 8, 2023 at 20:12
  • I know the volume number could be verified with every sector read, but that doesn't say anything about whether DOS would verify that a file which was happened to be opened on volume 123 will not get written to when a different disk is inserted. Commented Apr 8, 2023 at 21:42
  • @supercat It's the way it is. A RWTS call always checks the numbers. Reading and comparing the header is the very base of every sector operation - read and write. Check for yourself if you don't believe. Commented Apr 8, 2023 at 22:42
  • 1
    I only had 4 DOS 3.3 volumes on the Sider (re: the 'little' comment) since I was focusing primarily on ProDOS at the time. I minimized the Pascal and CP/M partitions since I didn't use them, but I decided to have a little bit of DOS 3.3 on my massive 20MB of fixed storage :-) Commented Jan 13 at 17:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.