Storage_Floppy_Drive

Download Report

Transcript Storage_Floppy_Drive

PC Peripherals for
Technicians
Chapter 2.1 Storage: Floppy Drives
Systems Manufacturing Training
and Employee Development
Copyright © 1998 Intel Corp.
1
Storage:
Floppy Drives
OBJECTIVES: At the end of this section, the
student will be able to do the following:

Describe the components of the Diskette Sub-system

Describe the floppy disk drive interface cables.

Discuss the Floppy Disk Controller registers and list
the FDC I/O addresses.

List the sequence of operations in a DMA Transfer.

Discuss floppy diskette BIOS INT 13h support.

Explain the structure of DOS and the MS-DOS floppy
boot process.
2
Block Diagram of Floppy Sub-system
Floppy Drives are accessed through the FDC and not directly by the CPU.
FDC (Floppy Disk Controller)
System
Bus
(e.g. ISA)
Host
Bus
Interface
Logic
Bus I/F Logic
Control
Register
Status
Register
Drive
Interface
Logic
Floppy
Drive(s)
Drive I/F Logic
Inputs: Rd, Wr, A[0:2],
TC, CS, RST, DACK2, etc.
Inputs: RdData, DskChg,
INDX, WrProt, TRK0, etc.
Outputs: DRQ2, IRQ6, etc.
Outputs: WrData DrvSel,
Step, HdSel, DenSel, etc.
Bi-Dir: DB[7:0]
3
The Floppy Disk Sub-system

The Floppy Disk Controller (FDC) is the heart of the
Diskette system & connects each drive to the system.
The
FDC controls all communications & data transfers
between the system bus & the floppy drives(s).
»

Beginning with the PC/AT, the BIOS supports 2 drives.
The FDC architecturally resides on the ISA bus.
FDC
interface consists of an 8-bit bi-directional data bus,
control signals, and several registers.

The NEC uPD765, Intel 8272, & Intel 82077 are
commonly used single chip Floppy Disk Controllers.
The
FDC is often integrated into “super I/O” chips such
as the National PC87308 or the SMC FDC37C932FR.
4
Floppy Disk Sub-system: Diskette
Information on Floppy Disk Structure on following pages.
1. Drive head
2
3
2. Track
3. Sector
Each track is divided
into individually
addressable sectors
5
Floppy Disk Sub-system: Diskette
DENSITY
MEDIA
TRACKS
SECTORS
SPEED
SIZE
(per side)
(per track)
(RPM)
# OF
CAPACITY
CAPACITY
TRANSFER
CYLINDERS
(formatted)
(unformatted) RATE
(in inches)
DOUBLE
5.25
40
9
300
80
354 K
360 K
300 Kbps
HIGH
5.25
80
15
360
160
1.2 Meg
1.6 Meg
500 Kbps
DOUBLE
3.5
80
9
300
160
720 K
1.0 Meg
250 Kbps
HIGH
3.5
80
18
300
160
1.44 Meg
2.0 Meg
500 Kbps
EXTRA
3.5
80
36
300
160
2.88 Meg
4.0 Meg
1 Mbps
Note: 512 BYTES / SECTOR; bps = bits per second

(80 tracks * 15 sectors/track) * 2 sides * 0.5 Kb/sector = 1.2 Mb

(80 tracks * 18 sectors/track) * 2 sides * 0.5 Kb/sector = 1.44 Mb
6
Floppy Disk Sub-system: Diskette

360K (Double Density) was the PC/XT format.

5.25 inch, 1.2 Meg format (High Density) was
introduced by IBM with the PC/AT in 1984.

3.5 inch, 720K disk (Double Density) was introduced
by IBM in its first PS/2 computers in 1987.

3.5 inch, 1.44 Meg Disk (High Density) is now the
"new" industry standard.

3.5 inch, 2.88 Meg format (Extra Density) was
introduced by IBM but has not been used much.
 Note:
