Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Absolute Disk Read

Absolute Disk Read

Absolute Disk Read

Back in the good old days of MS DOS and small hard drives, I wrote a program that examined the boot sector using interrupt 25H.  After upgrading to a new system with a much larger HD, the INT 25H no longer works with the hard drive.  (It does work on floppies though.)  Any suggestions on absolute disk reads for FAT32 systems?

RE: Absolute Disk Read

Interrupt 25h was used pretty much, exclusively, by Stacker. (Ah, those were the good old days. I gave up Stacker with more than a few kicks and screams.)

Unless you are running NT you might try Interrupt 13h, function 02h.

AH will be 02h
AL will contain the number of sectors to read
CH will contain the low eight bits of the cylinder number
CL (bits 0-5) will hold the sector number
    bits 6-7 reference the drive number (leave it at 0 until it works well on the floppy in A:)
DH is the head number
DL is the drive number (bit 7 is set for hard drives)
ES:BX points to the address of the data buffer (which should be sized 200h times the number of sectors you intend to read.)

Interrupt 13h, function 03h mirrors function 02 but is intended to write disk sectors.

Don't bother to try these or any other low-level disk access calls under NT. The OS will get very weepy and complain that such a thing cannot be allowed.

And remember, always test low-level disk access functions on a floppy or a throw-away hard drive! I can't stress this enough.

I hope Int 13 is what you were looking for. Use the call with some caution.

A plain black box

RE: Absolute Disk Read

I did, but got nothing but received garbage from the read.  However, after about four hours of research on the Microsoft developers site, found a little known function in the DOS services interrupt (21H); AX = 7305H.  This works, but only for the first time.  After that it gives me the same error that INT 25H gives me.  I tried reseting the disk system with INT 13H, ah=0 and ah=0Dh, but to no avail.  Would really like to get this to work.

RE: Absolute Disk Read

The "Old Ones" used to recommend performing Int13 functions 2h or 3h at least four times, interspersed with calls to function 0 (reset disk system). I haven't had any problem reading a hard drive with a single call to function 0 followed by a call to function 2h but, with a floopy, you have to allow the media to get up to speed (at least, on the first sector read.

I haven't heard of the Int21 function you refered to. What is it intended to do? Is it third-party specific?

A plain black box

RE: Absolute Disk Read

  Found the information for function 7305H on Microsorft's Developer Support website.  Here is the address:  


  Click on the TOC icon and a whole lot of info on the win32 SDK pops up.
  I STILL can't find the DOS bootsector using INT 13H functions.  Got the MBR, but no DOS Boot record any where on disk using INT 13H.  Believe me, I've searched!  I know it's there, Just can't find it.

RE: Absolute Disk Read

After reviewing thre code for my INT 13h routine, found a problem with the address calculation sub-routine that prevented it from reading the disk sector where the DOS Master Boot Record was kept.  After correcting that, everything worked perfectly.  Thanks for all the help!

RE: Absolute Disk Read

Any time, Prattaratt. And thank you for making my day. A few Tek-Tips members don't post back after they have solved the problem and one always wonders how it all turned out.

Pardon my curiosity... but were you attempting to address sector 0 instead of sector 1? The reason I ask is that I made that error the first time I tried to read a boot record. Logic suggested that sector numbers should begin with 0....

A plain black box

RE: Absolute Disk Read

No, The problem was in the address calculation logic.  I wasn't figuring the head/cylinder switch over properly, and wound up skipping several cylinders.  STUPID Mistake on my part.  However, there were a few kinks in the FAT 32 system that had to be taken into account;  The BFB (BigFatBootsector) Structure is a tack-on to the regular bootsector structure and some of the info given by the regular boot sector structure was zeroed, giving me coniptions until I tracked down the structure info.

RE: Absolute Disk Read

Excellent work! Will you be willing to release your findings to Tek-Tips? It sounds like it would make a killer FAQ for the members who reach for the low-level solutions.

If you say "no", I think we will all understand. <Sob> We will just have to spend a few hours of frustrating research to replicate the problem you described and hunt down the solution on the Internet.

Really, my whining commentary is intended with good humor <grin>. I thought I had a fair grasp of the calls and their implications but, now, I realize I had overlooked some important issues. Windows and some third-party firmware solutions (like Maxtor EZ-Drive) do mysterious things to the hard disks.

Realizing that our code(s) should work on all machines, I was forced to don my tattered thinking cap.

The gears are beginning to turn...

Thanks, Prattaratt, for making my day twice in one day.

A plain black box

RE: Absolute Disk Read

I'm a bit confused as to how i actually ask a question here but i'll give this a go.
I want to know if there is a way of reading/writing from the hard-drive(FAT32) under WIN2000. I thought int25 (abs disk read/write) would do it but am not so sure after reading the discussions above. I can't use BIOS int13h cos of NTs rejection of it.. (well I haven't tried, but am basing this on Alt255's discussion). There is the extended version of int25 for large hdisks but i really only want to read/write from the Master Boot Record to the end of the FAT tables (incl. everything in between).
It's part of a project to provide security for the hard drive.. if you want to know more just email me and i'll be happy to fill you in.(9727647@student.ul.ie)
Also is there a specific DOS functoin to return the master boot record. I need access to info such as num of sectors etc. At the moment i'm using int21 440Dh to get a drive parameters table, and am also using DOS function getfat(). These together give me enough info to calculate the disk size but i think the figures returned might be wrong because in windows the disk size is always different (by a factor of 10 even). The drive i'm using is 10Gb .. not sure of the make/model.
Any suggestions would be appreciated.

RE: Absolute Disk Read

  Returning to this thread after so long due in part to busy work at my job, I have learned the following items of interest to persons monitoring this thread:

  In response to the above about getting hard disk specifications, the following is very helpful:
    A.  Getting the number of installed hard drives is found at the BYTE located at 40h:75h.

    B.  Ralph Brown's Interrupt List was extremely useful, particularly the information on INT 41h/48h (Hard Disk 0/1 Information Table Address).  The BIOS INT 13H Get Disk Information routines are ALWAYS OFF!  The tables located at the addresses stored in Interrupt Vector 41H and 48H always give good numbers.

    C.  There are extended BIOS functions for Fixed disks over 8 GB.  These functions start at INT 13H AH = 41H.

RE: Absolute Disk Read

howto write operating system in asm howto boot and write hello

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close