[comp.os.msdos.programmer] Reading Bootsector with BIOS

sunny@daimi.aau.dk (Rene Wenzel Schmidt) (04/05/91)

I'm currently writing a program where I need to read the boot-
sector without using DOS calls.
So instead I'm using INT 13h subfunction: AH=02h: Read Sectors
Into Memory.
The following code works fine, if I try to read the bootsector
of drive A: (dl=00h), but I can't read the bootsector of my
harddisk (dl=80h), instead I get the logical sector 3100h. Why?

        ...
        
        ; DL = Physical Drive Number
        mov     ax,0201h        ; Read One Sector
        mov     dh,00h          ; Side 0
        mov     cx,0001h	; Track 0, Sector 1
	mov	bx,offset BoSec ; Store address
	int	13h		; Execute function

	...

I'm running DOS 4.1 with a 49MB SCSI harddisk, with one big partion
(16 bit FAT), and I will be very pleased if someone could help me!

paulg@bhpmrl.oz.au (Paul Gallagher) (04/17/91)

This is off the top of my head, so be warned: I remember doing 
something similar in the past (a sector editor/recronstruction/backup
utility) and I'm sure that when using int13/func2 you specify DL=2 to
read C:, unlike disk reset (int13/func0). ???

My main reaon for posting: this reminded my of a long standing question
I've had. Is there any way of telling exactly which drive was the boot device?
(other than assuming it from the COMSPEC variable or other inductive means)
This must be documented somewhere, but God knows I've tried finding the answer
without success.

Paul Gallagher

     /\/\       Paul Gallagher, PC Support Officer,
    / / /\      Computer Systems Group,
   / / /  \     BHP Melbourne Research Laboratories
  / / / /\ \    245 Wellington Rd Mulgrave Vic 3170 AUSTRALIA
  \ \/ / / /    Phone : +61-3-560-7066,  Fax : +61-3-561-6709
   \  / / /     ACSnet  :  paulg@bhpmrl.OZ.AU        
    \/\/\/