There is also a “Density Select” output from the FDC to the
drive (Pin 2) that refers to data transfer rates (e.g. 500Kbps) which
is different than the “Recording Density” (e.g. Double, High, Extra).
»
0=Low Density: 250-300 Kbps; 1=High Density: 500Kbps -1 Mbps
7
Floppy Disk Sub-system: Diskette

The floppy disk is rotated only when accessed.
A
magnetic read/write head assembly is moved back and
forth across the surface of the disk by a stepper motor,
and gets to a position because of “steps” by the motor.
»
No feedback indicating where the head is on the disk.
The
head stays in physical contact with the disk medium
at all times, causing wear.

A floppy disk format does BOTH a low-level & highlevel format at the same time.
Low
Level formatting divides each track into sectors by
placing Address Marks & Sector IDs around the track.
High
level formatting sets up the O/S file system
structure (boot record, FAT, directory, etc.)
8
Floppy Disk Sub-system: Head

The head reads or writes magnetically encoded
patterns (serial bit streams) that represent digital data.
There
are two heads so data is stored on both sides of
the diskette--heads are numbered 0 and 1.
>
Note: The first IBM PC's used a single sided floppy disk drive.
As
the disk rotates under the write-head, a small current
is applied to the coil in the disk head.
»
Spots of the disk metallic oxide become magnetized and
thus "remember" the magnetic field which was imposed.
Reading
is essentially the writing process in reverse.
»
Magnetic spots on the disk create protruding magnetic fields
and a small electric current is induced in the head.
»
A sensitive Read Amplifier boosts this signal up to useable
strength for interpretation as the data stored on the disk. 9
Floppy Disk Sub-system: Track

The area of the disk that passes under a single head
during one complete spin of the disk traces a circle.
Data
is recorded in concentric circles called tracks or
cylinders.
»

The terms are often used interchangeably, but track
traditionally refers to a single ring on one side of a disk, and
cylinder refers to a stack of tracks.
The positioning of the heads from track to track by a
stepper motor is called seeking.
Tracks
are numbered sequentially, starting with the
outermost track (track 0) and can be a maximum of either
39 or 79 per side (40 or 80 tracks).
»
The head is “recalibrated” (moved to track 0) by issuing the
“recal” command to the FDC.
10
Floppy Disk Sub-system: Sector

The data on each track is divided into equal size
pieces called sectors (the basic unit of data storage)
Sectors
»
Typically 9, 15, 18 or 36 sectors per track.
All
»
sectors hold 512 bytes of data on a DOS PC
Other Operating Systems may use different size sectors
Each
»
are numbered sequentially, starting from “1”
sector also has a few Bytes of "Overhead"
Overhead bytes Identify the Sector, provide Error Checking
Check Sums, Synchronization data, defined gap areas, etc.
Only
the 512 bytes of data in the data field are written
to in normal operation.
11
Floppy Disk Drive Interface
Floppy Drives normally use two cables

4-wire Power cable.
5.25
inch drives require a +12 volt and a +5 volt supply
Current

3.5 inch drives only require a +5 volt supply.
34-wire Control/Data cable
The
Control/Data connector, at the floppy controller is
dual-row pin type connector (2X17).
The
Control/Data connector at the floppy drive is a cardedge type for 5.25" drives, and a mixture of pin or cardedge types for 3.5" drives
NOTE:
Pin #1 on any drive cable SHOULD be indicated
by a colored stripe.
12
Floppy Disk Drive Interface
Controller
Drive-2 (B:)
Twist
Drive-1(A:) - After the Twist
|::|===================|::|========x=======|::|
1 Ground
18 Head direction
2 Density select (Data Rate)
19 Ground
3 Ground
20 Step
4 Not connected
21 Ground
5 Key (pin missing)
22 Serial Write data
6 Extended density in
23 Ground
7 Ground
24 Write enable
8 Index
25 Ground
9 Ground
26 Track 0
10 Motor A on
27 Media Sense 0
11 Ground
28 Write protect
12 Drive B select
29 Ground
If only one drive (A:) is
used , leave middle
connector free.
13 Ground
30 Serial Read data
Details next pages.
14 Drive A select
31 Ground
15 Ground
32 Head select side 1
16 Motor B on
33 Ground
17 Media Sense 1
34 Disk change
A twist in the 34-wire
cable between wires 10
and 16 just before the
connector for drive 1,
transposes the control
signal between one drive
and the next.
Media Sense Pins 17, 27--Drive outputs to indicate type of media installed (720k, 1.44M, etc)
13
Floppy Disk Drive Interface

