User Tools

Site Tools


Floppy disk or floppy disk



By now everyone must have seen a music record (vinyl record). Its peculiar shape clearly defines it: flat, round and with a central hole. Well, the external appearance of a computer disk or floppy disk is basically the same. Three-inch drive users may not believe it, as their floppies are encased in a rectangular plastic shell that protects them, but inside they're still round.


However, the resemblance between a music disc and a computer disc ends here. Computer disks do not store information on a single spiral groove, and the material from which they are made is not vinyl, but a flexible plastic surface covered with an adhesive layer that serves to fix a magnetizable substance. It is this that stores the digital information in the form of different magnetic orientations of its particles.

The disk appeared as a substitute for magnetic tapes, which due to their slow access, mainly due to the way of placing the information, did not provide sufficient benefits to computer users.

In principle, as is a newly manufactured disk, it is not at all usable in a practical way by a computer. This is because, in order to be able to save the information and then be able to easily access it, we need a certain prior organization. So that it is understood, we can buy a blank record (just as it is newly manufactured) with a cupboard-shelf in which the shelves are precisely missing. No matter how big and robust the closet is, if we can't group, separate and classify the things we want to store in it, when looking for something we can have serious problems.


Disks have write protect holes, when a write protect hole is closed, that side of the disk can be written to and the disk is called write unprotected. On the contrary, if the hole is open, it will be protected against writing.

Depending on the format of the disc, these protections can be activated with your fingernail by moving the shutter tab up (unprotected) or down (protected). In others we will need the help of a pen or other object to move the tab laterally to protect or unprotect the disc.



Well, formatting or initializing a disk is nothing more than putting shelves in the closet and labeling these shelves, so that we can access what we are looking for quickly and in an organized way. In a disc we are not talking about shelves, but about sectors, and instead of labels we will talk about index marks and the identification field of the sectors or ID field.

The magnetic surface of the disk is physically continuous, so we will need to make a certain version of it. The first consideration we make is that of the disk as a set of concentric tracks. Typically, both three-inch and five-and-a-quarter-inch floppy disks have forty tracks on each side, numbered zero through forty-nine. As an exception, disks formatted in drive B of a PCW 8512 or PCW 8256 Extended will have eighty tracks per side. In any case, the outermost track is always considered as the zero track and the innermost as the highest numbered track.

The next division that we will make will be to divide each track into several fragments that we will call sectors. In this way, each disk is divided into tracks, and each track into sectors. Returning to the example of our closet, each horizontal shelf would be equivalent to a track, and each vertical separation that we put in a horizontal shelf would mark the separation between two sectors.


All this complication pursues a practical purpose that we are going to explain with our wardrobe. Suppose we are going to use it to store disks. For this, we have a list with the names of the singers of which we have a record. Next to the name of each singer is the number of the horizontal shelf (track) and the number of vertical separation (sector) in which we can find a record by that singer. In this way, if we intend to separate the entire Plácido Domingo collection to leave it to a friend, we will not need to go through our entire disco searching from disc to disc. What we will do is use our list and go directly to the shelves where one of his records is located. If the number of disks that fit on each shelf is small enough, the search will take little time. However, making the shelves too small can present drawbacks that we will discuss later.

Floppy disks have a hole called index hole, which allows you to locate the beginning of a track. A light diode and an optical sensor allow to determine when said perforation has been located.


All disks have two structures: physical and logical. The physical structure is the disk itself, that is, what shape it has, type of magnetic material, etc. And the logic, is how the disk is really structured after having formatted it.


  • The physical structure of the disk

A floppy disk is the magnetic medium on which we store our programs. data, text, etc. Its shape is that of a circular crown. When initializing it, it is divided into a series of concentric zones, which we will call tracks, each of which is subdivided into sub-zones called sectors. With the disk formats used by CPC and PCW, each sector can contain 512 bytes of information, although this number can be altered, as we will see later.

The number of tracks and sectors on a disk is variable: single-density 3“ disks in CPC or PCW format have 40 tracks and 9 sectors per track (although these numbers can also be changed), thus consisting of 360 sectors in total and its capacity is 180K (per side).

The tracks are numbered from 0 to 39 and the sectors from 0 to 8 (track 0 is the outer one), although on a physical level the tracks have different numbers to distinguish the formats. But this does not affect the logical handling, as we will see next.


Sometimes not all available disk space can be used by the user, but the first or first tracks contain an operating system loader program. These tracks are called reserved tracks.

The set of characteristics that distinguish some discs from others (number of tracks, number of sectors per track, etc). is called the disk format. CPC computers recognize two disk formats:

  • System format.
  • Data format.

In addition to these, the PCW also recognizes the following:

  • Disk A system format.
  • System format disk B.
  • M disk format.

In the following table we give the characteristics of almost all these disk formats.


On this point, the following clarification must be made: If we initialize a disk in the PCW with the DISCKIT program, we will obtain a disk with a system format (either single or double density). However, the operating system can also read and write to disks with the CPC formats. All of these formats can also be used by LocoScript.

  • The logical structure

As is well known, the CP(M (excluding the CPC) is divided into two parts: the BIOS and the BDOS. From both the disk can be managed, but in two very different ways.

The BIOS is the low level part and uses the division into tracks and sectors. In the CP/M 2.2 the BIOS does not use physical sectors, but logical sectors, which are called registers and always have 128 bytes; in the CP/M plus it uses the physical sectors. In the following table you can see BIOS subroutines for disk management.


BDOS manages the disk using blocks or registers. Blocks can be from 1K to 16K (PCW and CPC single density disks are 1K and PCW double density are 2K). Registers are always 128 bytes long, for compatibility reasons with earlier versions of CP/M (physical disk sectors used to be 128 bytes in the past).

The blocks are numbered starting with 0 from the first unreserved track: the first blocks (two on single-density disks and four on double-density disks) contain the directory, whose structure we will describe later.

The directory contains the name of the files that exist on the disk, along with the blocks that each one occupies.

To read or write to a file, 128-byte registers are used. The CP/M has functions to do both random and sequential reading and writing; however, this method only allows access to the records that make up a file and it is never possible to access the reserved tracks or the directory area, or the unoccupied blocks, so if we want to access these areas we have of using the BIOS, so we won't talk here about the BDOS functions for disk management. You do have to use BDOS, however, to call the BIOS, because, as the operating system is distributed in different memory banks, it cannot be done directly (this problem does not exist in the CP/M 2.2, since the operating system and the TPA are in a single bank). The BDOS function that we have to use is 32 hexadecimal, whose input and output conditions can be seen in the following table.


A sector editor is mainly used to directly access the directory zone, so let's study it in more detail.

The sector editor is a program that, by means of some instructions, changes the content of a disk. In this way we can, for example, add infinite lives to a game, recover lost information and many other uses. An example of a disc editor is the widespread and well-known Knife.

Each directory block is divided into 32-byte entries, each of which has the structure detailed in the following table.


We will highlight several things in it:

A) The user number can be from 0 to 15; this allows to have the files divided into 16 different zones (LocoScript, for example, leaves groups 0 to 7 for user and the other 8 groups for limbo).

When a file is deleted, the user number is changed to E5; This allows you to recover a file that has just been deleted, simply by changing, using a sector editor, said number to the desired one. For recovery to be possible, nothing must have been written to the disk after deletion, since otherwise the blocks used by the deleted file may have been used to record a new file, in which case the deleted file is unrecoverable.

In addition to the above, user numbers from 16 to 32 may appear if the disk label and password have been defined. It is not recommended to do so, because such disks are not compatible with LocoScript or AMSDOS.

B) Each directory entry can contain at most 16K (16 bytes for blocks per 1K/block); therefore, any file with a size greater than 16 K will occupy several “extensions”, which differ in the extension byte (extensions are numbered 0, 1, 2, …). If you want to undelete a file of more than 16 K, you must find and undelete all its extensions.

C) If the maximum block number is greater than 255 (which is the case on PCW double-density disks), the block numbers occupy 2 bytes (in low-high order). For example, if a file occupies blocks 3 and 4, the corresponding block list will show 03 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00.

This must be taken into account, for example, if you want to edit a bad block of a file. In addition, the limit of 16 K per extension must be taken into account, which means that the blocks must be at least 2K (in the case of double-density disks of the PCW).

D) The attributes of a file are stored in the upper bit of the 8 bytes of the name and the 3 of the type (in all its extensions).

The attributes of the first four letters of the name can be freely used by the user; those corresponding to the other four are used by the CP/M plus to manage the file (in the CP/M 2.2 they are reserved for use by the CP/M plus): The three of the type are, in order, the following :

  • Read-only attribute.
  • System attribute.
  • File attribute.

Therefore, the three bytes corresponding to the type of a read-only COM type file will be C3(=80+43),4F,4D. This must be taken into account when searching for a file; can also be used to change file attributes, but for that it is more convenient to use the SET program.

In order to adapt to the different formats, BDOS saves the characteristics of each of them in a table. This table is called the disk parameter block (DPB), and we can access it through the 1F call to BDOS; previously seen in the table as well as its structure.


In the case of a floppy disk, when we save a program the Operating System looks at the list to see what sectors are free, writes the program to them and updates the list, including in it the name of the program and the sector and track numbers it contains. occupies. The aforementioned list is known by the name of Disk directory, and it has the peculiarity that it is saved inside the disk itself, normally in the first tracks, depending on its exact location on the format of each disk.

In some cases the first or first tracks of the disk are reserved, precisely to house part of the Operating System. Thus, on Amstrad CPCs, runways zero and one are reserved. In PCWs only track zero is reserved. In any case, after the last reserved track begins the directory, the size of which depends on the capacity of the disk.

