Sunteți pe pagina 1din 16

Lecture 27

Extended Read

Service used for extended read is int 13h/42h


On Entry
AH=42H
DL=drive #
DS:SI= far address of Disk address packet

On Exit
If CF=0
AH=0= Success
If CF=1
AH= Error code

Extended Write
Service used for extended read is int 13h/42h
On Entry
AH=43H
AL=0,1 write with verify off
2 write with verify on
DL=drive #
DS:SI= far address of Disk address packet

On Exit
If CF=0
AH=0= Success
If CF=1
AH= Error code

Reading a LBA block


#include <dos.h>
#include <bios.h>
struct DAP {
unsigned char size;
unsigned char reserved1;
unsigned char blocks;
unsigned char reserved2;
unsigned char far *buffer;
unsigned long int lbalod;
unsigned long int lbahid;
} dap;
char st[80];
unsigned char buf[512];
FILE *fptr;

void main (void)


{
puts ("enter the lba low double word: ");
gets (st);
dap.lbalod=atol(st);
puts ("enter the lba high double word: ");
gets (st);
dap.lbahid=atol(st);
dap.size=16;
dap.reserved1=0;
dap.blocks=1;
dap.reserved2=0;
dap.buffer = (unsigned char far *)MK_FP(_DS,buf);

_AH=0x42;
_DL=0x80;
_SI=(unsigned int)&dap;
geninterrupt(0x13);
puts ("enter the path: ");
gets (st);
fptr = fopen(st,"wb");
fwrite(buf,512,1,fptr);
fclose (fptr);
}

Disk Partitioning
Partition Table contains information pertaining
to disk partitions.
Partition Table is the first physical sector
Head = 0
Track/Cylinder = 0
Sec = 1 or LBA = 0
Partition Table at CHS = 001 is also called MBR
(Master Boot Record).

Structure of Partitioning Table


Total size of Partition Table is 512 bytes.
First 446 bytes contains code which loads the
boot block of active partition and is executed at
Boot Time.
Rest of the 66 bytes is the Data part.
Last two bytes of the Data part is the Partition
table signature.

File System for Each O.S.


On a single disk there can be 4 different file
systems and hence 4 different O.S.
Each O.S. will have its individual partition on
disk.
Data related to each partition is stored in a 16bytes chunk within the Data Part of Partition
Table.

Structure of Data Part of P.T.


Size

Description

16 Bytes Partition into of 1st partition.


16 Bytes Partition into of 2nd partition.
16 Bytes Partition into of 3rd partition.
16 Bytes Partition into of 4th partition.
02 Bytes Signature

Size

Description

Byte

80H if Bootable, 0 if Not

Byte

Head # for first block in the partition

Byte

0 5 bits are sector # for first block


within the partition and bits 6 -7 are
higher bits of cylinder #

Byte

Low 8-bits of cylinder # for last block


within the partition..

Byte

File System ID

Size

Description

Byte

Head # for last block in the partition

Byte

0 5 bits are sector # for last block


within the partition and bits 6 -7 are
higher bits of cylinder #

Byte

Low 8-bits of cylinder # for last block


within the partition.

Double
Word

Relative address of the boot record for


the partition with respect to the first
block in partition in terms of LBA
address.

Double
Word

Count of total blocks within the


partition.

File System ID
0 ~ FF for various O.S.
Bit Description
#
00

Empty

01

DOS 12-bit partition

02

Xenix root

03

Xenix/usr

04

MS-DOS 16-bits < 32MB

05

MS-DOS extended partition can manage


disks of sizes up to 8.4 GB

06

MS-DOS 16-bits FAT >= 32MB

07

OS/2, 1FS = Installable file system


Advanced Unix
Windows NT NTFS

08

AIX Boot partitions

09

AIX Data partitions

0A

OS/2 Boot Manager

0B

Win 95

FAT 32

0C

Win 95

FAT 32

LBA Mapped

0E

Win 95

FAT 16

LBA Mapped

0F

Extended partitions LBA Mapped

Primary Partition
Partition defined in the MBR (Master Boot
Record) are primary partition.
Each Primary Partition contains information
about its respective O.S.
However if only one O.S. is to be installed then
extended partitions.

Extended Partitions
MBR

Primary
Partitio
n

Extended Partition

S-ar putea să vă placă și