Extended Read And Disk Partitioning-System Programming-Lecture Notes, Study notes of System Programming

This lecture handout is for System Programming course. It was provided by Prof. Indubhushan Vijayabhas at Ambedkar University, Delhi. It includes: Extended, Read, Service, Entry, Exit, Drive, Error, Code, Verify, Success, Error, Disk, Address

Typology: Study notes

2011/2012

Uploaded on 08/07/2012

anishay
anishay 🇮🇳

4.2

(25)

118 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
Interrupt 13H/42H can be used to read a LBA addressed block whose LBA address is
placed in the Disk Address packet as described in the slide above.
Extended Write
Service used for extended write is int 13h/43h
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
Similarly int 13H / 43H can be used to write onto to LBA addressed block as described in
the slide above.
docsity.com
pf3
pf4
pf5
pf8

Partial preview of the text

Download Extended Read And Disk Partitioning-System Programming-Lecture Notes and more Study notes System Programming in PDF only on Docsity!

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=

AH=0= Success

If CF=

AH= Error code

Interrupt 13H/42H can be used to read a LBA addressed block whose LBA address is

placed in the Disk Address packet as described in the slide above.

Extended Write

• Service used for extended write is int 13h/43h

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=

AH=0= Success

If CF=

AH= Error code

Similarly int 13H / 43H can be used to write onto to LBA addressed block as described in

the slide above.

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);

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 16-

bytes chunk within the Data Part of Partition

Table.

Structure of Data Part of P.T.

02 Bytes Signature

16 Bytes Partition into of 4th^ partition.

16 Bytes Partition into of 3rd^ partition.

16 Bytes Partition into of 2nd^ partition.

16 Bytes Partition into of 1st^ partition.

Size Description

The data part can contain information about four different partitions for different

Operating systems. Each partition information chunk is 16 bytes long and the last two

bytes at the end of the partition table data part is the partition table signature whose value

should be AA55 indicating that the code part contains valid executable code.

The structure of the information stored in each 16 byte for partition is shown in the slides

below

Byte File System ID

Low 8-bits of cylinder # for last block within the partition..

Byte

0 – 5 bits are sector # for first block within the partition and bits 6 -7 are higher bits of cylinder #

Byte

Byte Head # for first block in the partition

Byte 80H if Bootable, 0 if Not

Size Description

0F Extended partitions LBA Mapped

0E Win 95 FAT 16 LBA Mapped

0B Win 95 FAT 32

0C Win 95 FAT 32 LBA Mapped

0A OS/2 Boot Manager

09 AIX Data partitions

08 AIX Boot partitions

OS/2, 1FS = Installable file system Advanced Unix Windows NT NTFS

06 MS-DOS 16-bits FAT >= 32MB

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 Extended Partition Partition

However if a single operating system is to be kept for instance, then the disk can be

divided into primary and extended partitions. Information about primary and extended

partition is kept in the first physical block. The extended partition may again be divided

into a number of partitions, information about further partitions will be kept in extended

partition table which will be the first physical block within extended partition (i.e. it will

not the first block of primary partition.). Moreover there can be extended partitions

within extended partitions and such that in then end there are number of logical partitions

this can go on till the last drive number in DOS.