in my boot secotor i am trying to implement fat12. in my read disk function, the cary flag is always set after trying to read from the disk. when i set the function arguments to constants, it works, but when there set to varriables it dosn't.
I have tried 2 different ways of converting logical sector to track, head, ect..but either way is dosn't work. any help possable?
reasons for carry flag to be set?
-
Curufir
Re:reasons for carry flag to be set?
There is one, and only one, correct way to convert LBA to CHS.
In pseudo-code:
Sector = ((LBA Sector) mod (Sectors per track)) + 1
Head = floor((LBA Sector) / (Sectors per track)) mod (Heads per cylinder)
Cylinder = floor(floor((LBA Sector) / (Sectors per track)) / (Heads per cylinder))
Make sure you are getting the results you should be getting.
Also remember that LBA starts at 0, so a floppy has an LBA range of 0-2779, CHS starts at sector 1, this has caused much confusion throughout the ages
.
As to why the carry flag is set. Have you reset the drive before starting your read operations?
In pseudo-code:
Sector = ((LBA Sector) mod (Sectors per track)) + 1
Head = floor((LBA Sector) / (Sectors per track)) mod (Heads per cylinder)
Cylinder = floor(floor((LBA Sector) / (Sectors per track)) / (Heads per cylinder))
Make sure you are getting the results you should be getting.
Also remember that LBA starts at 0, so a floppy has an LBA range of 0-2779, CHS starts at sector 1, this has caused much confusion throughout the ages
As to why the carry flag is set. Have you reset the drive before starting your read operations?