0

I'm getting myself used to x86 assembly, so I figured I'd start with some 16-bit programs. To test myself, I'm creating a program that will load data off a disk, copy it to memory, and then use it for the next bit. It's going to replace the MBR, so I can only use basic interrupts (the full thing is going to be a sort of "joke virus" for my use only).

The interrupt to read data off a disk and place it in memory requires arguments in CHS format, however my main drive is an SSD. I can't find anything online that will help me in this situation, because SSDs obviously do not work on cylinders.

My question is, is there any way to "convert" a logical sector number on my SSD to a CHS tuple to trick the program, or is that impossible?

0

It used to be possible to look up the number of logical cylinders, heads and sectors for a drive in the BIOS (as a user - it's also possible to do this programatically, since the Linux fdisk utility used to do that, but no longer does). You can then solve for c, h and s using the formula

A = (c ⋅ Nheads + h) ⋅ Nsectors + (s − 1)

where A is the LBA address, Nheads is the number of heads on the disk, Nsectors is the maximum number of sectors per track, and (c, h, s) is the CHS address (from 1).

It's also possible to change the CHS geometry values in the BIOS - but don't do this, as it will render any operating systems that rely on it, like Windows, unbootable.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.