IBM devised a method to eliminate having to change
floppy drive jumpers on the assembly line.
»
Floppy disk drive select jumpers configure the drives
as either the 1st (jumper= 0) or 2nd (jumper= 1) drive.
Most
PC's use a standard cable where both drives are
jumpered as the 2nd drive (Physical Drive 1).
Adding
the twist in the the 34-wire cable between wires
10 and 16 effectively changes the drive number setting
on the floppy drive after the twist from Physical Drive 1
(B: 2nd drive) to Physical Drive 0 (A: 1st drive).
»
If only “A:” drive is used, leave the middle connector free.
Note:
Some O/S’s allow a single physical drive to appear
logically as both A: and B:
14
Floppy Disk Drive Interface

A twist between wires 10 & 16 transposes the control
signal between one drive and the next.
»
Both Drive-2 (B) & Drive-1(A) are jumpered as 2nd drive (B)
Controller
Drive-2 (B:)
Twist Drive-1 (A:) After the Twist
|::|===================|::|=========x===|::|
Controller
Drive (B)
Drive (A)
Wire 1-9
1-9
1-9
Wire 10 (Mtr A on)
10
16
Wire 12 (B select)
12
14
Wire 14 (A select)
14
12
Wire 16 (Mtr B on)
16
10
Wire 17-34
17-34
17-34
- Drive A: responds to “Mtr A on” on pin 16 because it
is jumpered as Drive B: (responds as A: due to twist).
i.e.
15
Floppy Disk Controller: Overview
Floppy Drives are accessed through the FDC and not directly by the CPU.
Floppy Disk Controller
System
Bus
Host
Bus
Interface
Logic
Bus I/F Logic
Control
Register
Status
Register
Drive
Interface
Logic
Floppy
Drive(s)
Drive I/F Logic
Inputs: Rd, Wr, A[0:2],
TC, CS, RST, DACK2, etc
Inputs: RdData, DskChg,
INDX, WrProt, TRK0, etc.
Outputs: DRQ2, IRQ6, etc
Outputs: WrData DrvSel,
Step, HdSel, DenSel, etc.
Bi-Dir: DB[7:0]
16
Floppy Disk Controller: Overview

The FDC incorporates a PLL, microcontroller, a data
separator, and drive, host & serial interface logic.
The
FDC architecturally resides on the ISA bus.
The
FDC is typically clocked by a single 24 MHz signal.
The
FDC can be reset by hardware or software
The
FDC controls all communications & data bus
transfers between the system bus & the floppy drives(s).
»
FDC interface consists of an 8-bit bi-directional data
bus & several registers.
Data
transfers to/from the FDC are controlled by the
DMA controller.
»
The FDC is hardwired to DMA Channel 2 (DRQ2, DACK2)
for compatibility with the IBM-defined standard.
17
Floppy Disk Controller: Registers

The FDC receives commands, transfers data, and
returns status information using CPU I/O read & write
operations to the FDC registers.
FDC
I/O addresses are 3F2, 3F4, 3F5 & 3F7
»
3F2 = Digital Output Reg [control]; 3F4 = Main Status Reg
»
3F5 = Data Reg [FIFO]; 3F7 = Digital Input Reg.
Note:
»

Register support and use vary by platform.
Ports 3FO & 3F1 used by some systems.
Detailed FDC register description and programming is
beyond the scope of this course.
Techs
may find the following registers (which apply to all
systems) useful for debugging floppy problems.
18
Floppy Disk Controller: Registers

FDC Digital Output Register (DOR) at port 3F2h
Controls
»
drive motors & drive selection
Note: All DOR bits are cleared during controller reset
Bit
0 & 1: floppy drive select (0=A, 1=B, 2=floppy C, ...)
Bit
2: 1 = FDC enable, 0 = FDC reset
Bit
3: 1 = DMA & I/O interface enabled
Bit
4: 1 = turn floppy drive A motor on
»
e.g. Writing 10h to port 3F2 turns on Drive A: motor
>
Software may write 0C to turn off motor(s)--Bits 2 & 3 enabled.
Bit
5: 1 = turn floppy drive B motor on
Bit
6 & 7 used for Floppy C & D on older systems.
»
Most systems only support 2 drives (A & B).
19
Floppy Disk Controller: Registers

FDC Digital Input Register at 3F7h (Read only)
Returns
the state of the “diskette change” line which
signals when the door is open.
»
Bit 7:0 = Present & not changed; 1= Diskette changed
Software
uses the change line to know that a disk may
have been changed by reading Port 3F7 bit 7.
»
Then the O/S does not have to access the FAT on the
floppy disk to recognize that a new disk has been inserted.
>
Only
»
Note: Use an O/S such as DOS to access the diskette to see
this bit change.
bit 7 of Port 3F7 is used in PC/AT mode.
Note: Port 3F7 is shared by the hard disk controller on the
PC/AT which returns information on the lower 6 bits.
20
Floppy Disk Controller: Notes

Write-Protection takes the form of an LED, a photodetector diode and a status bit in a register of the
FDC.
Floppy
disks are hardware "write-protected" with a hole &
plastic slider (3.5” disks) near the corner of the disk.
»
Uncovering the notch write-protects the disk.
Software
checks a status bit (Status Reg ST1@ 3F5) in
the floppy controller (during the results phase of a
command) to determine that a disk is "write-protected".
»
An error routine then aborts the disk write and informs the
user.
Note:
You cannot override the physical write-protection
through software.
21
Floppy Disk Controller: Operation

The FDC has an extensive command set:
Read

Data, Write Data, Format Track, Recalibrate, etc.
FDC operations are processed in phases:
1.
Command phase: Commands are sent from the CPU
to the FDC data register via port 3F5h
2.
Execution phase: The FDC executes instructions
(performs the desired command) & generates IRQ6
3.
Result phase: System reads a series of bytes from the
FDC data register (port 3F5h) indicating command status
4.
Idle phase: After hardware or software reset or when
no commands are in progress.
22
Floppy Disk Controller: Operation


Overview of a read operation:

Turn disk motor on and set delay time for drive spin up

Perform seek operation; wait for disk interrupt (IRQ 6)

Prepare DMA chip to move data to memory

Send read cmd; wait for xfr complete interrupt (IRQ 6)

Read status information

Turn disk motor off
Note: These tasks are usually performed by the O/S
[Operating System] and/or the BIOS using INT 13h.
See
following pages for description of BIOS INT 13h.
23
DMA Transfer Example : Floppy Read

Data transfers between the FDC and system memory
are controlled by the DMA controller.
This
is an example of a DMA transfer between a Floppy
Disk device and Memory on a system with a PCI bus
using the 82430 Chip-set.
NOTE:
This example assumes the Floppy Controller &
DMA controller are already programmed, possibly via
BIOS INT 13H or DOS INT 25H, 26H.
»
The floppy sub-system has already been initialized with the
cylinder number, head number, start sector, & number of
sectors to read.
»
The DMAC has already been initialized with memory buffer
address, number of transfers, & operation type (I/O Read
and Memory Write)
24
DMA Transfer Example : Floppy Read
TC (terminal Count)
DACK2#
DREQ2#
IOR#
DMA Ctrl
and
Page Regs.
HOLD/
PHOLD
MEMW#
Address Bus
HLDA/
PHLDA
MEMORY
Floppy Ctrl
CPU or
ChipSet
Data Bus
Explanation follows on next few pages.
25
DMA Transfer Example : Floppy Read
1)
When the floppy controller reads data from the
diskette, it requests a transfer by raising the DMA
request line (DRQ2) to the DMAC.
2)
The DMAC responds by asserting (PCI) Hold Request
(PHOLD# on the 82430 Chip-set)
3)
When the bus is granted to the DMAC, Hold Ack. is
asserted (PHLDA# on the 82430 Chip-set).
4)
The DMAC asserts the DACK2# signal to notify the
FDC that the transfer cycle is now started.
»
The #DACK is effectively the device select and is similar to
an I/O address decode for the selected device.
»
The FDC now deasserts DRQ2 because the DMA controller
is servicing the data transfer request.
26
DMA Transfer Example : Floppy Read
5)
The DMAC places a memory address on the bus and
at the same time the DMA Page Register places a page
number on the high memory address lines .
6)
The DMAC activates the control signals to effect the
transfer.
»
7)
Floppy Read / Memory Write Transfer--#IOR and #MEMW
For the floppy drive, only one byte is transferred:
»
The DMAC transfer counter is decremented.
»
The DMAC memory address is incremented.
»
The DMAC releases the Hold Request (PHOLD#) giving the
bus back to the ChipSet.
»
The DMAC DACK2# to the FDC is deasserted.
27
DMA Transfer Example : Floppy Read
8)
This process continues until the transfer is complete
and the DMAC Transfer Counter is decremented to zero.
»
e.g. - All 512 bytes of one sector is transferred.
9)
When the transfer is complete the DMAC sends the
TC (Terminal Count) signal to the Floppy Disk Controller.
»
TC signals the FDC that all bytes have been transferred.
10)
»
The FDC activates the IRQ6 signal (results phase).
The IRQ6 ISR reads the FDC Status Registers and writes
them into the 7 bytes of the BIOS Data Area.
>
»
Reading the Status clears the interrupt request (IRQ6)
The IRQ6 ISR also sets bit 7(diskette H/W INT occurred) of
the byte in the BIOS Data Area at 40:3E, which the BIOS
uses to determine if the disk operation has completed.
28
DMA Transfer Example : Floppy Read
11)
The floppy drive motor is shut off by a timer located in
the BIOS data area at 40:40 (Diskette Motor Time-out)
»
Whenever any disk activity occurs, this byte is loaded with a
countdown value (~2 seconds).
>
»
The PIT- CT0 Output is tied to 8259 PIC IRQ0 and causes
an INTERRUPT TYPE 8 (Time Of Day Interrupt.)
>
>
»
If another diskette action occurs before the counter
expires, the timer is reset to begin counting again.
The Interrupt Service Routine for IRQ0 decrements the
byte at 40:40 in BIOS Data Area every 55 ms (18.2 Hz).
If the count reaches zero, the ISR issues a command to
shut off the disk drive motor if it is on (BIOS Data Area
40:3Fh stores diskette motor status).
Debug Hint: If the Floppy Drive Motor LED stays ON
after accessing the drive, check the 8254 Timer & the
8259 Interrupt Controller operation.
29
BIOS Diskette Support

BIOS interrupts are often used in ITP Debug Procs to
read, write, and verify floppy operation.
Note:
Because the CPU is not involved in DMA floppy
transfers, using BIOS interrupts is a method to stimulate
the FDC, DMA, & Memory signals involved in floppy data
transfer operations.

INT 13h invokes BIOS Diskette & Fixed Disk Service.
INT
13h programs the DMA & floppy controller registers
and executes the required operation (e.g. read sector).
»
Note: If a fixed disk is present, the BIOS redirects all
INT 13h Diskette Request services to INT 40h.
>
This is transparent to the user & users should continue to
invoke INT 13 for both diskette and fixed disk services.
30
BIOS Diskette Support

The Floppy Disk Drive I/O INT 13h interface provides
access to the disk drives supported by the system.

Partial list of the functions (AH values) for INT 13h
AH Value
00H
01H
02H
03H
04H
05H
Function
Reset disk drive
Read status
Disk read
Disk write
Disk verify
Format disk track
31
BIOS Diskette Support

INT 13h Function 2 reads the specified sector(s) from
the specified side of a disk and stores the data in a
memory buffer at address ES:BX.
»
Input:
AH = 02H (Function 2)
AL = Number of sectors
CH =Track number; CL = Sector number
DH = Head number; *DL = Drive number
ES:BX = Address of buffer
* Bit 7 = 0 for Floppy Drive; Bit 7 = 1 for Fixed Drive
»
Output:
AH = Status; AL = Number of sectors transferred
CF = 1 if Error; Carry Flag = 0 if No error
Disk
Write uses same registers except AH = 03
32
BIOS Diskette Support

Example -- Read Diskette Boot Sector into memory
»
MOV AX,8000
;Buffer area defined by ES:BX
»
MOV ES,AX
;Data will be put in 8000 :25
»
MOV BX,25
;80025 Physical (~ 512Kb DRAM area )
»
MOV AH,02 ;Function 2 of INT 13 is READ SECTOR
»
MOV AL,01 ;AL= # of Sectors to read = 1
»
MOV CX,1 ;CH = Track # 0, CL= Sector #1
»
MOV DX,0 ;DL= Head 0, DH= Drive #0 (A:)
»
INT 13
Note:
»
;Transfer Boot Sector to 8000:25
Spin up floppy disk before reading the data.
Function ”0” is often invoked in ITP procs prior to Function
”2” to get disk spinning.
>
This resets the disk controller & recalibrates head to track zero.
33
The Structure of DOS
Look at the structure of MS-DOS before describing the DOS Boot Process.
A0000h
640K
COMMAND.COM
Transient
Command Processor
BOOTLOADER
@7C00h
512K
COMMAND.COM
Command Processor
~5DD0h / FB10h
256K
DEVICE DRIVERS
~2740h
128K
MSDOS . SYS
64K
I/O . SYS
Non-resident BIOS
Kernel
DOS DATA
BIOS DATA
Interrupt Vector
Table
~12F0h
Note: Addresses will
vary depending on
DOS Version!
~0700h
0500h
0400h
0000h
34
The Structure of DOS

The PC/AT has a “layered” operating system.
 The
O/S serves as an interface between the Application
Program (Word, Excel, etc) and the Hardware.
 SYSTEM
BIOS provides low-level interaction with the hardware.
APPLICATIONS
DOS has a hierarchical structure.
Three layers isolate the user and the
application program from the hardware.
O/S: [BIOS / KERNEL /
COMMAND PROCESSOR]
SYSTEM BIOS
(RESIDENT)
HARDWARE
Non-resident BIOS
>IO.SYS or IBMBIO.COM
>Kernel
>MSDOS.SYS or IBMDOS.COM
>Command processor
>COMMAND.COM
IO.SYS & MSDOS.SYS "Hidden" & "Read
Only" so they can't be deleted from the disk.
>
35
The Structure of DOS

The non-resident BIOS (IO.SYS) is the lowest layer
of MS-DOS and interacts directly with the hardware.
IO.SYS
is not resident until it is read into main system
memory (DRAM) from disk or network when the
computer loads the operating system.
»
Note: The SYSTEM BIOS is called the resident portion and
is built into each computer by the computer manufacturer.
IO.SYS
may contain modifications or updates to the
SYSTEM ROM BIOS that are needed to add support for
other types of hardware (e.g. new disk drives).

The second component is the DOS Kernel.
This
»
is the actual DOS program & the heart of the O/S.
In MS-DOS this file is called MSDOS.SYS
36
The Structure of DOS

The third component is the Command Processor.
»
In MS-DOS this file is called COMMAND.COM
This
is the “shell” that contains all of the internal DOS
commands, produces the familiar “A:\>“ or “C:\>“ prompt,
and carries out user commands.

