Solved

Loading Boot Sector to buffer

Posted on 2002-04-21
4
461 Views
Last Modified: 2008-02-01
INT 13 - DISK - READ SECTOR(S) INTO MEMORY
 AH = 02h
 AL = number of sectors to read (must be nonzero)
 CH = low eight bits of cylinder number
 CL = sector number 1-63 (bits 0-5)
      high two bits of cylinder (bits 6-7, hard disk only)
 DH = head number
 DL = drive number (bit 7 set for hard disk)
 ES:BX -> data buffer
Return: CF set on error
     if AH = 11h (corrected ECC error), AL = burst length
 CF clear if successful
 AH = status (see #00234)
 AL = number of sectors transferred (only valid if CF set for some
       BIOSes)
Notes: errors on a floppy may be due to the motor failing to spin up quickly
   enough; the read should be retried at least three times, resetting
   the disk with AH=00h between attempts
 most BIOSes support "multitrack" reads, where the value in AL
   exceeds the number of sectors remaining on the track, in which
   case any additional sectors are read beginning at sector 1 on
   the following head in the same cylinder; the MSDOS CONFIG.SYS command
   MULTITRACK (or the Novell DOS DEBLOCK=) can be used to force DOS to
   split disk accesses which would wrap across a track boundary into two
   separate calls
 the IBM AT BIOS and many other BIOSes use only the low four bits of
   DH (head number) since the WD-1003 controller which is the standard
   AT controller (and the controller that IDE emulates) only supports
   16 heads
 AWARD AT BIOS and AMI 386sx BIOS have been extended to handle more
   than 1024 cylinders by placing bits 10 and 11 of the cylinder number
   into bits 6 and 7 of DH
 under Windows95, a volume must be locked (see INT 21/AX=440Dh/CX=084Bh)
   in order to perform direct accesses such as INT 13h reads and writes
 all versions of MS-DOS (including v7 [Win95]) have a bug which prevents
   booting on hard disks with 256 heads, so many modern BIOSes provide
   mappings with at most 255 heads
SeeAlso: AH=03h,AH=0Ah,AH=06h"V10DISK.SYS",AH=21h"PS/1",AH=42h"IBM"
SeeAlso: INT 21/AX=440Dh/CX=084Bh,INT 4D/AH=02h

According to the above, how do you setup the registers for loading boot sector (of Hardisk C:) to memory (GAS or GCC)?

Regards,
Jacky
0
Comment
Question by:luckie
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
dimitry earned 100 total points
ID: 6958151
In order to read boot sector from C: with INT 13h you need to set next values:
AH = 02h
AL = 1
CH = 0
CL = 1
DH = 1
DL = 0x80
ES:BX = pointer to 512 bytes buffer

But if you want only to see the contents I suggest you to use DiskEditor, for example from:
http://www.sf-soft.de/winhex/index-m.html

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6959266
I think it is likely that you will need to set DH to 0.

-- Dan
0
 
LVL 11

Expert Comment

by:dimitry
ID: 6959289
If you want to read MBR then Dan is absolutely right:
DH should be 0. But if you want to read boot sector of first partition you need to set DH to 1.
0
 

Author Comment

by:luckie
ID: 6959295
Ok. That will do... Thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Net framework versions 2.0 and sdk 4 508
Reverse Engineering Assembly Code 17 1,636
core dump analysis 26 2,577
Bomb lab phase_5 1 1,343
HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
A procedure for exporting installed hotfix details of remote computers using powershell
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now