8

Background

I'm writing a simulation of a very simple computer (in VHDL), that is similar to 1960s/1970s computers in capacity and architecture. It previously could load a program from a ROM, but I wanted to expand functionality to load a program from an address in storage. The RAM and resouces are very limited on the computer, so it seems like being able to load individual bytes was a good idea. Partial sector transfer seems to have been a feature in old floppy disk controllers:

  • FDC37C78 Floppy Disk Controller (datasheet)
  • WD1002-05/HDO Winchester/Floppy Disk Controller (datasheet)
  • TMS9909 Floppy Disk Controller (datasheet)
  • An Inside Look at MS-DOS, Tim Paterson (article)

In the disk controller I've written, a sector is buffered from the drive, and the DMA is then requested to transfer the data (used DREQ and DACK pins similar to FDC37C78. ) I write parameters for the read operation using memory-mapped I/O addresses for each register in the disk controller. The parameters are:

  • Address for first sector
  • Sectors to read in total
  • Offset for first sector
  • Total bytes to read in last sector

The controller is able to do a partial sector transfer on the first and last sector, and treats all sectors in between as full transfers.

I want to write a controller that is similar to what was (or is) actually used on similar computers, so that I can learn about the constraints and parts and mechanisms of that, and why different solutions were used.

The vhd file for "disk_ctrl" entity that supports only read operation so far: https://snippet.host/kvcunz.

Question

What I want to ask is, what are the trends for how floppy disk-based operative systems ("FDOS") solved partial sector transfer, assuming there was a trend that they used partial sector transfer. The alternative I can see to my design in my simulation is to let the disk controller output the whole block on the data bus, but then let the OS (via CPU) or DMA only apply write_enable signals for the desired data in the block. I am interested in the big picture for the advancement of computers, and to be able to "put myself in the shoes of" engineers of early computers, and what challenges they had to solve.

3
  • 4
    Interesting question. I'll be looking for authoritative answers too. My guess is: it was a feature never used by any operating system (though it may have been used by special-purpose embedded devices). I personally have not only never ever heard of any microcomputer OS with a file system that was anything other than block/sector oriented, I also didn't even know the capability existed! (As in: I have never read about it in any of the many low-level programming books I read at the time.)
    – davidbak
    Jan 24, 2023 at 16:57
  • I have never seen any OS use partial block transfers, not even 60s/70s OS. Most OS have some kind of system buffers (that are also used for things like directory access) which can be used if byte-wising reading or writing is supported.
    – dirkt
    Jan 25, 2023 at 7:04
  • And one reason to avoid partial block transfers and use buffers instead is that reading a sector byte-by-byte using a partial transfer would be extremely slow: if processing time for a byte is less then one disk rotation, you'd have to wait for one disk rotation for the next byte. Reading it byte-by-byte from a buffer is fine.
    – dirkt
    Jan 25, 2023 at 7:10

1 Answer 1

11

The Intel 8272 floppy controller may be a little late for you, but since you mention MS-DOS above you may still find this relevant. The 8272 has the ability to perform a partial transfer using the Terminal Count signal. Once the signal is sent, then the controller will continue to read / write data from / to the disc drive, but will not transfer any more bytes to / from memory.

This makes it possible to perform a partial read, as long as the bytes required are at the beginning of the sector. However it requires the CPU or some other piece of hardware to monitor the number of bytes transferred and set Terminal Count at the correct moment.

If Terminal Count is set during a write, the remaining bytes in the sector are written as zeroes.

The only operating systems I am aware of which use the 8272 and perform partial reads are CP/M on the Amstrad PCW and Spectrum +3, LocoScript on the PCW, and +3DOS on the +3 (all floppy access code in these systems shares a common heritage). These computers use the CPU to read data from the floppy controller one byte at a time, rather than DMA hardware, and so can simply count the number of bytes transferred and stop the transfer when the required number have been read.

On the above systems, a partial read is performed only in one specific situation: When logging in a disc, the first ten bytes of the boot sector are read to determine the filesystem parameters. All other I/O is done in complete sectors.

3
  • Thanks. What I've gathered from the past day is that file systems usually use a "cluster size" (such as sector) as smallest file size. And that this is the reason they always also work in clusters (and, this engineering decision is from that the disk itself naturally works in sectors as smallest units). Before initializing the file system and such though, the OS might work with smaller sizes, and that fits with what you write, when logging in on a disc, on the systems you mentioned, an actual partial sector transfer (one without RAM as intermediary) is done.
    – BipedalJoe
    Jan 25, 2023 at 13:50
  • I was going to add a file system after I added storage (on my simulation), so I had not yet gotten to that part (cluster sizes) :) From my point of view, not using partial sector transfers (those without RAM buffer as intermediary) seemed wasteful.
    – BipedalJoe
    Jan 25, 2023 at 13:54
  • Very interesting solution for a time when even sector sizes weren't standardized and who knows what someone might stick into your floppy drive.
    – davidbak
    Jan 25, 2023 at 14:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .