hi all . i've try this code :


        mov bx,7C00h
mov ax,201h
mov ch,0 ;which cylinder
mov cl,1 ;which sector
mov dh,0 ;head number
mov dl,80h ;Drive C
int 13h


i want to read boot sector of drive C but only success if use a small partition.

is int 13h only support small partition ?
how i can read a sector in a large parttion ?
thanks for your help.
Posted on 2006-12-07 22:04:04 by secmask
Hi!
It's important to note that int 13h doesn't read relative to a partition, it reads relative to a physical drive.  That means that the sector 1 being read in your example is sector 1 of the drive (i.e. the Master Boot Record), not of a partition, and drive 80h is usually the drive from which the computer booted (including USB keys thankfully :) ).  It should still read that sector, it just might not be the one you were expecting.

That said, int 13h inherently doesn't support large sector numbers (excluding the loosely-documented and not-always-consistent int 13h extensions), so if you need to read sectors much beyond the partition boot data, you might need some ATA driver code instead.  If you do need that, you can use the ATAReadSectors procedure from my PwnOS ATA driver code (note that you'll need the associated include files, which I think are all in that directory).  If you're in protected mode, it should work fine on its own, and if you're staying in real mode, you should only need to make minor modifications.

Good luck  :)
Posted on 2006-12-07 22:48:30 by hackulous
ohm ,thanks, that's usefull.
Posted on 2006-12-08 08:22:58 by secmask
A most useful link someone sent to me.
http://www.ctyme.com/intr/rb-0607.htm
Congratulations on the effort to do disk reads, it can be quite an adventure. Absolute disk writes are even more fun.
Posted on 2006-12-08 08:25:35 by Jeronimo0d0a
hic, is there any easy way to read a sector relative with a parttion ? i don't want make it to be complicated bacause my exersice is simple .
Thanks.
Posted on 2006-12-09 05:30:19 by secmask
Sorry for taking so long to reply.  I forgot to click the "Notify" link.  :sad:

To read relative to a partition, read sector 1 of the drive (the MBR), and the partition table, starting at offset 1BEh, will indicate where the partitions are on the disk.  For the format of the partition table, you can check out http://www.ata-atapi.com/hiwtab.htm.  Once you've got the location of the partition that you'd like to read, that's the boot sector of the partition, and if you want to read other sectors, you can calculate their disk addresses (easy with LBA, but awkward with CHS).

I hope that helps.
Posted on 2006-12-19 15:55:12 by hackulous
ok, i think i should read them now, thanks for your helps.
Posted on 2006-12-24 22:10:33 by secmask