On a floppy disk, the “BOOT SECTOR” is located in
logical sector 0 (Sector One of Track Zero, Side Zero).
The
Boot Sector is only 512 Bytes long and contains:
»
A record of the disks format.
»
A Boot Strap Loader program which reads the bulk of the
operating system (IO.SYS, MSDOS.SYS, & COMMAND.COM) into
memory from elsewhere on the disk and then to transfers
control to the operating system.
37
MS-DOS BOOT PROCESS (Cont.)
Here is part of the boot sector in hex and ASCII.
Offset
0 1 2 3 4 5 6 7 8 9 A B C D E F *0123456789ABCDEF*

000000 eb3c904d 53444f53 352e3000 02010100 *.<.MSDOS5.0.....*

000010 02e00040 0bf00900 12000200 00000000 *...@............*

000020 00000000 0000295a 5418264e 4f204e41 *......)ZT.&NO NA*

000030 4d452020 20204641 54313220 2020fa33 *ME

000040 c08ed0bc 007c1607 bb780036 c5371e56 *.....|...x.6.7.V*
FAT12 .3*
Boot loader code starts at offset 3Eh and ends at offset 19Dh

000190 ca86e98a 16247c8a 36257ccd 13c30d0a *.....$|.6%|.....*

0001a0 4e6f6e2d 53797374 656d2064 69736b20 *Non-System disk *

0001b0 6f722064 69736b20 6572726f 720d0a52 *or disk error..R*

0001c0 65706c61 63652061 6e642070 72657373 *eplace and press*

0001d0 20616e79 206b6579 20776865 6e207265 * any key when re*

0001e0 6164790d 0a00494f 20202020 20205359 *ady...IO

0001f0 534d5344 4f532020 20535953 000055aa *SMSDOS SYS..U.*
SY*
38
MS-DOS BOOT PROCESS (Cont.)
The
»
»
»
major sections in the BOOT SECTOR are:
The first byte in the boot sector is an x86 jump instruction
(i.e. ”eb 3c”) to the bootstrap code in the final section.
The next section is where an OEM software manufacturer’s
name and version can be found (e.g. - MSDOS5.0.)
The next section contains information about the disk’s
physical characteristics which is needed by MS-DOS.
»
The final section in the boot sector contains the disk
bootstrap (starts at offset 3Eh and ends at offset 19Dh for
the version of DOS shown.)
»
The last 2 bytes (1FE & 1FF) of the boot sector contain the
55AAh signature to indicate that the data in the boot sector
represents a bootstrap program.
39
MS-DOS BOOT PROCESS (Cont.)
A high level view of the process of loading DOS

1 - Power up and run POST.
The
remaining steps are accomplished at the end of
POST and are the beginning of the O/S Boot process.
»
The Bootstrap Loader interrupt is invoked via the “INT 19h”
instruction imbedded in the System BIOS EPROM's.
>

The Boot Strap Loader is a very simple program used with
the BIOS ROM to load the O/S from the boot disk.
2 - System BIOS reads the disk boot sector (track 0,
head 0, sector 1) into system memory at 0000:7C00h,
then transfers control to that address.
If
no boot sector is found on the primary boot device,
BIOS looks for a boot sector on a secondary boot device
if present.
40
MS-DOS BOOT PROCESS (Cont.)

3 - If no boot sector is found on any disk, BIOS calls
INT 18h, which displays an error message such as
“NO Boot Device Available” and halts the system.
Some
Network Interface Cards contain boot ROMs that
trap INT 18h so that a system attached to a network can
boot without using a floppy or hard disk.
NOTE:
INT 18h on the original IBM PC transferred
control to ROM BASIC (no longer supported).

4 - The bootstrap loader confirms there are directory
entries for IO.SYS & MSDOS.SYS and loads these
system files.
If
errors occur, a message such as “Non System Disk” is
displayed.
41
MS-DOS BOOT PROCESS (Cont.)

5 - Program control is then transferred from the
bootstrap loader to IO.SYS.

6 - IO.SYS calls MSDOS.SYS.
MSDOS.SYS
»