In the CP/M, both in its version 2.2 and in the CP/M Plus, each directory entry (each singer's name with the addresses of their disks) occupies thirty-two bytes, which are distributed as follows:

  • Byte 0: Indicates the user area to which the file belongs. If its value is hexadecimal E5, it is a deleted file.
  • Bytes 1 to 11: They contain the ASCII characters that form the name and extension of the file. Not included in the directory is the period that separates the eight characters of the name from the three of the type.
  • Byte 12: Indicates the extension number. As we will see later, each directory entry can indicate a maximum of sixteen blocks, so we could only handle files up to 16 x 1024 = 16 KBytes. To avoid this limitation, when a file is larger than 16K it is divided into as many groups of 16K as necessary, and a directory entry is used for each group. These groups are called extents, with each extension occupying a directory entry and all receiving the same name and user number. Well, this byte 12 indicates the extension number. The extensions start numbering from zero.
  • Byte 13: Not used.
  • Byte 14: Used as part of the extension counter when necessary. Given the normal capacity of floppy disks, with a maximum of 720K, it is not necessary to use it, since byte 12 can count up to 256 extents = 4096K.
  • Byte 15: Indicates the number of records that make up a file. For CP/M, a record is made up of 128 bytes, so a sector of 512 bytes fits 4 records.
  • Bytes 16 to 31: These sixteen bytes each indicate the number of a block used by the file. In the CPC and disk A of the PCW, each block is 1K, that is, 2 sectors of 512 bytes. On disk B of the PCW each block is 2 K, which are 4 sectors of 512 bytes. If we refer to 512-byte sectors, it is because in both CPCs and PCWs, when formatting the disk, each track is fragmented into nine 512-byte sectors.

Regarding the size of the extensions, it is evident that in the case of a PCW disk B, since each block is 2 K, since we can address up to 16 blocks for each directory entry, the extensions will have a size of 2 x 16 = 32K

Summarizing what we have seen so far, we can see that CP/M basically works at two levels: the 128-byte register level, which is the unit of information considered by the disk reading and writing routines, and the one- to two-kilobyte block level. , which is the unit of information used by the directory. It must be taken into account that the AMSDOS Operating System uses the same directory structure as the CP/M, so what has been said so far can also be applied to this OS.

It may seem paradoxical that the disk sectors are 512 bytes and the CP/M uses 128 byte registers, but this is for historical reasons and has been kept that way to ensure compatibility with previously written software.


The Operating System incorporates a series of routines that carry out the adaptation between the physical structure of the disk (sectors of 512 bytes with identification numbers that depend on each format) and the logical structure of the disk (registers of 128 bytes). These routines use a data table that defines the characteristics of the disk format that is currently being used. This table is known as DPB (Disk Parameter Block), and its structure is in the following table.



Amstrad computers use an FDC 765 chip from NEC. It is a very powerful Floppy Disc Controller that can work both in DMA (microprocessor-independent memory directory access) and microprocessor-dependent mode. In the Amstrad, due to hardware limitations, it does not work in DMA mode (except in PC 1512).

One feature of this controller is that by simply giving it a few pieces of data, it takes care of formatting a complete track on its own.



The Amstrad CPC and PCW can use three disc formats. The so-called system, used by the CPCs to support the CP/M, is characterized by having nine 512-byte sectors in each track, numbered as follows: 41 46 42 47 43 48 44 49 45 (these numbers are hexadecimal) .

The system format used by the PCW is characterized by having nine sectors of 512 bytes numbered: 01 06 02 07 03 08 04 09 05 and the DATA or data format that also consists of nine sectors of 512, numbered C1 C6 C2 C7 C3 C8 C4 C9 C5.


Many times you will have read phrases related to “cold boot the Operating System”. This simply refers to an operation as simple as turning on the computer and inserting the disk containing the Operating System.

What happens when we do this? Very easy. Inside the computer, recorded in ROM, there is a small program that is responsible for recognizing the format of the disk by reading a sector ID (Identifier) ​​from track zero. If the format is correct, it loads the first sector of track zero and plays it.

In this first sector are the necessary and sufficient instructions to load in the memory the necessary part of the tracks reserved for the system, and that contain precisely that, the Operating System. Once loaded, the various parts of the S.O. on a site and control of the situation is given to the Operating System. In the case of Amstrad PCWs and CPCs with the CP/M Plus, the Operating System is not taken from the reserved tracks, but from a file with the extension “EMS”, short for Early Morning Start-up. tomorrow early).

This sector of the reserved track is known as the Boot-sector, and it is loaded at the hexadecimal address 0100. As once loaded, a JP 0100 instruction is executed, we can use a routine designed by us and stored in the sector boot to start a program.

The only limitation of this boot method is that the routine contained in the boot sector cannot exceed the size of the sector, which in the case of CPC and PCW is 512 bytes.

As we can see, Operating Systems form a very complex world.

en/disquete_3_pulgadas.txt · Last modified: 2022/06/19 09:50 by jevicac