Tag Archives: int 13H 0x20 controller failure

int 13H 0x20 error,controller failure

int
13H
0x20
error,controller
failure

int
13H
0x20
error
code,int
13H
0x20号错误(AH=02H)Controller
Failure.

问题来源:参数理解不正确。

原帖:http://www.brokenthorn.com/Resources/OSDev5.html

BIOS
Interrupt
(INT)
0x13
Function
0x02

Reading
Sectors

INT
0x13/AH=0x02

DISK
:
READ
SECTOR(S)
INTO
MEMORY

AH
=
0x02

AL
=
Number
of
sectors
to
read

CH
=
Low
eight
bits
of
cylinder
number

CL
=
Sector
Number
(Bits
0-5).
Bits
6-7
are
for
hard
disks
only

DH
=
Head
Number

DL
=
Drive
Number
(Bit
7
set
for
hard
disks)

ES:BX
=
Buffer
to
read
sectors
to

Returns:
AH
=
Status
Code

AL
=
Number
of
sectors
read

CF
=
set
if
failure,
cleared
is
successfull

Okay,
This
is
alot
to
think
about.
Some
of
this
is
fairly
easy,

others
should
be
explained
more.
Lets
take
a
look
closer,
shall
we?

CH
=
Low
eight
bits
of
cylinder
number

What
is
a
Cylinder?
A
cylinder
is
a
group
of
tracks
(with
the
same
radius)
on
the
disk.

To
better
understand
this,
lets
look
at
a
picture:

Looking
at
the
above
picture,
remember:

·
Each
Track
is
useually
divided
into
512
byte
sectors.
On
floppies,
there
are
18
sectors
per
track.

·
A
Cylinder
is
a
group
of
tracks
with
the
same
radius
(The
Red
tracks
in
the
picture
above
are
one
cylinder)

·
Floppy
Disks
have
two
heads
(Displayed
in
the
picture)

·
There
is
2880
Sectors
total.

What
does
this
mean
for
us?
The
Cylinder
number
basically
represents
a
track
number
on
a
single
disk.
In
the
case
of
a
floppy
disk,
It
represents
the
Track
to
read
from.

There
is
18
sectors
per
track.
There
is
63
tracks
total
on
floppy
disks.

If
this
value
is
greater
then
63,
The
Floppy
Controller
will
generate
an
exception,
because
the
sector
does
not
exist.
Because
there
is
no
handler
for
it,
The
CPU
will
generate
a
second
fault
exception,
which
will
ultimately
lead
to
a
Triple
Fault.

CL
=
Sector
Number
(Bits
0-5).
Bits
6-7
are
for
hard
disks
only

This
is
the
first
sector
to
begin
reading
from.
Remember:
There
is
only
18
sectors
per
track.
This
means
that
this
value
can
only
be
between
0
and
17.
You
have
to
increase
the
current
track
number,
and
insure
the
sector
number
is
correctly
set
to
read
the
correct
sector.

If
this
value
is
greater
then
18,
The
Floppy
Controller
will
generate
an
exception,
because
the
sector
does
not
exist.
Because
there
is
no
handler
for
it,
The
CPU
will
generate
a
second
fault
exception,
which
will
ultimately
lead
to
a
Triple
Fault.

DH
=
Head
Number

Remember
that
some
floppys
have
two
heads,
or
sides,
to
them.
Head
0
is
on
the
front
side,
where
sector
0
is.
Because
of
this,
We
are
going
to
be
reading
from
Head
0.

If
this
value
is
greater
then
2,
The
Floppy
Controller
will
generate
an
exception,
because
the
head
does
not
exist.
Because
there
is
no
handler
for
it,
The
CPU
will
generate
a
second
fault
exception,
which
will
ultimately
lead
to
a
Triple
Fault.

DL
=
Drive
Number
(Bit
7
set
for
hard
disks)
ES:BX
=
Buffer
to
read
sectors
to

What
is
a
Drive
Number?
Its
simply
a
number
that,
of
course,
represents
a
drive.
Drive
Number
0
useually
represents
a
floppy
drive.
Drive
Number
1
is
useually
for
5-1/4″
Floppy
drives.

Because
we
are
on
a
floppy,
we
want
to
read
from
the
floppy
disk.
So,
the
drive
number
to
read
from
is
0.

ES:BX
stores
the
segment:offset
base
address
to
read
the
sectors
into.
Remember
that
the
Base
Address
represents
the
starting
address.

With
this
all
in
mind,
lets
try
to
read
a
sector.



关于int
13H
另外一个有用的帖子:

http://lingchuangsong.blog.163.com/blog/static/126932322009412105157228/


几句话总结:

1.int
13H只使用一个磁道上的操作;

2.也就是说,每次AL中的磁道数不能多于18(0x12)CL中的开始扇区号不能大于17

违反上述规定,出现如下错误:

The
Floppy
Controller
will
generate
an
exception,
because
the
sector
does
not
exist.
Because
there
is
no
handler
for
it,
The
CPU
will
generate
a
second
fault
exception,
which
will
ultimately
lead
to
a
Triple
Fault.

也就是错误号:0x20,controller failure