initializes interrupt vectors used by DOS.
DOS primarily uses vectors 20h, 21h, 25h, 26h, & 27h.
7 - MSDOS.SYS checks to see if a CONFIG.SYS file
exists.
If
CONFIG.SYS exists, modify DOS parameters & install
user-specified device drivers (i.e. DEVICE=ANSI.SYS)
Otherwise,

use default DOS parameters.
8 - IO.SYS loads COMMAND.COM as the default shell
(Command Interpreter).
42
MS-DOS BOOT PROCESS (Cont.)

9 - If an AUTOEXEC.BAT file is present on disk the
commands in AUTOEXEC.BAT are executed.
»
Typical functions carried out by this file are:
>
>
>
Set the system prompt (e.g. A:\>)
Set-up a search path DOS uses when looking for programs
Automatically runs programs required on start-up
Otherwise,

10 - COMMAND.COM displays the DOS prompt (A:)
and waits for user input.
»

issue DOS DATE and TIME commands.
COMMAND.COM contains the internal DOS commands as
well as the DOS command processor responsible for
processing your commands.
The PC is now ready for user input.
43
REVIEW & SUMMARY
Floppy Drives are accessed through the FDC and not directly by the CPU.
FDC (Floppy Disk Controller)
Host
Bus
Interface
Logic
System
Bus
Control
Register
Status
Register
Drive
Interface
Logic
Floppy
Drive(s)
1. Drive head
2
3
2. Track
3. Sector
Each track is divided into
individually addressable sectors
44
REVIEW & SUMMARY
WE HAVE DISCUSSED THE FOLLOWING:

The components of the Diskette Sub-system
The
FDC controls all communications & data transfers
between the system bus & the floppy drives(s).
3.5“
1.44 Meg (High Density) is the industry standard.
The
floppy disk is rotated only when accessed & the
head stays in physical contact with the disk medium.
»
The head assembly is moved by a stepper motor, and there
is no feedback on where the head is on the disk.
Data
stored on both sides of the disk--heads #0 & #1.
Data
is recorded in concentric circles called tracks.
Each
track is divided into equal size sectors--512 bytes.
45
REVIEW & SUMMARY

The floppy disk drive interface cables.
4-wire
Power cable. +12 volt & +5 volt supply.
34-wire
Control/Data cable--twist between wires 10 & 16
changes the drive number after the twist from “B” to “A”.
»

If only one drive (A:) is used , leave middle connector free.
Floppy Disk Ctlr registers & the FDC I/O addresses.
The
FDC architecturally resides on the ISA bus, consists
of an 8-bit data bus, control signals, & several registers.
The
FDC receives commands, transfers data, & returns
status information using CPU I/O read & write
operations.
FDC
»
operations are processed in phases:
1-Command; 2-Execution; 3-Result; 4-Idle phase.
46
REVIEW & SUMMARY

The sequence of operations in a DMA Transfer.
FDC
Bus
requests a transfer by raising DRQ2.
arbitration--PCI Hold Req (PHOLD#) & PHLDA#.
DACK2#
Mem
1
address put on the bus; activate #IOR & #MEMW.
byte transferred; PHOLD# & DACK2# deasserted.
After
512 bytes transferred, DMAC sends TC to the FDC.
FDC
activates IRQ6 (results phase).
Floppy

from DMAC to FDC.
Drive motor shut off by IRQ0 ISR.
The floppy diskette BIOS INT 13h support.
INT
13h Function 2 reads specified sector(s) and stores
the data in a memory buffer at address ES:BX.
47
REVIEW & SUMMARY

The structure of DOS & the DOS floppy boot process
Three
layers: IO.SYS; MSDOS.SYS; COMMAND.COM
Power
Read
up and run POST - INT 19h at end of POST.
disk boot sector into memory @ 0000:7C00h.
Loads
IO.SYS & MSDOS.SYS; xfr control to IO.SYS.
IO.SYS
calls MSDOS.SYS; Check for CONFIG.SYS.
IO.SYS
loads COMMAND.COM.
If
present AUTOEXEC.BAT is executed.
COMMAND.COM
displays prompt & waits for user input.
End of Chapter 2-1
48