1. ## reading floppy disk sector

Hello!

I've trying to read and write sectors using the Win32 API. However, I am having some difficulties on finding out the sector number in a floppy disk.

For example, I created an assembly program wherein I write a 512 bytes on Track 1, Sector Number 1 and Head Number 1. When I use the Windows.h function, I can't seem to locate that 512 byte file.

From what I understand, windows uses flat adressing. So the sectors numbers are actually from 0 to 2879. I've created an equation that calculates the sector given the track number, head number and the sector number. However, I can't seem to make it work.

My prototype equation goes as:
iSector = (HeadNum * SECTORS_PER_TRACK * TRACKS_PER_SIDE ) + (TrackNum * SECTORS_PER_TRACK+ aSectorNum) -1;

SECTORS_PER_TRACK = 18
TRACKS_PER_SIDE = 80
NUMBER OF SIDES for a floppy diskkete = 2

Hope somebody can give me an idea about the windows flat addressing. Maybe that's where my problem lies.

Thanks.

2. why on EARTH would you be using assembly to write to a floppy.

technology HAS progressed, after all.

3. Actually, I'm using assembly create the small com files that I place in the floppy sectors. From there, I will use my C++ code to see if the sector I am reading is correct.

The reason why I do not use windows to also write in floppy is because I need to know how to compute the sector number given the head, cylinder and sector number.

4. >> why on EARTH would you be using assembly to write to a floppy
Fun is a good enough reason for me

Code:
```#include <iostream>
using namespace std;

#define NUM_SIDES         2
#define TRACKS_PER_SIDE   80
#define SECTORS_PER_TRACK 18
#define SECTORS_PER_SIDE  (TRACKS_PER_SIDE * SECTORS_PER_TRACK)

size_t LogicalFloppySector(size_t side, size_t track, size_t track_sec)
{
// do some range checking on params here

// params are 1 based values - calculations need 0 based values
side--;
track--;
track_sec--;

return (side * SECTORS_PER_SIDE) +   // get to right side
(track * SECTORS_PER_TRACK) + // get to right track
track_sec;                    // get to right sector on track
}//LogicalFloppySector

int main()
{
size_t side, track, track_sec;
for (side = 1; side <= NUM_SIDES; side++)
for (track = 1; track <= TRACKS_PER_SIDE; track++)
for (track_sec = 1; track_sec <= SECTORS_PER_TRACK; track_sec++)
cout << LogicalFloppySector(side, track, track_sec) << ", ";

return 0;
}//main```
Output: 0, 1, ... , 2879