# int 13h Extended Read



## LJinx (Nov 30, 2007)

Hello every one,i am new to this forum....

I am facing some problems with the BIOS int 13h Extensions Extended Read Function (042h)

i am trying to read raw sectors into memory during bootup using a simple real mode program which gets loaded from the CD-ROM

Program Description
===================================================
1)it first switches to unreal mode so that it can bypass the 64k segment limitation

2) then it reads in the raw sectors starting from any LBA into memory one sector at a time using the Int 13h Extensions Extended Read Function - 042h, It goes on successfully till about 1000 sectors ,but after that it stops reading ,and the carry flag is set reporting an error.
===========================================================
!!!!! I can read about 1000 sectors starting from any LBA but not above that !!!!!!

I dunno if any one has encountered this sort of problem before...

But It would be of great help if some one help me sort this problem.

My Config:
DELL Dimension-4400 Intel P4-2.0ghz
Maxtor 80GB-HDD


----------



## ZeRealBigBoss (Mar 17, 2007)

Do you read DURING or immediately AFTER booting? I never tried during because that means writing your own OS, but from what you write I deduce that you are running the huge model, that allows you to pass over the 64k segment barrier, after you boot up but you do not switch to protected mode. Abt 1000 sectors is abt 512k memory; that leaves 640-512=128k for OS & program, which sounds about the right size. Ergo: you are still addressing the space under 640k in real mode and not running in protected mode, ergo your memory is full, ergo you can not read more. Don't mix up the 64k segment barrier with the addressable memory space. The 64k segment border is a pointer size definition (small/medium/huge) that is defined within the compiler/linker and that has nothing to do with the real/protected mode; the 640k/1M barrier is different in that, that you have to switch from real to protected mode to be able to address all your memory, which apparently you do not in this case.

When CF is set, what value do you read from DS:SI offset 02H (I guess 0) and which error code comes up in AH? These are the ones I have documented:

01h	invalid function in AH or invalid parameter
02h	address mark not found
03h	disk write-protected
04h	sector not found/read error
05h	reset failed (hard disk)
05h	data did not verify correctly (TI Professional PC)
06h	disk changed (floppy)
07h	drive parameter activity failed (hard disk)
08h	DMA overrun
09h	data boundary error (attempted DMA across 64K boundary or >80h sectors)
0Ah	bad sector detected (hard disk)
0Bh	bad track detected (hard disk)
0Ch	unsupported track or invalid media
0Dh	invalid number of sectors on format (PS/2 hard disk)
0Eh	control data address mark detected (hard disk)
0Fh	DMA arbitration level out of range (hard disk)
10h	uncorrectable CRC or ECC error on read
11h	data ECC corrected (hard disk)
20h	controller failure
31h	no media in drive (IBM/MS INT 13 extensions)
32h	incorrect drive type stored in CMOS (Compaq)
40h	seek failed
80h	timeout (not ready)
AAh	drive not ready (hard disk)
B0h	volume not locked in drive (INT 13 extensions)
B1h	volume locked in drive (INT 13 extensions)
B2h	volume not removable (INT 13 extensions)
B3h	volume in use (INT 13 extensions)
B4h	lock count exceeded (INT 13 extensions)
B5h	valid eject request failed (INT 13 extensions)
BBh	undefined error (hard disk)
CCh	write fault (hard disk)
E0h	status register error (hard disk)
FFh	sense operation failed (hard disk)


----------

