Win95 DOS Call

From OSDev Wiki
Jump to navigation Jump to search

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Windows 95, while not precisely a disk image utility itself, gives a programmer an easy access method for reading and writing data from/into disk image files. This comes from the total lack of security features in the OS. The method is the DOS interrupt call: INT21h, ax=0x7305. This might make Windows 95 a better choice for an OS development platform than Windows 98.

Usage

The main reason to be working with disk images when doing OS development is that they are needed for emulators such as Bochs. If you are using a non-standard filesystem in the emulator, then you must use a disk hexeditor, or read and write sectors in your disk image file directly, because no host OS will recognize your non-standard filesystem.

This interrupt call gives a programmer a method to read and write logical disk sectors. You need to use some utility to find the sector location on your disk partition of your disk image.

Create a 10 byte "DISKIO" structure in memory, consisting of the base sector number (4 bytes), number of sectors to read/write (2 bytes), and a pointer to your data buffer (4 bytes). (I'm not sure why it's a 4 byte pointer, as the rest of the call seems to be in real mode?)

Set si to 0x6001 for a write, or 0 for a read. cx = 0xffff, ds:bx points to the DISKIO structure, dl = logical drive letter (1= A, 2= B, ... ), ax = 0x7305. Then do an INT 0x21.