Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ProDOS vs DOS 3.3 sector order, sector headers, and interleaving

685 views
Skip to first unread message

Steve Chamberlin

unread,
Mar 30, 2015, 5:07:18 PM3/30/15
to
Hi everyone,

I'm working on adding Apple II support to an SD card floppy emulator board I previously designed for the Macintosh (Floppy Emu). Ultimately I hope to support Apple II 5.25 an 3.5 inch floppy emulation, as well as SmartPort devices - and Mac and Lisa disks are already supported. I'm making good progress, but I'm confused about some of the low-level differences between ProDOS and DOS 3.3 disks and disk images, and which ones are relevant for a floppy emulator.

1. I'm unsure if the sector address marker, header, checksum algorithm, etc is the same between DOS 3.3 and ProDOS - the famous D5 AA 96 and all that follows. I believe they are the same, but would love to get confirmation. Also, I understand the sector header contains a disk volume number for DOS 3.3 disks. Is this also present in ProDOS disks, but ignored?

2. I'm confused whether "DOS 3.3 order" and "ProDOS order" refer to the order in which sectors appear on a real floppy disk (the interleave), or the order they appear in a disk image file like a .po or .2mg file, or both. I've read several explanations, and I still don't get it. :-(

According to this Wikipedia page: http://en.wikipedia.org/wiki/Apple_DOS, the 16 sectors on a DOS 3.3 disk track are ordered

0 7 14 6 13 5 12 4 11 3 10 2 9 1 8 15

I don't understand the purpose of that interleave, it's like a 12:1 interleave, but no matter. Then the 16 sectors on a ProDOS disk track are ordered

0 8 1 9 2 10 3 11 4 12 5 13 6 14 7 15

which is what I would call a normal 2:1 interleave.

But I'm uncertain if this interleaving is what's meant by DOS 3.3 order and ProDOS order.

From comparing a Disk Copy 4.2 image and a 2IMG ProDOS order image of the same 800K Apple IIgs disk, it appears that "ProDOS order" for a disk image means the data is stored in the natural order, from logical sector 0 to sector 1599. Except for the headers, the DC42 image file and the 2IMG ProDOS image files are identical.

I haven't yet looked at any "raw" .po or .do disk image files for comparison.

Thanks for any light you can shed on this.

Steve Nickolas

unread,
Mar 30, 2015, 7:00:38 PM3/30/15
to
On Mon, 30 Mar 2015, Steve Chamberlin wrote:

> 1. I'm unsure if the sector address marker, header, checksum algorithm,
> etc is the same between DOS 3.3 and ProDOS - the famous D5 AA 96 and all
> that follows. I believe they are the same, but would love to get
> confirmation. Also, I understand the sector header contains a disk
> volume number for DOS 3.3 disks. Is this also present in ProDOS disks,
> but ignored?

It's the same; the volume is set to 0, iirc.

> 2. I'm confused whether "DOS 3.3 order" and "ProDOS order" refer to the
> order in which sectors appear on a real floppy disk (the interleave), or
> the order they appear in a disk image file like a .po or .2mg file, or
> both. I've read several explanations, and I still don't get it. :-(

It means the order in which they appear in a disk image. DOS 3.3 and
ProDOS have different sector interleaves, so they see the sectors in a
different order.

I have a tool that uses ProDOS to read a disk, and then writes it out
through DOS 3.3, and it has to reorder the sectors on a track like so: 0,
14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 15.

-uso.

David Empson

unread,
Mar 30, 2015, 7:11:27 PM3/30/15
to
Steve Chamberlin <steve.ch...@gmail.com> wrote:

> Hi everyone,
>
> I'm working on adding Apple II support to an SD card floppy emulator board
> I previously designed for the Macintosh (Floppy Emu). Ultimately I hope to
> support Apple II 5.25 an 3.5 inch floppy emulation, as well as SmartPort
> devices - and Mac and Lisa disks are already supported. I'm making good
> progress, but I'm confused about some of the low-level differences between
> ProDOS and DOS 3.3 disks and disk images, and which ones are relevant for
> a floppy emulator.

I'll answer what I can.

For reference, Beneath Apple ProDOS goes into a lot of detail about the
sector formatting, and differences between DOS 3.3 and ProDOS, so if you
can lay your hands on that it might answer most of your questions.

I'm not sure if my copy survived the flooding in my garage a few years
ago. I'm not at home right now to check, so this is from memory.

> 1. I'm unsure if the sector address marker, header, checksum algorithm,
> etc is the same between DOS 3.3 and ProDOS - the famous D5 AA 96 and all
> that follows. I believe they are the same, but would love to get
> confirmation.

I'm pretty sure that level is identical. Apple used the same physical
5.25" disk format (apart from sector interleave) for DOS 3.3, Apple II
Pascal, Apple /// SOS and ProDOS. All of them can read and write each
other's disks, given the right software.

> Also, I understand the sector header contains a disk volume number for DOS
> 3.3 disks. Is this also present in ProDOS disks, but ignored?

The field exists, and if I remember right it is normally 001 on a disk
formatted by ProDOS or Pascal (the default was 254 on a DOS 3.3
formatted disk, but adjustable). It is ignored by ProDOS and Pascal.

> 2. I'm confused whether "DOS 3.3 order" and "ProDOS order" refer to the
> order in which sectors appear on a real floppy disk (the interleave), or
> the order they appear in a disk image file like a .po or .2mg file, or
> both. I've read several explanations, and I still don't get it. :-(

I can't answer regarding the emulators or image files, but the physical
interleave was different for DOS 3.3 and SOS/ProDOS. (I don't recall
ever looking into Pascal at this level, but it may be the same as
ProDOS.)

> According to this Wikipedia page: http://en.wikipedia.org/wiki/Apple_DOS,
> the 16 sectors on a DOS 3.3 disk track are ordered
>
> 0 7 14 6 13 5 12 4 11 3 10 2 9 1 8 15
>
> I don't understand the purpose of that interleave, it's like a 12:1
> interleave, but no matter.

I can explain that. The interleave is optimised for booting DOS 3.3.
When DOS 3.3 is read into memory from tracks 0-2, the sectors are read
in descending order, so it is effectively a -2 interleave. This made DOS
3.3 less efficient for data access, since that normally accessed sectors
in ascending order.

> Then the 16 sectors on a ProDOS disk track are ordered
>
> 0 8 1 9 2 10 3 11 4 12 5 13 6 14 7 15
>
> which is what I would call a normal 2:1 interleave.

Correct. SOS/ProDOS reads disks a block (two sectors) at a time, so it
always wants the odd numbered sectors immediately after the even
numbered ones. The one sector gap is sufficient to deal with the
processing overhead between sectors. If the next block is needed,
SOS/ProDOS is hopefully ready to read or write it before the disk has
rotated more than one sector.

> But I'm uncertain if this interleaving is what's meant by DOS 3.3 order
> and ProDOS order.
>
> From comparing a Disk Copy 4.2 image and a 2IMG ProDOS order image of the
> same 800K Apple IIgs disk, it appears that "ProDOS order" for a disk image
> means the data is stored in the natural order, from logical sector 0 to
> sector 1599. Except for the headers, the DC42 image file and the 2IMG
> ProDOS image files are identical.
>
> I haven't yet looked at any "raw" .po or .do disk image files for
> comparison.
>
> Thanks for any light you can shed on this.

--
David Empson
dem...@actrix.gen.nz
0 new messages