<s>
INT	B-Device
13h	I-Device
is	O
shorthand	O
for	O
BIOS	B-Device
interrupt	I-Device
call	I-Device
13hex	O
,	O
the	O
20th	O
interrupt	B-General_Concept
vector	I-General_Concept
in	O
an	O
x86-based	O
(	O
IBM	O
PC-descended	O
)	O
computer	O
system	O
.	O
</s>
<s>
The	O
BIOS	B-Operating_System
typically	O
sets	O
up	O
a	O
real	B-Application
mode	I-Application
interrupt	B-General_Concept
handler	I-General_Concept
at	O
this	O
vector	O
that	O
provides	O
sector-based	O
hard	B-Device
disk	I-Device
and	O
floppy	B-Device
disk	I-Device
read	O
and	O
write	O
services	O
using	O
cylinder-head-sector	B-Device
(	O
CHS	O
)	O
addressing	O
.	O
</s>
<s>
Modern	O
PC	O
BIOSes	O
also	O
include	O
INT	B-Device
13h	I-Device
extension	O
functions	O
,	O
originated	O
by	O
IBM	O
and	O
Microsoft	O
in	O
1992	O
,	O
that	O
provide	O
those	O
same	O
disk	O
access	O
services	O
using	O
64-bit	O
LBA	B-Device
addressing	O
;	O
with	O
minor	O
additions	O
,	O
these	O
were	O
quasi-standardized	O
by	O
Phoenix	O
Technologies	O
and	O
others	O
as	O
the	O
EDD	O
(	O
Enhanced	O
Disk	O
Drive	O
)	O
BIOS	B-Operating_System
extensions	O
.	O
</s>
<s>
INT	B-Device
is	O
an	O
x86	B-Operating_System
instruction	O
that	O
triggers	O
a	O
software	O
interrupt	O
,	O
and	O
13hex	O
is	O
the	O
interrupt	O
number	O
(	O
as	O
a	O
hexadecimal	O
value	O
)	O
being	O
called	O
.	O
</s>
<s>
Modern	O
computers	O
come	O
with	O
both	O
BIOS	B-Operating_System
INT	B-Device
13h	I-Device
and	O
UEFI	B-Architecture
functionality	O
that	O
provides	O
the	O
same	O
services	O
and	O
more	O
,	O
with	O
the	O
exception	O
of	O
UEFI	B-Architecture
Class	O
3	O
that	O
completely	O
removes	O
CSM	O
thus	O
lacks	O
INT	B-Device
13h	I-Device
and	O
other	O
interrupts	O
.	O
</s>
<s>
Typically	O
,	O
UEFI	B-Architecture
drivers	O
use	O
LBA-addressing	O
instead	O
of	O
CHS-addressing	O
.	O
</s>
<s>
Under	O
real	B-Application
mode	I-Application
operating	O
systems	O
,	O
such	O
as	O
DOS	B-Device
,	O
calling	O
INT	B-Device
13h	I-Device
would	O
jump	O
into	O
the	O
computer	O
's	O
ROM-BIOS	B-Operating_System
code	O
for	O
low-level	O
disk	O
services	O
,	O
which	O
would	O
carry	O
out	O
physical	O
sector-based	O
disk	O
read	O
or	O
write	O
operations	O
for	O
the	O
program	O
.	O
</s>
<s>
In	O
DOS	B-Device
,	O
it	O
serves	O
as	O
the	O
low-level	O
interface	O
for	O
the	O
built-in	O
block	O
device	O
drivers	O
for	O
hard	B-Device
disks	I-Device
and	O
floppy	B-Device
disks	I-Device
.	O
</s>
<s>
This	O
allows	O
INT	B-Device
25h	O
and	O
INT	B-Device
26h	O
to	O
provide	O
absolute	O
disk	O
read/write	O
functions	O
for	O
logical	O
sectors	O
to	O
the	O
FAT	B-Application
file	I-Application
system	I-Application
driver	O
in	O
the	O
DOS	B-Device
kernel	O
,	O
which	O
handles	O
file-related	O
requests	O
through	O
DOS	B-Application
API	I-Application
(	O
INT	B-Application
21h	I-Application
)	O
functions	O
.	O
</s>
<s>
Under	O
protected	B-Application
mode	I-Application
operating	O
systems	O
,	O
such	O
as	O
Microsoft	B-Device
Windows	I-Device
NT	I-Device
derivatives	O
(	O
e.g.	O
</s>
<s>
NT4	O
,	O
2000	O
,	O
XP	O
,	O
and	O
Server	O
2003	O
)	O
and	O
Linux	B-Application
with	O
dosemu	B-Application
,	O
the	O
OS	O
intercepts	O
the	O
call	O
and	O
passes	O
it	O
to	O
the	O
operating	O
system	O
's	O
native	O
disk	O
I/O	O
mechanism	O
.	O
</s>
<s>
Windows	O
9x	O
and	O
Windows	O
for	O
Workgroups	O
3.11	O
also	O
bypass	O
BIOS	B-Operating_System
routines	O
when	O
using	O
32-bit	O
Disk	O
Access	O
.	O
</s>
<s>
Besides	O
performing	O
low-level	O
disk	O
access	O
,	O
INT	B-Device
13h	I-Device
calls	O
and	O
related	O
BIOS	B-Operating_System
data	O
structures	O
also	O
provide	O
information	O
about	O
the	O
types	O
and	O
capacities	O
of	O
disks	O
(	O
or	O
other	O
DASD	B-Application
devices	O
)	O
attached	O
to	O
the	O
system	O
;	O
when	O
a	O
protected-mode	B-Application
OS	O
boots	O
,	O
it	O
may	O
use	O
that	O
information	O
from	O
the	O
BIOS	B-Operating_System
to	O
enumerate	O
disk	O
hardware	O
so	O
that	O
it	O
(	O
the	O
OS	O
)	O
can	O
load	O
and	O
configure	O
appropriate	O
disk	O
I/O	O
drivers	O
.	O
</s>
<s>
The	O
original	O
BIOS	B-Operating_System
real-mode	B-Application
INT	B-Device
13h	I-Device
interface	O
supports	O
drives	O
of	O
sizes	O
up	O
to	O
about	O
8	O
GB	O
using	O
what	O
is	O
commonly	O
referred	O
to	O
as	O
physical	O
CHS	O
addressing	O
.	O
</s>
<s>
This	O
limit	O
originates	O
from	O
the	O
hardware	O
interface	O
of	O
the	O
IBM	B-Device
PC/XT	I-Device
disk	O
hardware	O
.	O
</s>
<s>
The	O
BIOS	B-Operating_System
used	O
the	O
cylinder-head-sector	B-Device
(	O
CHS	O
)	O
address	O
given	O
in	O
the	O
INT	B-Device
13h	I-Device
call	O
,	O
and	O
transferred	O
it	O
directly	O
to	O
the	O
hardware	O
interface	O
.	O
</s>
<s>
A	O
lesser	O
limit	O
,	O
about	O
504	O
MB	O
,	O
was	O
imposed	O
by	O
the	O
combination	O
of	O
CHS	O
addressing	O
limits	O
used	O
by	O
the	O
BIOS	B-Operating_System
and	O
those	O
used	O
by	O
ATA	O
hard	B-Device
disks	I-Device
,	O
which	O
are	O
dissimilar	O
.	O
</s>
<s>
When	O
the	O
CHS	O
addressing	O
limits	O
of	O
both	O
the	O
BIOS	B-Operating_System
and	O
ATA	O
are	O
combined	O
(	O
i.e.	O
</s>
<s>
when	O
they	O
are	O
applied	O
simultaneously	O
)	O
,	O
the	O
number	O
of	O
512-byte	O
sectors	O
that	O
can	O
be	O
addressed	O
represent	O
a	O
total	O
of	O
about	O
504	O
MB	O
.	O
</s>
<s>
The	O
504	O
MB	O
limit	O
was	O
overcome	O
using	O
CHS	O
translation	O
,	O
a	O
technique	O
by	O
which	O
the	O
BIOS	B-Operating_System
would	O
simulate	O
a	O
fictitious	O
CHS	O
geometry	O
at	O
the	O
INT	B-Device
13h	I-Device
interface	O
,	O
while	O
communicating	O
with	O
the	O
ATA	O
drive	O
using	O
its	O
native	O
logical	O
CHS	O
geometry	O
.	O
</s>
<s>
Translation	O
allows	O
the	O
BIOS	B-Operating_System
,	O
still	O
using	O
CHS	O
addressing	O
,	O
to	O
effectively	O
address	O
ATA	O
disks	O
with	O
sizes	O
up	O
to	O
exactly	O
8064	O
MB	O
,	O
the	O
native	O
capacity	O
of	O
the	O
BIOS	B-Operating_System
CHS	O
interface	O
alone	O
.	O
</s>
<s>
(	O
The	O
ATA	O
interface	O
has	O
a	O
much	O
larger	O
native	O
CHS	O
addressing	O
capacity	O
,	O
so	O
once	O
the	O
"	O
interference	O
"	O
of	O
the	O
CHS	O
limits	O
of	O
BIOS	B-Operating_System
and	O
ATA	O
was	O
resolved	O
by	O
addressing	O
,	O
only	O
the	O
smaller	O
limitation	O
of	O
the	O
BIOS	B-Operating_System
was	O
significant	O
.	O
)	O
</s>
<s>
CHS	O
translation	O
is	O
sometimes	O
referred	O
to	O
as	O
logical	O
CHS	O
addressing	O
,	O
but	O
that	O
is	O
actually	O
a	O
misnomer	O
since	O
by	O
the	O
time	O
of	O
this	O
BIOS	B-Operating_System
development	O
,	O
ATA	O
CHS	O
addresses	O
were	O
already	O
logical	O
,	O
not	O
physical	O
.	O
</s>
<s>
The	O
8064	O
MB	O
limit	O
originates	O
from	O
a	O
combination	O
of	O
the	O
register	O
value	O
based	O
calling	O
convention	O
used	O
in	O
the	O
INT	B-Device
13h	I-Device
interface	O
and	O
the	O
goal	O
of	O
maintaining	O
backward	O
compatibilitydictating	O
that	O
the	O
format	O
or	O
size	O
of	O
CHS	O
addresses	O
passed	O
to	O
INT	B-Device
13h	I-Device
could	O
not	O
be	O
changed	O
to	O
add	O
more	O
bits	O
to	O
one	O
of	O
the	O
fields	O
,	O
e.g.	O
</s>
<s>
This	O
limit	O
uses	O
1024	O
cylinders	O
,	O
256	O
heads	O
,	O
63	O
sectors	O
,	O
and	O
512	O
byte	B-Application
blocks	O
,	O
allowing	O
exactly	O
7.875	O
GiB	O
of	O
addressing	O
(	O
1024	O
*	O
256	O
*	O
63	O
*	O
512	O
bytes	B-Application
)	O
.	O
</s>
<s>
There	O
were	O
briefly	O
a	O
number	O
of	O
BIOSes	O
that	O
offered	O
incompatible	O
versions	O
of	O
this	O
interfacefor	O
example	O
,	O
AWARD	O
AT	B-Operating_System
BIOS	I-Operating_System
and	O
AMI	O
386sx	O
BIOS	B-Operating_System
have	O
been	O
extended	O
to	O
handle	O
up	O
to	O
4096	O
cylinders	O
by	O
placing	O
bits	O
10	O
and	O
11	O
of	O
the	O
cylinder	O
number	O
into	O
bits	O
6	O
and	O
7	O
of	O
register	O
DH	O
.	O
</s>
<s>
All	O
versions	O
of	O
MS-DOS	B-Application
,	O
(	O
including	O
MS-DOS	B-Application
7	I-Application
and	O
Windows	B-Application
95	I-Application
)	O
have	O
a	O
bug	O
which	O
prevents	O
booting	O
disk	O
drives	O
with	O
256	O
heads	O
(	O
register	O
value	O
0xFF	O
)	O
,	O
so	O
many	O
modern	O
BIOSes	O
provide	O
CHS	O
translation	O
mappings	O
with	O
at	O
most	O
255	O
(	O
0xFE	O
)	O
heads	O
,	O
thus	O
reducing	O
the	O
total	O
addressable	O
space	O
to	O
exactly	O
8032.5	O
MiB	O
(	O
approx	O
7.844	O
GiB	O
)	O
.	O
</s>
<s>
To	O
support	O
addressing	O
of	O
even	O
larger	O
disks	O
,	O
an	O
interface	O
known	O
as	O
INT	B-Device
13h	I-Device
Extensions	O
was	O
introduced	O
by	O
IBM	O
and	O
Microsoft	O
,	O
then	O
later	O
re-published	O
and	O
slightly	O
extended	O
by	O
Phoenix	O
Technologies	O
as	O
part	O
of	O
BIOS	B-Operating_System
Enhanced	O
Disk	O
Drive	O
Services	O
(	O
EDD	O
)	O
.	O
</s>
<s>
It	O
defines	O
new	O
functions	O
within	O
the	O
INT	B-Device
13h	I-Device
service	O
,	O
all	O
having	O
function	O
numbers	O
greater	O
than	O
40h	O
,	O
that	O
use	O
64-bit	O
logical	B-Device
block	I-Device
addressing	I-Device
(	O
LBA	B-Device
)	O
,	O
which	O
allows	O
addressing	O
up	O
to	O
8	O
ZiB	O
.	O
</s>
<s>
(	O
An	O
ATA	O
drive	O
can	O
also	O
support	O
28-bit	O
or	O
48-bit	O
LBA	B-Device
which	O
allows	O
up	O
to	O
128	O
GiB	O
or	O
128	O
PiB	O
respectively	O
,	O
assuming	O
a	O
512-byte	O
sector/block	O
size	O
)	O
.	O
</s>
<s>
This	O
is	O
a	O
"	O
packet	O
"	O
interface	O
,	O
because	O
it	O
uses	O
a	O
pointer	O
to	O
a	O
packet	O
of	O
information	O
rather	O
than	O
the	O
register	O
based	O
calling	O
convention	O
of	O
the	O
original	O
INT	B-Device
13h	I-Device
interface	O
.	O
</s>
<s>
Some	O
cache	O
drivers	O
flush	O
their	O
buffers	O
when	O
detecting	O
that	O
DOS	B-Device
is	O
bypassed	O
by	O
directly	O
issuing	O
INT	B-Device
13h	I-Device
from	O
applications	O
.	O
</s>
<s>
A	O
dummy	O
read	O
via	O
INT	B-Device
13h	I-Device
can	O
be	O
used	O
as	O
one	O
of	O
several	O
methods	O
to	O
force	O
cache	O
flushing	O
for	O
unknown	O
caches	O
(	O
e.g.	O
</s>
<s>
Some	O
DOS	B-Device
and	O
terminate-and-stay-resident	O
programs	O
clobber	O
interrupt	O
enabling	O
and	O
registers	O
so	O
PC	B-Operating_System
DOS	I-Operating_System
and	O
MS-DOS	B-Application
install	O
their	O
own	O
filters	O
to	O
prevent	O
this	O
.	O
</s>
<s>
+	O
Drive	O
Table	O
1st	O
floppy	B-Device
disk	I-Device
(	O
"	O
drive	O
A	O
:	O
"	O
)	O
2nd	O
floppy	B-Device
disk	I-Device
(	O
"	O
drive	O
B	O
:	O
"	O
)	O
3rd	O
floppy	B-Device
disk	I-Device
(	O
"	O
drive	O
C	O
:	O
"	O
)	O
.	O
</s>
<s>
128th	O
floppy	B-Device
disk	I-Device
1st	O
hard	B-Device
disk	I-Device
2nd	O
hard	B-Device
disk	I-Device
3rd	O
hard	B-Device
disk	I-Device
.	O
</s>
<s>
CD/DVD	O
,	O
or	O
97th	O
hard	B-Device
disk	I-Device
.	O
</s>
<s>
If	O
the	O
second	O
column	O
is	O
empty	O
then	O
the	O
function	O
may	O
be	O
used	O
both	O
for	O
floppy	B-Device
and	O
hard	B-Device
disk	I-Device
.	O
</s>
<s>
FD	O
:	O
for	O
floppy	B-Device
disk	I-Device
only	O
.	O
</s>
<s>
HD	O
:	O
for	O
hard	B-Device
disk	I-Device
only	O
.	O
</s>
<s>
PS/2	O
:	O
for	O
hard	B-Device
disk	I-Device
on	O
PS/2	O
system	O
only	O
.	O
</s>
<s>
EXT	O
:	O
part	O
of	O
the	O
Extensions	O
which	O
were	O
written	O
in	O
the	O
1990s	O
to	O
support	O
hard	B-Device
drives	I-Device
with	O
more	O
than	O
8	O
GB	O
.	O
</s>
<s>
Otherwise	O
the	O
interrupt	O
may	O
fail	O
with	O
some	O
BIOS	B-Operating_System
or	O
hardware	O
versions	O
.	O
</s>
<s>
Utilizing	O
memory	B-General_Concept
segmentation	I-General_Concept
,	O
there	O
are	O
different	O
ways	O
to	O
calculate	O
the	O
register	O
values	O
,	O
e.g.	O
</s>
<s>
The	O
last	O
4	O
bytes	B-Application
contains	O
the	O
Error	O
Correction	O
Code	O
(	O
ECC	O
)	O
,	O
a	O
checksum	O
of	O
sector	O
data	O
.	O
</s>
<s>
As	O
already	O
stated	O
with	O
int	B-Device
13h	I-Device
AH	O
=	O
02h	O
,	O
care	O
must	O
be	O
taken	O
to	O
ensure	O
that	O
the	O
complete	O
buffer	O
is	O
inside	O
the	O
given	O
segment	O
,	O
i.e.	O
</s>
<s>
+Specification	O
StructureOffset	O
Size	O
(	O
byte	B-Application
)	O
Description	O
00h1Size	O
of	O
packets	O
in	O
byte	B-Application
(	O
13h	O
)	O
01h1Boot	O
Media	O
Type	O
:	O
</s>
<s>
0100b	O
:	O
Hard	O
Disk4-5Reserved6Image	O
Contain	O
ATAPI	O
Driver7Image	O
Contain	O
SCSI	O
Driver02h1Drive	O
Number	O
(	O
Drive	O
Index	O
)	O
03h1CD-ROM	O
Controller	O
Number04h4Logical	O
Block	O
Address	O
(	O
LBA	B-Device
)	O
of	O
disk	O
image	O
to	O
emulate08h2Device	O
Specification	O
:	O
</s>
