Beruflich Dokumente
Kultur Dokumente
Status Register
Floppy Drive(s)
Bus I/F Logic Inputs: Rd, Wr, A[0:2], TC, CS, RST, DACK2, etc. Outputs: DRQ2, IRQ6, etc.
Drive I/F Logic Inputs: RdData, DskChg, INDX, WrProt, TRK0, etc. Outputs: WrData DrvSel, Step, HdSel, DenSel, etc.
Bi-Dir: DB[7:0]
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).
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
1. Drive head
3
2. Track 3. Sector
Each track is divided into individually addressable sectors
CAPACITY (formatted)
CAPACITY
TRANSFER
(unformatted) RATE
40 80 80 80 80
9 15 9 18 36
(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
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).
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.
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. level formatting sets up the O/S file system structure (boot record, FAT, directory, etc.)
8
High
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
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
The area of the disk that passes under a single head during one complete spin of the disk traces a circle.
Data
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
The data on each track is divided into equal size pieces called sectors (the basic unit of data storage)
Sectors
All
Each
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
inch drives require a +12 volt and a +5 volt supply 3.5 inch drives only require a +5 volt supply.
Current
Control/Data connector, at the floppy controller is dual-row pin type connector (2X17). 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 Pin #1 on any drive cable SHOULD be indicated by a colored stripe.
12
The
NOTE:
Twist
Drive-
|::|===================|::|========x=======|::|
18 Head direction
A twist in the 34-wire 19 Ground cable between wires 10 20 Step and 16 just before the 21 Ground connector for drive 1, 22 Serial Write data transposes the control 23 Ground signal between one drive 24 Write enable and the next.
25 Ground 27 28
If 26 Track 0
only one drive (A:) is used0, leave middle Media Sense connector free. Write protect next pages.
Media Sense Pins 17, 27--Drive outputs to indicate type of media installed (720k, 1.44M, etc)
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). 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).
Adding
Note:
Some O/Ss allow a single physical drive to appear logically as both A: and B:
14
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)
Twist Drive-1
|::|===================|::|=========x===|::|
Controller
Wire 1-9
Wire 10 (Mtr A on) Wire 12 (B select) Wire 14 (A select)
Drive (B)
1-9
10 12 14
Drive (A)
1-9
16 14 12
16
17-34
10
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). 15
System Bus
Status Register
Floppy Drive(s)
Bus I/F Logic Inputs: Rd, Wr, A[0:2], TC, CS, RST, DACK2, etc Outputs: DRQ2, IRQ6, etc
Drive I/F Logic Inputs: RdData, DskChg, INDX, WrProt, TRK0, etc. Outputs: WrData DrvSel, Step, HdSel, DenSel, etc.
Bi-Dir: DB[7:0]
16
The FDC incorporates a PLL, microcontroller, a data separator, and drive, host & serial interface logic.
The
The
The 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
The FDC is hardwired to DMA Channel 2 (DRQ2, DACK2) for compatibility with the IBM-defined standard.
17
The FDC receives commands, transfers data, and returns status information using CPU I/O read & write operations to the FDC registers.
FDC
3F2 = Digital Output Reg [control]; 3F4 = Main Status Reg 3F5 = Data Reg [FIFO]; 3F7 = Digital Input Reg.
Note:
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
0 & 1: floppy drive select (0=A, 1=B, 2=floppy C, ...) 2: 1 = FDC enable, 0 = FDC reset 3: 1 = DMA & I/O interface enabled
Bit
Bit
Bit
the state of the diskette change line which signals when the door is open.
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.
>
Note: Use an O/S such as DOS to access the diskette to see this bit change.
Only
Note: Port 3F7 is shared by the hard disk controller on the PC/AT which returns information on the lower 6 bits.
20
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.
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:
Command phase: Commands are sent from the CPU to the FDC data register via port 3F5h Execution phase: The FDC executes instructions (performs the desired command) & generates IRQ6 Result phase: System reads a series of bytes from the FDC data register (port 3F5h) indicating command status Idle phase: After hardware or software reset or when no commands are in progress.
2.
3.
4.
22
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
23
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. This example assumes the Floppy Controller & DMA controller are already programmed, possibly via BIOS INT 13H or DOS INT 25H, 26H.
NOTE:
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
DREQ2#
IOR# DMA Ctrl and Page Regs.
MEMW#
Address Bus
HOLD/ PHOLD
HLDA/ PHLDA
MEMORY
Floppy Ctrl
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)
When the bus is granted to the DMAC, Hold Ack. is asserted (PHLDA# on the 82430 Chip-set). The DMAC asserts the DACK2# signal to notify the FDC that the transfer cycle is now started.
3)
4)
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
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)
7)
This process continues until the transfer is complete and the DMAC Transfer Counter is decremented to zero.
9)
When the transfer is complete the DMAC sends the TC (Terminal Count) signal to the Floppy Disk Controller.
10)
The IRQ6 ISR reads the FDC Status Registers and writes them into the 7 bytes of the BIOS Data Area.
>
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
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).
>
If another diskette action occurs before the counter expires, the timer is reset to begin counting again.
The PIT- CT0 Output is tied to 8259 PIC IRQ0 and causes an INTERRUPT TYPE 8 (Time Of Day Interrupt.)
>
>
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 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. 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
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
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
Note:
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
A0000h 640K
512K COMMAND.COM
Command Processor
~5DD0h / FB10h
Kernel
I/O . SYS Non-resident BIOS
DOS DATA BIOS DATA Interrupt Vector Table ~12F0h ~0700h 0500h 0400h 0000h
34
O/S serves as an interface between the Application Program (Word, Excel, etc) and the Hardware. BIOS provides low-level interaction with the hardware. DOS has a hierarchical structure. Three layers isolate the user and the application program from the hardware.
O/S: [BIOS / KERNEL /
COMMAND PROCESSOR]
SYSTEM
APPLICATIONS
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 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). is the actual DOS program & the heart of the O/S.
36
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
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
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 FAT12 .3* 000040 c08ed0bc 007c1607 bb780036 c5371e56 *.....|...x.6.7.V* 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 SY* 0001f0 534d5344 4f532020 20535953 000055aa *SMSDOS SYS..U.*
38
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 manufacturers name and version can be found (e.g. - MSDOS5.0.)
The next section contains information about the disks 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
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
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.
INT 18h on the original IBM PC transferred control to ROM BASIC (no longer supported).
NOTE:
4 - The bootstrap loader confirms there are directory entries for IO.SYS & MSDOS.SYS and loads these system files.
If
5 - Program control is then transferred from the bootstrap loader to IO.SYS. 6 - IO.SYS calls MSDOS.SYS.
MSDOS.SYS
DOS primarily uses vectors 20h, 21h, 25h, 26h, & 27h.
CONFIG.SYS exists, modify DOS parameters & install user-specified device drivers (i.e. DEVICE=ANSI.SYS)
Otherwise,
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.
COMMAND.COM contains the internal DOS commands as well as the DOS command processor responsible for processing your commands.
System Bus
Floppy Drive(s)
1. Drive head
3
2. Track
3. Sector
FDC controls all communications & data transfers between the system bus & the floppy drives(s). 1.44 Meg (High Density) is the industry standard. floppy disk is rotated only when accessed & the head stays in physical contact with the disk medium.
3.5 The
The head assembly is moved by a stepper motor, and there is no feedback on where the head is on the disk.
stored on both sides of the disk--heads #0 & #1. is recorded in concentric circles called tracks. track is divided into equal size sectors--512 bytes.
45
34-wire
Control/Data cable--twist between wires 10 & 16 changes the drive number after the twist from B to A.
FDC architecturally resides on the ISA bus, consists of an 8-bit data bus, control signals, & several registers.
FDC receives commands, transfers data, & returns status information using CPU I/O read & write operations. operations are processed in phases:
46
The
FDC
arbitration--PCI Hold Req (PHOLD#) & PHLDA#. address put on the bus; activate #IOR & #MEMW. 512 bytes transferred, DMAC sends TC to the FDC. activates IRQ6 (results phase). Drive motor shut off by IRQ0 ISR.
DACK2# Mem 1
After FDC
Floppy
13h Function 2 reads specified sector(s) and stores the data in a memory buffer at address ES:BX.
47
layers: IO.SYS; MSDOS.SYS; COMMAND.COM up and run POST - INT 19h at end of POST. IO.SYS & MSDOS.SYS; xfr control to IO.SYS. calls MSDOS.SYS; Check for CONFIG.SYS. loads COMMAND.COM. displays prompt & waits for user input. disk boot sector into memory @ 0000:7C00h.
Loads
IO.SYS IO.SYS If
COMMAND.COM