Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got some floppy images (original DOS 6.22 und FreeDOS 1.44 MB boot disks) created using the *nix ddcommand that work fine when used in a virtual environment.

Now I want to understand the structure of these files.

As far as I know a 1.44 MB floppy disk has 80 tracks, each track has 18 sectors and each sector consists of 512 bytes. Multiplying this gets me to about 0.7MB which is exactly the size of one of the two sides.

The position of track 0 sector 2 head 2 is 9728 (or 0x2600) - this is the first sector the DOS 6.22 bootloader fetches from the disk. But how is this calculated?

How do I get to these values? I used an emulator to step through the bootloader. The first floppy access is done by calling interrupt 013h with AH = 2 (read from floppy), AL = 1 (read one sector), CH = 0 (read from track 0), CL = 2 (read from sector 2) and DH = 1 (use head 1 = use second side). This call gets the emulator to load the bytes starting at position 9728.

Each register value except of the sector number (which is 1-based) is 0-based.

Thanks in advance!

share|improve this question
Doesn't the emulator need to pass the address to the virtual disk drive to indicate which physical disk location to retrieve the data from? It's also possible that the emulator uses a base-offset addressing scheme for the virtual disk driver, or positions the "disk head" before the first read call. Also, what emulator are you using? – Breakthrough Feb 28 '12 at 16:23
@Breakthrough The emulator is called emu8086. Nevertheless the image works with VMWare Player as well. Of course it needs to pass the address to the virtual disk drive, but I don't have access to it - it just accesses the floppy image. I disassembled the bootloader code, and this really is the second interrupt call at all (the first one is Int 13h as well with AH = 00 to reset the disk drive). Therefore the adress parameteres (register values) don't have anything to do with the emulator that is used, do they? – muffel Feb 28 '12 at 16:32
correct, in this case they don't have anything to do with the particular emulator. I re-read your question in this light, and am not sure what you are asking. Do you want to know how the actual offset 0x2600 is calculated from the passed register values (AH, AL, CH, CL, DH)? – Breakthrough Feb 28 '12 at 16:36
@Breakthrough yes, I just want to know how this offset is calculated. That's all ;) – muffel Feb 28 '12 at 16:57
@Breakthrough I added the details. Accepting my own answer isn't possible atm, but I'm going to make up for it asap. – muffel Feb 29 '12 at 17:04
up vote 3 down vote accepted

I found the answer by myself. The file is structured in the LBA format, which can be easily calculated from the CHS values I got:

LBA = (cylinder * number_of_heads + head) * sectors_per_track + sector - 1

= (0 * 2 + 1) * 18 + 2 - 1 = 19

19 * bytes_per_sector = 19 * 512 = 9728

share|improve this answer

You must log in to answer this question.

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