Question

So im trying making a little boot able assembly program that lets the user delete and add files to a specified drive. The only problem is that im not sure how to access drive with assembly. Could someone point me in the direction in where i can find this information please? The information may also be for the c programming language.

I would be trying to access the default windows 7 hardrive from some bootable assembly code type. Which is NTFS.

Was it helpful?

Solution

To access disk in some bootable code on an x86 PC, the easiest and most natural is to use the BIOS int 13h functions. That will let you read and write individual disk sectors.

Hard drives are commonly split up into partitions and there's also the Master Boot Record (MBR) that describes the location, size and type of each partition. The MBR is the very first sector of an HDD.

Within each partition is some file system. You will need to implement an NTFS driver in order to be able to read and write files in NTFS.

AFAIK, NTFS is not open but there exist reverse-enginering-based NTFS drivers (e.g. in Linux). NTFS drivers are typically written in C(++), not assembly because NTFS is big and complex and C is more practical in terms of development, maintenance and portability than assembly. I would not recommend writing FS code in assembly.

P.S. on EFI systems things are somewhat different. There's GPT instead of MBR and you use EFI facilities to access disks instead of BIOS int 13h.

P.P.S. I've done what you want in C and a little bit assembly but with FAT1x/32 instead of NTFS. That's doable. NTFS is harder. It may be impossible for a single person, especially if they don't have sufficient knowledge and skills.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top