sector read/write 
Author Message
 sector read/write

> As I work around I am trying to use the bios to do the disk read/write.

The following   > code only works for drives A and B (drive set to 0, 1
respectivly). It doesn't work for > drive C (drive = 2) Why?

>     mov ah, 08h
>     mov dl, byte ptr drive
>     int 13h
> the carry flag is set and get ah=01 Bad Command
> I need to get the geometry of the Hard drive but function 08h of int 13h

doesn't work > for the hard drive. HELP!

> thanx

You suggest that the number for drive C is 2. That's true for dos
functions, but not for BIOS functions. Bit 7 of the number for a harddisk
has to be 1, so the number for harddisk 1 is 80h, for harddisk 2 it is 81h
The working code for getting the disk drive parameters will then be:

mov     ah, 08h
mov     dl,  80h
int     13h
That's all.
For a harddisk the returned information is:
ch:     number of tracks on one head
cl:     number of sectors on one track
dh:     number of heads
dl:     number of harddisks

Your first question was why you could use dos function 25h to read a sector
on your desktop, but not on your notebook. There can be many problems, but
probably your notebook's harddisk is larger than 32MB. If that's true then
dos function 25h (and 26h too) needs other parameters.
al:     drive number
cx:     FFFFh (because of extended parameters)
(dx:    relative number of first sector to read) (I don't think this is
ds:bx   pointer to a parameter block.

This parameter block needs to following paramters:

offset  lenght      discription

00h     DWORD    number of first sector
04h     WORD        number of sectors to read
06h     DWORD    pointer to buffer for data    

I think this should do it.

Mon, 05 Jul 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. IDE-HD sector read/write

2. sector read/write

3. Read/Write sectors in memory

4. Need help reading/writing boot sector (floppy disk)

5. Writing at boot sector to the first sector of a disk

6. Clarification: read/write slow, and TCPSocket and sys{read,write}

7. read/write slow, and TCPSocket and sys{read,write}

8. boot sector writing

9. Writing To Boot Sector

10. Write a boot sector

11. Writing specific bytes to a sector

12. Writing String to Sector?


Powered by phpBB® Forum Software