0% found this document useful (0 votes)
428 views

Technical Reference Options and Adapters Volume 2 2of3

IBM Technical Reference Manual, Options and Adapters, Volume 2 part 2 of ,3

Uploaded by

kgrhoads
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
428 views

Technical Reference Options and Adapters Volume 2 2of3

IBM Technical Reference Manual, Options and Adapters, Volume 2 part 2 of ,3

Uploaded by

kgrhoads
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 198

Personal Computer

Hardware Reference
Library

mM Printer Adapter

6361507
ii
Contents

Description .................................... 1
Programming Considerations ...................... 3
Specifications .................................. 7
Logic Diagrams ................................. 9

iii
iv
Description

The IBM Printer Adapter is specifically designed to attach


printers with a parallel port-interface, but it can be used as a
general input/output port for any device or application that
matches its input/output capabilities. It has 12 TTL-buffer
output points, which are latched and can be written and read
under program control using the microprocessor In or Out
instruction. The adapter also has five steady-state input points
that may be read using the microprocessor's In instructions.

In addition, one input can also be used to create a microprocessor


interrupt. This interrupt can be enabled and disabled under
program control. A reset from the power-on circuit is also ORed
with a program output point, allowing a device to receive a
'power-on reset' when the system unit's microprocessor is reset.

The input/ output signals are made available at the back of the
adapter through a right-angle, printed-circuit-board-mounted,
25-pin, D-shell connector. This connector protrudes through the
rear panel of the system unit or expansion unit, where a cable may
be attached.

When this adapter is used to attach a printer, data or printer


commands are loaded into an 8-bit, latched, output port, and the
strobe line is activated, writing data to the printer. The program
then may read the input ports for printer status indicating when
the next character can be written, or it may use the interrupt line
to indicate "not busy" to the software.

The output ports may also be read at the card's interface for
diagnostic loop functions. This allows faults to be isolated to the
adapter or the attaching device.

This same function is also part of the IBM Monochrome Display


and Printer Adapter.

Printer Adapter 1
The following is a block diagram of the Printer Adapter.

8 25-Pin D-Shell
Connector
~U'BUff"8 .Data Latch 8
po

.... Enable ... Clock

~ Trans- .....
...
8
...
ceiver

r DIR

~ O.C.
Read Drivers SLCTIN

~
A Data
STROBE
Write Data po

Command AUTO
Decoder Write Control
- -
FDXT
Read Status
-INIT
Read
Control
-
A

Bus Control
Buffers Latch

~ Enable
~ ..... Clock r-
5 ERROR
po

4 Enable SLCT

R eset
r r.. ~ Clear PE

ACK

BUSY

Printer Adapter Block Diagram

2 Printer Adapter
Programming Considerations

The Printer Adapter responds to five I/O instructions; two output


and three input. The output instructions transfer data into two
latches whose outputs are presented on pins of a 25-pin D-shell
connector.

Two of the three input instructions allow the system unit's


microprocessor to read back the contents of the two latches. The
third allows the system unit's microprocessor to read the real-time
status from a group of pins on the connector.

A description of each instruction follows.

Printer Adapter

Output to address hex 378


Bit 3 I Bit 2 I Bit 1 I BitO
Pin 5 Pin 4 Pin 3 Pin 2

The instruction captures data from the data bus and is present on
the respective pins. Each of these pins is capable of sourcing 2.6
rnA and sinking 24 rnA.

It is essential that the external device does not try to pull these
lines to ground.

Printer Adapter

Output to address hex 37 A


Bit3 Bit 2 Bit 1 BitO
Pin 17 Pin 16 Pin 14 Pin 1

This instruction causes the latch to capture the five least


significant bits of the data bus. The four least significant bits
present their outputs, or inverted versions of their outputs, to the

Printer Adapter 3
respective pins as shown in the previous figure. If bit 4 is written
as aI, the card will interrupt the system unit's microprocessor on
the condition that pin 10 changes from high to low.

These pins are driven by open-collector drivers pulled to +5 Vdc


through 4.7 kQ resistors. They can each sink approximately 7 rnA
and maintain 0.8 volts down-level.

Printer Adapter
Input from address hex 378

This instruction presents the system unit's microprocessor with


data present on the pins associated with the output to hex 3BC.
This should normally reflect the exact value that was last written
to hex 3BC. If an external device should be driving data on these
pins at the time of an input (in violation of usage ground rules),
this data will be ORed with the latch contents.

Printer Adapter
Input from address hex 379

This instruction presents the real-time status to the system unit's


microprocessor from the pins, as follows.

BitO

Printer Adapter
Input from address hex 37 A

4 Printer Adapter
This instruction causes the data present on pins 1, 14, 16, 17, and
the IRQ bit to be read by the system unit's microprocessor. In
the absence of external drive applied to these pins, data read by
the system unit's microprocessor will match data last written to
hex 3BE in the same bit positions. Notice that data bits 0-2 are
not included. If external drivers are dotted to these pins, that
data will be ORed with data applied to the pins by the hex 3BE
latch.

Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 BitO


IRQ Pin 17 Pin 16 Pin 14 Pin 1
Enable
Por=O Por= 1 Por=O Por = 1 Por= 1

These pins assume the states shown after a reset from the system
unit's microprocessor.

Printer Adapter 5
6 Printer Adapter
Specifica tions
25-Pin D-Shell
Connector

o
• • 14
• •
• •
• •
• •
• •
• •
•• •

•• ••
• • 25
13 •
o
At Standard TTL Levels
Signal Adapter
Name Pin Number
- Strobe 1
+ Data Bit 0 2
+ Data Bit 1 3
+ Data Bit 2 4
+ Data Bit 3 5
+ Data Bit 4 6
+ Data Bit 5 7
+ Data Bit 6 8
Printer + Data Bit 7 9 Printer
- Acknowledge 10 Adapter
+ Busy 11
+ P.End (out of paper) 12
+ Select 13
- Auto Feed 14
- Error 15
- Initialize Printer 16
- Select Input 17
Ground 18-25

Connector Specifications

Printer Adapter 7
8 Printer Adapter
Logic Diagrams

The following page contains the logic diagram for the IBM Printer
Adapter.

Printer Adapter 9
~""
,~ -"--NO ..

---..- oM

~ , !:, '"

."
~LFrE5~J'"
... ~

- -~'
.: "' COXl.""""
.:~~~
.. .-. " ..~

fTTT~ ~

tf
m .. .~

,
ri' ~ .~
E
~
r--- --'" --~-L'.-n-"";·'''' '~
t.
~[Jt
~
, roo '"
.on.
....
~!.D ,r<::."
-~.

....... I.tk,
~:§~
-"
-.~ v ...,..
,,~,~
~,

..., -""~ ~ ,,~


v
""
v
::: ... i~' fa~" ~'" ¥. ~" *'" *,u ~" '-- '~'" i.,,;,,I~, '~
17 Lm L", L",
I....-- ~ '--.---I '---' L..J ~ ~ "[ I I .•~. r :l~-
'10- IIF .O""IIF 10 ..F .OIOU 10"", .0"1",F (lx).OOZZ .. F
"!- ..=l~'O,~ '- ~
..; "'iTl·" ...:::::=' ~
...... _M'~ ~
v ...",
~. -,.... I
L ~,
... , v ...,,, I

Printer Adapter (Sheet 1 of 1)


----
-
--
--
---
- --
-
-_ -
---
-
-
---
- ---
-. -
Personal Computer
Hardware Reference
Library

mM 5-114" Diskette
Drive Adapter

6361505
ii
Contents

Description .................................... 1
Programming Considerations ...................... 3
Digital-Output Register ...................... 3
Floppy Disk Controller ....................... 4
Command Summary ......................... 8
Programming Summary ...................... 17
Interface ..................................... 19
System 110 Channel Interface ................ 19
Drive A and B Interface ..................... 20
Specifications ................................. 23
Logic Diagrams ................................ 25

iii
iv
Description

The IBM 5-1/4" Diskette Drive Adapter fits into one of the
expansion slots in the system unit. It is connected to one or two
diskette drives through an internal, daisy-chained flat cable. The
adapter has a connector at the other end that extends through the
rear panel of the system unit. This connector has signals for two
additional external diskette drives; thus, the 5-1/4 inch diskette
drive adapter can attach four 5-1/4 inch drives - two internal
and two external.

The adapter is designed for double-density, MFM-coded, diskette


drives and uses write precompensation with an analog phase-lock
loop for clock and data recovery. The adapter is a
general-purpose device using the NEC fLPD765 or equivalent
controller. Therefore, the diskette drive parameters are
programmable. In addition, the attachment supports the diskette
drive's write-protect feature. The adapter is buffered on the I/O
bus and uses the system board's direct memory access (DMA) for
record data transfers. An interrupt level also is used to indicate
when an operation is complete and that a status condition requires
microprocessor attention.

In general, the 5-1/4 inch diskette drive adapter presents a


high-level command interface to software I/O drivers.

Diskette Adapter 1
Clock
and
Timing
Circuit
1
• Write
. • Write
Precompensate
Circuit ~
Write Data

t'-- .../
I Data Read Data
Data
VCO SYNC· Separator
<}- I--
I-
STD. DATA

~ Buffer
I'r- r-v'
NEC
Floppy
Disk
""
Data Window

V
Step
Direction
Write Enable
f " , ,
~-

Controller
V Head Select
Index
I"" "'-.J Write Protect
./1 '-J Track 0

iRes~t f-- B
Drive A Motor On

Digital
~
f--C
Control Decoder f--D Drive A Select

'1
Port
I-- B
INTR. f-- C
I I-- D

5-1/4 Inch Diskette Drive Adapter Block Diagram


Programming Considerations

This attachment consists of an 8-bit digital output register in


parallel with a NEe p.PD765 or equivalent floppy disk controller
(FDe).

In the following description, drive numbers 0, 1,2, and 3 are


equivalent to drives A, B, e, and D.

Digital-Output Register
The Digital-Output register (DOR) is an output-only register used
to control drive motors, drive selection, and feature enable. All
bits are cleared by the I/O interface 'reset' line. The bits have the
following functions:

Bits 0 and 1 These bits are decoded by the hardware to


select one drive if its motor is on:

Bit 1 0 Drive
00 0 (A)
o1 1 (B)
10 2 (e)
11 3 (D)

Bit 2 The FDe is held reset when this bit is clear.


It must be set by the program to enable the
FDe.

Bit 3 This bit allows the FDe interrupt and DMA


requests to be gated onto the 110 interface.
If this bit is cleared, the interrupt and DMA
request 110 interface drivers are disabled.

Bits 4,5,6, These bits control, respectively, the motors of


and 7 drives 0, 1,2 (A, B, e), and 3 (D). If a bit is
clear, the associated motor is off, and the
drive cannot be selected.

Diskette Adapter 3
Floppy Disk Controller
The floppy disk controller (FDC) contains two registers that may
be accessed by the system unit's microprocessor: a status register
and a data register. The 8-bit main status register contains the
status information of the FDC and may be accessed at any time.
The 8-bit data register (actually consisting of several registers in a
stack with only one register presented to the data bus at a time)
stores data, commands, parameters, and provides floppy disk
drive (FDD) status information. Data bytes are read from or
written to the data register in order to program or obtain results
after a particular command. The main status register can only be
read and is used to facilitate the transfer of data between the
system unit's microprocessor and FDC.

The bits in the main status register (hex 34F) are defined as
follows:

Bit
Number Name Symbol Description
DBO FDD A Busy DAB FDD number 0 is in the Seek mode.
DB1 FDD B Busy DBB FDD number 1 is in the Seek mode.
DB2 FDD C Busy DCB FDD number 2 is in the Seek mode.
DB3 FDD 0 Busy DDB FDD number 3 is in the Seek mode.
DB4 FOC Busy CB A read or write command is in process.
DB5 Non-DMA NDM The FDC is in the non-DMA mode.
Mode
DB6 Data Inputl 010 Indicates direction of data transfer
Output between FDC and processor. If DIO =" 1;'
then transfer is from FDC data register to
the processor. If 010 = "0;' then transfer
is from the processor to FDC data register.
DB7 Request for ROM Indicates data register is ready to send or
Master receive data to or from the processor. Both
bits 010 and ROM should be used to
perform the handshaking functions of
"ready" and "direction" to the processor.

The FDC is capable of performing 15 different commands. Each


command is initiated by a multi-byte transfer from the system
unit's microprocessor, and the result after execution of the
command may also be a multi-byte transfer back to the system

4 Diskette Adapter
unit's microprocessor. Because of this multi-byte interchange of
information between the FDC and the system unit's
microprocessor, it is convenient to consider each command as
consisting of three phases:

Command Phase
The FDC receives all information required to perform a particular
operation from the system unit's microprocessor.

Execution Phase
The FDC performs the operation it was instructed to do.

Result Phase
After completion of the operation, status and other housekeeping
information are made available to the system unit's
microprocessor.

The following tables define the symbols used in the command


summary. The command summary immediately follows these
tables.

Diskette Adapter 5
Symbol Name Description

AO Address Line 0 AO controls selection of main status


register (AO = 0) or data register (AO = 1).
C Cylinder Number C stands for the current/selected cylinder
(track) number of the medium.
D Data D stands for the data pattern that is going
to be written into a sector.
07-00 Data Bus 8-bit data bus, where 07 stands for a
most significant bit, and DO stands for a
least significant bit.
OTL Data Length When N is defined as 00, OTL stands for
the data length that users are going to
read from or write to the sector.
.
EOT End of Track EOT stands for the final sector number on
a cylinder.
GPL Gap Length GPL stands for the length of gap 3
(spacing between sectors excluding VCO
sync field).
H Head Address H stands for head number 0 or 1, as
specified in ID field.
HD Head HO stands for a selected head number 0
or 1. (H = HD in all command words).
HLT Head Load Time HLT stands for the head load time in the
FDD (4 to 512 ms in 4-ms increments).
HUT Head Unload Time HUT stands for the head unload time after
a read or write operation has occurred (0
to 480 ms in 32-ms increments).
MF FM or MFM Mode If MF is low, FM mode is selected; if it is
high, MFM mode is selected only if MFM
is implemented.
MT Multi-Track If MT is high, a multi-track operation is to
be performed. (A cylinder under both HOO
and HD 1 will be read or written.)
N Number N stands for the number of data bytes
written in a sector.

Symbol Descriptions (Part 1 of 2)

6 Diskette Adapter
Symbol Name Description

NCN New Cylinder NCN stands for a new cylinder number,


Number which is going to be reached as a result
of the seek operation. (Desired position of
the head.)
ND Non-DMA Mode ND stands for operation in the non-DMA
mode.

PCN Present Cylinder PCN stands for cylinder number at the


Number completion of sense-interrupt-status
command indicating the position of the
head at present time.
R Record R stands for the sector number, which
will be read or written.

R/W Read/Write R/W stands for either read (R) or write


(W) signal.
SC Sector SC indicates the number of sectors per
cylinder.
SK Skip SK stands for skip deleted-data address
mark.
SRT Step Rate Time SRT stands for the stepping rate for the
FDD (2 to 32 ms in 2-ms increments).
STO Status 0 STO-3 stand for one of four registers that
ST 1 Status 1 store the status information after a
ST 2 Status 2 command has been executed. This
ST 3 Status 3 information is available during the result
phase after command execution. These
registers should not be confused with the
main status register (selected by AO = 0).
ST 0-3 may be read only after a command
has been executed and contain
information relevant to that particular
command.
STP Scan Test During a scan operation, if STP = 1, the
data in contiguous sectors is compared
byte-by-byte with data sent from the
processor (or DMA), and if STP = 2, then
alternate sectors are read and compared.
USO, Unit Select US stands for a selected drive number
US1 encoded the same as bits 0 and 1 of the
digital output register (DOR).

Symbol Descriptions (Part 2 of 2)

Diskette Adapter 7
Command Summary
In the following table, 0 indicates "logical 0" for that bit, 1 means
"logical 1," and X means "don't care."

Data Bus
Phase R/W D7 D6 D5 D4 D3 D2 D1 DO Remarks
Read Data
Command W MT MF SK 0 0 1 1 0 Command Codes
W X X X X X HD US1 usa
w C Sector ID information
W H prior to command
W R execution.
W N
W EOT
W GPL
W DTL
Execution Data transfer
between the FDD
and main system.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector ID information
R H after command
R R execution.
R N
Read Deleted Data
Command W MT MF SK 0 1 1 0 0 Command Codes
W X X X X X HDUS1USO
W C Sector ID information
W H prior to command
W R execution.
W N
W EOT
W GPL
W DTL
Execution Data transfer
between the FDD
and main system.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector ID information
R H after command
R R execution.
R N

8 Diskette Adapter
Data Bus
Phase R/W 07 06 05 04 03 02 01 DO Remarks
Write Data
Command W MT MF 0 a a 1 a 1 Command Codes
W X X X X X HO US1 usa
W C Sector 10 information
W H prior to command
W R execution.
W N
W EOT
W GPL
W OTL
Execution Data transfer
between the main
system and FOO.
Result R ST a Status information
R ST 1 after command
R ST 2 execution.
R C Sector 10 information
R H after command
R R execution.
R N
Write Deleted Data
Command W MT MF a a 1 1a a Command Codes
W X X X X X HO US1 usa
w C Sector 10 information
W H prior to command
W R execution.
W N
W EOT
W GPL
W OTL
Execution Data transfer
between the FOD and
main system.
Result R STa Status 10 information
R ST 1 after command
R ST 2 execution.
R C Sector 10 information
R H after command
R R execution.
R N

Diskette Adapter 9
Oata Bus
Phase R/W 07 06 05 04 03 02 01 00 Remarks
Read a Track
Command W 0 MF SK 0 0 0 1 0 Command Codes
W X X X X X HO US1 usa
w C Sector ID information
W H prior to command
W R execution.
W N
W EOT
W GPL
W DTL
Execution Data transfer
between the FDD
and main system.
FDC reads all of
cylinder's contents
from index hole to
EOT.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector ID information
R H after command
R R execution.
R N
Read 10
Command W 0 MF 0 0 1 0 1 0 Command Codes
W X X X X X HD US1 usa
Execution The first correct ID
information on the
cylinder is stored in
data register.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector ID information
R H during execution
R R phase.
R N

10 Diskette Adapter
Oata Bus
Phase R/W 07 06 05 04 03 02 01 00 Remarks
Format a Track
Command W 0 MF 0 0 1 1 0 0 Command Codes
W X X X X X HD US1 usa
W N Bytes/Sector
W SC Sector/Track
W GPL Gap 3
W D filler byte.
Execution FDC formats an
entire cylinder.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C In this case, the ID
R H information has no
R R meaning.
R N
Scan Equal
Command W MT MF SK 1 0 0 0 1 Command Codes
W X X X X X HD US1 usa
w C Sector ID information
W H prior to command
W R execution.
W N
W EOT
W GPL
W STP
Execution Data compared
between the FDD
and the main system.
Result R STO Status information
R ST 1 after Command
R ST 2 execution.
R C Sector ID information
R H after command
R R execution.
R N

Diskette Adapter 11
Oata Bus
Phase R/W 07 06 05 04 03 02 01 00 Remarks
Scan Low or Equal
Command W MT MF SK 1 1 0 0 1 Command Codes
W X X X X X HD US1 usa
w C Sector 10 information
W H prior to command
W R execution.
W N
W EOT
W GPL
W STP
Execution Data compared
between the FDD
and main system.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector 10 information
R H after command
R R execution.
R N
Scan High or Equal
Command W MT MF SK 1 1 1 0 1 Command Codes
W X X X X X HD US1 usa
w C Sector 10 information
W H prior to command
W R execution.
W N
W EOT
W GPL
W STP
Execution Data compared
between the FDD
and main system.
Result R STO Status information
R ST 1 after command
R ST 2 execution.
R C Sector 10 information
R H after command
R R execution.
R N

12 Diskette Adapter
Data Bus
Phase R/W 07 06 05 04 03 02 01 DO Remarks
Recalibrate
Command W 0 0 0 0 0 1 1 1 Command Codes
W X X X X X 0 US1USO
Execution Head retracted to
No Result track 0
Phase
Sense Interrupt Status
Command W 0 0 0 0 1 0 0 0 Command Codes
Result R STO Status information at
R PCN the end of seek
operation about the
FOC
Specify
Command W 0 0 0 0 0 0 1 1 Command Codes
W t--SRT HUT-
W HLT ND
No Result
Phase
Sense Drive Status
Command W 0 0 0 0 0 1 0 0 Command Codes
W X X X X X HO US1 usa
Result R ST 3 Status information
about FDD.
Seek
Command W 0 0 0 0 1 1 1 1 Command Codes
W X X X X X HO US1 usa
w NCN
Execution Head is positioned
over proper cylinder
on diskette.
No Result
Phase
Invalid
Command W Invalid Codes Invalid command
codes (NoOp - FOC
goes into standby
state).
Result R STO ST 0: 80.

Diskette Adapter 13
Bit
No. Name Symbol Description
D7 D7 = 0 and D6 = 0
Interrupt IC Normal termination of command (NT).
Code Command was completed and properly
executed.
D6 D7 = 0 and D6 = 1
Abnormal termination of command (AT).
Execution of command was started, but
was not successfully completed.
D7 = 1 and D6 = 0
Invalid command issue (IC). Command
that was issued was never started.
D7 = 1 and D6 = 1
Abnormal termination because, during
command execution, the ready signal
from FDD changed state.
D5 Seek End SE When the FDC completes the seek
command, this flag is set to 1 (high).
D4 Equipment EC If a fault signal is received from the
Check FDD, or if the track 0 signal fails to occur
after 77 step pulses (recalibrate
command), then this flag is set.
D3 Not Ready NR When the FDD is in the not-ready state
and a read or write command is issued,
this flag is set. If a read or write command
is issued to side 1 of a single-sided drive,
then this flag is set.
D2 Head Address HD This flag is used to indicate the state of
the head at interrupt.
D1 Unit Select 1 US 1 These flags are used to indicate a drive
DO Unit Select 0 usa unit number at interrupt.

Command Status Register 0

14 Diskette Adapter
Bit
No. Name Symbol Description
D7 End of EN When the FDC tries to access a sector
Cylinder beyond the final sector of a cylinder, this
flag is set.
D6 - - Not used. This bit is always 0 (low).
D5 Data Error DE When the FDC detects a CRC error in
either the ID field or the data field, this
flag is set.
D4 Over Run OR If the FDC is not serviced by the main
system during data transfers within a
certain time interval, this flag is set.
D3 - - Not used. This bit is always 0 (low).
D2 No Data ND During execution of a read data, write
deleted data, or scan command, if the
FDC cannot find the sector specified in
the ID register, this flag is set. During
execution of the read ID command, if the
FDC cannot read the ID field without an
error, then this flag is set. During the
execution of the read a cylinder
command, if the starting sector cannot be
found, then this flag is set.
D1 Not Writable NW During execution of a write data, write
deleted data, or format-a-cylinder
command, if the FDC detects a
write-protect signal from the FDD, then
this flag is set.
DO Missing MA If the FDC cannot detect the ID address
Address mark, this flag is set. Also, at the same
Mark time, the MD (missing address mark in
the data field) of status register 2 is set.

Command Status Register 1

Diskette Adapter 15
Bit
No. Name Symbol Description
D7 - - Not used. This bit is always 0 (low).
D6 Control Mark CM During execution of the read data or scan
command, if the FDC encounters a sector
that contains a deleted data address
mark, this flag is set.
D5 Data Error in DD If the FDC detects a CRC error in the data,
Data Field then this flag is set.

D4 Wrong WC This bit is related to the ND bit, and when


Cylinder the contents of C on the medium are
different from that stored in the ID
register, this flag is set.
D3 Scan Equal SH During execution of the scan command, if
Hit the condition of "equal" is satisfied, this
flag is set.
D2 Scan Not SN During execution of the scan command,
Satisfied if the FDC cannot find a sector on the
cylinder that meets the condition, then
this flag is set.
D1 Bad Cylinder BC This bit is related to the N D bit, and when
the contents of C on the medium are
different from that stored in the ID
register, and the contents of C is FF, then
this flag is set.
DO Missing MD When data is read from the medium, if
Address Mark the FDC cannot find a data address mark
in Data Field or deleted data address mark, then this
flag is set.

Command Status Register 2

16 Diskette Adapter
Bit
No. Name Symbol Description
07 Fault FT This bit is the status of the fault signal
from the FDD.
06 Write WP This bit is the status of the
Protected write-protected signal from the FDD.
05 Ready RY This bit is the status of the ready signal
from the FDD.
04 Track 0 TO This bit is the status of the track 0 signal
from the FDD.
03 Two Side TS This bit is the status of the two-side
signal from the FDD.
02 Head Address HD This bit is the status of the side-select
signal from the FDD.
01 Unit Select 1 US 1 This bit is the status of the unit-select-1
signal from the FDD.
DO Unit Select 0 USO This bit is the status of the unit-select-O
signal from the FDD.

Command Status Register 3

Programming Summary
FDC Data Register I/O Address Hex 3F5
FDC Main Status Register I/O Address Hex 3F4
Digital Output Register I/O Address Hex 3F2
BitO Drive 00: DR #A 10: DR #C
1 Select 01:DR#B 11 : DR #0
2 Not FDC Reset
3 Enable INT & DMA Requests
4 Drive A Motor Enable
5 Drive B Motor Enable
6 Drive C Motor Enable
7 Drive 0 Motor Enable
All bits cleared with channel reset.

OPC Registers

Diskette Adapter 17
FDC Constants (in hex)

N: 02 GPL Format: 05
SC: 08 GPLR/W: 2A
HUT: F HLT: 01
SRT: C (6 ms track-to-track)

Drive Constants
Head Load 35 ms
Head Settle 15 ms
Motor Start 250 ms

Comments

• Head loads with drive select, wait HD load time before R/W.

• Following access, wait HD settle time before R/W.

• Drive motors should be off when not in use. Only A or Band


Cor D may run simultaneously. Wait motor start time before
R/W.

• Motor must be on for drive to be selected.

• Data errors can occur while using a home television as the


system display. Placing the TV too close to the diskette area
can cause this to occur. To correct the problem, move the TV
away from, or to the opposite side of the system unit.

18 Diskette Adapter
Interface

System 1/0 Channel Interface


All signals are TTL-compatible:

Most Positive Up Level +5.5 Vdc


Least Positive Up Level +2.7Vdc
Most Positive Down Level +0.5 Vdc
Least Positive Down Level -0.5 Vdc

The following lines are used by this adapter.

+00-7 (Bidirectional, Load: 1 74LS, Driver: 74LS 3-state):


These eight lines form a bus through which all
commands, status, and data are transferred. Bit 0 is
the low-order bit.

+AO-9 (Adapter input, Load: 1 74LS): These 10 lines form an


address bus by which a register is selected to receive or
supply the byte transferred through lines DO-7. Bit 0
is the low-order bit.

+AEN (Adapter input, load: 1 74LS): The content of lines


AO-9 is ignored if this line is active.

-lOW (Adapter input, Load: 1 74LS): The content of lines


DO-7 is stored in the register addressed by lines AO-9
or DACK2 at the trailing edge of this signal.

-lOR (Adapter input, Load: 1 7 4LS): The content of the


register addressed by lines AO-9 or DACK2 is gated
onto lines DO-7 when this line is active.

-DACK2 (Adapter input, load: 2 74LS): This line being active


degates output DRQ2, selects the FDC data register as
the source or destination of bus DO-7, and indirectly
gates T / C to IRQ6.

Diskette Adapter 19
+T/C (Adapter input, load: 4 74LS): This line along with
DACK2 being active indicates that the byte of data for
which the DMA count was initialized is now being
transferred.

+RESET (Adapter input, load: I 74LS): An up level ends any


operation in process and clears the digital output
register (DOR).

+DRQ2 (Adapter output, driver: 74LS 3-state): This line is


made active when the attachment is ready to transfer a
byte of data to or from main storage. The line is made
inactive by DACK2 becoming active or an I/O read of
the FDC data register.

+IRQ6 (Adapter output, driver: 74LS 3-state): This line is


made active when the FDC has completed an
operation. It results in an interrupt to a routine that
should examine the FDC result bytes to reset the line
and determine the ending condition.

Drive A and B Interface


All signals are TTL-compatible:

Most Positive Up Level + 5.5 Vdc


Least Positive Up Level + 2.4 Vdc
Most Positive Down Level + 0.4 Vdc
Least Positive Down Level - 0.5 Vdc

All adapter outputs are driven by open-collector gates. The


drives must provide termination networks to Vcc (except 'motor
enable', which has a 2,000-ohm resistor to Vcc).

Each adapter input is terminated with a I 50-ohm resistor to Vcc.

20 Diskette Adapter
Adapter Outputs

-Drive Select A and B (Driver: 7438): These two lines are


used by drives A and B to degate all
drivers to the adapter and receivers
from the attachment (except 'motor
enable') when the line associated
with a drive is inactive.

- Motor Enable A and B (Driver: 7438): The drive associated


with each of these lines must control
its spindle motor such that it starts
when the line becomes active and
stops when the line becomes
inactive.

-Step (Driver: 7438): The selected drive


moves the read/write head one
cylinder in or out per the direction
line for each pulse present on this
line.

-Direction (Driver: 7438): For each recognized


pulse of the 'step' line, the
read/write head moves one cylinder
toward the spindle if this line is
active, and away from the spindle if
inactive.

- Head Select (Driver: 7438): Head 1 (upper


head) will be selected when this line
is active (low).

-Write Data (Driver: 7438): For each


inactive-to-active transition of this
line while 'write enable' is active, the
selected drive causes a flux change
to be stored on the diskette.

-Write Enable (Driver: 7348): The drive disables


write current in the head unless this
line is active.

Diskette Adapter 21
Adapter Inputs

-Index The selected drive must supply one pulse per


diskette revolution on this line.

- Write Protect The selected drive must make this line active
if a write-protected diskette is in the drive.

-Track 0 The selected drive must make this line active


if the read/write head is over track O.

-Read Data The selected drive supplies a pulse on this


line for each flux change encountered on the
diskette.

22 Diskette Adapter
Specifications
34- Pin Keyed
Edge Connector

Component
Side

Note: Lands 1-33 (odd numbers) are on the back of the


board. Lands 2-34 (even numbers) are on the front. or
component side.

At Standard TTL Levels Land Number


Ground-Odd Numbers 1-33
Unused 2.4.6
Index 8
Motor Enable A 10
Drive Select B 12
Drive Select A 14
Motor Enable B 16
Diskette Direction (Stepper Motorl 18 Drive
Drives Step Pulse 20 Adapter
Write Data 22
Write Enable 24
Track 0 26
Write Protect 28
Read Data 30
Select Head 1 32
Unused 34

Connector Specifications (Part 1 of 2)

Diskette Adapter 23
37-Pin D-Shell
Connector
o
1 • • 20

19 • 37
o

At Standard TTL levels Pin Number


Unused 1-5
Index 6
Motor Enable C 7
Drive Select D 8
Drive Select C 9
Motor Enable D 10
Direction (Stepper Motor) 11

External Step Pulse 12 Drive


Drives Write Data 13 Adapter
Write Enable 14
Track 0 15
Write Protect 16
Read Data 17
Select Head 1 18
Ground 20-37

Connector Specifications (Part 2 of 2)

24 Diskette Adapter
(2) + El'A8LE DRtVE 314
!2) - ENABl.E DAM 314
+",11> 2118

~~~~~~~~~~~~~~~~~~~~~"~-g"~"~-'~~i: ~:I~~~~o~,~~~~~~~ ~~'i'§~~~+INDEX


(2) _ DRIVE SELECT 1
(21 - DftM SELECT 2 II> + IoORITEPI'IOTECT (3)
t31
(2) _ MOTOR ENA8LE 1
:; + 1R,"CII 0 :::
(2) _ MOTOR ENABlE 2

'"
'"
'"
(S) + WRITE DATA

~~~~g~, ~,~il"~
lSI + WRITE ENABlE
(2) _ DRIVE SELECT 3
!2) _ DflIV£SELECT4
(2) _ MOTOftENABl.E3 10 DR[VES3&4 n
(2) _ MOTOR ENABLE 4
NOTES I &2

+'" 11>2K 3 '"


"e +AO
+A1
(2)
(2)
8'16-1 1/4'" ~
PROCESSOR Al'l +A2 (2)
RP-2
" .. A3
+A4
(2)
(2)
+A5 (2)
+A6 (2)
+A7 t2}
," .. A6 (2)

'"'"
+A9 (2)
I SIGNALS ON DRIVE PINS 10 THRU II> ARE SWAPPED BV THE DRIVE (ABLE

:~ :~ ".
,e,
+AEN
-lOR
(ll
12)

:~
TIO
:~ 8.21lFD
'" :~~ET l!:
14
I')
12
II
'"
,e'
,e,
_ +TC
_ _ +00
+01
(3)
(2)
(2)
II> TO 10
'"
'CO
,"
+02
_ _ _ +03
(2)
(2)
2 ALL DRiVES ARE JUMPERED FOR MULTIPLO OPERAT[ON. HEAD LOAD
WITH DRIVE SELECT AND DRIVE SELECT ViA INPUT PIN 12. TERMINATlNG
,,. .. 04
_ _ _ +05
(2)
(2)

:g~
_ _ +06 (2)
_ _ _ +07 (2)
rn .0'11 ",FO SHOULD BE ADJACENT TO MODU~ES MC ,'161. 1'+.8. 7451'1.lbMHZOSC.
RI'-I.I1C'I0'fI.11{'I02'I,74L5Ibl&74LSI'I1 B.2"Fl)CAPSSHOULD8ENEARAS'i)(lATED~ PltlS '"
_ _ _ OACK2 (3)

[LD ALL SlGtlAL UNES H["HER THAN OR EQUAL TO IMHZ SHOULD BE IIEPT TO THE
SHORTEST 'POSSIBLE LENGTH. THIS IS A PRIMARV DESIGN GOAL

') MAKE NO CONNEClIOt< TO UNUSED PINS ON 1HE VCO. CHARGE PUMP & DATA SEI'!!IRATOR MODULES

b ALL VOLTAGE AND (,ROUtlD eONtiECTIONS TO THE veo. CHARGE PUMP AND ASSOCIATED DISCRETE
COMPONENTS SHOULD 6E SEPARATE FROM OTHER CIRCUITS AND THEN JOINED TO THE OTHER
CiRCUITS AT ONE POINT

5-1/4 Inch Diskette Drive Adapter (Sheet 1 of 4)


~~...L--
''"" --~~ GATE- +ENABLE DRIVE 3/4
7"LG~
,,
& ENABLE DRIVE 314
''""
'"
(1) +A<;
,
u,"
,I, 1

K:~'
11, +Ab
(1)
(1)
+A7
+AB
7'+:18,
I,
'"
, 74~~ L
(1) +A9
u"
~'SO»'~'----l1~~:~~,'~"r,'~~~====jt=L~~~-----------
,I
~ ~ rV UZ9
L __ -.JuIS
DRIVE SELECT 3
'"

~ ,"'mJ
----r---;======4::j"tl--' Ag~ ~I;~~~lll
~ ~ g~ :~ ~
(11 +AZ
II 6 U 14

U 13 ~ ===it g~ :; 1: tH2 ~ 17~3a-"1


q g; ~llq ~Ir'''-'--++---~=--=--=":i:'t-=!L.fT''------------
'~13
10 7'+LS12 8

I~Kt !~I :7'*'18-":


'"
~7 ~ 2~ 3
'"
lr I
LJ-______-l-____________-W+t:j,,:tl:[)~~"'------------MOTORENA8LEl
7LtlS01t J2 7'+38-4
(1) +RESET ----1-1---------''-1 2 (t)

J
Ll--______+-__________--+-lJ:::~,,~l:[).__t-'·'------------MOTOA
UI2 9 1"38-'1

ENABLE 2 (1)

__ ..J U ..

91
L-l-____________________-W===::l,,4=:[)~.lL-----------MOTOR
7'1'18-'118
ENABLE 3 (1)
p, -DA"
(3) Dl.CK&lt 12 ~ 14i8--I j'

'"'" 'D'
.00 L---t====================~==jt~==~~"=-----------
13

L_---1ulS
MQTORENABLE4 (1)

.02
'" 'D'
'"'"'" 'D'
.",

.""
'"'" .D7 '"
."
'''"""
HO

(1) -IOR

5-1/4 Inch Diskette Drive Adapter (Sheet 2 of 4)


,
, +lbMHZ 14}

+"i00 KHZ WRiTE CLOCK 14}

r
IK~~~
MR2 GlI'l
, t2 MHZ (21

~roo--oo2 ,

C::
+WRITE DATA III

D I~(~
+2TRQbNC TR 10 .----- ,
" ~~ R~:
.2 8 <A 7 + DIRECTION III
4 CLK!
~Ol
OSC.
~ ---L: ~-~CLKI
n .. we
CPI Qi :>--N( ~2A
7 .". I CLF 7 14 PO Q~ II = IS CLR ~~A
~D2 Q2~ IrEA
= NOTE 5J 74lS10'l ~ 14LS10"
~OB r-'!---
U2
"' U2 ~D~ ~~NC II IB
YB

" c8J ',,,,


,-!-< CLR Q1
~- r----R- 28
2 I ~
e'lB-1
., -
2K
RP-2
----3! We< wDA '>0 U \I
2"iOnSEC
Et1B
" E8
WRITE PRE(QMP06A110N
1<1 ClK PSO 12 + EARLY -'4 SO
PSI 11 + LATE 2 51

,
.-" RD'
WE 2S
74lSIS'> UIO , +WRITE ENABLE III
17 lOX
III +!NOEX

, FRISTP ,7
.. 74LSOB
8 , +STEP III
III + WR'lTE PROTECT ~4 WPITS SEEK "3" 10

HDL~NC ""
, I 74lS0B USO~NC
USI t2t;- N(

~'
1~ FLT/TRO MF .... p-NC
U4
lC~ ~~ , +V FO SYNC (4)

HO 27 4
74LSOB
, ,
~4
+SELECT HEAD I III

(4) SfANDARDOATAiCLK
, 2~ ROO
(4) +OATA WINDOW 22 ROW
j.iPD7f;f)
CONTlJUEO FROM SHEET 4"'
1074LSOB

'"
(1)- OA(K 2 j==============~f5~====~==~==)!8~
9

74lS04
_____--------------------------------~, +DACK & TC 12j

I~ 7'il50B 14LSO'+
U" " DACK (2)
(2) +OMA GATE ~-------------~~~U'

",OTE: U '+ t 7'+LS08J PINS 12 AND 13 ARE


CONNECTED ONLY ON CARDS
8UILT USING RAW CARD PIN'iOOIZ'n

5-1/4 Inch Diskette Drive Adapter (Sheet 3 of 4)


DlGITALONHHOT +IPULLUPI
W
co 13) +1 ...HZ CLOCK

... ....
"STANDARD DATA" GENI!RATOR
...
•.
~
~~. ~
11 J PR Q'
un

1'0Ic~C~ TC~
un

3~5 11
,..3L
.I
u..

.
!"....
Q •

, ,-----'- J •
~4 +STANDAltD DATA 131

. ,.
LS112 13 1/1 La11:t :I LA1" t1lLS112 1/2LS1U
'--( CK1/2
'--< OK ~PCP ,-----'-< OK ~ CO<

Ii (1) +READ DATA Ie

-7f-
orL- r -7.t- Q' rEO'-7f- ~ K

~
Q'

I"¥
> '4 a

f
~

I3J+VCOSYNC

. . ,.1 U24

k
+0'

..,
B U20
'co A

..
(3) +500 KHZ
WRIT. CLOCK
L'-!- '01
,co u,a

..• ......
~

.... .. ,. a, , 4,. !l.


'4 ,
•.-
• ,ea Aour • 2 , vee vee F • ~ r;;;:;-;; r!-

......-:c. .
B 10 lCO CONTI. OUT •
• B

.f<
IIC4024
t!!.2C1 oct-!-
...
Xl E• •

@~
U"
~2C2 AI. a GO ' +DATA WINDOW (3)
~2C3
, lit:
. r~
2.15K C17

UF~ '"
'r"
INPUT SELECTOR
4 pu OF 10

. . . . . 1IOTECTOfI
R5

2IC :!:. 2IC


I"'"
...
':" SJJa27pF
...
R2 O.03IIJIF

LOOP FILTI!R
--- ~
7

+
(PULLUPI
+ •

5-1/4 Inch Diskette Drive Adapter (Sheet 4 of 4)


-- -
--
--- --
-- ---
- ---
---
Personal Computer
--- -
,- Hardware Reference
Library

mM Fixed Disk
Adapter

6361503
ii
Contents

Description .................................... 1
Fixed Disk Controller ........................ 1
Programming Considerations ...................... 3
Status Register ............................. 3
Sense Bytes ................................ 4
Data Register .............................. 7
Control Byte ............................... 8
Command Summary ........................ 10
Programming Summary ...................... 14
Interface ..................................... 15
Specifications ................................. 17
Logic Diagrams ................................ 19
BIOS Listing .................................. 25

iii
it>
Description

The Fixed Disk Adapter attaches to one or two fixed disk drive
units through an internal, daisy-chained, flat cable (datal control
cable). Each system supports a maximum of one Fixed Disk
Adapter and two fixed disk drives.

The adapter is buffered on the I/O bus and uses the system
board's direct memory access (DMA) for record data transfers.
An interrupt level also is used to indicate operation completion
and status conditions that require microprocessor attention.

The Fixed Disk Adapter provides automatic II-bit burst error


detection and correction in the form of 32-bit error checking and
correction (ECC).

The device level control for the Fixed Disk Adapter is contained
on a ROM module on the adapter. A listing of this device level
control can be found in "BIOS Listing" of this section.

Warning: The last cylinder on the fixed disk drive is reserved


for diagnostic use. The diagnostic write test will destroy any
data on this cylinder.

Fixed Disk Controller


The disk controller has two registers that may be accessed by the
system unit's microprocessor: a status register and a data register.
The 8-bit status register contains the status information of the
disk controller, and can be accessed at any time. The 8-bit data
register (actually consisting of several registers in a stack with
only one register presented to the data bus) stores data,
commands, and parameters, and provides the disk controller's
status information. Data bytes are read from, or written to the
data register in order to program or obtain the results after a
particular command. The status register is a read-only register
that is used to help the transfer of data between the system unit's
microprocessor and the disk controller. The controller-select
pulse is generated by writing to port address hex 322.

Fixed Disk Adapter 1


Serializer /
Deserializer
J2
To
SERDES Data } Drives
ECC Separator

Edge
Connector

Data Bus
OB7-DBO
Control Sector
Buffer

a-Bit
Processor

.Fixed Disk Adapter Block Diagram


Programming Considerations

Status Register
At the end of all commands from the system board, the disk
controller sends a completion status byte to the system board.
This byte informs the system unit's microprocessor if an error
occurred during the execution of the command. The following
shows the format of this byte.

~I
6 5 4 3 2
o d o o o e

Bits 0, 1, 2, 3, 4, 6, 7 These bits are set to zero.

Bit 1 When set, this bit shows an error has


occurred during command execution.

Bit 5 This bit shows the logical unit number


of the drive.

If the interrupts are enabled, the controller sends an interrupt


when it is ready to transfer the status byte. Busy from the disk
controller is unasserted when the byte is transferred to complete
the command.

Fixed Disk Adapter 3


Sense Bytes
If the status register receives an error (bit 1 set), the disk
controller requests four bytes of sense data. The format for the
four bytes is as follows:

Bits 7 6 5 4 3 2 1 0
Byte 0 Address Error Type Error Code
Valid I o I I
Byte 1 0 0 d
I Head Number
Byte 2 Cylinder High I Sector Number
Byte 3 Cylinder Low

Remarks
d = drive

Byte 0 Bits 0, 1, 2, 3 Error code.

Byte 0 Bits 4,5 Error type.

Byte 0 Bit 6 Set to 0 (spare)

Byte 0 Bit 7 The address-valid bit. Set only when


the previous command required a
disk address, in which case it is
returned as a 1; otherwise, it is O.

4 Fixed Disk Adapter


Disk Controller Error Tables
The following disk controller error tables list the error types and
error codes found in byte 0:

Error Type Error Code


Bits 5 4 3 2 1 0 Description
0 0 0 0 0 0 The controller did not detect any error
during the execution of the previous
operation.
0 0 0 0 0 1 The controller did not detect an index signal
from the drive.
0 0 0 0 1 0 The controller did not get a seek-complete
signal from the drive after a seek operation
(for all non-buffered step seeks).
0 0 0 0 1 1 The controller detected a write fault from
the drive during the last operation.
0 0 0 1 0 0 After the controller selected the drive, the
drive did not respond with a ready signal.
0 0 0 1 0 1 Not used.
0 0 0 1 1 0 After stepping the maximum number of
cylinders, the controller did not receive the
track 00 signal from the drive.

0 0 0 1 1 1 Not used.
0 0 1 0 0 0 The drive is still seeking. This status is
reported by the Test Drive Ready command
for an overlap seek condition when the
drive has not completed the seek. No
time-out is measured by the controller for
the seek to complete.

Fixed Disk Adapter 5


Error Type Error Code
Bits 5 4 3 2 1 0 Description
0 1 0 0 0 0 ID Read Error: The controller detected an
ECC error in the target ID field on the disk.
0 1 0 0 0 1 Data Error: The controller detected an
uncorrectable ECC error in the target sector
during a read operation.
0 1 0 0 1 0 Address Mark: The controller did not detect
the target address mark (AM) on the disk.
0 1 0 0 1 1 Not used.
0 1 0 1 0 0 Sector Not Found: The controller found the
correct cylinder and head, but not the
target sector.
0 1 0 1 0 1 Seek Error: The cylinder or head address
(either or both) did not compare with the
expected target address as a result of a
seek.
0 1 0 1 1 0 Not used.

0 1 0 1 1 1 Not used.
0 1 1 0 0 0 Correctable Data Error: The controller
detected a correctable ECC error in the
target field.
0 1 1 0 0 1 Bad Track: The controller detected a bad
track flag during the last operation. No
retries are attempted on this error.

Error Type Error Code


Bits 5 4 3 2 1 0 Description
1 0 0 0 0 0 Invalid Command: The controller has
received an invalid command from the
system unit.
1 0 0 0 0 1 Illegal Disk Address. The controller
detected an address that is beyond the
maximum range.

6 Fixed Disk Adapter


Error Type Error Code
Bits 5 4 3 2 1 0 Description
1 1 0 0 0 0 RAM Error: The controller detected a data
error during the RAM sector-buffer
diagnostic test.
1 1 0 0 0 1 Program Memory Checksum Error: During
this internal diagnostic test, the controller
detected a program-memory cheCksum
error.
1 1 0 0 1 0 ECC Polynominal Error: During the
controller's internal diagnostic tests, the
hardware ECC generator failed its test.

Data Register
The system unit's microprocessor specifies the operation by
sending the 6-byte device control block (DCB) to the controller.
The figure below shows the coniposition of the DCB, and defines
the bytes that make up the DCB.

Bit 7 6 5 4 3 2 1 0
Byte 0 Command Opcode
Class
Byte 1 0 0 d Head Number
Byte 2 Cylinder High
I Sector Number
Byte 3 Cylinder Low
Byte 4 Interleave or Block Count
Byte 5 Control Field

Byte 0 Bits 7, 6, and 5 identify the class of the command.


Bits 4 through 0 contain the Opcode command.

Byte 1 Bit 5 identifies the drive number. Bits 4 through 0


contain the disk head number to be selected. Bits
6 and 7 are not used.

Fixed Disk Adapter 7


Byte 2 Bits 6 and 7 contain the two most significant bits
of the cylinder number. Bits 0 through 5 contain
the sector number.

Byte 3 Bits 0 through 7 are the eight least-significant bits


of the cylinder number.

Byte 4 Bits 0 through 7 specify the interleave or block


count.

Byte 5 Bits 0 through 7 contain the control field.

Control Byte
Byte 5 is the control field of the DeB and allows the user to
select options for several types of disk drives. The format of this
byte is as follows:

I I
Bits
7
r
6
a
5
0
4
0
3
0
2
s s ~I
Remarks
r = retries
s = step option
a = retry option on data ECC
error

Bit 7 Disables the four retries by the controller on all


disk-access commands. Set this bit only during the
evaluation of the performance of a disk drive.

Bit 6 If set to 0 during read commands, a reread is


attempted when an Eee error occurs. If no error
occurs during reread, the command will finish
without an error status. If this bit is set to 1, no
reread is attempted.

Bits 5, 4, 3 Set to O.

8 Fixed Disk Adapter


Bits 2, 1, 0 These bits define the type of drive and select the
step option. See the following figure.

Bits 2. 1. 0
0 0 0 This drive is [lot specified and defaults to 3 milliseconqs per
steP
0 0 1 N/A
0 1 0 N/A
0 1 1 N/A
1 0 0 200 microseconds per step.
1 0 1 70 microseconds per step (specified by BIOS).
1 1 0 3 milliseconds per step.
1 1 1 3 milliseconds per step.

Fixed Dislt Adapter 9


Command Summary

Command Data Control Block Remarks

Test Drive Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1)


Ready Byte 0 0 0 010 0 0 0 0 x = don't care
(Class 0, Byte 1 0 0 d Ix x x x x Bytes 2, 3, 4, 5 = don't
Opcode 00) care

Recalibrate Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 01 0 0 0 0 1 x = don't care
Opcode 01) Byte 1 0 0 d Ix x x x x r = retries
Byte 5 r 0 0 0 0 s s s s = Step Option
Bytes 2, 3, 4 = don't
care
ch = cylinder high

Reserved This Opcode is not


(Class 0, used.
Opcode 02)
Request Sense Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )
Status Byte 0 0 0 01 0 0 0 1 1 x = don't care
(Class 0, Byte 1 0 0 d Ix x x x x Bytes 2, 3, 4, 5 = don't
Opcode 03) care

Format Drive Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 01 0 0 1 0 0 r = retries
Opcode 04) Byte 1 0 0 d I Head Number s = step option
Byte 2 ch 10 0 0 0 0 0 ch = cylinder high
Byte 3 Cylinder Low
Byte 4 0 0 01 Interleave Interleave 1 to 16
Byte 5 r 0 0 0 0 s s s for 51 2-byte sectors.

Ready Verify Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 01 0 0 1 0 1 r = retries
Opcode 05) Byte 1 0 0 I
d Head Number s = step option
Byte 2 ch I Sector Number a = retry option on
Byte 3 Cylinder Low data ECC
Byte 4 Block Count ch = cylinder high
Byte 5 r a 0 0 0 s s s

10 Fixed Disk Adapter


Command Data Control Block Remarks

Format Track Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 010 0 1 1 0 r = retries
Opcode 06) Byte 1 0 0 d I Head Number s = step option
Byte 2 ch 10 0 0 0 0 0 ch = cylinder high
Byte 3 Cylinder Low
Byte 4 0 0 01 Interleave Interleave 1 to 16
Byte 5 r 0 0 0 0 s s s for 512-byte sectors.

Format Bad Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


Track Byte 0 0 0 010 0 1 1 1 r = retries
(Class 0, Byte 1 0 0 d I Head Number s = step option
Opcode 07) Byte 2 ch 10 0 0 0 0 0 ch = cylinder high
Byte 3 Cylinder Low
Byte 4 0 0 01 Interleave Interleave 1 to 16
Byte 5 r 0 0 0 0 s s s for 512-byte sectors.

Read Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 0[0 1 0 0 0 r = retries
Opcode 08) Byte 1 0 0 d I Head Number a = retry option on
Byte 2 ch I Sector Number data ECC error
Byte 3 Cylinder Low s "" step option
Byte 5 r a 0 0 0 s s s ch = cylinder high

Reserved This Opcode is not


(Class 0, used.
Opcode 09)

Write Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 0, Byte 0 0 0 010 1 0 1 0 r = retries
Opcode OA) Byte 1 0 0 d I Head Number s = step option
Byte 2 ch I Sector Number ch = cylinder high
Byte 3 Cylinder Low
Byte 4 Block Count
Byte 5 r 0 0 0 0 s s s

Seek Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1)


(Class 0, Byte 0 0 0 010 1 0 1 1 r = retries
Opcode OB) Byte 1 0 0 d I Head Number s '" step option
Byte 2 ch 10 0 0 0 0 0 x = don't care
Byte 3 Cylinder Low ch = cylinder high
Byte 4 x x x x x x x x
Byte 5 r 0 0 0 0 s s s

Fixed Disk Adapter 11


Command Data Control Block Remarks

Initialize I Bit 17 6 5 4 3 2 1 01 Bytes 1, 2, 3, 4, 5, =


Drive I Byte 0 10 0 010 1 1 0 01 don't care
Characteristics *
(Class 0,
OpcodeOC)

Read ECC Burst I Bit 17 6 5 4 3 2 1 01 Bytes 1, 2, 3, 4, 5, =


Error Length I Byte 0 10 0 01 0 1 1 0 1I don't care
(Class 0,
Opcode OD)

Read Data from LBit 17 6 5 4 3 2 1 01 Bytes 1, 2, 3, 4, 5, =


Sector Buffer IByteO 10 0 OlO 1 1 1 01 don't care
(Class 0,
Opcode OE)

Write Data to I Bit 17 6 5 4 3 2 1 01 Bytes 1, 2, 3, 4,5, =


Sector Buffer IByte 0 10 0 010 1 1 1 1 I don't care
(Class 0,
Opcode OF)

RAM I Bit 17 6 5 4 3 2 1 01 Bytes 1, 2, 3,4,5, =


Diagnostic IByte 0 11 1 1 [0 0 0 0 01 don't care
(Class 7,
Opcode 00)

Reserved This Opcode is not


(Class 7, used.
Opcode 01)

Reserved This Opcode is not


(Class 7, used.
Opcode 02)

*Initialize Drive Characteristics: The DBC must be followed by eight additional bytes.
Maximum number of cylinders (2 bytes)
Maximum number of heads (1 byte)
Start reduced write current cylinder (2 bytes)
Start write precompensation cylinder (2 bytes)
Maximum ECC data burst length (1 byte)

12 Fixed Disk Adapter


Command Data Control Block Remarks

Drive Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


Diagnostic Byte 0 1 1 1 10 0 0 1 1 s = step option
(Class 7, Byte 1 0 0 dlx x x x x r = retries
Opcode 03) Byte 2 x x x x x x x x x = don't care
Byte 3 x x x x x x x x
Byte 4 x x x x x x x x
Byte 5 r 0 0 0 0 s s s

Controller I Bit 7 6 5 4 3 2 1 0 Bytes 1, 2, 3, 4,5, =


Internal I Byte 0 1 1 1 10 0 1 0 0 don't care
Diagnostics
(Class 7,
Opcode 04)

Read Long* Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 7, Byte 0 1 1 1 10 0 1 0 1 s = step option
Opcode 05) Byte 1 0 0 d I Head Number r = retries
Byte 2 ch J Sector Number ch = cylinder high
Byte 3 Cylinder Low
Byte 4 Block Count
Byte 5 r 0 0 0 0 s s s

Write Long * * Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1 )


(Class 7, Byte 0 1 1 1 10 0 1 1 0 s = step option
Opcode 06) Byte 1 0 0 d I Head Number r = retries
Byte 2 ch I Sector Number ch = cylinder high
Byte 3 Cylinder Low
Byte 4 Block Count
Byte 5 r 0 0 0 0 s s s

*Returns 512 bytes plus 4 bytes of ECC data per sector.


* *Requires 512 bytes plus 4 bytes of ECC data per sector.

Fixed Disk Adapter 13


Programming Summary
The two least-significant bits of the address bus are sent to the
system board's I/O port decoder, which has two sections. One
section is enabled by the I/O read signal ( -lOR) and the other by
the I/O write signal (-lOW). The result is a total of four
read/write ports assigned to the disk controller board.

The address enable signal (AEN) is asserted by the system board


when DMA is controlling data transfer. When AEN is asserted,
the I/O port decoder is disabled.

The following figure is a table of the read/write ports.

R/W Port Address Function


Read 320 Read data (from controller to system unitl.
Write 320 Write data (from system unit to controllerl.
Read 321 Read controller hardware status.
Write 321 Controller reset.
Read 322 Reserved.
Write 322 Generate controller-select pulse.
Read 323 Not used.
Write 323 Write pattern to DMA and interrupt mask
register.

14 Fixed Disk Adapter


Interface

The following lines are used by the disk controller:

AO-AI9 Positive true 20-bit address. The least-significant 10


bits contain the I/O address within the range of hex
320 to hex 323 when an I/O read or write is
executed by the system unit. The full 20 bits are
decoded to address the read-only memory (ROM)
between the addresses of hex C8000 and C9FFF.

DO-D7 Positive 8-bit data bus over which data and status
information is passed between the system board and
the controller.

-lOR Negative true signal that is asserted when the system


board reads status or data from the controller under
either programmed I/O or DMA control.

-lOW Negative true signal that is asserted when the system


board sends a command or data to the controller
under either programmed I/O or DMA control.

AEN Positive true signal that is asserted when the DMA in


the system board is generating the I/O Read (-lOR)
or I/O Write (-lOW) signals and has control of the
address and data buses.

RESET Positive true signal that forces the disk controller to


its initial power-up condition.

IRQ 5 Positive true interrupt-request signal that is asserted


by the controller when enabled to interrupt the
system board on the return ending status byte from
the controller.

DRQ3 Positive true DMA-request signal that is asserted by


the controller when data is available for transfer to
or from the controller under DMA control. This
signal remains active until the system board's DMA
channel activates the DMA-acknowledge signal
(-DACK 3) in response.

Fixed Disk Adapter 15


-DACK 3 This signal is true when negative, and is generated by
the system board DMA channel in response to a
DMA request (DRQ 3).

16 Fixed Disk Adapter


Specifications

The Fixed Disk Adapter connector and interface specifications


follow.

Fixed Disk Adapter 17


Pin 34 fil~l~,::,
~~ Pin 1

Pin 20rru!ZlJ!-...'
::::::
"
';~
..........
:::~~
, Pin 1
Pin 2~2~ ,-
Position 5 has No Pin
(for Cable Orientation)
Pin 1
Signal Pin Number
Ground-Odd Numbers 1-33
Reserved 4.16.30.32
- Reduced Write Current 2
- Write Gate 6
- Seek Complete 8
Disk - Track 00 10 Disk
Drive - Write Fault 12 Adapter
Connector - Head"Select 2° 14 Connector
J1 - Head Select 2' 18 J1
-Index 20
- Ready 22
-Step 24
- Drive Select 1 26
- Drive Select 2 28
- Direction In 34

Signal Pin Number


Ground 2.4.6.8.12.16.20
Drive Select 1
Reserved 3,7
Spare 9.10.5 (No Pin)

Disk Ground 11 Disk


Drive MFM Wire Data 13 Adapter
Connector - MTM Write Data 14 Connector
J2orJ3 Ground 15 J2 or J3
MFM Read Data 17
- MFM Read Data 18
Ground 19

Fixed Disk Adapter Interface Specifications

18 Fixed Disk Adapter


~
RESET
"
=
...
!~Jml1iIAI ~~~~'I~
' CJCI
All A18 4 5
A13 A17 15
74LS688 tr
16 N RNA AlAB S
IzzzzZZl ,'
':::
12 A , [-:";Jj:!'p'51 ~ :~ Lsi7i 19 ,1 1 2 18 7 CI AI +RESET ~

B ~~~ ...=~
4 lS244l=! -RESET
!~~ ~ ~4 ~~ "
5H 6 12 LS321
Al3 EN AB 4 l1F
• :~R 2 6J 11

Tlg '*
1 D1
1o-o,16t~ul
11Y~
A
I 7 :
: '6D2~
6 D6
05 •
AI2-=~.~D ~~.
I I 1511H 1 •
,• A

I"
lC S04
':' 5
, 6 D4

lS24 ~ 1~~;,I~I2~I~'~-'-I~'jf~~~ij~~t~~~~~5~~~~~
5
" ~g
D3
D2
A
A
CJCI
....
=
R5D
••
so~2iET:" ~'1'
I DI
m
:ll
A22
A8
A:'
A
AI
17
~
lOJ 38 8 Z
. ,
:: 5
: AI'CE
;
1 0"60004 -'
,:'9R~O 10F 5
"
3
"NTERRUPTEN::Bl:J~~O
OF"
rtrlS04
a
:~; ~~ il~5~'=1t~¥'!G~~~~~'S~DO~~:I~'~o~8:t'~'~K'>"""':-i',f--'=~D •
"05 23 fI.l
:~ A2
A4
11
13
12 3
ITYPI 7 4
~ 6 DO ~O,
11 ':" LS244
LS74 11
12
02 : +DMAENABlE ~3 LSI25

~fl9 ±::i ,
'f;f~,\~~:~
D
~ "~'V1~~II9t=~D~~~~~~~~==~~~'hJ.L ~
.30 AI lS244' I AD 6F ClCl 02" ,·5Dp4lS1.kk,'

A31 I~
lS244 10 19 ~3 5~S041~"D'AI" ::-: A51 4
----- 3 9JQ 6
OR03
12 9K:>"'-1-I\,}---="--i::> 81
~ ~4 Z5-SELECT Cl LS125
~
::R ION;6
1 J't
16 +5V
8H rLSI5~D~I~6~-~"~SE~TID::;:===1111~t11--------------il
1 -OATADUT .50
¥ 74lS688 ~4 rl rs~!IIP 2 - 3 11 -DRIVE TYPE I I~Ol
C>-';=D~=-'------'l-'-SD:-:'-::~;::-8K--8=::;::q--I~~~I~;~AS~'~~~] r~ '~,~. ~ l:~' ~:~'f'l~':S7:-:.N-====--
+ACKNOWlEDGE

A" ,
81' ~lSD' CLYi'
taK-.J;r:pi~'~O~;============:::t;'~~:6==~'~1:J~~6!j=i ~jS:S~~ss~~~~d~
OJ
81'
~
K3lSD41312 5 ~l§
h, '''' __
815 IDA 11
9 g8K LS04 8J lS08 15lS244~ ~501aR50LS74

~
~
,'~_~8~U:S.Y~DI_~o~Di=iA~=S3~~:;~~~~~~~~~~~~~~~~~~~~~~~~~==~~~~I~B~~~4~~'l~:!l==~~I2~D'~~'j
3 + -D + OH T/-FR MH E ii10"''+-I----------='- 4 ITYPI I 11 ~ ',I
Co
t:;j
, -ClBUSY 1 ~ el l3

I •rrn5Vj:~ ~
-EN IN 5 LS32

/il' ,2
-EN HOST •
~'''OUEST
OJ ' 22K 1
~
, , " 3 ~~D~IP~~~'
2 6
-r; ~614 ,2I
lS244 12
>
Co
-EN OUT 1 6J 3
:

12
1314 4

ITYPI

~
....
...
~

Fixed Disk Adapter (Sheet 1 of 6)


jooI.
\C
DELAYCLOCK
.51
+RESE
I i wa ~ -ENItOST
1
+ WEACLOCK
-JlESET

~
+;:62~HK 6 J Q I J 0
5V
16
~~K

~~' I
T
8131

~
[ .7
,••t. 1
11118 15144 5
• 1 2530
" 35
R2
.70 NAZ eLK
. 1 12
35 llC 1 +A KNDWLE E

~
>II'-
87
gc
.st. 2 4 IE 3
.51:;>-5 "7 Mst'
11. 21
22 0
Msce
LSI
~
LSI
~-t-- ,1 LSI 23
O.
OJ
3
01 15 lS04 2B 1 n +
••
ill
vee", 11 27
~r-- •
14 vee 35
~ 3.'
GNO=29
'-7 VCC=31.5
GND=20
29
30
01
D
3. GND -15 32
3

=t~~:,t::~:r.:r:;r~rAII:i= :1:1::~:4 :b1


36
~
31
lJ'"'V 11

16
I .81: 33~1~1:738 40 Bl 00 D5 0302100

882ZK DIP A Al AZ A3A4A5A6 7 AD DISKU1


,
BH
22KDlP
5 5 7F 6
t>-.:
j AD +AO

·· ,, .
~

~
+A1
All 21
R~+ 11 0
~

~• I•"
~ 7f 3 ~-!::-

~
A5
~ "VA ~
LS3 AS A9
LSI 13 9F 0 !!...!!Z.
~LS257 7 ISUC.1 11 0 2148
02 !l....!!fi.. E"OJD2~
~
~
2732
t:::lsYG PROM 01 ~ ~21~1~

' t -~ I--
4 1H 0-

-;:1l t:! • 17
AD DI ~ ¥,=t oo~
~
• 6 AQ DO
5 ~ CSOE
AD , ~ csiE '·'-P~iiiE I TE N l T BUS 3.1

~12
I' 8ll-
S-
~' 3 LS3Z IOLS
11
9
11
1H
'Y"
rr T EHOUT
1,3
1

- a;P." 00
~LS74'3 12:l_.
11 8 11 10~l 9
lS04 ~3
.51

Fixed Disk Adapter (Sheet 2 of 6)


+POWERCLOCK

6 -READ GATE -DELAY CLOCK


R10
41n 4MHZCLK
+ROGATE

+SElDR2

SEL~~~3S=t::===iE
-ORASEL
-ORB
-INDEX
11
13
+SELDRT

~14lh~~ATOR
+tNDEX

,>O,!'.6_ _ _ _ _ _ _ _~2B~~----'-~A.'!!..!!!"':!!SEc!.T----> 5.6


W DIP 06
;-".,!!..,..--------r-:mrl -REDUCE WRITE CURRENT
~_ _-..-.J<::..J!!!L.l!I ;-".,!!......-----<ID4l -DIRECTION
'A, 3 B 3 12
"><"""~-------<-:m!4l -STEP
15 tCIB
142G
f
0 ~---~~ ;-"'~-----<=n -HD2

~:~:.~IS~@~[:====::i±~~ :f- ~
LSI55 1 6
f')c;:¥'--""---------r-:miB"l -HDl
I~---~~ -HDO
-RESET

,,
+WRITEGATE
2B
-READY GiJj:j'·!D~---.......,*-'-~<m-:::T.1.l!-~[;d
03
, 4.6

28 ::~~: ~8 D2 ).!!-:------<mo -DRIVE SELECT T


-SEEKCOMPCj~~====~::t=~
-WRITE FAULT ( -12
28 3 lB YB: 4
Dl
DO P-'---------<mn -DRIVESELECTO
28 5 lB 2A Y8
-TRACK 0 Q[j,.,[[)~-----",*,'--<:C!.~;:J
TERM lS2411 ~------<mn -WRITE GATE

Fixed Disk Adapter (Sheet 3 of 6)


+DELDATA
~
~ -ClAMPVCO

~
~ WINDOW CLOCK
+NRZ DO DATA
2.6

Q.

a:>0 +ENABLE NRl DATA


-NRIClOCK
2.6

t
.
'a 10 MHZ CRVSTAL
5.6
~

+MFMWRO
-MFMWRO

+MFMWRI
-MIIMWRI

""1.",C.",EA",S,",,,,,,,,,,,C,,,OM,,"P~I~X 2B·13 J2.J3,GNOPINS


2,4.6.8.10,
06 TERM .48 11,12,15.16.19.20

.
-INCREASE PRECOMP
-TESTENA L
All +5V

"
Fixed Disk Adapter (Sheet 4 of 6)
WINODWClK
+ DEL DATA

J-'
+5VA

-1
J3-1 TPB

'38
33"

-CLAMP VCO
\'1"" AG5l0pF
9'"

-AM DETECT
'_6
+ RD GATE
-AM RESET

Fixed Disk Adapter (Sheet 5 of 6)


4) -HAl WR DATA J4
3)-AMRESET ~
tt5

I·~·i
.;,." .Bom '5'
3 >-Wi AM [L:>
5)=:~ D:~~ DD
J4
~1,3.7"1
IK
.48
04.
:;~-~'.~C'~'A~S~'..P',,'C"B._P________________~~
>--RO GATE crr::> ':' TEST CONNECTOR .SO
: :> 10 MHZ CRYSTAL UI:> .51

4:> -TEST EHABlE ~m::>


J4
+t2V

r-------------.u-----------,
l 3300 TO 202 PACKAGE I
I I
: L.320MP5.0 I
I IQ·OII--t-----~::-:-----.,_--~~ -5VA
I CI G
I
I ~ I
4MHZClDCK
I I
I
I
IL___ ____________________________ J I

~
D +5V6LTS
83.829

rpg TP10
GROUItD
Bl,BID,B31

B9
o +12VOLTS

NOTES:
UNLESS OTHERWISE SPECIFIED:
1. All RESISTOIIS 1/4 W,5'\'1, CARBON FILTER.
2. ALL CAPS +10V DR BREATER+ID%.
3. NO MORE THAN 15 lOADS PER PULLUP NET.

Fixed Disk Adapter (Sheet 6 of 6)


BIOS Listing

The BIOS Listing for the IBM Fixed Disk Adapter follows.

Fixed Disk Adapter 25


LaC OBJ LINE SOURCE

$TITLE( FIXED DISK BIOS FOR IBM DISK CONTROLLER)

j w_ IHT 13 -------------------- _________________________________ _

; FIXED DISK lID INTERFACE

THIS INTERFACE PROVIDES ACCESS TO 5 1/4" FIXED 0151(5


THROUGH THE IBM FIXED DISK CONTROLLER.

10 j -- - - -- ---------------------- - --- - - - - - - --- - - - - -- - -------- - -------


11
12 ; - - - - - - - - - - - - ------ -- - --- - ----- -- - - - - ----- - --------- ----- --------
13 THE BIOS ROUTINES ARE MEANT TO BE ACCESSED THROUGH
14 SOFTWARE INTERRUPTS ONLY. ANY ADDRESSES PRESENT IN
15 THE LISTINGS ARE INCLUDED ONLY FOR COMPLETENESS.
16 NOT FOR REFERENCE. APPLICATIONS WHICH REFERENCE
17 ABSOLUTE ADDRESSES WITHIN THE CODE SEGMENT
18 VIOLATE THE STRUCTURE AND DESI~N OF BIOS.
19 ; ------------------------~--------.------------------------------
2.
21 i INPUT (AH = HEX VALUE)
22
23 IAH)=OO RESET DISK ~Dl. = 80H,61H) I PISKETTE
2. (AH 1=01 READ THE STAnJS OF THE LAST DISK OPERATION INTO tAli
25 NOTE: Dl < SOH - DISKETTE
26 Dl > 80H - DISK
27 IAHI=02 READ THE DESIREQ SECTORS INTO MEMORY
28 IAHI=03 WRITE THE DESIRED SECTORS FROM MEMORY
29 IAHI=04 VERIFY THE DESIRED SECTORS
3D IAHI=05 FPRMAT THE DESIRED TRACK
31 IAH)=06 FORMAT THE DESIRED TRACK AND SET BAD SECTOR FLAGS
32 (AH )=07 FORMAT THE DRIVE STARTING AT THE DESIRED TRACK
33 IAH )=OS RETURN THE CURRENT DRIVE PARAMETERS
34
35 I AH )=09 INITIAlIZE DRIVE PAIR CHARACTERISTICS
36 INTERRUPT 41 POINTS TO DATA BLOCK
37 I AH I=OA READ LONG
38 IAHI=OB WRITE LmlG
3. NOTE: READ AND WRITE LONG ENCOMPASS 512 + it BYTES ECC
4. (AH I=OC SEEK
41 IAHI=OD Al.TERNATE DISK RESET (SEE Dli
4' (AH I=O~ READ SECTOR BUFFER
43 IAHI=OF ~ITE SECTOR BUFFER,
44 IRECDt1f1ENDED PRACTICE BEFORE FORMATTING)
45 IAH)=10 TEST DRIVE READY
46 tAHI=l1 RECALIBRATE
47 (AHI=12 CONTROLLER RAM DIAGNOSTIC
48 (AHI=13 DRIVE I;)IAGNOSTIC
4. IAHI=14 CONTROLl~R INTERNAL DIAGNOSTIC
5.
51 REGISTERS USED FOR FIXED DISK OPERATIONS
52
53 (DLI - DRIVE NUt1BER ISOH-S7H FOR DISK, VALUE CHECKED)
54 IDHI - H~AD HUt1BER [P-7 ALLOWED, NOT VALUE CHECKED)
55 (CH) - CYlINDER HUt1BER (0-1023. NOT VALUE CHECKEDHSEE CU
56 (CLI - SECTOR NUMBER 11-17. NOT VALUE CHECKED)
57
58 NOTE: HIGH 2 BITS OF ~YlINDER HUt1BER ARE PLACED
5' IN THE HIGH 2 BITS OF THE CL REGISTER
6. (10 BITS TOTAL)
61 (All - NUI1BER OF SECTORS (MAXItM'1 POSSIBLE RANGE 1-80H.
62 FOR READIWRITE LONG 1-79H,
63 (INTERLEAVE VALUE FOR FORMAT 1-160)
64 IES:BX) - ADDRESS OF BUFFER FOR READS AND WRITES.
65 (NOT REQUIRED FOR VERIFY)
66
67 ; OUTPUT
6!S AH = STATUS OF CURRENT OPERATION
69 STATUS BITS ARE DEFINED IN THE EQUATES BElCH
70 CY = 0 SUCCESSFUL OPERATION (AH:O ON RETURN)
71 CY : 1 FAIlED OPERATION (AH HAS ERROR REASON)
72
73 NOTE: ERROR I1H INDICATES THAT THE DATA READ HAD A RECOVERABLE
74 ERROR WHICH WAS CORRECTED BY THE ECC ALGORITHM. THE DATA
75 IS PROBABLY GOOD. HOWEVER THE BIOS ROUTINE INDICATES AN
76 ERROR TO ALLOW THE CONTROL LIft(; PROGRAM A CHANCE TO DECIDE
17 Fnp ITSELF. THE ERROR HAY HOT RECUR IF THE OA.TA IS

26 Fixed Disk Adapter


LOC OBJ LINE SOURCE

70 REWRITTEN. (AU CONTAINS THE BURST LENGTH.


7'
00 IF DRIVE PARAMETERS WERE REQUESTED.
01
OZ DL ; NUMBER OF CONSECUTIVE ACKNOWLEDGING DRIVES ATTACHED (0-21
01 (CONTROllER CARD ZERO TALLY ONLY)
84 DH :: MAXIMUM USEABLE VALUE FOR HEAD NUMBER
85 CH = MAXIMUM USEABLE VALUE FOR CYLINDER HUMBER
Bb CL = MAXIMUM USEABLE VALUE FOR SECTOR NUMBER
87 AND CYLINDER NUMBER HIGH BITS
80
0' REGISTERS WILL BE PRESERVED EXCEPT WHEN THEY ARE USED TO RETURH
90 INFORMATION.
91
92 NOTE: IF AN ERROR IS REPORTED BY THE DISK CODE. THE APPROPRIATE
93 AcnON IS TO RESET THE DISK. THEN RETRY THE OPERATION.

'495 ; ----------------- -------------------------------------------------------


'6
OOFF
OOBe ,.
'7 SENSEJAIL
UNDEF _ERR
EDU
EDU
OFFH
OBBH
I SENSE OPERATIOH FAILED
I UNDEfINED ERROR OCCURRED
0080
0040 "
100
TIME_OUT
BAD_SEEK
EDU
EQU
80H
40H
; ATTACHMENT FAILED TO RESPOND
; SEEK OPERATIOH FAILED
0020 101 BAD_CNTLR EDU ZOH I CONTROLLER HAS FAILED
0011 lOZ DATA_CORRECTED EDU 11H ; ECC CORRECTED DATA ERROR
0010 101 BAD_ECC EDU lOH ; BAD ECC ON DISK READ
oooe 104 BAD_TRACK EDU 08H ; BAD TRACK FLAG DETECTED
0009 105 DMA_BOlrnOARY EQU 09H ; ATTEMPT TO DHA ACROSS 64K BOUNDARY
0007 106 INITJAIL EDU 07H ; DRIVE P....RAMETER ACTIVITY FAILED
0005 107 BAD_RESET EDU 05H ; RESET FAILED
0004 108 RECORD_NOTJNO EDU 04H ; REQUESTED SECTOR NOT FOl.n'ro
0002 109 BAD_ADDR_MARK EQU OZH I ADDRESS MARK NOT FOUND
0001 110 BAD_CMD EQU OlH I BAD COMMAND PASSED TO DISK I/O
111
112 ; ----------------------------------------
113 INTERRUPT AND STATUS AREAS
114 ; -------------- --------------------------
115
116 DU!1I1Y SEGMENT AT 0
0034 117 ORG ODH*4 ; FIXED D 15K INTERRUPT VECTOR
0034 118 HOISK_INT LABEL DWOOD
004C 11' DRG 13H*4 I DISK INTERRUPT VECTOR
004C 1ZO DRG_VECTOR LABEL DWORD
0064 1Zl ORG 19H*4 I BOOTSTRAP INTERRUPT VECTOR
0064 lZZ BOOT_VEC LABEL DWORD
0078 lZl ORG lEH*4 I DISKETTE PARAMETERS
0078 lZ4 DISKETTE_PARM LABEL DWORD
0100 lZ5 DRG 040H*4 I NEW DISKETTE INTERRUPT VECTOR
0100 126 DISK_VECTOR LABEL DWORD
0104 lZ7 ORG 041H*4 ; FIXED DISK PARAMETER VECTOR
0104 lZO HF _TBL_VEC LABEL DWORD
7C00 129 ORG 7COOH ; BOOTSTRAP LOADER VECTOR
7eOD 130 BOOT_lOCN LABEL FAR
III DUMI1Y ENDS
m
III DATA SEGMENT AT 40H
0042 !l4 DRG 4ZH
0042 !l5 CMD_BLOCK LABEL BYTE
0042 (7 1?) 136 HO_ERROR 08 7 DUP(?l ; OVERLAYS DISKETTE STATUS
DQbt !l7 ORG ObCH
006t n?? 138 TIMER_lOW OW ; TIMER LOW WORD
0072 139 ORG 7ZH
0072 7111 140 RESETJLAG OW • lZ34H IF KEYBOARD RESET UNDERWAY
0074 141 DRG 74H
0074 11 14Z DISK_STATUS 08 ; FIXED DISK STATUS BYTE
0075 11 141 HF _HUM 08 ; COUNT OF FIXED OISK DRIVES
0076 ?? 144 CONTROL_BYTE DB ; COUTROL BYTE DRIVE OPTIONS
0077 ?? 145 PORT_OFF 08 ; PORT OFFSET
146 DATA ENOS
147
148 COOE SEGMENT
14'
150 1--------------------------------------------------------
lSI ; HARDWARE SPECIFIC VALUES

'"
153 - CONTROLLER I/O PORT
154 > WHEI'i READ FIWM,

Fixed Disk Adapter 27


LaC OSJ LINE SOURCE

155 HF _F'ORT+O - READ DATA (fROM CONTROLLER TO CPU)


156 HF _PORT+l ... READ CONTROLLER HARDWARE STATUS
151 (CONTROLLER TO CPU)
158 HF _PORT+2 ... READ CONFIGImATlON SWITCHES
159 HF_PORT+! - NOT USED
160 > WHEN WRITTEN TO:
161 HF_PORT+O - WRITE DATA (fROM CPU TO CONTROLLER) :
162 HF __ PORHI - CONTROLLER RESET
163 HF _PORT+2 - GENERATE CONTROLLER SELECT PUlsE
164 HF_PORT+3 - WRIl'E PATTERN TO OHA AND INTERRUPT
165 MASK REGISTER
166
167 i ... -- ------- - - --- --------------- -- ------- ... --- -------------
168
0320 16. HF _PORT EQU 0320H I DISK PORT
OQ08 17. Rl_BUSY EQU 000010008 J DISK PORT 1 BUSY BIT
0004 171 Rl_BUS EQU 00000100B 1 COMMAND/DATA BIT
0002 172 Rl_IOMOOE EQU 000000108 MODE BIT
0001 173 Rl_REQ EQU 000000018 REQUEST BIT
170
0047 17. DHA_READ EQU 010001118 J CHANNEL 3 (047H)
004B 176 DM.\.WRlTE EQU 010010118 I CHANNEL 3 (048H)
0000 177 DHA EQU 0 I DHA ADDRESS
0082 178 DHA_HIGH EQU 082H I PORT FOR HIGH ,. BITS OF OMA
17.
DOGD 180 TST_RDY_Cf'I) EQU 000000008 I CNTLR READY (DOH)
0001 181 RECAL_Cf'I) EQU 000000018 RECAL 101HI
0003 18. SENSE_CI'I) EQU 000000118 SENSE 103H)
OOOct 183 FMTDRV_CMD EQU 00000100B DRIVE 104H)
ODDS 18_ CH~TRK_Ct1D EQU 00000101B T CHK (OSH)
0006 18S FMTTRK_CMD EQU 000001108 TRACK (06H)
0007 186 FMTBAD_CMD EQU 000001118 BAD (07H)
0008 187 READ_CMD EQU 000010008 READ (08H)
OOOA. 188 WRITE_CtID EQU 000010108 WRITE (OAH)
DOOB 18. SEEK_CMD EQU 000010118 SEEK (OBH)
Dooe 1'0 INIT_DRV_CtIJ EQU 000011008 INIT (OCH)
DODD 1.1 RD_ECC_CI1D EQU 000011018 BURST (DOH)
DOOE 1" RD_BUFF _CMD EQU 00001110B BUFFR 10EH)
DOOF 1.3 WR_BUFF _CtIJ EQU 00001111B BUFFR (OFH)
oDeD 1'_ RAM_DlAG_CND EOU 111000008 RAM (EOH)
00E3 1.5 CHK_DRV_CtI) EOU 111000118 DRV (ElH)
OOE4 1.6 CNTLR_DIAG_CHD EQU 11100100B CNTLR (E4H)
00E5 1.7 HO_LONG_Cm EQU 111001018 RlONG (E5H)
00E6 1.8 WR_LONG_CMD EQU 11100110B WlONG (E6H)
1••
0020 .OO INT_CTL_PORT EOU 20" I 8259 CONTROL PORT
0020
.0.
.01 Eot EQU
'0" I END OF INTERRUPT CONtlAHD

000& ."
.0_ HAX]IlE EQU
0002
...
'06
S_HAX_FIlE

ASS\Jt1E
EQU

CS:COOE
0000 207 o.G 0"
0000 55
0001 AA .0.
'08 DB
DB
055H
OUH
I GENERIC BIOS HEADER

0002 10 ." DB 16D

."
212 1-----"" -.. -.. ---------------------------------------- ... ----------... -
213 1 FIXED DISK lID SETUP
21_
215 - ESTABLISH TRANSFER VECTORS FOR THE FIXED DISK
216 - PERFORM POWER ON DIAGNOSTICS
217 SHOULD AN ERROR OCCUR" "1701" MESSAGE IS DISPUYED
218
219 1_ -- ------- -- --------------- w _w _______ . ____________ w - - -----------

•• 0
.21 DISK_SETUP PROC FAR

...
0003
0003 EBIE
0005 35303030303539
••• JHP
DB
SHORT L3
'5000059 (C)COPYRIGHT IBM 19B2' I COPYRIGHT NOTICE
20284329434FSO
5952494748542.0
20494240203139

0023
3632

0023 tBCO
..-
••S
"6
l3:
ASSU1E
SUB
DS:Dl.It1MY
AX,AX I ZERO
002:5 8E08 ,.7 MO. DS,AX

28 Fixed Disk Adapter


LaC OBJ LINE SOURCE

0027 FA 22. eLI


0028 A14COO 22. MOV AX,WORD PTR ORG_IIECTOR ; GET DISKETTE IIECTOR
0026 A3COOl 230 MOV WORD PTR DISK_VECTOR,AX I INTO INT 40H
002£ Al4EOO 231 MOV AX,WORD PTR ORG_IIECTOR+2
0031 A30201 232 HOV WORD PTR DISK_IIECTOR+2.AX
0034 C7064C005602 233 HOV WORD PTR ORG_ VECTOR, OFFSET DIsK_IO I HDISK HANDLER
C03A 8COE4EOO ,,. HOV WORO PTR ORG_YECTOR+2:,CS
003E 886007 235 HOV AX. OFFSET HD_INT I HDISK INTERRUPT
0041 A3340Q 23. HOV WORD PTR HDIsK_INT, AX
0044 6COE3600 237 MaY WORD PTR HDISK_lHT+2:.CS
0048 C70664008601 23. MaY WORD PTR BOOT_IIEe.OFFSET BOOT_STRAP I BOOTSTRAP
004E 8CO£6600 23. HOV WORD PTR BOOT_IIEC+2.CS
0052 C7060401£703 240 MaY WORD PTR HF _TBl_IIEC.OFFSET Fa_TBl I PARAMETER TBL
0058 8eOE0601 241 HOV WORD PTR HF _TBl_VEC+2 .CS
Dose FB 242 STI
243
244 ASSUME 05:0ATA
0050 884000 ,.5 MOV AX.OATA I ESTABLISH SEGMENT
0060 8ED8 24. HOV 05,AX
0062 C606740000 247 HOV OISK_STATU5.0 I RESET TliE STATUS INDICATOR
0067 C606750000 246 HOV HF _HUH,O I ZERO COUNT OF DRIVES
D06e C606430000 24. HOV CMD_BlOCK+l,O I DRIVE ZERO. SET VALUE IN BLOCK
0071 C606770000 250 HOV PORT_OFF. a ; ZERO CARD OFFSET
251
0076 892500 252 HOV CX.25H ; RETRY COUNT
0079 253 L4:
0079 EBF200 254 ; RESET CONTROLLER
oo?e 7305 255 JHe L7
007E E2F9 25. LOOP L4 ; TRY RESET AGAIN
0080 E9BFDO 257 JHP ERROR_EX
0083 256 L7:
0083 890100 25. HOV CXol
0086 BA8000 2.0 MOV OX.80H
2.,
0089 B60D12 2.2 HOV AX,1200H I CONTROllER DIAGNOSTICS
DOet CD 13 2.3 INT 13H
006E 7303 2.4 JNe P7
0090 E9AFOQ 265 JHP ERROR_EX
0093 2 •• P7:
0093 880014 2.7 HOY AX,1400H I CONTROllER DIAGNOSTICS
0096 con 266 INT 13H
0098 7303 2 •• JNe P.
009,A. E9.6.500 270 JMP ERROR_EX
0090 271 P9:
0090 C7066COOOOOO 272 HOV TIMER_LOW. a j ZERO TIMER
aDA] .6.17200 273 MOV AX.RESETJLAG
00A6 3D3412 274 eHP AX.l234H I KEYBOARD RESET
OOA9 7506 275 JNE P6
OOA8 C7066C009AOI 27. MOV TIMER_LOW.410D I SKIP WAIT ON RESET
DaB 1 277 P8l
OOBI £421 276 IN AL.021H ; TIMER
0083 24FE 27. AND AL,OFEH j ENABLE TIMER
0065 E621 260 OUT 021H ,AL ; START TIMER
DOB7 261 P4l
00B7 E88400 262 J RESET CONTROLLER
oaBA 7207 263 Je P10
ooee 8BOOI0 264 MOV AX,lOOOH I READY
DOBF COl3 26' INT 13H
OOCI 7308 26. JNe P2
OOC] '67 Pia:
00C3 A16eoo 266 MOY AX, TlMER_ LOW
aOC6 308EOI 289 eMP AX,4460 ; 25 SECONDS
00C9 72£t ,.0 JB P4
00C8 EB7S90 291 JMP ERROR_EX
DaCE ,92 P2:
DaCE MOIDa 2.3 MOV CX.l
ODD 1 BA800Q 294 MOV OX.80H
29.
0004 880011 29. MOV AX.llOOH ; RECALlBRATE
0007 con 297 INT 13H
0009 7267 2.6 Je ERROR_EX
299
0008 880009 300 MOV AX,0900H ; SET DRIVE PARAMETERS
OODe COil 3" INT 13H
OOEO 7260 3" Je ERROR_EX
303
OOH B800C8 304 HOV AX,OC800H I OMA TO BUFFER

Fixed Disk Adapter 29


LOC OBJ LINE SOURCE

ODES SEeD 305 MOV ES,AX ; SET SEGMENT


00E7 2808 300 sue BX.BX
OOE9 a8000F 307 MOV AX,OFOOH J WRITE SECTOR 8UFFER
OOEt con 308 INT J3H
DOEE 7252 30. JC ERROR_EX
310
OOFO FE067500 3JJ IHC HF _tM1 J DRIVE ZERO RESPONDED
31'
00F4 8.4.1302 313 MOV OX,213H J EXPANSION BOX
OOF7 BODO 314 MOV AL,O
00F9 EE 315 OUT OX,AL i TURN BOX OFF
OOFA. BA2103 310 MOV OX,321H ; TEST IF CONTROLLER
OOFO EC 317 IH AL,OX J ••• IS IN THE SYSTEM l~IT

OOFE 240F 318 AND AL.OFH


0100 3eOF 31' CMP AL.OFH
Cla2 7406 320 JE BOX_ON
0104 C7066COOA40 1 321 MOV TIMER_LOW.42:00 ; CONTROLLER IS IN SYSTEM !..tIIT
OIDA. 322
010A. 8.4.1302 323 MOV OX,213H I EXPANSION BOX
0100 BOFF 324 MOV AL,OFFH
010F EE 325 OUT OX,At • TURN BOX ON
320
0110 890100 327 MOV eX,l j ATTEMPT NEXT DRIVES
0113 BA8100 "8 MOV Dx.oalH
0116 32. P3:
0116 ZBce 330 sue AX,AX j RESET
Olle COll 331 ,NT 13H
011A 7240 33' JC POD_DONE
OIlC 880011 333 MOV AX,OllOOH J RECAL
OllF COIl 334 IHT J3H
0121 7308 335 JHC P5
0123 A.16eOO 330 MOV AX, TIMER_LOW
0126 30BEOI 337 CMP AX.446D I 25 SECONDS
0129 nEB 338 JB P3
0128 E82F90 33' JMP POD_DONE
012E 340 P5:
012E 880009 341 MOV AX,0900H J INITIALIZE CHARACTERISTICS
0131 con 34' INT 13H
0133 7227 343 JC POD_DONE
0135 FE067500 344 lHe HF _NUt1 1 TALLY ANOTltER DRIYE
0139 81F.4.8100 345 CMP OX, (SOH + 5_MAX]ILE - 1)

0130 7310 340 JAE POD_DONE


013F 42 347 IHC OX
0140 EBD4 .48 JMP P3
34.
350 ; ----- POD ERROR
351
0142 35' ERROR_EX:
0142 BOOFOO 353 MOV BP,OFH I POD ERROR FLAG
014:5 28CO 354 sua AX,AX
0147 85FO 355 MOV SI.AX
0149 89060090 350 MOV CX.FI7L ; MESSAGE CHARACTER COUNT
0140 8700 357 MOV BH,O I PAGE ZERO
014F 358
014F 2E8A.846Btn 35. HOV AL,CS:F17[SIJ I GET BYTE
0154 840E 300 HOV AH.14D ; VIDEO OUT
0156 COlO 301 INT lOH I DISPLAY CHARACTER
015846 30' INC 51 ; NEXT CHAR
0159 E2F4 303 LOOP OUT_CH I 00 MORE
0158 F9 364 STC
DISC 305 POD_DONE:
DISC FA 300 ClI
0150 E421 307 IH AL,021H I 8E SURE TIMER IS DISABLED
015F OCOI 308 OR AL,OlH
0161 E621 30. OUT 021H,AL
0163 F8 37. STl
0164 EBASOD 371 CALL OSBL
0167 CB 37' RET
373
016& 31373031 374 FJ7 DB '1701',ODH.OAH
Clbt 00
0160 0.4.
0006 375 F17L EQU S-F17
370
016E 377 HD_RESET_l PROC NEAR
016E 51 378 PUSH CX ; SAVE REGISTER
016F 52 31. PUSH DX

30 Fixed Disk Adapter


LOC OBJ LINE SOURCE

0170 F8 380 eLe ; CLEAR CARPY


0171 990001 381 MOV eX,OloaH ; RETRY COUNT
0174 382 l6:
0174 e80706 383 CALL PORT_I
0177 EE 384 OUT DX,AL ; RESET CARD
0178 E80306 385 CAll PORT_l
0178 EC 386 IN AL,Di< ; CHECK STATUS
OI7e 2402 387 AND AL.2 ; ERROR BIT
OI7E 7403 388 Jl .3
0180 E2F2 389 lOOP 16
0182 F9 390 STe
0183 391 R3:
0183 SA 392 POP OX RESTORE REGISTER
0184- 59 393 PDP ex
0185 C3 394 RET
395 HO_RESET_l ENoP
396
397 DISK_SETUP ENDP
398
399 ;----- INT 19 ---------------------------------------------------
400
401 INTERRUPT 19 BOOT STRAP LOADER
402
403 THE FIXED DISK BIOS REPLACES THE INTERRUPT 19
404 BOOT STRAP VECTOR IHTH A POINTER TO THIS BOOT ROUTINE
405 RESET THE DEFAULT DISK AHe DISKETTE PARAMETER VECTORS
406 THE BOOT BLOCK 'to BE READ IN IolIlL BE ATTEMPTED FROM
407 CYLINDER a SECTOR 1 OF THE DEVICE.
408 THE BOOTSTRAP SEQUENCE IS:
409 > ATTEMPT TO LOAD FROM THE DISKETTE !HTO THE BOOT
410 LOCATION (0000:7COO) AND TRANSFER CONTROL THERE
411 > IF THE DISKETTE FAILS THE FIXED DISK IS TRIED FOR A
412 VALID BOOTSTRAP BLOCK. A VALID BOOT BLOCK ON THE
413 FIXED DISK CONSISTS OF THE BYTES 055H OAAH AS Tl-IE
414 LAST TWO BYTES OF THE BLOCK
415 > IF THE ABOVE FAILS CONTROL IS PASSED TO RESIDENT BASIC
41.
417 ; ---- ---- -- --- -------------- ----------------- ---- ----------------
418
0186 419 BOOT_STRAP:
420 ASSUNE OS :OUMHY, ES : DUMMY
0186 2BCO 421 sua AX,AX
0188 8E08 422 MOV OS,AX ESTABLISH SEGMENT
423
424 ;----- RESET PARAMETER VECTORS
425
018A FA 426 eLI
013B C7060401E703 427 MoV WORD PTR HF_TBL_VEC, OFFSET fD_reL
0191 8COE0601 42. MoV WORD PTR HF_TBL_VEC+Z. CS
0195 C70678000102 429 MoV WORD PTR DISKETTE]ARH, OFFSET DISKETTE_TSl
019B 8COE7AOO 430 MoV WORD PTR DISKETTE_PARM+2. CS
019F FB 431 sn
432
433 ;----- ATTEMPT BOOTSTRAP FRON DISKETTE
434
DIAD 690300 435 MOV CX.3 ; SET RETRY COUNT
01A3 43. HI: ; IPL_SYSTEM
01.4.3 51 437 PUSH ex 1 SAVE RETRY COUNT
OIA4 2602 438 sua OX.OX ; DRIV~ ZERO
01A6 2BCO 439 SUB AX,AX ; RESET THE DISKETTE
01A8 CDll 440 INT 13H ; FILE 10 CAll
01AA nOF 441 Je H2 ; IF ERROR, TRY AGAIN
01AC 880102 442 MOV AX,0201H ; READ IN THE SINGLE SECTOR
443
OlAF 2B02 444 sua DX,DX
01BI 8EC2 445 MOV ES,DX I ESTABLISH SEGMENT
0163 BB007C 44. MOV ex .OFFSET BOOT_LOCN
447
01B6 890100 448 MOV CX.l ; SECTOR I, TRACK 0
01B9 CDl3 449 INT 13H ; FILE 10 CAll
OlBB 59 450 H2: POP ex ; RECOVER RETRi COWl
OIBC 730A 451 JNC H4 i CF SE~ BY UNSUCCESSFU!- READ
OlBE aOFC80 452 eMP AH, BOH j IF TIME OUT, NO RETRY
01Cl 740A 453 Jl H5 ; TRY FIXED DISK
01C3 E20E 454 LOOP HI ; DO IT FOR RETRY TIMES
OlCS EB0690 455 JMP H5 ; UNABLE TO IPL FROM THE DISKETTE
0lC8 45. H4: ; IPL WAS SUCCESSFUL

Fixed Disk Adapter 31


LOC OBJ LINE SOURCE

OIC8 £A007COOOO 457 JMP BOOT_LOCN


458
459 ; ----- ATTEMPT BOOTSTRAP FROM FIXEO DISK
460
OICO 461 H5:
Oleo 2BCO 462 SUB AX. AX. ; F1ESET DISKETTE
OleF 2602 463 SUB DX,DX
OlDl COB 464 INT 13H
0103 890300 465 MOV eX,3 I SET RETRY COUNT
0106 466 H6: ; IPl_SYSTEH
0106 51 467 PUSH ex ; SAVE RETRY COUNT
0107 BA800a 468 MOV OX, ooaOH ; FIXED DISK ZERO
OIDA 28CO 469 SUB AX,AX ; RESET THE FIXED DISK
OlOe COl3 470 INT 13H I FILE 10 CALL
alOE 7212. 471 JC H7 I IF ERROR. TRY AGAIN
DIED 880102 472 MOV AX,0201H ; READ IN THE SINGLE SEC'rOR
OlE3 2BDB 473 SUB eX,ex
0lE5 SEC3 474 tlOY ES,BX
0lE7 BB007e 475 MOV BX,OFFSET BOOT_LoeN ; TO THE BOOT LOCATION
OlEA BA8000 476 MOV Dx,eOH ; DRIVE NUMBER
OlEO 690100 477 HOV ex,} ; SECTOR 1, TRACK 0
DIFO C013 478 INT 13H ; FILE 10 CALL
CIF2 59 479 H7: POP ex j RECOVER RETRY COUNT
OlF3 7208 480 JC HB
OIFS AIFE7D 481 MOV AX,WORD rTR BOOT_lOCN+510Q
DIF8 3D55AA 482 CMP AX,QAA55H j TEST FOR GENERIC BOOT BLOCK
OlFB 74CB 483 JZ N4
OIFD 484 H8:
DIFO E207 485 LOOP H6 I DO IT FOR RETRY TIMES
486
487 j------ UNABLE TO IPl FROM THE OISKETTE OR FIXED DISK
488
OIFF COIB 489 INT 18N j RESIOENT BASIC
490
0201 491 DISKETTE_ TBl:
492
0201 CF
0202 02
493
494
DB
08 ,
llaOlUl8 1 5RT=C. HO UNlQAD=OF -
; HO LOAD=l, MODE=OI1A -
1ST SPEC BYTE
2HD SPEC BYTE
0203 25 495 08 25N ; WAIT AFTER OPN TIL MOTOR OFF
0204 02 496 08 2 ; 512 BYTES PER SECTOR
0205 08 497 08 ; EDT (LAST SECTOR ON TRACK)
0206 ZA 498 08 02AH I GAP LENGTH
0207 FF 499 08 OFFH DTl
0208 50 500 08 050H ; GAP LENGTH FOR FORHAT
02.09 F6 501 08 OF6H ; FILL BYTE FOR FORHAT
020A 19 502 08 25 1 HEAD SETTLE TIME (MILLISECONDS}
02.06 04 S03 08 ; MOTOR START TIME (1/8 SECOND)
S04
505 ;----- HAKE SURE THAT ALL HOUSEKEEPING IS DONE BEFORE EXIT
506
ozoc S07 OSB L PROC NEAR
S08 ASSUME DS:DATA
ozoc 1E 509 PUSH OS SAVE SEGMENT
0200 B84000 510 MOV AX,OATA
0210 8E08 5II MOV OS,AX
51'
0212 8A267700 513 HOV
0216 50 514 PUSH AX ; SAVE OFFSET
515
0217 C606770000 516 MOV
021e E86905 517 CALL PORT_3
0211" 2ACO 518 sus AL,AL
0221 EE 519 OUT OX,AL ; RESET !NT/DNA NASK
0222 C606770004 520 MOV PORT_OFF ,4H
0227 E85E05 521 CALL PORT_3
022A 2ACO 52' SUB AL.AL
D22C EE 523 OUT OX.Al ; RESET INT /DNA MASK
0220 C606770008 524 MOV PORT_OFf,8H
0232 E85305 525 CALL PORT_3
0235 2ACO 526 SUB Al,AL
0237 EE 527 OUT OX.AL ; RESET INT /DNA NASK
0238 C60677000C 528 MOV PORT_OFF. OCH
0230 E84805 529 CAll PORT_3
D2tiO 2ACO 530 SUB Al,AL
0242 EE 531 OUT OX ,AL ; RESET INT/ONA MASK
t10V Al,07H
0243 B007
0245 E60A '"
533 OUT DMA+IO.AL I SET DMA MODE TO DISABLE

32 Fixed Disk Adapter


LaC OBJ LINE SOURCE

0,47 FA. 5,4 CLI ; DISABLE INTERRUPTS


02:48 E421 535 IH Al,021H
024A oelD 536 DO AL,OZIiIH
024C E621 537 OUT 02lH,AL ; DISABLE INTERRUPT 5
024E FB 538 STI ; ENABLE INTERRUPTS
024F 58
0250 88267700
539
540
'0'
MOV
AX
PORT_OfF ,AH
t RESTORE OFFSET

0254 IF 541 PO, OS ; RESTORE SEGMENT


02.55 C3 S42 RET
543 DSBl ENIlP
544
545 I -- --- - - ---------- - -- --------------------
546 FIXED DISK BIOS ENTRY POINT
547 ; - -- --------------- ----------------------
548
02:56 549 DISK_IO PROC FAR
550 ASSUME OS: NOTHING, ES: NOTHING
0256 80FAeo 551 CMP Dl,80H ; TEST FOR FIXED DISK DRIVE
0259 7305 552 JAE HARD_DISK ; YES, HAHOLE HERE
0258 C040 553 IHT 40H ; DISKETTE HANDLER
0250 554 RET_2:
0250 CA02:00 555 RET I BACK TO CALLER
0260 556 HARD_DISK:
557 ASSUME OS:O.1.T"
0260 FB 558 STI I ENABLE INTERRUPTS
0261 OAE4 559 OR AH.AH
0263 7509 560 JHZ A3
0265 C040 561 INT 40H I RESET NEt WHEN AH=O
0267 2AE4 562 SUB AH.AH
0269 80fA81 563 CMP Dl.leOH + S_MAXJllE - 1J
026C 77Ef 564 JA RET_2
026E 565 A3:
026E 80FC08 566 CMP AH,08 I GET PARAMETERS IS A SPECIAL CASE
0271 7503 567 JNZ A2
0273 E91A01 568 JMP GET_PARH_N
0276 569 A2;
0276 53 570 PUSH ex ; SAVE REGISTERS DURING OPERATION
0277 51 571 PUSH CX
0278 S2 572 PUSH ox
0279 IE 573 PUSH OS
027A 06 574 PUSH ES
0276 56 575 PUSH SI
027C 57 576 PUSH or
577
0270 E86AOO 578 CAll DISK_Io_com PERFORM THE OPERATum
579
0280 50 sao PUSH AX
0281 E888FF 581 CALL D56L ; BE SURE DISABLES OCCURRED
0284 684000 582 MOV AX.DATA
0287 8ED8 583 MOV DS,AX I ESTABLISH SEGMENT
0289 58 584 PO, AX
02:8A 8A267400 585 MOV AH ,DISK_STATUS ; GET STATUS FROM OPERATION
028E 80FCOl 586 CMP AH.l I SET THE CARIi/)' HAG TO INDICATE
0291 F5 587 CMC , SUCCESS OR FAILURE
0292 SF 588 POP OI ; RESTORE REGISTERS
0293 5E 589 pop SI
0294 07 590 POP ES
0295 IF 591 POP OS
0296 SA 592 PO' ox
0297 59 593 POP CX
0298 56 594 POP 8X
0299 CA0200 595 RET 1 THROW MoIA)' SAvea Fl.A~S

596 DISK_IO EtIDP


597
029C 598 M1 LABEL worm ; FUNCTION TRANSFER TABLE
02:9C 3803 '99
600
ow
OW
DISK_RESET
RETURN_STATUS
; OOQH
; OOIH
D29E 4003
02AO 5603 601 OW DISK_READ I D02H
02A2 6003 6" ow DISK_l>IRITE DOJH
02A4 6A03 6" ow DISK_ VERF I D04H
02A6 7203 604 ow FHT_TFlK ; DOSH
02A8 7903 60S OW FMT_BAO ; 006H
02AA e003 606 ow FHT_DRV I Q07H
02AC 3003 607 ow 6AD_COHMAtro ooaH
OZAE 2704 60s ow INICORV I 009H
0260 CF04 6" ow RO_LONG OOAH
0262 0004 610 ow WR_LONG DosH

Fixed Disk Adapter 33


LaC OBJ LINE SOURCE

0284 F204 611 ow ; OOCH


0286 ;3803 612 ow
DISK_SEEK
DISK_RESET , OOOH
02SS F904 613 D~ RD_BUFF I OOEH
02BA. 0705 61. ow WR_BUFF ; OOFH
a2BC 1505 6,5 ow 1ST_ROY J 0101'1
028E lCOS 61, ow HDISK_RECAL I 011H
02tO 2305 617 .w RAM_DIAG I 012H
02e2 ZAOS 618 ow CHK_DRV I 013H
02t4 3105 61. ow CNTLR_DIAG ; 014H
002A 620 MIL EQU $-NI
621
q2C6 622 SETUP_A PROt NEAR
623
02t6 C606740000 62. MbV DISK_STATUS,O J RESET THE STATUS INtl~CATOR
02tB 51 625 PUSH CX I SAVE ex
6'6
627 1----- CALCULATE THE PORt QFFSET
6~8
02ec 8AEA 629 MOV CH,Ot i SAVE DL
02eE 80CAOJ 630 OR CL,I
0201 FEeA 631 DEC DL
0203 DOE2 632 SHL pL'l I GENERATE OFFSET
0205 88167700 633 MOV PORT_OFF ,OL I STORE OFFSET
0209 8.1.05 634 "OV OL.CH • RESTORE Dl
~2DB 80E201 635 AND OL,l
636
020E BI05 637 MOV Cl,S I $HIFT COUNT
02EO 02E2 638 SHL Ct.eL I DfHVE tM1BER I 0 ,I )
02E2 OA06 63. OR OltOH ; HEAD I'U18ER
02E4 asi64300 64. MOV CMD_BlOCK+l,DL
OZE6 59 641 POP ex
02E9 C3 642 RET
6ft3 SETUP_A EHDP
644
02EA 645 DISK_IO_CONT "DC NEAR
02EA 50 646 PUSH AX
02EB 884000 647 MOV AX ,DATA
02EE 8ED8 64' MOV OS,AX ; ESTABLISH SEGMENT
02FO 58 64. POP AX
02Fl 60FCOl 650 CMP AH.OIH J RET~N STATUS
02F4 7503 651 JHZ A.
02F6 E65590 65' JMP RETURN_STATUS
02F9 653 A4:
OZf980EA60 654 ~~ OL.80H ; CotNERT DRIVE HlII1BER TO 0 BASED RANGE
02FC ~OFA08 655 eMP DL.MAXJILE , LEGAL DRIVE TEST
02FF 732F 656 JAE BAD_COMMAND
657
0301 E6C2FF 658 CALL SETUP_A
65~

660 ; ----- SET UP CQt1t1AND BLOCK


661
0304 FEC9 662 DEC CL J SECTORS 0-16 FOR CotrrROLLER
0306 C606420000 663 MeV CHD_BLOCK+O.O
03~B 880£4400 664 MeV CHD_BLOCK+2,CL ; SECTOR AND HIGH 2 BITS CYLINDER
030F 862£4500 665 MOV CMD_BLOCK+3.CH J CYLINDER
0~13 1.24600 666 MOV CI"IIJ_BLQCK+4.AL J INTERLEAVE / BLOCK COUNT
0316 A07600 667 MOV AL.CONTRQL_BYTE ; CONTROL BYTE (STEP OPTION)
0319 A24700 668 MOV CMD_BLOCK+5.Al
031t 59 ~69 P\JSH AX J SAVE AX
031D 6At4 670 HOY AL.AH I GET INTO LOW BYTE
031F 32E4 611 XOR AH.AH I ZERO HlliH BYTE
0321 DIED 672 SAL AX.l I *2 FOR TABLE LOOKUP
0323 8BFO 673 MOV SI.Ax I PUT INTO SI FOR BRANCH
0325 302AOO 674 CMP AX,HlL ; TEST WITHIN RANGE
032656 675 POP AX ; RESTORE AX
0329 7305 676 JN8 8~D_COHJ'1AND
0328 2EFFA49C02 677 JMP WORD PTR CS:[SI + OFFSET Mll
0330 678 BAD_COMMAND :
0330 C606740001 67. MeV DISK_STATUS. BAD_CtI) ; COMMAND ERROR
0335 BODO 680 MOV AL,O
0337 Cl 681 RET
682 OISK_IO_C;ONT ENDP.
68'
684 I - - - - - - - - - - - - - -- -- ----- --- ---------- -- - - ---------
61t~ RESET THE DISK SYSTEM CAH = OOOH)
686 t ----------------------------,.------- - - - ----------
681

34 Fixed Disk Adapter


LaC OSJ LINE SOURCE

0338 688 DISK_RESET PROt NEAR


0338 E84304 689 CAll PORT_l i RESET PORT
0336 EE 690 OUT OX,AL I ISSUE RESET
OBC E83F04 691 CALL PORT_l I CONTROLLER HARDWARE STATUS
033F EC 692 IN AL.DX ; GET STATUS
0340 2402 69' AND AL.2 ; ERROR BIT
0342 7406 694 JZ ORI
0344 C606740005 695 HOV DISK_STATUS ,BAD_RESET
O~49 C3 696 RET
034A 697 oRl:
034A E90AOO 698 JHP INIT_DRY SET THE DRIVE PARAMETERS
699 OISK_RESET ENDP
700
701 ; - ---- - --- -- -- ----- --- -- ------------- ------------
702 DISK STATUS ROUTINE (AH = OOlH)
70 3 ; -- ------ - -- - - --------- - -- - ---------- ------------
704
0340 705 RETURN_STATUS PROC NEAR
0340 A07400 706 HOV AL,DISK_STATUS I OBTAIN PREVIOUS STATUS
0350 C606740000 707 HOV DISK_STATUS.O i RESET STATUS
0355 C3 708 RET
709
710
711 i ------------------------------------------------
71Z DISK READ ROUTINE (AH = OOZH)
713 i ------------ - -- - --------- - -- ------------ --------
714
0356 715 DISK_READ PROC NEAR
0356 8047 716 HOV AL.OMA_READ MODE BYTE FOR OMA READ
0358 C606420008 717 HOV
0350 E9E501 718 JHP
719 DISK_READ ENDP
720
721 ; -------------- ------ - ------ --- --- ---------------
722 DISK WRITE ROUTINE (AH = 003HI
7Z3 ; -------------------- - --------- --- ---------------
724
0360 725 PROC NEAR
0360 804B 726 HOV AL.OHA_WRITE ; HODE BYTE FOR DHA WRITE
0362 C60642000A 727 HOV
0367 E90801 728
729
730
731 ; --------- -- ---- ------- --------------------------
732 DISK VERIFY (AH = 004H)
733 ; ------------------------------------------------
734
036A 735 OISK_VERF PROC NEAR
036A C606420005 736 HOV
036F E9C401 737 JHP
738 DISK_VERF
739
740 ; ------------------------ --- ---- -----------------
741 FORHATTIHG IAH = OOSH 006H 007H)
742 ; ---------------------- -- ------------------------
743
0372 744 FHT_TRK PROC NEAR ; FORMAT TRACK (AH = OOSH)
0372 C606420006 745 MOV CHO_BLOCK. FMTTRK_CMO
0377 EBOC 746 JMP SHORT FHT_CONT
747 FHT_TRK ENDP
748
0379 749 ; FaRHAT BAD TRACK (AH = 006H)
0379 C606420007 750
037E EB05 751 JHe
752 FMT_BAD ENDP
753
0380 754 ; FORHAT DRIVE (AH = 007H)
0380 C606420004 755 HOV CMD_BLOCK. FHTORV_CI1O
756 FMT_DRV END?
757
0385 758 FMT_CONT:
0385 A04400 759 HOV AL.CMD_BlOCK+2 ; ZERO OUT SECTOR FIELD
0388 24CO 760 AfID AL,llOOOOOOB
038A A24400 761 HOV CMD_BLOCK+2,AL
038D E9A60 1 762 JNP NDHA_OPN
763

Fixed Disk Adapter 35


laC OBJ LINE SOURCE

764 ; ------ .. ------ -----------------.. -------------- ---


765 GET PARAMETERS (AH = 8)
766 ; -- .... ----- --- -- ------------------------------- ---
767
0390 7.8 GET]ARH_N LABEL NEM~
0390 769 GET_PARM PROC FAR i GET DRIVE PARAMETERS
0390 1E 770 PUSH OS o SAVE REGISTERS
0391 06 771 PUSH ES
0392 53 77' PUSH BX
773
774 ASSUME DS:DUt1t1Y
0393 2BCO 775 SUB AX,AX ESTABLISH ADDRESSING
0395 6E08 776 Mav OS,AX
0397 C41E0401 777 LES BX,HF _TaL_VEe
778 ASSUME OS:DATA
03'98 884000 77, MOV AX,DATA
039E 8E06 7., Mav as,AX J eSTABLISH SEGMENT
781
C3Ae aOEABO 782 sull DL,SOH
03A) 80FAoe 783 eMP DL,MAX]IlE I TEST WITHIN RANGE
03A6 73ZF 784 JAE G4
785
03A8 E81BFF 786 CALL SETUP _A
787
03A8 E80FOl 7M CALL SW2_0FFS
03AE 7227 789 JC G4
03BO 0308 790 ADD BX,AX
791
03B, 268B07 792 Mav AX,ES:[BXJ I MAX NUHBEF! OF CYLINDERS
03B5 200200 793 SUB AX,2 I ADJUST FOR O-N
794 I AND RESERve LAST TRACK
03Ba 8AE6 795 MDV CH,Al
03BA 250003 796 AND AX,0300H I HIGH TWO BITS OF, cn
03BO 01E8 797 SHR AX'}
03BF DIES 798 SHR AX.l
03(:1Dell 799 'R AL,OllH ; SECTORS
03C3 8Ace 800 MOV CL,AL
8"
03es 266A7702 8" MOV DH.ES:{BXJ!2J ; HEADS
03C9 FEtE 8" DEC OH ; O-N RANGE
03e8 6AI67500 804 MaV DLjHF _NUl1 ; DRIVE COUNT
03eF 2BCO 8" SUB AX,AX
0301 8" G5 ~
0301 58 .,7 pop BX ; RESTORE REGISTERS
0302 07 .08 POP ES
0303 IF 8" POP oS
0304 CAD20D 8" RET
0307 811 G4:
0307 C606740007 812 Mav DISK_STATUS. INrCFAIL I OPERATION FAILED
ClOC 6407
030E 2Aca
8"
814
Mav
Sull
AH.INIT]AIL
AL,AL
03EO 2802 81S SUB DX,DX
03E2 2BC9 81. SUB CX,CX
03£4 F9 817 STO I SET ERROR FLAG
03ES EBEA 818 JMP GS

8" GET_PARM ENDP


8"
621 ; ----- .. -- ------------------------------------------------
822 I INITIALIZE DRIVE CHARACTERISTICS
8"
824 FIXED DISK PARAMETER TABLE
825
826 THE TABLE IS COMPOSED OF A. BLOCK DEFINED A.S:
821
"8 (1 WORD) - MAXIMUM HUMBER Or CYLINDERS

...
8"
8"
j

(1
1 BYTE) - MAXIMUM tM1BER OF HEADS
WORD' - STARTING REDUCED WRITE CURRENT
(1 WORO I - STARTING WRITE PRECOMPENSATlON CYL
cn

8" (1 BYTE) - MAXIMUM ECC DATA BURST LENGTH

8" Il BYTEJ - CONTROL BYTE IDRIVE STEP OPTION)


83' BIT 7 DISABLE DISK-ACCESS RETRIES:
835 BIT 6 DISABLE ECC RETRIES
8" BITS 5-3 ZERO
837 BITS 2-0 DRIVE OPTION
838 (1 BYTE) - STANDARD TIME OUT VALUE (SEE BELCH)
8" (1 BYTE J - TINE OUT VALUE FOR FORMAT DRIVE
8., (1 eYTE) - TIME OUT VALUE FOR CHECK DRIVE
8., (4 BYTES)

36 Fixed Disk Adapter


LOC OBJ LINE SOURCE

8., - RESERVED fOR FUTURE USE


8.3
8 •• - TO DYNAMICALLY DEFINE A SET OF PARAMETERS
8.5 BUILD A TABLE OF VALUES AND PLACE THE
84. CORRESPONDING VECTOR INTO INTERRUPT 41.
8.7
8.8 NOTE:
8.' THE DEFAULT TABLE IS VECTORED IN FOR
850 AN INTERRUPT 19H (BOOTSTRAP J
851
8S>
853 ; ON THE CARD SWITCH SETTINGS
85.
855 DRIVE 0 DRIVE 1
85.
857 ON
858 : -1- -2- I -3- -4-:
8. . OFF
8.0
8.,
8.'
8.3 TRANSLATION TABLE
8 ••
8.5 1/3 : 2/4 : TABLE ENTRY
8 ••
8.7 ON ON
8.8 ON OFF
8.' OFF ON
870 OFF OFF
871
812 ; ------------------------- -- - ------- - .------ .---- --------
a73
03E7 87.
875
87. ;----- DRIVE TYPE 00
877
03E7 3201 878 DW 03060
03E9 02 87' DO 02D
03EA 3201 8ao DW 03060
03EC 0000 881 DW 00000
03EE DB 88' DO OOH
03EF 00 883 DO OOH
03FO DC SS. DO OCH I STAHOARD
03Fl 84 8" DO OB4H j fORMAT DRIVE
03F2 28 88. DB 028H ; CHECK DRIVE
03F3 00000000 887 DO 0,0,0,0
888
88' j----- DRIVE TYPE 01
890
03F7 7701 891 DW 03750
03F9 08 8" DO 08D
03FA 7701 8'3 DW 03750
03FC 0000 8'. DW 00000
03FE DB 8" DO OOH
03FF 05 8'. DO 05H
0400 ac 897 DO OCH ; STANDARD
0401 64 8'8 DO OB4H j FORMAT DRIVE
0402 28 a" 00 026H ; CHECK DRIVE
0403 00000000 900 DB 0,0,0,0
901
'02 j----- DRIVE TYPE 02
903
0407 3201 90. ow 03060
0409 06 905 DO 06D
040A BODO 90. DW 01280
040C 0001 907 DW 02560
040E DB 908 DO OOH
Q40F as 90' D8 05H
0410 ac 910 DO OCH ; STANDARD
0411 84 '11 DO OB4H j FORHAT DRIVE
0412 28
0413 00000000 '"
913
D8
DO
028H
0,0,0,0
; CHECK DRIVE

91.
915 ;----- DRIVE TYPE 03
91.
0417 3201 917 OW 03060
0419 04 918 DB 040

Fixed Disk Adapter 37


LOC OSJ LINE SOURCE

041A 3201 919 OW 03060


041C 0000 920 OW 00000
041E DB 921 DB OBH
041F 05 922 OB 05H
0420 DC 923 DB OCH I STANDARD
0421 B4 924 DB DB4H ; FORMAT DRIVE
0422 28 925 DB 028H ; CHECK DRIVE
0423 00000000 926 DB 0,0,0.0
927
0427 928 IN IT_DRY PROC HEAR
929
930 ; ----- DO DRIVE ZERO
931
0427 C606420QOC 932 MOV CMD_BLDCKtO .INIT_DRV_tHO
04ZC C606430000 933 MOV CMD_BLOCK+l.D
0431 E81000 934 CAll INIT_DRV_R
0434 7200 935 JC nUT_DRV_OUT
936
937 j----- 00 DRIVE ONE
938
0436 C6D64Z000C 939 MOV CMD_BlOCK+D. INIT _DlN_Ct1D
0436 C606430020 940 MDV tHO_BLOCK+ 1. 001000006
0440 E80100 941 CALL INIT_ORV_R
0443 942 IN!T_DRV_OUT:
0443 C3 943 RET
944 WIT_DRV EHOP
945
0444 946 INIT_DRV_R PROt NEA.R
947 ASSUME ES:CODE
0444 2ACO 948 SUB Al,Al
0446 E8190 I 949 CALL tOMMAHO ISSUE THE COMMAND
0449 7301 950 JNt Bl
0448 C3 951 RET
044C 952 Bl:
044C IE 953 PUSH OS ; SAVE SEGMENT
954 ASSUME DS:Dl.It1HY
0440 2BCO 955 SUB AX,AX
044F 8E08 956 MOV OS,AX ; ESTABLISH SEGMENT
0451 C41E0401 957 LES BX,HF _TBl_VEC
0455 IF 958 POP OS ; RESTORE SEGMENT
959 ASSUHE OS:OATA
0456 E83403 960 CAll SW2:_0FF5
0459 7257 961 JC B3
045B 0308 962 ADD BX,AX
963
964 I~--~- SEND DRIVE PARAMETERS MOST SIGNIFICANT BYTE FIRST
965
0450 BFOI00 966 MOV 01.1
0460 E85FOO 967 CALL INIT_ORV_S
0463 7240 968 JC B3
969
0465 BFOOOO 970 MOV 01.0
0468 E85700 971 CALL lNlT_DRV_S
046B 7245 972 JC B3
973
0460 BF0200 974 MDV 01.2
0470 E84FOO 975 CAll INIT_ORV_S
0473 7230 976 JC B3
977
0475 BF0400 978 MDV 01.4
0478 E84700 979 CAll 1NIT_DRV_S
0478 7235 980 JC B3
981
0470 BF0300 982 MOV 01,3
0480 E83FOO 983 CAll lNIT_ORV_S
0483 7220 984 JC B3
985
0485 BF0600 986 MOV 01.6
0468 E83700 987 CAll INIT_DRY_S
048B 7225 988 JC B3
989
0480 BF0500 990 MDV 01,5
0490 E82FOO 991 CAll nUT_ORV_S
0493 7210 992 JC B3
993
0495 BF0700 994 MOV 01,7
0498 E82700 995 CAll INlT_ORY_S

38 Fixed Disk Adapter


LaC OBJ LINE SOURCE

0498 7215 99. JC B'


997
0490 BF0800 99. MOY DI,8 ; DRIVE STEP OPTION
04AQ 26eAD 1 999 MOY AL,ES:[BX + OIl
04A3 A27600 1000 MOY CONTROL_SHE.AL
1001
04A6 28C9 1002 SUB eX,ex
04A8 1003 85:
04A8 E80302 1004 CALL PORT_l
04AB EC 1005 IN AL,DX
04AC ABOl 1006 TEST AL ,R I_IOMODE ; STATUS INPUT NODE
04AE 7509 1007 JNZ 86
0480 E2:f6 1008 lOOP 85
0482 1009 B1:
0482 C606740007 1010 MaY DISK_STATUS.INITJAIL ,OPERATION FAILED
0487 f9 1011 STC
0468 C3 1012 RET
1013
0489 1014 86:
0489 E88502 1015 CALL PORT_O
04BC EC 1016 IN AL.DX
0480 2402 1017 ANO AL,2 ; HASK ERROR BIT
04BF 75Fl 1018 JNZ B1
04Cl C3 1019 RET
1020 ASSUME ES: NOTHING
1021 ENDP
1022
1023 ;----- SEND THE BHE OUT TO THE CONTROLLER
1024
04C2 1025 INIT_DRV_S PROt NEAR
04C2 E8e501 1026 CAll HD_WAIT_REQ
04C5 7207 1027 JC 01
04C7 EBA70Z 1028 CALL PORT_O
04CA 2MAOI 1029 NOV AL,ES:tBX + OIl
04CO EE 1030 OUT DX,AL
04CE 1031 01:
04CE C3 1032 RET
1033 ENDP
1034
1035 ; ------------ ---------------- - ___ -- _____ _
1036 READ LONG (AH = OAH)
1037 ; ------------ - --------------- ---------- --
1038
04CF 1039 PRoe NEAR
04CF E81900 1040 CALL CHK_LONG
0402 7268 1041 JC G8
0404 C6064200E5 1042 MOV CMD_BLDCK+O,RD_LONG_CI1O
0409 8047 1043 HOV AL.DHA_READ
0406 EB68 1044 JMP SHORT DHA_OPN
1045 ENOP
1046
1047 ; ------------------- - ----------------- __ _
1048 WRITE LONG (AH OBH)
1049 ; ----------------------------- - ----------
1050
0400 1051 PROC NEAR
0400 EBOBOO 1052
04EO 7250 1053 JC 68
04E2 C60642:00E6 1054
04E7 8048 1055 HOV Al,ONA_WRITE
04E9 EBSA 1056 JMP SHORT DNA_OPN
1057 WR_LOHG ENOP
1058
04E8 1059 PROC NEAR
04E6 A04600 1060 MOY AL.CHD_BLOCK+4
04[E 3e80 1061 CMP AL,080H
04FO FS 1062 eMC
04Fl C3 1063 RET
1064 CHK_LONG ENilP
1065
1066 ; ------------------ - -- --- ----- _____ --- __ _
1067 SEEK I AH =
OCH)
1068 ; -----------------------_ ----- ____ - _____ _
1069
04F2 1070 PROC HEAR
04F2 C606420008 1071 MOY CHO_BLoeK ,SEEK_eND
04F7 E630 1072 JMP SHORT NOMA_OPN

Fixed Disk Adapter 39


LOC 06J LINE SOURCE

1073 ENDP
1074
1075 ; --- .. -- - ... ------............... -- --- ...... --_ .. _______ "' __ .. ___ _
1076 REAl) SECTOR BUFFER UH = DEH)
1077 i -------- .. ----------------- .. ---------------------
1(178
04F9 1079
04F9 C606420DOE Hl80
04FE C60b46DOOl 1081 MOV CHD_BlOCK+4.1 , ONLY ONE BLOCK
0503 se47 11182 MOV AL.OHA_READ
050,5 E83E 1083 JMP SHORT DMA_OPH
1084 !lUi/_BUFF ENDP
108S
1086 ; .. -------------------------... -_ .. _________________ _
1187 WJfITE SECTOR BUFfER I AH = IFH)
lIJ88 ; ------------------------------------___________ _
1089
0,87 1690
OSI7 C"'428"" 1691
osee C6U46DOOl 1092 MOV CHll_BlDCK+4.1 I ONLY ONE BLOCK
0511 11948 109] MOV AL.DNA_WRITE
osn Eel8 1094 JH" SHaRT DNA_OPH

1096
1 0 97 ; --------- -- --- .. - --------________________ .... ___ .. _ ..
1098 TEST DISK READY (AH = 01 OH)
1 0 99 ; ----------------- --- _ - ---- --- --- - _____ .. ________ _
1110
0515 1101 TST_ROY PROC NEAR
0$15 C:,,6£t20ote 1102 MaV CHO_BlOCKt-O, TST_ROY_C~
05U EBlA 1103 JMP SHORT NOHA_OPN
1104 TST_RDY ENDP
1105
1106 ; --.. -----.. ----------.. ---... ---------- _____ .. _______ _
1107
Il08
RECALIBRATE (AH =
011H)
; ------------- __ "._ .. __ ... ___ ... _______________ .... _____ _

1109
OSlt 1110 HDISK_"ECAL PROC NEAR
D51C C606420001 1111 MOV tHO_BLOCK ,RECA~CHO
0521 EBU 1112 JMP SHORT NDMA_OPN
1113 HDISK_RECAL ENOP
1114
1115 ; -- .. -- .. ----------- .. ,.-- .. -------_________________ .. _____ .. __ _
1116 CONTROLLER RAM DIAGNOSTICS UH 012H) =
1117 ; - .... ---------------------- ______________ .. ______ .. ________ _
1118
0523 1119 PAce NEAR
0523 C60Mt200ED 1120 MOV
0528 EBOC 1l/!:1 JMP
1122 ,NOP
1123
1124 ; - .. ---------- .. ------------------.. ----- .... --- ____ .. _
1125 DRIVE DIAGNOSTICS (AH = 013H)
1126 ; -----------.. ..,.----- .... --- .. ----------- .... -----------
1127
052A 1128 CHK_DRV PROC NEAR
052A C6D6428eE3 1129
aS2:F EB85 1130 JMP
1131 CHK_DRV Et-I>P
1132
1133 J --... --- .......... ---- ....... ---- .. ------ .. - ......... ---.. ------------ .... -----
1134 CONTROLLER INTERNAL DIAGNOSTICS (AH = 014HI
1135 ) ---------.--- ... ------.--- .... ---- .. -- .. ------ ... ---.......... -- .. ----
1136
0531 1137 PROC NEAR
0$31 C6f16421&E4 1138 MOV CMD_BLOCK+O .CNTLR....DIAG_CHD
1139 ENDP
11ItG
1141 i -------....... ----- .. ------------------.. --.. - .. ----------------
1142 SUPPORT ROUTINES
1143 ; - .. ------.------------------------ .. --------------------- ..
ll44
1536 1145 N&lMA_OP'N:
0536 eOll2 1146 HOV AL,02H
1538 E82:700 1147 CALL COMMAND I IS$UE THE COtflAHD
0538 7221 1148 JC GIl
11-530 lun, 1149 JMP SHORT Gl

40 Fixed Disk Adapter


LOC OBJ LINE SOURCE

053F 1150 66:


053F C606740009 1151 NOV DISK_STATUS, DNA_BOUNDARY
0544 C3 1152 RET
0545 1153
0545 E85701 1154 ; SET UP FOR DNA OPEPATION
0543 72F5 ll55 JC G8
054A B003 US6 HOV AL,03H
054C E81300 1157 CALL COMMAND ; ISSUE THE COMMAND
054F nOD 1158 JC G11
0551 B003 1159 NOV Al,03H
0553 E60A 1160 OUT DMA+! 0, Al ; INITIALIZE THE DISK CHANNEL
0555 ll61 G3:
0555 E421 1162 IN AL,021H
0557 Z40F 1163 AtID Al,ODFH
0559 HZ1 1164 OUT 021H,AL
0558 EBAAOl 1165 CALL WAIT_HIT
OSSE 1166 G11:
OSSE E83800 1167 CALL EPPOR_CHK
0561 C3 1168 RET
1169
1170 ; --------------------------------------------------------
1171 ; COMNAND
1172 THIS ROUTINE OUTPUTS THE COMMAND BLOCK
1173 INPUT
1174 Al = CONTROLLER DNA/INTERRUPT REGISTER MASK
1175
1176 ; --------------------------------------------------------
1177
0562 1178 COMNAHD PRot NEAR
0562 BE4200 1179 MOV SI,OFFSET CHD_BLOCK
0565 E81B02 Ilea CALL PORT_2
0568 EE 1181 OUT DX,Al CONTROLLER SELECT PULSE
0569 E81C02 1182 CALL PORT_3
056C EE 1183 OUT OX,Al
0560 2:8C9 1184 SUB ex.cx ; WAIT COUNT
056F E80C02- 1185
0572 1186
0572 EC 1187 IN AL,OX ; GET STATUS
0573 240F 1188 ANO Al,OFH
0575 3COD 1189 CNP Al.RI_BUSY OR RI_BUS 00 Rl_REQ
0577 7409 1190 JE Cl
0579 ElF7 1191 lOOP
0578 C606740060 lIn NOV
0580 F9 1193 STC
0581 C3 1194 RET 1 ERROR RETURN
0582- 1195 Cl:
0582 Fe 1196 CLD
0583 B90600 ll97 NOV CX,6 ; BYTE COUNT
0586 1198 CM3:
0586 E8E801 1199
0589 At 1200 lOOSB ; GET THE NEXT COHNAN[) BYTE
058A EE 1201 OUT OX.AL ; OUT IT GOES
0588 E2F9 1202 lOOP CM3 ; DO MORE
1203
0580 E8EEOI 1204 CALL PORT_l ; STATUS
0590 EC 1205 IN AL,DX
0591 A80 1 1206 TEST AL,RI_REQ
0593 7406 1207 JZ CN7
0595 e606740020 1208 NOV DISK_STATUS .BAD_CNTLR
059A F9 1209 STC
0598 1210 CM7:
0598 C3 1211 RET
1212 COMMAND ENDP
1213
1214 ; ------ ------- --------- -- -- - - - - ------,. -------- ---
1215 SENSE STATUS BYTES
1216
1217 j BYTE a
1218 BIT ADDRESS VALID, WHEN SET
1219 BIT SPARE, SET TO ZERO
1220 BITS 5-4 ERROR TYPE
1221 BITS 3-0 ERROR CODE
1222
1223 BYTE 1
1224 BITS 7-6 ZERO
1225 BIT 5 DRIVE (0-11
1226 BITS 4-0 HEAD NUMBER

Fixed Disk Adapter 41


LaC OBJ LINE SOURCE

1227
1228 ; BYTE 2:
1229 BITS 7-5 CYlINDER HIGH
1230 BITS 4-0 SECTOR HUMBER
1231
1232 ; BYTE 3
1233 BITS 7-0 CYLINDER LOW
1234
1235 i ------- ------- - -------------- ------ -------------
1236
0590 1237 ERROR_CHK PROt NEAR
1238 ASSUME ES:OATA
059C A07400 1239 MOY AL,OISK_STATUS I CHECK IF THERE WAS AN ERROR
059F OACO 1240 OR Al,Al
05Al 7501 1241 JNZ G'I
05A3 C3 1242 RET
1243
1244 j----- PERFORM SENSE STATUS
1245
05A4 1246 G21:
05A4 884000 1247 MaY AX,DATA
05A 7 8EtO 1248 MaY ES,AX ESTABLISH SEGMENT
05A9 2BCO 1249 SUB AX,AX
05A6 SSFe 1250 MOY DI,AX
05AO C606420003 1251 MOY CMD_BLOCK+O ,SENSE_tHO
0562 2ACO 1252 SUB Al,Al
0564 E8ABFF 1253 CALL COMMAND i ISSUE SENSE STATUS COMMAND
0587 7223 1254 JC SENSE_ABORT ; CAHNOT RECOVER
0589 B90400 1255 MOY CX,4
osse 12:56 G22 :
05BC E8CBOO 1257 CALL HO_WAIT_REQ
05BF 7220 1258 JC G24
05Cl E8AOOI 1259 CALL PORT_O
05C4 EC 1260 IN Al.OX
05C5 26884542 1261 MaY ES :HO_ERRORt OI] .Al ; STORE AWAY SENSE BYTES
05C9 47 1262 INC or
05CA E8BI01 1263 CAll PORT_l
05CO E2ED 1264 LOOP G22
05CF E88800 1265 CALL HO_WAIT_REQ
0502 7200 1266 JC G24
0504 E09AOl 1267 CALL PORT_O
0507 EC 1268 IN AL.oX
0508 A802 1269 TEST AL.2
050A 740F 1270 JZ STAT_ERR
050e 1271 SENSE_ABORT:
05DC C6067400FF 1272 MOY DISK_STATUS .SENSE_FAIl
05El 1273 G24:
05El F9 1274 STC
05E2 C3 1275 RET
1276 ERROR_CHK ENDP
1277
05E3 1A06 1278 T_O OW TYPE_a
05E5 2706 1279 T_I OW TYPE_I
05E7 6A06 1280 T_' ow TYPE_2
05E9 7706 1281 T_' ow TYPE_3
1282
05EB 1283 STAT_ERR:
05EB 268AIE4200 1284 MOV Bl,ES:HD_ERROR ; GET ERROR BYTE
05FO 8AC3 1285 MaV AliBl
05F2 240F 1286 ANO Al.OFH
05F4 80E330 1287 AND Bl. 00 1100008 ; ISOLATE TYPE
05F7 2AFF 1288 SUB BH.BH
05F9 BI03 1289 MOV Cl.3
05FB 03EB 1290 SHR BX,Cl ; ADJUST
05FD 2EFFA7E305 1291 JMP WORD PTR CS:[BX .. OFFSET T_O I
1292 ASSUME ES:NOTHING
1293
0602 1294 TYPE a_TABLE LABEl BYTE
0602 00204020800020 1295 OB O. BAD_CHTLR .BAO_SEEK • BAO_CHTLR • TIHE_OUT, 0, BAD_CN'lLR
0609 0040 1296 OB o ,BAD_SEEK
0009 1297 TYPEO_LEN EOU $- TYPEO_ TABLE

060B 1298 TYPE I_TABLE LABEl BYTE


060B 1010020004 1299 OB BAD_ECC, BAD_ECC. BAD _AOOR_MARK. 0, RECORD_NOTJND
0610 400000110B 1300 OB BAD_SEEK.O. 0 ,DATA_CORRECTED .BAO_TRACK
OOOA 1301 TYPEl LEN EOU $-TYPEl_TABlE
0615 1302 TYPE2_TABLE LABEL BYTE
0615 0102 1303 OB BAO_CND. BAD_AD OR_HARK

42 Fixed Disk Adapter


LOC OBJ LINE SOURCE

0002 1304 TYPE2_LEN EOU $-TYPE2_ TABLE


0617 1305 TYPD_TABLE LABEL BYTE
01)17 202010 1306 DB BAD_CHTlR ,BAD_CHTLR ,BAD_ECC
0003 1307 TYPE3_lEH EOU $-TYPE3_ TABLE
1308
1309 ;----- TYPE 0 ERROR
1310
061A 1311 TYPE_O :
061A 880206 1312 MOV BX.OFFSET TYPED_TABLE
0610 3C09 1313 CMP Al. TYPED_LEN ; CHECK IF ERROR IS DEFINED
OolF 7363 1314 JAE UNDEF _ERR_l
0621 2ED7 1315 XlAT C5:TYPEO_TABLE I TABLE LOOKUP
0623 A27400 1316 MOV DISK_STATUS,AL ; SET ERROR CODE
0626 C3 1317 RET
1318
1319 ; ------ TYPE 1 ERROR
1320
0627 1321 TYPE_I:
0627 8BOB06 1322 MOV BX,OFFSET TYPE I_TABLE
062A 86ca 1323 MOV eX.AX
Obze 3COA 1324 CMP AL,TYPEl_lEN ; CHECK If ERROR IS DEFINED
06ZE 7354 1325 JAE UNDEF _ERR_l
0630 ZED7 1326 XlAT CS:TYPEl_TABLE i TABLE LOOKUP
0632 A27400 1327 MOV DISK_STATUS,Al ; SET ERROR CODE
0635 80EI08 1328 AND Cl , 08H ; CORRECTED Eec
0638 80F908 1329 CMP Cl,08H
0638 7S2A 1330 JNZ G30
1331
1332 ;----- OBTAIH ECC ERROR BURST lENGTH
1333
0630 t606420000 1334 MOV tNO_BlOtKtO IRO_Ett_tHO
0642 2ACO 1335 SUB Al,Al
0644 E8lBFF 1336 CAll COMMAND
0647 72lE 1337 JC G30
0649 E83EOO 1338 tAll HD_WAIT_REQ
064C 7219 1339 JC G30
064E E82001 1340 tALL PORT 0
0651 EC 1341 IN Al,OX
0652: 8At8 1342: MOV Cl,Al
0654 E83300 1343 tAll HD_WAIT_REQ
0657 nOE 1344 JC G30
0659 E81501 1345 CAll PORT_O
06se Et 1346 IN Al,DX
0650 A801 1347 TEST Al,OlH
065F 7406 1348 JZ G30
0661 t60674002:0 1349 MOV OISK_ STATUS, BAO_ CNTLR
0666 F9 1350 STC
0667 1351 G30:
0667 8ACl 1352: MOV Al,Cl
0669 C3 1353 RET
1354
1355 ; ----- TYPE 2 ERROR
1356
066A 1357 T'l'PE_2:
066A BBlS06 1358 MOV BX,OFFSET TYPE2_TABlE
0660 3C02 1359 CMP Al, TYPE2_LEN 1 CHECK IF ERROR IS DEFINED
066F 7313 1360 JAE UHDEF _ERR_L
0671 2E07 1361 XLAT CS:TYPEl_TABlE ; TABLE LOOKUP
0673 A27400 1362 MOV DISK_STATUS,AL ; SET ERROR CODE
0676 C3 1363 RET
1364
1365 1----- TYPE '3 ERROR
1366
0677 1367 TYPE_3:
0677 BB1706 1368 MOV BX,OFFSET TYPE3_ TABLE
067A 3t03 1369 CMP Al, TYPE3_LEN
067t 7306 1370 JAE UHOEF _ERR_l
067E 2E07 1371 XLAT CS:TYPE3_TABlE
0680 A2:7400 1372 MOV DISK_STATUS,AL
0683 t3 1373 RET
1374
0684 1375 UNDEF _ERR_L:
0684 C6067400BB 1376 MOV DISK_STATUS,UHDEF _ERR
0689 C3 1377 RET
1378
068A 1379 HO_WAIT_REQ PROt NEAR
068A 51 1380 PUSH cx

Fixed Disk Adapter 43


LOC OBJ LINE SOURCE

068& 28C9 1381 SU8 eX,ex


068D E8[EOO 1382 CALL PORT_l
0690 1383 U:
0690 EC 1384 IN AL,OX
0691 A801 1385 TEST AL,Rl_REQ
0693 75118 1386 JNZ I'
0695 E2F9 1387 lOOP LI
0691 C606740080 1388 I10V DISK_STATUS. TIME_OUT
069C F9 1389 5TC
069D 1390 L2:
069D 59 1391 pop CX
069E CS 1392 RET
1393 HD_WAIT_REQ EtIlP
1394
1395 J -------------------------------- - .. - ...... ---------- .. --.,. .. -_ ..
1396 ; DMA_SETUP
1397 ntIS ROUTINE SETS UP FOR DHA OPERATIONS.
1198 i INPUT
1399 (AU :: HODE BYTE FOR THE DHA
1400 (ES:8Xl ;:; ADDRESS TO READ/WRITE THE DATA
1401 I OUTPUT
1402 I AX) OESTROYED
1403 J .. -------------- .. ----------------------------------------
069F 1404 DHA_SETUP PROC NEAR
069F 50 1405 PUSN AX
0640 404600
06A3 3(:81
06.5 58
06A6
06A8 F9
n02
1406
1407
1408
1409
1'\10
I10V
CMP
POP
JB
5TC
.
AL.CI1D_BlOCK"4
AL,8tH

JI
I BLOCK COUNT OUT OF RANGE

06A9 C3 1411 RET


06AA 1412 Jl:
06AA 51 1413 PUSH CX I SAVE THE REGISTER
06A8 FA 1414 CLI j NO MORE INTERRUPTS
06AC E60C 1415 OUT DI1A+12,AL I SET THE FIRSTILAST FIF
MAE 50 1416 PUSH AX
06AF 58 1417 POP AX
0680 E~08 1418 OUT DHA+ll.AL J OUTPUT THE MODE BYTE
0682 eceo 1419 "OV AX,ES j GET THE ES VALUE

06B4 BI04 1420 "OV Cl.4 , SHlFT COUNT


06B6 DlGO 1421 ROI AX,CL I ROTATE LEFT
068& SAES 1422 "OV CH,AL i GET HIGHEST NYBBLE OF ES TO CH
06BA 24FO 1423 AND Al.OFOH , ZERO THE LOW NYBBLE FROM SEGHENT
Obec 03C3 1424 ADD AX.BX I TEST FOR CARRY FROM ADDITION
06BE 7302 1425 mc J33
06CO FEC5 1426 lNC eH I CARRY HEANS HIGH 4 BITS MUST BE tNC
06C2 1427 J33:
06C2 50 1428 PUSN AX , SAVE START ADDRESS
06C3 E606 1429 OUT DI1A+6"U 1 OUTPUT LOW ADDRESS
06C5 8AC4 1430 MOV AL.AH
06C7 E606 1431 OUT OMA+6,Al j OUTPUT HIGH ADDRESS

06C9 8ACS 1432 I10V AL,CH I GET HIGH 4 BITS


06CB 240F 1435 ANO AL.OFH
06CD E682 1434 OUT DHA_HIGH.AL i OUTPUT THE HIGH 4 BITS TO PAGE REG
1435
1436 1-----.. OETERHINE COUNT
1437
06CF A04600 U.38 I10V Al,CtID_BLOCK+4 I RECOVER BLOCK COUNT
0602 ODED 1439 SNI AL.l I HULTIPLY BY 512 BYTES PER SECTOR
0604 FEC8 1440 DEC Al ANO DECREMENT VALUE BY ONE
0606 8AEO 1441 I10V AH,Al
0608 BOFF 1442 I10V AL,OFFH
1443

060A 50
0608 Mft200
06DE 3Ce5
1444
1445
1446
1447
1448
PUSH
,",V
C"P
.
1----- HAtilLE READ AND WRITE LONG 15160 BYTE BLOCKS)

AL,ct1D_aLOCK+O
ALoRD_LONG_CHO
I SAVE REGISTER
I GET COMMAND

06EO 7407 1449 JE ADD_


06E2 3CE6
06E4 7403
06E6 58
06E7 EBll
1450
1451
1452
1453
C"P
JE
POP
J"P
.
AL.WR_lONG_CMD
A004

SHORT J20
1 RESTORE REGISTER

06E9 1454 ADD4;


06E9 58 1't55 POP AX I RESTORE REGIST~R
06EA aa0402 1456 ,",V AX,516D I ONE BLOCK (512) PLUS 4 BYTES ECC
06ED 53 1457 PUSN BX

44 Fixed Disk Adapter


LOC OBJ LINE SOURCE

06Ef 2AFF 1458 SUB SH,SH


06FO 8AIE4600 1459 MOV BL,CMD_BLOCK+4
06F4 52 1460 PUSH OX
06F5 F7E3 1461 MUL BX ; BLOCK COUHT TIMES Sib
06F7 SA 1462 PDP OX
06F8 58 1463 PDP BX
06F9 48 1464 DEC AX I ADJUST
06FA 1465 J20:
1466
06FA 50 1467 PUSH AX SAVE COUHT VALUE
06FB E607 1468 OUT DMA+7.AL lOW BYTE OF COUNT
06FO 8AC4 1469 MOV AL,AH
D6FF f607 1470 OUT OHA+7,AL 1 HIGH BYTE OF COUHT
0701 FB 1471 sn ; INTERRUPTS BACK ON
0702 S9 1472 POP CX ; J;!ECOVER COUtU VALUE
0703 58 1473 POP AX ; RECOVER ADDRESS VALUE
0704 03el 1474 ADD AX,ex ; ADD. TEST FOR 64K OVERflOW
0706 59 1475 POP CX ; RECOVER REGISTER
0707 C3 1476 .ET ; RE11..IRN TO cALLER. CFL SET BY ABOVE IF ERROR
1477 DHA_SETUP ENOP
1478
1479 ,------------------------------------------------
1480 ; WAIT_lNT
1481 THIS ROUTINE WAITS FOR THE FIXED DISK
1482 CotHROLLER TO SIGNAL THAT AN ItHERRUPT
1483 HAS OCCURRED.
1484 ; ------------------ -- ----- --------------- --------
0708 1485 WAIT_INT PIWC NEAR
0708 FB 1486 sn TURN ON INTERRUPTS
0709 53 1487 PUSH BX PRESERVE REGISTERS
070A 51 1488 PUSH CX
070B 06 1489 PUSH ES
070C 56 1490 PUSH 51
0700 IE 1491 PUSH OS
1492 ASSUME OS:DUHMY
070E 2BCO 1493 SUB AX,AX
0710 8E08 1494 MOV DS,AX I ESTABLISH SEGMENT
0712 C4360401 1495 LES SI,HF_TBl_VEC
1496 ASSUME OS:DATA
0716 IF 1497 POP OS
1498
1499 ;----- SET TIMEOUT VAlUES
1500
0717 2AFF 1501 SUB BH,BH
0719 268A5C09 1502 HOV BL,BYTE PTR ES:tSIlt91 ; STANDARD TIME OUT
071D 8A264200 1503 MOV AH,CMD_BLOCK
ani 80FC04 1504 CMP AH.FMTDRV_CMD
0724 7506 1505 JHZ W5
0726 268A5COA 1506 MOV Bl.IHTE PTR ES:[SIHOAH] FORMAT DRIVE
072A EB09 1507 JMP SHORT W4
onc 80Fcn 1508 1015: CMP AH. CHK_DRV _CND
onF 7504 1509 JHZ W4
0731 268A5COB 1510 MOV Bl.BHE PTR ES:[SIl!OBHl ; CHECK DRIVE
0735 1511 1014:
0735 28C9 1512 SUB CX.CX
1513
1514 1----- WAIT FOR INTERRUPT
1515
0737 1516 loll:
0737 £84400 1517 CALL PORT_l
073A EC 1518 IN AL,DX
0738 2420 1519 AND ,A,L.020H
0730 3C20 1520 CMP Al.020H ; DID INTERRUPT OCCUR
073F 740A 1521 JZ W'
0741 E2F4 1522 LOOP WI ; INNER LOOP
0743 4B 1523 DEC BX
0744 75Ft 1524 JHZ WI • OUTER LOOP
0746 C606740080 1525 MOV DISK_STATUS. TIME_OUT
0748 1526 1012:
074B E82300 1527 CALL PORT_O
074E EC 1528 IN AL.DX
074F 2402 1529 MID AL.2 ; ERROR BIT
0751 08067400 1530 OR DISK_STATUS.AL ; SAVE
0755 E83000 1531 CALL PORT_3 ; INTERRUPT MASK REGISTER
0758 32CO 1532 XOR AL,AL ; ZERO
075A EE 1533 OUT OX.AL ; RESET MASK
0758 5E 1534 POP 51 ; RESTORE REGISTERS

Fixed Disk Adapter 45


LOC OBJ LINE SOURCE

07se 07 1535 pop ES


0750 59 1536 pop CX
07SE 58 1537 POP BX
075F C3 1538 RET
1539 WAIT_INT ENOP
1540
0760 1541 HD_INT PROC NEAR
0760 50 1542 PUSH AX
0761 B020 1543 MOV AL,EOI J END OF INTERRUPT
0763 E620 1544 OUT INT_CTL_PORT,Al
0765 B007 1545 MOV AL,07H ; SET DHA HOOE TO DISABLE
0767 E60A 1546 OUT DMA+IO,AL
0769 E421 1547 IN AL,OZlH
0766 DClD 1548 OR AL.020H
0760 E621 1549 OUT 021H,AL
076f 58 1550 POP AX
0770 CF 1551 IRET
1552 HD_INT ENOP
1553
1554 ;----------------------------------------
1555 , PORTS
1556 GENERATE PROPER PORT VALUE
1557 8ASED ON THE PORT OfFSET
1558 1----------------------------------------
1559
0771 1560 PORT_O PROC NEAR
0771 BA2003 1561 MOV DX.HF _PORT j BASE VALUE
0774 50 1562 PUSH AX
0775 2AE4 1563 SUB AH,AH
0777 A07700 1564 MOV .U,PORT_OFF I ADO IN THE OFFSET
077A 0300 1565 ADO OX.AX
077C 58 1566 POP AX
0770 C3 1567 RET
1568 PDRT_O ENOP
1569
077E 1570 PORT_l PROC NEAR
077E E8FOFF 1571 CALL PORT_O
0781 42 1572 INC OX ; INCREMENT TO PORT ONE
0782 C3 1573 RET
1574 PORT_l ENOP
1575
0783 1576 PORT_2 PROC NEAR
0783 E8F8FF 1577 CALL PORT_1
0786 42 1578 INC OX I INCREMENT TO PORT TWO
0787 C3 1579 RET
1580 PORT_2 ENOP
1581
0788 1582 PORT_3 PROC NEAR
0788 E8F8FF 1583 CALL PORT_2
0768 4Z 1564 INC OX • INCREMENT TO PORT THREE
076C C3 1585 RET
1566 PORT_3 ENOP
1587
1566 ; -------~----------------------------------------
1589 I SW2_0FFS
1590 DETERHINE PARAMETER TABLE OFFSET
1591 USING CONTROllER PORT T1oIO AND
1592 DRIVE NUNBER SPECIFIER (0-1)
1593 1------------------------------------------------
1594
0780 1595 SW2.0FFS PROC NEAR
0780 E8F3FF 1596 CALL PORT_2
0790 EC 1597 IN AL.OX I READ PORT 2
0791 50 1598 PUSH AX
07901: E8E9FF 1599 CALL PORT_I
0795 EC 1600 IN AL,DX
0796 2402 1601 ANO AL.Z I CHECK FOR ERROR
0798 58 1602 POP AX
0799 7516 1603 JNZ SW2_0FFS_ERR
0798 8A264300 1604 MOY AH .CMD_BLOCK+l
079F 80E420 1605 ANO AH.00I00000B I DRIVE 0 OR 1
07A2 7504 1606 JNZ SW2_AND
07A4 00E8 1607 SHR Al.I ; ADJUST
07A6 DOE8 1608 SHR AL.I
07A8 1609 SW2_AND:
07A8 2403 1610 ANO AL.OllB I ISOLATE
07AA 8104 1611 MeV Cl.ft

46 Fixed Disk Adapter


LOC OBJ LINE SOURCE

07Ae 02EO 1612 SHL AL,CL I ADJUST


07AE 2AE4 1613 SUB AH,AH
07BO C3 1614 RET
07Bl 1615 SW2_0FFS_ERR:
07Bl F9 1616 STC
0782 C3 1617 RET
1618 SW2_0FfS EHOP
1619
07B3 30382F31362F38 1620 DB '08/16/82' ; RELEASE MARKER
32
1621
07B6 1622 END_ADDRESS LABEl BYTE
1623 CODE ENOS
1624 ENO

Fixed Disk Adapter 47


Notes:

48 Fixed Disk Adapter


--
- -- -- -
-
--- -
---- Personal Computer
--
-- --
-_
-
- ---
---
-.- Hardware Reference
Library

Fixed Disk and Diskette


Drive Adapter
Contents

Description .................................... 1
Fixed Disk Function ............................. 1
Task File .................................. 2
Task File Registers .......................... 2
Miscellaneous Information ................... 11
Diskette Function .............................. 11
Diskette Controller ......................... 14
Diskette Controller Commands ............... 16
Controller Commands ...................... 20
Command Status Registers ................... 32
Interfaces .................................... 36
Interface Lines ............................ 37
Logic Diagrams ................................ 41

iii
Notes:

iv
Description

The IBM Personal Computer AT Fixed Disk and Diskette Drive


Adapter connects to the system board using one of the system
expansion slots. The adapter controls the 5-1/4 inch diskette
drives and fixed disk drives. Connectors on the adapter supply all
the signals necessary to operate up to two fixed drives and one
diskette drive or one fixed drive and two diskette drives. The
adapter will allow concurrent data operations on one diskette and
one fixed disk drive.

The adapter operates when connected to a system board


expansion slot. This channel is described in the" System Board"
section of the IBM Personal Computer AT Technical Reference
Manual.

Fixed Disk Function

The fixed disk function features 512-byte sectors; high-speed,


programmed input/output (PIO) data transfers; error correction
code (ECC) correction of up to five bits on data fields; multiple
sector operations across track and cylinder boundaries; and
on-board diagnostic tests. The adapter will support two fixed
disks with up to 16 read/write heads and 1024 cylinders.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 1
Task File
A task file, which contains eight registers, controls fixed-disk
operations. The following figure shows the addresses and
functions of these registers.

I/O Address
Primary Secondary Read Write
1 FO 170 Data Register Data Register
1 F1 171 Error Register Write Precomp
1 F2 172 Sector Count Sector Count
1 F3 173 Sector Number Sector Number
1 F4 174 Cylinder Low Cylinder Low
1F5 175 Cylinder High Cylinder High
1 F6 176 Drive/Head Drive/Head
1 F7 177 Status Register Command Register
Task File

Task File Registers


Data Register

The data register provides access to the sector buffer for read and
write operations in the PIG mode. This register must not be
accessed unless a Read or Write command is being executed. The
register provides a 16-bit path into the sector buffer for normal
Read and Write commands. When a R/W Long is issued, the 4
ECC bytes are transferred by byte with at least 2 microseconds
between transfers. Data Request (DRQ) must be active before
I I

the transferring of the ECC bytes.

Error Register

The error register is a read-only register that contains specific


information related to the previous command. The data is valid
only when the error bit in the status register is set, unless the
adapter is in diagnostic mode. Diagnostic mode is the state
immediately after power is switched on or after a Diagnose
command. In these cases, the register must be checked regardless
of the status register indicator. The following are bit values for
the diagnostic mode.

August 31, 1984


2 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Diagnostic Mode

01 No errors

02 Controller error

03 Sector buffer error

04 ECC device error

05 Control processor error

The following are bit definitions for the operational mode.

Operational Mode

Bit 0 Data Address Mark (DAM) Not Found-This bit


indicates that DAM could not be found within 16 bytes
of the ID field.

Bit 1 TR 000 Error-This bit will be set if, during a Restore


command, the track 000 line from the fixed disk is not
true within 1023 step pulses to the drive.

Bit 2 Aborted Command-A command is aborted based on


the drive status (Write Fault, Not Seek Complete, Drive
Not Ready, or an invalid command). The status and
error registers may be decoded to determine the cause.

Bit 3 Not used.

Bit 4 ID Not Found-The ID field with the specified cylinder,


head, and sector number could not be found. If retries
are enabled, the controller attempts to read the ID 16
times before indicating the error. If retries are disabled,
the track is scanned a maximum of two times before
setting this error bit.

Bit 5 Not used

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 3
Bit 6 Data Eee Error-This bit indicates that an
uncorrectable Eee error occurred in the target's data
field during a read command.

Bit 7 Bad Block Detect-This bit indicates that the bad block
mark was detected in the target's ID field. No Read or
Write commands will be executed in any data fields
marked bad.

Write Precompensation Register

The value in this register is the starting cylinder number divided


by 4. The I reduced write current I signal to the drive is activated
and the adapter's write precompensation logic is turned on when
this number is entered into the register.

Sector Count Register

The sector count register defines the number of sectors to be


transferred during a Verify, Read, Write, or Format command.
During a multi-sector operation, the sector count is decremented
and the sector number is incremented. When the disk is being
formatted, the number of sectors per track must be loaded into
the register prior to each Format command. The adapter supports
multi-sector transfers across track and cylinder boundaries. The
drive characteristics must be set up by the Set Parameters
command before initiating a multi-sector transfer. The sector
count register must be loaded with the number of sectors to be
transferred for any data-related command.

Note: A 0 in the sector count register specifies a 256-sector


transfer.

Sector Number Register

The target's logical sector number for Read, Write, and Verify
commands is loaded into this register. The starting sector number
is loaded into this register for multi-sector operations.

August 31, 1984


4 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Cylinder Number Registers

The target number for Read, Write, Seek, and Verify commands
is loaded into these registers as shown in the following figure. The
cylinder-number registers address up to 1024 cylinders.

Cylinder High Cylinder Low


Register Bits 76543210 76543210
Cvlinder Bits --98 76543210
Cylinder Number Registers

Drive/Head Register

Bit 7 Set to 1

Bit 6 Set to 0

Bit 5 Set to 1

Bit 4 Drive Select-This bit selects the drive. A 0


indicates the first fixed disk drive, and a 1
indicates the second.

Bit 3-Bit 0 Head Select Bits-Bits 3 through 0 specify the


desired read/write head. Bit 0 is the
least-significant (0101 selects head 5). The
adapter supports up to 16 read/write heads. For
access to heads 8 through 15, bit 3 of the fixed
disk register (address hex 3F6) must be set to 1.

Note: This register must be loaded with the maximum


number of heads for each drive before a Set Parameters
command is issued.

Status Register

The controller sets up the status register with the command status
after execution. The program must look at this register to
determine the result of any operation. If the busy bit is set, no
other bits are valid. A read of the status register clears interrupt

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 5
request 14. If -write fault or error is active, or if -seek
I I I I I

complete or -ready is inactive, a multi-sector operation is


I I I

aborted.

The following defines the bits of the status register:

Bit 7 Busy-This bit indicates the controller's status.


A 1 indicates the controller is executing a
command. If this bit is set, no other status
register bit is valid, and the other registers reflect
the status register's contents; therefore, the busy
bit must be examined before any fixed disk
register is read.

Bit 6 Drive Ready-A 1 on this bit together with a 1


on seek complete bit (bit 4) indicates that the
fixed disk drive is ready to read, write, or seek. A
o indicates that read, write, and seek are
inhibited.

Bit 5 Write Fault-A 1 on this bit indicates improper


operation of the drive; read, write, or seek is
inhibited.

Bit 4 Seek Complete-A 1 on this bit indicates that the


read/write heads have completed a seek
operation.

Bit 3 Data Request-This bit indicates that the sector


buffer requires servicing during a Read or Write
command. If either bit 7 (busy) or this bit is
active, a command is being executed. Upon
receipt of any command, this bit is reset.

Bit 2 Corrected Data-A 1 on this bit indicates that


the data read from the disk was successfully
corrected by the ECC algorithm. Soft errors will
not end multi-sector operations.

Bit 1 Index-This bit is set to 1 each revolution of the


disk.

August 31, 1984


6 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Bit 0 Error-A 1 on this bit indicates that the previous
command ended in an error, and that one or more
bits are set in the error register. The next
command from the controller resets the error bit.
This bit, when set, halts multi-sector operations.

Command Register

The command register accepts eight commands to perform fixed


disk operations. Commands are executed by loading the task file
and writing in the command register while the controller status is
not busy. If -write fault is active or if -drive ready or -seek
I I I I I

complete are inactive, the controller will not execute any


I

command. Any code not defined in the following figure causes an


Aborted Command error. Interrupt request 14 is reset when any
command is written. The following are acceptable commands to
the command register.

Command Bits
7 6 5 4 3 2 1 0
Restore 0 0 0 1 R3 R2 Rl RO
Seek 0 1 1 1 R3 R2 Rl RO
Read Sector 0 0 1 0 0 0 L T
Write Sector 0 0 1 1 0 0 L T
Format Track 0 1 0 1 0 0 0 0
Read Verify 0 1 0 0 0 0 0 T
Diagnose 1 0 0 1 0 0 0 0
Set Parameters 1 0 0 1 0 0 0 1
Valid Command-Register Commands

Note: Stepping rate values and bit definitions for Land T


are shown in the following figures.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 7
The following figure shows the stepping rate as defined by R3
through RO.

R3 R2 R1 RD Stepping Rate
a a a a 35 us
a a a 1 0.5 ms
a a 1 a 1.0 ms
a a 1 1 1.5 ms
a 1 a a 2.0ms
a 1 a 1 2.5 ms
a 1 1 a 3.0ms
a 1 1 1 3.5 ms
1 a a a 4.0ms
1 a a 1 4.5 ms
1 a 1 a 5.0 ms
1 a 1 1 5.5 ms
1 1 a a 6.0 ms
1 1 a 1 6.5 ms
1 1 1 a 7.0 ms
1 1 1 1 7.5 ms
Stepping Rate

Note: After a Diagnose or Reset Command, the stepping


rate is set to 7.5 milliseconds.

The following figure shows the bit definitions for bits Land T.

Bit Definition D 1
L Data Mode Data Only Data Plus 4 Byte ECC
T Retry Mode Retries Enabled Retries Disabled
Land T Bit Definitions

Note: When retries are disabled, ECC and ID field retries


are limited to less than two complete revolutions.

Following are descriptions of the valid command-register


commands.

Restore: The controller issues step pulses to the drive until the
Track 000 indicator from the drive is active. If Track 000 is not
active within 1023 steps the error bit in the status register is set
and a Track 000 error is posted in the error register. The implied
seek step rate can be set up using the stepping rate figure on the

August 31, 1984


8 Personal Computer AT Fixed Disk and Diskette Drive Adapter
previous page. The restore step rate is established by the seek
complete signal from the drive (each step pulse is issued after
seek complete is asserted by the drive from the previous step).

Seek: The Seek command moves the R/W heads to the cylinder
specified in the task files. The adapter supports overlapped
seeking on two drives or setup of the buffered seek stepping rate
for the implied seek during a Read/Write command. An interrupt
is generated at the completion of the command.

Read Sector: A number of sectors (1-256) may be read from


the fixed disk with or without the ECC field appended in the
Programmed I/O (PIO) mode. If the heads are not over the
target track, the controller issues step pulses to the drive and
checks for the proper ID field before reading any data. The
stepping rate used during the implied seek is the value specified
during the previous Seek or Restore command. Data errors, up to
5 bits in length, are automatically corrected on Read Short
commands. If an uncorrectable error occurs, the data transfer
still takes place; however, a multi-sector read ends after the
system reads the sector in error. Interrupts occur as each sector is
ready to be read by the system. No interrupt is generated at the
end of the command, after the last sector is read by the system.

Write Sector: A number of sectors (1-256) may be written to


the fixed disk with or without the ECC field appended in the PIO
mode. The Write Sector command also supports implied seeks.
Interrupts for the Write command occur before each sector is
transferred to the buffer (except the first) and at the end of the
command. The first sector may be written to the buffer
immediately after the command has been sent, and I -data
request is active.
I

Format Track: The track specified by the task file is formatted


with ID and data fields according to the interleave table
transferred to the buffer. The interleave table is composed of two
bytes per sector as follows: 00, Physical Sector 1, 00, Physical
Sector 2, ... 00, Physical Sector 17. The table for 2-to-l
interleave is: 00,01,00, OA, 00, 02, 00, OB, 00, 03, 00, OC, 00,
04,00,OD,00,05,00,OE,00,06,00,OF,00,07,00,10,00,08,
00, 11, 00, 09. The data transfer must be 512 bytes even though
the table may be only 34 bytes. The sector count register must be
loaded with the number of sectors per track before each Format

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 9
Track command. An interrupt is generated at the completion of
the command; the Format Track command supports no error
reporting. A bad block may be specified by replacing a 00 table
entry with an 80.

When switching between drives, a restore command must be


executed prior to attempting a format.

Preform the following when formatting a drive with more than 8


read/write heads:

1. Restore

2. Format all cylinders, heads 0 - 7 only

3. Restore

4. Format all cylinders, heads 8 and above.

Read Verify: This command is similar to to a Read command


except that no data is sent to the host. This allows the system to
verify the integrity of the fixed disk drive. A single interrupt is
generated upon completion of the command or in the event of an
error.

Diagnose: This command causes the adapter to execute its


self-test code and return the results to the error register. An
interrupt is generated at the completion of this command.

Set Parameters: This command sets up the drive parameters


(maximum number of heads and sectors per track). The
drive/head register specifies the drive affected. The sector count
and drive/head registers must be set up before this command is
issued. The adapter uses the values specified for track and
cylinder crossing during multi-sector operations. An interrupt is
generated at the completion of this command. This command
must be issued before any multi-sector operations are attempted.
The adapter supports two fixed disk drives with different
characteristics, as defined by this command.

August 31, 1984


10 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Miscellaneous InCormation
The following is miscellaneous information about the fixed disk
drive function.

• The adapter performs normal read/write operations on a


data field only after a successful match of that sector's ID
with the targeted ID.

• ID fields are checked for errors when read from the disk.

• The adapter supports only Eee on data fields and only eRe
on ID fields. The eRe polynomial is X16 + X12 + X5 + 1;
the Eee polynomial is X32 + X28 + X26 + X19 + X17 +
X10 + X6 + X2 + 1. All shift registers are preset to hex F
before calculating the checksums, which begin with the
respective address marks.

Diskette Function

The 5-1/4 inch diskette drive function is an integral part of the


Fixed Disk and Diskette Drive Adapter. One or two diskette
drives are attached to the adapter through an internal,
daisy-chained, flat cable. The attachment will support 160K.-,
320K.-, and 1.2M.-byte diskette drives.

The address assignments for diskette functions are shown in the


following figure.

I/O Address
Primary Secondary Read Write
3F2 372 - Digital Output Register
3F4 374 Main Status Register Main Status Register
3F5 375 Diskette Data Register Diskette Data Register
3F6 376 - Fixed Disk Register
3F7 377 Digital Input Register Diskette Control Register
Diskette Function

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 11
The adapter is designed for a double-density, MFM-coded,
diskette drive and uses write precompensation with an analog
circuit for clock and data recovery. The diskette-drive parameters
are programmable, and the diskette drive's write-protect feature is
supported. The adapter is buffered on the I/O bus and uses the
system board's direct memory access (DMA) for record data
transfers. An interrupt level also is used to indicate when an
operation is complete and that a status condition requires
microprocessor attention.

Digital Output Register (hex 3F2)

The digital output register (DOR) is an output-only register used


to control drive motors, drive selection, and feature enable. The
bit definitions follow:

Bit 7 Reserved

Bit 6 Reserved

Bit 5 Drive B Motor Enable

Bit 4 Drive A Motor Enable

Bit 3 Enable Diskette Interrupts and DMA

Bit 2 Diskette Function Reset

Bit 1 Set to a logical 0

Bit 0 Drive Select-A 0 on this bit indicates that drive


A is selected.

Note: A channel reset clears all bits.

Digital Input Register (hex 3F7)

The digital input register is an 8-bit, read-only register used for


diagnostic purposes. The following are bit definitions for this
register:

August 31, 1984


12 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Bit 7 Diskette Change

Bit 6 Write Gate

Bit 5 Head Select 3/Reduced Write Current

Bit 4 Head Select 2

Bit 3 Head Select 1

Bit 2 Head Select 0

Bit 1 Drive Select 1

Bit 0 Drive Select 0

Note: Bits 0 through 6 apply to the currently


selected fixed disk drive. These bits are valid
for 50 microseconds after a write to the
Drive Head Register.

Data Rates
The diskette function will support three data rates: 250,000,
300,000 and 500,000 bits per second.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 13
Diskette Controller
The diskette controller has two registers to which the system
unit's microprocessor has access: a status register and a data
register. The status register may only be read and is used to
facilitate the transfer of data between the processor and diskette
controller. The 8-bit status register has the status information
about the diskette and may be accessed at any time. The 8-bit
data register (hex 3F5), which actually consists of several
registers in a stack with only one register presented to the data
bus at a time, stores data, commands, and parameters, and
provides diskette-drive status information. Data bytes are read
from or written to the data register in order to program or obtain
results after a particular command.

The bits in the status register (hex 34F) are defined as follows:

Bit 7 Request for Master (RQM)- The data register


is ready to send or receive data to or from the
processor.

Bit 6 Data Input/Output (DIO)-The direction of


data transfer between the diskette controller and
the processor. If this bit is a 1, transfer is from
the diskette controller's data register to the
processor; if it is a 0, the opposite is true.

Bit 5 Non-DMA Mode (NDM)-The diskette


controller is in the non-DMA mode.

Bit 4 Diskette Controller Busy (CB)- A Read or


Write command is being executed.

Bit 3 Reserved

Bit 2 Reserved

Bit 1 Diskette Drive B Busy (DBB)- Diskette drive


B is in the seek mode.

Bit 0 Diskette Drive A Busy (DAB)- Diskette drive


A is in the seek mode.

August 31, 1984


14 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Diskette Control Register (hex 3F7)

This register is assigned two addresses, hex 3F7 (primary) and


hex 377 (secondary). This is a four bit write only register. The
bits are defined as follows:

Bits 7 - 2 Reserved

Bits 2 - 0 Diskette Data Rate- These bits select the


diskette data rate as shown in the following
figure:

Bit 0 Bit 1 Diskette


Data Rate
0 0 500,000 bps
0 1 300,000 bps
1 0 250.000 bps
1 1 Unused
Diskette Data Rate

Fixed Disk Register (hex 3F6)

This register is assigned two addresses, 3F6 (primary) and 376


(secondary). This is a four bit write only register. The bits are
defined as follows:

Bits 7 - 4 Reserved

Bit 3 A logical 0 enables reduced write current. A


logical 1 enables head select 3.

Bit 2 A logical 1 enables reset fixed disk function.

Bit 1 A logical 0 enables fixed disk interrupts.

Bit 0 Reserved

Note: Bit 3 defines the function of the fixed disk control


interface connector (pin 2).

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 15
Diskette Controller Commands
The diskette controller can perform 16 different commands.
Each command is initiated by a multibyte transfer from the
processor, and the result after execution of the command may
also be a multibyte transfer back to the processor. Because of
this multibyte interchange of information between the diskette
controller and the processor, each command can be considered to
consist of three phases:

Command Phase: The processor issues a sequence of Write


commands to the diskette controller that direct the controller to
perform a specific operation.

Execution Phase: The diskette controller performs the specified


operation.

Result Phase: After completion of the operation, status and


other housekeeping information is made available to the processor
through a sequence of Read commands to the processor.

The following is a list of commands that may be issued to the


diskette controller:

• Read Data

• Read Deleted Data

• Write Data

• Write Deleted Data

• Read a Track

• Read ID

• Format a Track

• Scan Equal

• Scan Low or Equal

• Scan High or Equal

August 31, 1984


16 Personal Computer AT Fixed Disk and Diskette Drive Adapter
• Recalibrate

• Sense Interrupt Status

• Specify

• Sense Drive Status

• Seek

• Invalid.

Symbol Descriptions

The following are descriptions of the symbols used in the


"Command Definitions" later in this section.

AO Address Line O-A logical 0 selects the main status


register, and a 1 selects the data register.

C Cylinder Number-Contains the current or selected


cylinder number in binary notation.

D Data-Contains the data pattern to be written to a


sector.

D7 -DO Data Bus-An 8-bit data bus in which D7 is the


most-significant bit and DO is the least- significant.

DTL Data Length-When N is 00, DTL is the data length to


be read from or written to a sector.

EOT End of Track-The final sector number on a cylinder.

GPL Gap Length-The length of gap 3 (spacing between


sectors excluding the VCO synchronous field).

H Head Address-The head number, either 0 or 1, as


specified in the ID field.

HD Head-The selected head number, 0 or 1. (H = HD in


all command words.)

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 17
HLT Head Load Time-The head load time in the selected
drive (2 to 256 milliseconds in 2- millisecond increments
for the 1.2M-byte drive and 4 to 512 milliseconds in 4
millisecond increments for the 320K-byte drive ).

HUT Head Unload Time-The head unload time after a read


or write operation (0 to 240 milliseconds in
16-millisecond increments for the 1.2M-byte drive and 0
to 480 milliseconds in 32- millisecond increments for the
320K-byte drive.

MF FM or MFM Mode-A 0 selects FM mode and a 1


selects MFM (MFM is selected only if it is
implemented. )

MT Multitrack-A 1 selects multitrack operation. (Both


HDO and HDI will be read or written.)

N Number-The number of data bytes written in a sector.

NCN New Cylinder-The new cylinder number for a seek


operation

ND Non-Data Mode- This indicates an operation in the


non-data mode.

PCN Present Cylinder Number-The cylinder number at the


completion of a Sense interrupt status command
(present position of the head).

R Record-The sector number to be read or written.

R/W Read/Write-This stands for either a I read or write


I I I

signal.

SC Sector-The number of sectors per cylinder.

SK Skip-This stands for skip deleted-data address mark.

August 31, 1984


18 Personal Computer AT Fixed Disk and Diskette Drive Adapter
SRT This 4 bit byte indicates the stepping rate for the
diskette drive as follows:

1.2M-Byte Diskette Drive


1111 1 millisecond
111 a 2 milliseconds
11 a 1 3 milliseconds

320K-Byte Diskette Drive


1111 2 milliseconds
111 a 4 milliseconds
11 a 1 6 milliseconds

ST O-ST 3 Status a-Status 3-0ne of the four registers that


stores status information after a command is executed.

STP Scan Test-If STP is 1, the data in contiguous sectors is


compared with the data sent by the processor during a
scan operation. If STP is 2, then alternate sections are
read and compared.

USO-US1 Unit Select-The selected driver number encoded the


same as bits a and 1 of the digital output register
(DOR).

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 19
Controller Commands
The following are commands that may be issued to the controller.

Note: An X is used to indicate a don't-care condition.


Commands not shown in binary format are shown as bytes.

Read Data

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
MT MF SK 0 0 1 1 0
X X X X X HO US1 usa
c
H
R
N
EOT
GPL
OTL

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


20 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Read Deleted Data

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
MT MF SK 0 1 1 0 0
X X X X X HO US1 usa
c
H
R
N
EOT
GPL
OTL

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
C
H
R
N

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 21
Write Data

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
MT MF a a a 1 a 1
x X x x X HO US1 usa
c
H
R
N
EaT
GPL
OTL

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


22 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Write Deleted Data

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
MT MF 0 0 1 0 0 1
X X X X X HO US1 USO
C
H
R
N
EOT
GPL
OTL

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 23
Read a Track

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
a MF SK a a a 1 a
x x x x X HO US1 usa
c
H
R
N
EaT
GPL
OTL

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


24 Personal Computer AT Fixed Disk and Diskette Drive Adapter
ReadID

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
a MF a a 1 a 1 a
x x x x X HO US1 usa
Result Phase: The following bytes are issued by the processor in
the command phase:

STO
STl
ST2
C
H
R
N

Format a Track

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
a MF a a 1 1 a a
x x x x X HO US1 usa
N
SC
GPL
0

August 31, 1984 .


Personal Computer AT Fixed Disk and Diskette Drive Adapter 2S
Result Phase: The following bytes are issued by the controller in
the result phase:

STO
STl
ST2
C
H
R
N

Scan Equal

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
MT MF SK 1 0 0 0 1
X X X X X HO US1 usa
c
H
R
N
EOT
GPL
STP

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


26 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Scan Low or Equal

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
MT MF SK 1 1 0 0 1
X X X X X HO US1 usa
c
H
R
N
EOT
GPL
STP

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 27
Scan High or Equal

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
MT MF SK 1 1 1 a 1
x X x x X HO US1 usa
c
H
R
N
EDT
GPL
STP

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
STl
ST2
C
H
R
N

Recalibrate

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
a a a a 0111
X X X X X a US1 usa

Result Phase: This command has no result phase.

August 31, 1984


28 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Sense Interrupt Status

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
o 000 100 0

Result Phase: The following bytes are issued by the controller in


the result phase:

STO
peN

Specify

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
o 0 0 0 0 0 1 1
( SRT ) ( HUT
( HLT ) ( NO

Result Phase: This command has no result phase.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 29
Sense Driver Status

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
a a a a a a 1 a
x x x x X HO US1 usa
Result Phase: The following bytes are issued by the controller in
the result phase:

sn

Seek

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 DO
a a a a 1 1 1 1
x x x X X HO US1 usa
NCN

Result Phase: This command has no result phase.

August 31, 1984


30 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Invalid

Command Phase: The following bytes are issued by the


processor in the command phase:

07 06 05 04 03 02 01 00
Invalid Codes
X X X X X HO US1 USO

Result Phase: The following byte is issued by the controller in


the result phase:

STO

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 31
Command Status Registers
The following is information about the command status registers
STO through ST3.

Command Status Register 0 (STO)

The following are bit definitions for command status register o.

Bit 7-Bit 6 Interrupt Code (IC)

00 Normal Termination of Command


(NT)-The command was completed and
properly executed.

01 Abrupt Termination of Command


(AT)-The execution of the command was
started but not successfully completed.

10 Invalid Command Issue (IC)-The issued


command was never started.

11 Abnormal termination because, during the


execution of a command, the ready signal
I I

from the diskette drive changed state.

Bit 5 Seek End (SE)-Set to 1 when the controller


completes the Seek command.

Bit 4 Equipment Check (EC)-Set if a fault signal


I I

is received from the diskette drive, or if the


Itrack-O signal fails to occur after 77 step pulses
I

(Recalibrate Command).

Bit 3 Not Ready (NR)-This flag is set when the


diskette drive is in the not-ready state and a Read
or Write command is issued. It is also set if a
Read or Write command is issued to side 1 of a
single-sided diskette drive.

Bit 2 Head Address (HD)-Indicates the state of the


head at interrupt.

August 31, 1984


32 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Bit I-Bit 0 Unit select 0 and 1 (US 0 and 1 )-Indicate a
drive's unit number at interrupt. The following
figure shows the binary values to select each
drive:

Bit 1 Bit 0 Drive


Selected
0 0 A
0 1 B
1 0 Unused
1 1 Unused
Unit Selection

Command Status Register 1 (STl)

The following are bit definitions for command status register 1.

Bit 7 End of Cylinder (EC)-Set when the controller


tries to gain access to a sector beyond the final
sector of a cylinder.

Bit 6 Not Used-Always O.

Bit 5 Data Error (DE)-Set when the controller


detects a CRC error in either the ID field or the
data field.

Bit 4 Overrun (OR)-Set if the controller is not


serviced by the main system within a certain time
limit during data transfers.

Bit 3 Not Used-This bit is always set to O.

Bit 2 No Data (ND)-Set if the controller cannot find


the sector specified in the ID register during the
execution of a Read Data, Write Deleted Data, or
Scan Command. This flag is also set if the
controller cannot read the ID field without an
error during the execution of a Read ID

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 33
command or if the starting sector cannot be
found during the execution of a Read Cylinder
command.

Bit 1 Not Writable (NW)-Set if the controller detects


a I write-protect I signal from the diskette drive
during execution of a Write Data, Write Deleted
Data, or Format Cylinder command.

Bit 0 Missing Address Mark (MA)-Set if the


controller cannot detect the ID address mark. At
the same time, the MD of status register 2 is set.

Command Status Register 2 (ST2)

Bit 7 Not Used-Always o.


Bit 6 Control Mark (CM)-This flag is set if the
controller encounters a sector that has a deleted
data-address mark during execution of a Read
Data or Scan command.

Bit 5 Data Error in Data Field (DD)-Set if the


controller detects an error in the data.

Bit 4 Wrong Cylinder (WC)-This flag is related to


ND (no data) and when the contents of C on the
medium are different from that stored in the ID
register, this flag is set.

Bit 3 Scan Equal Hit (SH)-Set if the contiguous


sector data equals the processor data during the
execution of a Scan command.

Bit 2 Scan Not Satisfied (SN)-Set if the controller


cannot find a sector on the cylinder that meets
the condition during a Scan command.

Bit 1 Bad Cylinder (BC)-Related to ND; when the


contents of C on the medium are different from
that stored in the ID register, and the contents of
C is FF, this flag is set.

August 31, 1984


34 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Bit 0 Missing Address Mark in Data Field (MD)- Set
if the controller cannot find a data address mark
or a deleted data address mark when data is read
from the medium.

Command Status Register 3 (ST3)

The following are bit definitions for command status register 3.

Bit 7 Fault (FT)-Status of the fault signal from the


I I

diskette drive.

Bit 6 Write Protect (WP)-Status of the


Iwrite-protect signal from the diskette drive.
I

Bit 5 Ready (RY)-Status of the I ready signal from


I

the diskette drive.

Bit 4 Track 0 (TO)-Status of the I track 0 signal I

from the diskette drive.

Bit 3 Two Side (TS)-Status of the I two side signal I

from the diskette drive.

Bit 2 Head Address (HD)-Status of the side-select I I

signal from the diskette drive.

Bit 1 Unit Select 1 (US 1)-Status of the


Iunit-select-l signal from the diskette drive.
I

Bit 0 U nit Select 0 (US 0 )-Status of the I unit select


o signal from the diskette drive.
I

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 35
Interfaces

The system interface is through the I/O channel. The address,


DMA, and interrupt assignments are shown in the following
figures.

I/O Address
Primary Secondary Read Write
3F2 372 Digital Output Register
3F4 374 Main Status Register Main Status Register
3F5 375 Diskette Data Register Diskette Data Register
3F6 376 Fixed Disk Register
3F7 377 DiQital Input ReQister Diskette Control ReQister
Diskette Function

Note: DMA request is level 2 and interrupt request is level 6.

I/O Address
Primary Secondary Read Write
1FO 170 Data Register Data Register
1 F1 171 Error Register Write Precomp
1F2 172 Sector Count Sector Count
1F3 173 Sector Number Sector Number
1F4 174 Cylinder Low Cylinder Low
1F5 175 Cylinder High Cylinder High
1F6 176 Drive/Head Register Drive / Head Register
1F7 177 Status Register Command Register
Fixed Disk Function

Note: Interrupt request is level 14.

The following operations are supported by this adapter:

• 16 bit programmed I/O (PIO), data transfers to the fixed


disk. All other transfers are 8 bits wide.

• The I/O addresses, recognized by the adapter for either the


fixed disk.or the diskette function, are independently selected
by jumpers.

August 31, 1984


36 Personal Computer AT Fixed Disk and Diskette Drive Adapter
Interface Lines
The interface to the fixed disk drive consists of the Control cable
and the Data cable. The following figures show signals and pin
assignments for these cables.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 37
1 2

··..
··..
··.
·.
34

- r---

Ground - Odd Numbers 1-33


_ - Reduced Write Current/- Head Select 3 2
-
--
_ - Head Select 2
_ - Write Gate
4
6
- Seek Complete
- Track 000
8..
10 .. -
-
- Write Fault
_ - Head Select 0 14
12.
-
Reserved 16
Fix ed Disk
Fixed Dis k
_ - Head Select 1 18 And Diskette
Drive
- -Index 20_
Ada pter

- Ready 22_
-
- - Step
- Drive Select 1
24

26
-= - Drive Select 2 28
- Reserved 30
Reserved 32
_ - Direction In 34
-
- '---

Note: Connection is through a 2-by-17 Berg connector. Pin


15 is reserved to polarize the connector.
August 31, 1984
38 Personal Computer AT Fixed Disk and Diskette Drive Adapter
1 2

..

- -
+ MFM Write Data 13

- MFM Write Data 14


+ MFM Read Data 17
Fixe d Disk
Fixed Disk
- MFM Read Data 18 And Diskette
Drive
Ada pIer
Ground-Pins 2,4,6,11,12,15,16,19,20

All Other Pins Unused

- '----

Note: Connection is through a 2-by-1O Berg connector. Pin 8


is reserved to polarize the connector.

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 39
The interface to the diskette drives is a single cable that carries
both data and control signals. The signals and pin assignments are
as follows.
1 2

···....
c:::::Jc:::::::::::J c=J C=:l

···...
c::.::J c:::::J;~c:::::::::::Jc::JCJ

C J== =
c:=::::J c:=::::J ==
c::::::J ~ c::::::J c::==:J c::=::J [=::J c::::J c::J
··..
c.::::::J c=J

CJ~c_~=Jc=J~c:::J
c:::::::::::J c::l [===:J c::::::::J C=::J c:::::J c::J c:::::J c::::J

c:::::J c:::::Jc::Jc:=::J D~ ·
33 34
.
- r---

Ground - Odd Numbers 1-33

--
Reduced Write 2
Reserved 4

Drive Select 3 6
- Index 8_
...

--- Drive Select 0


Drive Select 1
10
12
-
--
Drive Select 2 14

Diskette --- Motor On


Direction Select
16
18
Fixe d Disk
And Diskette
Drive
- Ada pter
---
Step 20

--.. Write Data 22

- Write Gate
Track 00
24
26 _
..
Write Protect 28_
..
Read Data 30
..
-- Side 1 Select

Diskette Change
32
34 _

- L..-

Note: Connection is through a 2-by-17 Berg connector. Pin 5


is reserved to polarize the connector.
August 31, 1984
40 Personal Computer AT Fixed Disk and Diskette Drive Adapter
PUP IS {SNT 2,11 1)

PUP 51 {SHT 1.2.1.11

PUP11\SHT4.5,l}

"
2N'NO&

."
,.
'"
17.8Kn
L - t - - - t - - - ' = + - - - - - . - - - - V A R welK (SHT11

NOTES (UNLESS OTHERwt<;£ NOTED) :

~PINS '.1.'>.1.9.1I.ll.I'5.17,IQ,ZI.2l,2';.27,2CJ.1IIt4D11AREGROUNDONJI&J'>

&
.& ,J1 & Jlt GND PlNS:Z.'I.&.II,IZ,I'>.I&,IQANOZO

Fixed Disk and Diskette Drive Adapter (Sheet 1 of 9)


(SHY 61

utS SDHOf'''''--------+------~'f-l:-»'-+'-,-___1-------,----,-----,----"'O'::++f--f--f--____i
(SHT2IB(R-
22 :~t~-~If-''''---------+------,"'::H:»-i'-'',,----1-------1------~+++--+-------i
(SHT7)WRC:P
(SHT5) AD
~~ ~2~~"--------+------~lrt~~I~-+-------~------~-+-+-+--~
(SHT5IAI 1"5 AI I
SIlIflf-'''''----------'
(SNT51A2
(SHTI) HRST-
(SHTil WR-
; M,~E'-_ ~,,~,,~------~-~-'~.~~"--~,lr~~'~I~,---------l---,-----,--~------+-+__-____i
1
cu 1'J 112
(SHT51 RO-
(IH12) B(S-
18 ~_l::H~~~"'~,,~.='='.~,--------~~LH:_~~~---------,----------+--____i
(IHT3IRAb
(SHYij(SO-
=:-=-
17
9JZ8 DRQH~""'- - - - - - , -
~ 21 :~t~~:;3:SHT21
L0,GND
(SHT2) (St-

:~ ~ ::=:~ ::i r-l--~~r,~---~~~OOE~


""
"'"
D2
rB
(tNC

LUB-
~
19
CIN(- (SHT3)
:~~
1N0E~
r--+~--'M~f"__-----'''_II TlOlOO
(IHTI)

""
"'" g.; ~; lO WAUP(SHY U) r--+~-~~~~-~-.-,,-.--~"-I~::,O
'""'" Db
'"
CMR- Y (MR- (SHY 3)
""r''''~---~'{><':''----' WF (SHY 6) ""
SBEF(SHTZ)
r--+++11~~~~---~~"j~'"
RDY(SHT&) ,)!!&."
,lEPl-'''L-----''-j'1>""'----1
(SHY 3) HoIHID1-+'--'--------------.--------------=--=-++++t---:c---"
r:Z'J r-·no-, 19 00 'ml"~'---~'1'"[>",.,,,,,-""'-'---Illt DIRECTION IN-
I "" I 18 01 INTRQ'Jb INTliO(SHT2)

YOO ALE II
"'00,
I
I
IL... _ _
""
'"
~10
I
I "'"
17",
"",
"", ='n ::
EARLYZ'J
(SHT 1.1)
EAIILY(SHT1)
JI
~ RESEf-
(SHTI) HRST- 00 12
""
"'"
220
_____
"'"
"'"
"",
"", LATE ~ LATE(SNT1)
(SNTI)P\P)I!I "INT 011'J
'" 1;01
HI" "",
8(5-ZI B(S-(5HT2)
(IHY2)WAl,JP
~~ U1I : :~ ""
"'" ,,'"
,'" ,,' ," ~~ 'J8 :~(IHT1)
7 EA D~ I" 11.112 10 AI B(R- 2 BeR-ISHT2)
(SNTZ) INr::~
~ :~~ ~~:: "'''
"'"
'"
"",
" '
11.1 1"5
"<; ~

~:~ P~ ~I
'"
18 07
,,'
(Sa-(IHTZ) A2(SHT5) (SHT&IIII$T- MIi-

'" (SI-(SHY2) AI (SHY 5) (SHTZ)WOIOIOCS-

=:~:: :=
! ;:~
8 CS-
(SHYZ) SIlEF

'"
'JO
'JI PI~ P21 12 '"
W, '" NJ(SHTS)

.-----------------------~."~'~"~~-"'----~~~::~
Y PI"5 PU 21
"" n PIt. pn 2'1 ""
'J~ PI1 P2~ ~ (SHY 8) RCLK RCLK
P2"5 !~ (SNT8) RllIITA 'J7 RDATA

."
CORRO(IHTB) (SHT1)WReP Zo;WCLK
Wo/oto; ~~ 'J8
ERROIt(SHTI)

WAUPL
(SHT1)IOI'IlZ (SNT5)

-M1?"

Fixed Disk and Diskette Drive Adapter (Sheet 2 of 9)


(SHT 3) R DB-
~T3)WRB-l
==[:1 I 21
+~V

20 21t
RAO I):OE DE 1/07 17 SOBle; (SHT 5)
RAI 6 AI 1/06 16
SDB" (SHT 5)
RA2 7 A2 U~~ I/o~ I~

(SHTS)
lr
RD- ~
IblSA
UI9
~RDA-(SHTJ)
~RDB-(SHT3)
RA1
RA4
8 M 20161 IAl't III
I A4 1101 IJ
SDBI1 (SHT 5)
SDBI2 (SHTS)
SOB II (SHTS)
RA~ A~ 9
~
PAL2 2 1/02 SOBIO (SHTS)
(SHTS) WR- F-- WRA - (SHT 3) RAb 1 Ab 1101 10
f!'1--- WRB - SDBQ (SHTS)
=:!
(SHT 5) WDXFER-
~
(SHT 3)
(~~~C2~ -----:S
LS19l
CI >!-
RA7 4 >7 1/00 II SOBa (SHT 5)

pq
(SHT2) RCS- XCV REN-(SHT 3) OA RAB
RAO 19 A8
:~
11 9 a 7 b ~ 4 1 2
C2 QA RA9
RAI 22 A9 IT
OB A A
U>2 RA2 RAID 21 AIO 12
Oc 9 (SHT 5) WR- - - ' DIR U~~
RA1 LSZ4'1)
0D a
RI R2 + ~V -----'24 (SHT 3) X CVREN-~ EN

[
12

LS191
1'2

,
RAO
RAI
RA2
RA1
r;
AD
2016-1

b AI U~1
7 A2
a A1 1/07
n 17
B B
II 12 B 14 II) 16 17 18

HD7
RA4 RA4 Ib HDb
CI OA I" IICb
4 R. .
OB RA~ 2 A~ I~ HO~
Ub2 ~ RAb I/O~
HD~
Oc
Go
b
11
RA7
RAa
RAb
(SHT 2)
RAb
RA7
, Ab
4 A7
I/O"
1101
11 " HD1
.!2, C2 OA
10 RA9
RAa 19 A8 1/02
9 HD2
OB RA9 22 M 10 HDI
9 RAID I/OI
RAID HDO
RI
Oc
R2
21 AIO
WEOECS
1/00
"
T2 1'2 ~ HDO-HD1

=~:~rr
(SHT2) CHR- (SHTJ) WRA- (SHT 2)(SHT 5)
(SH T3 ) RDA -

Fixed Disk and Diskette Drive Adapter (Sheet 3 of 9)


JI

(SHT 1) PUPI '5


(SHT 7) FORO SYNC
1~~ ,,'"-----; 2 WCCNTRl-

+.v (SHT 6) FDSEl-1----'-'-<j).!L--ifI »'-'----;14 051-


3S
I RDY
'"
UPD7f;l1)

ISNT 61 FRST- I RST ,.------,12 D52-


(SHT 5) FOA(K -
U20
(5HT 5) FTDtC
16 ~~CK
LSIIf 10 MOT EN 1-
JI U'O
veo 24 veo EN (SKT 1)
DRG Ilf DRQ (SHT 7) 16 MQTEN2-
(5HT 1) FFODATA RDATA INT 18 FINT (SHT 5)
GNO 8,
22 RCLK
WE"~---1----------~)o~-------+--------;24
HO 27
WRTEN-
1487 12 HSI
(SHI Ii) Foes -
b DBD
ISHT 5) FDACK-
SOBI 7 OBI
SIP n 20 STEP-
SDB2 : 082 SEEK ~Q
1.,-;-"-1 10 DBl

1""
ISHT 5) 508;
SDBIf II OBit SEEK (5HT 4)
I I ~====~~------------~--~--------------------t-~~~-----j18 DIR-
L soss IZ DBr; OIR 18

150n 150n
_
,on I
..J U22
lSI4
5086
SOB7 11 ~:;
wO!\
PSQ
PSI
10
12
11 "'-'------'22 WRf DATA-
1 WR
INDEX.-
• • 2
, I •
ISHT 5) rOWB-
(5H1 5) IDRB- 2 RD
If cs
&. GNO
U22
LSIIf (SHT 5)·SAOS ' ClK
AO
1 , 2 (SHT 7) FREP IQ
WRf PROl- 2. 21 WCLK
(SHT 7) FWCLK
U22 n lOX
TRK 0- 2'
, , lS11f
lit WP/TS

'---"q>''-_____--'''-'-1'3 FLT/TKO
U59 20
LSIIf

f----4---------9'-<1,,~·--DC HG ISHT 6)
U22
LSIIt

WDA (SHT 7)
FWE (SHT 7)
L.'::::======= PS
PSOI (SHT
(5HT 7)7)

Fixed Disk and Diskette Drive Adapter (Sheet 4 of 9)


"'0=
>
., =
~IJQ
ill
0
ill
~

=w
!.:-'
("':I
0
....
IC
ALE - (SHT 5)
pup 68 (SHT I)
£1 h"
Ell
P;
PRI/SEC
STRAP
(SHT 5) JOWB-

(SHT 5) IOR8-
FAST I/O 16-

a
'=
00
.&;. U"
LSI ..
(SHT3)
(SHT 3)
(SHT 3)
SD81'5

SD6I~
el8

C"
SDI')
5014
5DI~

.,= S===~'~~'=~I2~~~~====~
WC (SHT 3) A4 6 CIS 5DI2
..... A£N ~~~
LDDOR- (SHI6) (SHT 3) SDBII ,,' "4
~: s~o
SOli
~ All .. U60 LOFCR - (SHT 6.7) (SHT 1) SDBID ,,4 SOlO
HDCS- (SHT 5)
'"
A2b~===:=;i;~3~
LDFDR- (SHT 6) (SHT 1)

>
2 IG Wc (SHT 3) 5DO.

rr;=====~
5008
SA')
SA'JA28 1J12
14 2G ,/C (SHT 5) I0R8-
""'l "
~====="t1~~~
SALt A27 ENDIR- (SHT 6)
SA9 A22 £NHDSTAT - (SHT 6) 'WD;(FER- (<;-(7)
~ SA7 A24
IoIAUPL (SHT 2,6)

Irr=;========~Jj
~' FDCS- (SHT 4)
(SHT 2) WAUP
~ (SHT2jSBRG
Q.

~ II LS24'; 9
:~ :~&;~S:~ ~
5OB7
(SHT 1) H07
!il' E (SHT 1) H06 12 8~U4S ~ 8 5086
5007
5006
5A2 A29
~ I~ 8"3
A2 (SHT 2)
(SHT 1) HDS A"3 7 16 Bb A6 4 A04 SODS
SAl A3D AI (SHI2)
A4 6
(SHT 1) 1-(14 14 B4 r=; BS AS S AOS 5004
~ SAoa (SHT 4)
(SHT 1) HO"3 I'> 8') A') ') 50" 14 84 A4 6

=
500"3

Q.
SAO
'"
IOW- 81'3 lS'367
AO (SHT 2)
(SHT I) HD2
(SHT 1) HOI
:~ f*,
87
A6
A7
~
SOB2 1"3 8"3
12 B2 A2 8
A~ 7
A08
SOO2
5001
IOR- 914 18 88 AB 2 II 81
(SHT 1) HOC
~ AI ' Aoq 5000
fWCS- (50- (SHT 2)
(SHT3)IORS- I D1Rm IDIR_
(7-05)
" 'N
~
WR- (SHT 2.3)

~
E RD- (SHT 2,3)
" "
.....
.....
(SHT 6.4) 5000 -SOB7

~ TIC 827 t----,=--'-'-f_='' (SHT 4) FINT

~ (SHT 6) FDMAEN

:I, FDACK - (SHT 4,5,7) (SHY 7) FORQ


~ RESET ORV B02
(SHT 5)HE-

~
(SHT 2) HINT

>
Q.
(SHT 6) HOHAEN

~
'=
.....
.,
~

.&;. Fixed Disk and Diskette Drive Adapter (Sheet 5 of 9)


Ut
SDIl~J
SDB4
5083 (SHT 5)
SOB>
SOBI
SOBO

~D O r FOSEL ISHT 4} ISHT 2} OSO- ~ ~


13 ~ FRST -ISHT4} ISHTZ} OSI - ---T, ~
• U26
~ FDMAEN ISHT.} (SHT 2) H50 - --"- U2'i
~
,
I. LSI7'f

:t==
~ HOEN I (SHU)

:~~N
{SHT 2} HSI -
ISHT 2} HS2 - ~
LSlB ~
I~

NIC~
2 ISHU}
(SHT 2) HS1 -/RWC
(SHl2) WG-
----1
~

12
(SHT') LDOOR
R
11
(SHU) OCHG -----.!
G EN
• SOB. ISHT.}
SDB7 (SHT 5)

III 11
(SHT 5) END IR-

(SHT 2) ERROR --'!! ~


(SHT 2) INDEX
------?7 U" f;t-
(SHT 2) CORRO ---=;;- LS1TI ~
(SHT 2) HDRQ
---T.i f-k--
~
(SHT 2) SC
(SHT 2) WF
~

12
(SHT 2)
(SHT 5)
ROY
WAUPL ----.!
G rn

II I
(SHT 5)ENHOSTAT-

~O Q~N/C
U" Q~N/C
'---- f----2 o LS175 OfL---NIC
Q~ HDMAEN (SHTS)
12 0 Q~NIC

~'
o II

(SHT 5) LDFDR-
: 0 ,,-It-- H53 ISHTS)
01-'--- H53-ISHT'}
I U,)8
LSOB
HRST - (SHT 2)

(SHT') MR-
P

Fixed Disk and Diskette Drive Adapter (Sheet 6 of 9)


!i

.
-
~~ :;;' -;::"

~ ~~ m
0

I i
"~ "'...."
Q)
I Q)
~
,.1 "1"1~~ i
I I
ff ~~
·1 ~
.
....Q)Q.
III
"C
~i~~i~m
;<; ... ;<;:;;,,,,:;;,:;;,:;;,:;;,
«Q)
~~~~~~~1~ >
";:
c
~3
....
Q)
....Q)
NN N

~1 ~ ~
III
C
"C
s:::
III
~
III
C
"C
Q)
><
iL:
~

~ l~

"
~

August 31, 1984


Personal Computer AT Fixed Disk and Diskette Drive Adapter 47
'"
Jle
yREG 2.--='-r-----------t-~~____j

I~~ ''''
ZZl.lF.I'5Y(ELECTROLYTIO
1/2W
.~

(SHY I) PUPil

"
(SNTI)

TI T2
{SlIT 7)

'"
"'" ~~1 RClK {SIfT 2)

'"
I~;V"~ELECTROLYTlc)
"
210n
11'+ RDATA{SIIT2)

"

CD POWER FOR UIDERIYED FROM 781'10'5 REGULATOR DECOUPLE UI


(CLOSEJTONEARESTOrGITALGROUNDUSING.IIJF(AP(STANOAIID)
@OECOUPLELF'IIiCLOSETODEVICETONEARE5TGROUND
Q) DECOUPLE veo CLOSE USING.II1F8£TWEEN PINS II> AND'I.PlN9
MUST BE CONNECT[D TO CLOSEST DIGITAL GROUND

Fixed Disk and Diskette Drive Adapter (Sheet 8 of 9)


+12V (SHT8]

(SHT 8) VREG 2 --+---+-+-'-1

ROb
--------l
-- +<;VS(SHT9) I
"
L<
4.7MH
FlD/REF -+---+-''4

B-B4) FFDDATA -1-------'4

O--th,) VCDFS -I---.----''-t

--FDCLK (SHT4)
I~ U48 veo (SHT 1)

CD DECOUPLE veo USING .luF CAP FROM PIN 16 TO PIN 9. CONNECT


PIN 9 TO CLOSEST DIGITAL GROLNO. CONNECT PIN 8 TO ANALOG GND "C"

Fixed Disk and Diskette Drive Adapter (Sheet 9 of 9)


Notes:

August 31, 1984


50 Personal Computer AT Fixed Disk and Diskette Drive Adapter
--
-
---
-
-
-----
--
- --
--- ---
---
---
Personal Computer
,- Hardware Reference
Library

IBM Personal Computer


20MB Fixed Disk
Drive Adapter

6139790 March 17, 1986


Notes:
Contents

Description ..................................... 1
Fixed Disk Controller .......................... 1
Programming Considerations ....................... 3
Types of Drives ............................... 3
Status Register ............................... 4
Sense Bytes .................................. 4
Data Register ................................ 7
Programming Summary ........................ 14
Interface ...................................... 15
Connectors ............... ;.................... 17
Logic Diagrams ................................. 19
BIOS Listing ................................... 23

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. Index-l

March 17, 1986 v


Notes:

vi March 17, 1986


Description

The 20MB Fixed Disk Drive Adapter attaches to one or two fixed
disk drive units through an internal, daisy-chained, flat cable
(datal control cable).

The adapter is buffered on the 110 bus and uses the system
board's direct memory access (DMA) for fixed-disk-drive data
transfers. When the adapter is enabled, an interrupt request
occurs on the IRQ-5 line to the 8259A Interrupt Controller. The
8259A then causes an interrupt hex OD.

The Fixed Disk Drive Adapter provides automatic 11-bit burst


error detection and correction in the form of 32-bit error
checking and correction (ECC).

The device level control for the Fixed Disk Adapter is contained
on a ROM module on the adapter. A listing of this device level
control can be found in "BIOS Listing" of this section.

Warning: The last cylinder on the fixed disk drive is reserved for
diagnostic use. The diagnostic write test will destroy any data on
this cylinder.

Fixed Disk Controller


The disk controller has three registers that may be accessed by the
system unit's microprocessor: a status register, a data register, and
a read-option-jumpers register. The 8-bit status register contains
the status information of the disk controller, and can be accessed
at any time. This register is read-only and is used to help the
transfer of data between the system unit's microprocessor and the
disk controller. The 8-bit data register (actually consisting of
several registers in a stack with only one register presented to the
data bus) stores data, commands, and parameters, and provides
the disk controller's status information. Data bytes are read from,
or written to the data register in order to program or obtain the
results after a particular command. The controller-select pulse is
generated by writing to port address hex 322.

March 17, 1986 20MB Fixed Disk Drive Adapter 1


The following is a block diagram of the IBM 20MB Fixed Disk
Drive Adapter.

Control Serial izerl


Deserializer

J2
liD
)
SERDES
ECC Interface
Edge liD
Interface J3
Connector

Data Bus

8-Bit
DB7-DBO

-- Sector Buffer

Processor

220MB Fixed Disk Drive Adapter March 17,1986


Programming Considerations

Types of Drives
The fixed disk drive adapter will accommodate any two of four
different types of drives. The figure below shows the
configuration of the different type drives.

Start of Landing
Type Cylinders Heads Write Pre-Camp Zone
1 306 4 a 306
2 615 4 300 615
13 306 8 128 336
16 612 4 a 663

Fixed Disk Types

The figure below shows the switch settings for the above
mentioned drive types. Switches 1 and 2 set the parameters of
Drive 0, and switches 3 and 4 set Drive 1.

Drive a Drive 1
Switch Switch
1 2 3 4
Type 1 On On On On
Type 2 Off On Off On
Type 13 Off Off on Off
Type 16 On Off On Off

March 17, 1986 20MB Fixed Disk Drive Adapter 3


Status Register
At the end of all commands from the system board, the disk
controller sends a completion status byte to the system board.
This byte informs the system unit's microprocessor if an error
occurred during the execution of the command. The following
shows the format of this byte.

I Bit I : I : I : I : I : I : I : I : I

Bit 5 This bit shows the logical unit number


of the drive.

Bit 1 When set, this bit shows an error has


occurred during command execution.

Bits 7, 6, 4, 3, 2, 0 These bits are set to zero.

If the interrupts are enabled, the controller sends an interrupt


when it is ready to transfer the status byte. Busy from the disk
controller is unasserted when the byte is transferred to complete
the command.

Sense Bytes
If the status register receives an error (bit 1 set), the disk
controller requests four bytes of sense data. The format for the
four bytes is as follows:
Bits 7 6 5 4 3 2 1 0
Byte 0 Address I I
0 Error Type Error Code

Byte 1
Va 1 i d
0 0 d
I
Head Number
Byte 2 Cy 1 i nder High Sector Number
Byte 3 Cylinder Low
Remarks: d = drive

420MB Fixed Disk Drive Adapter March 17, 1986


Disk Controller Error Tables
The following disk controller error tables list the error types and
error codes found in byte O.

The address-valid bit (bit 7) is only set when the previous


command required a disk address. Bit 6 is set to 0 (spare).

Error Error Code


Type
Bits 5 4 3 2 I 0 Description
0 0 0 0 0 0 The controller did not detect any error
during the execution of the previous
operation.
0 0 0 0 0 I The controller did not detect an index signal
from the drive.
0 0 0 0 I 0 The controller did not get a seek-complete
signal from the drive after a seek operation
(for all non-buffered step seeks).
0 0 0 0 I I The controller detected a write fault from
the drive during the last operation.
0 0 0 I 0 0 After the contro 11 er selected the drive, the
drive did not respond with a ready signal.
0 0 0 I 0 I Not Used.

0 0 0 1 I 0 After stepping the maximum number of cylinders,


the contro 11 er did not receive the track 00
signal from the drive.
0 0 0 I I I Not Used.

0 0 I 0 0 0 The drive is st ill seeking. This status is


reported by the test Drive Ready command for
an overlap seek condition when the drive had
not completed the seek. No time-out is measured
by the contro 11 er for the seek to complete.

March 17, 1986 20MB Fixed Disk Drive Adapter 5


Error Error Code
Type
Bits 5 4 3 2 1 0 Description
0 1 0 0 0 0 ID Read Error: The controller detected an
ECC error in the target ID field on the disk.
0 1 0 0 0 1 Data Error: The controller detected an
uncorrectable ECC error in the target sector
during a read operation.
0 1 0 0 1 0 Address Mark: The controller did not detect
the target address mark (AM) on the disk.
0 1 0 0 1 1 Not Used.

0 1 0 1 0 0 Sector Not Found: The contro ller found the


correct cyl inder and head, but not the
target sector.
0 1 0 1 0 1 Seek Error: The cyl inder or head address
(either or both) did not compare with the
expected target address as a result
of a seek.
0 1 0 1 1 0 Not Used.

0 1 0 1 1 I Not Used.

0 1 1 0 0 0 Correctable Data Error: The controller


detected a correctable ECC error in the
target fie ld.
0 1 I 0 0 1 Bad Track: The controller detected a bad
track flag during the last operation. No
retries are attempted on this error.

Error Error Code


Type
Bits 5 4 3 2 I 0 Description
1 o0 0 0 0 1nva lid Command: The controller had
received an i nva lid command from the
system unit.
I o 0 0 0 1 Illega I Disk Address: The controller detected
an address that is beyond the
maximum range.

6 20MB Fixed Disk Drive Adapter March 17,1986


Error Error Code
Type
Bits 5 4 3 2 1 0 Description
1 1 0 0 0 0 RAM Error: the controller detected a data
error during the RAM sector-buffer
diagnostic test.
1 1 0 0 0 1 Program Memory Checksum Error: During
this internal diagnostic test, the contro ller
detected a program-memory checksum error.
1 1 0 0 1 0 ECC Polynomial Error: During the
contro ller' s i nterna 1 diagnostic tests, the
hardware ECC generator fa i led its test.

Data Register
The system unit's microprocessor specifies the operation by
sending the 6-byte device control block (DCB) to the controller.
The figure below shows the format of the DCB, and defines the
bytes that make up the DeB.

Bits 7 6 5 4 3 2 1 0

Byte 5 Control Field


Byte 4 Interleave or Block Count
Byte 3 Cy 1 i nder Low
Byte 2 Cy 1 i nder High I Sector Number
Byte 1 0 0 d Head Number
Byte 0 Command Opcode
Class

Byte 5 Bits 7 through 0 contain the control field.

Byte 4 Bits 7 through 0 specify the interleave or block


count.

Byte 3 Bits 7 through 0 are the eight least-significant bits


of the cylinder number.

March 17, 1986 20MB Fixed Disk Drive Adapter 7


Byte 2 Bits 7 and 6 are the two most significant bits of the
cylinder number. Bits 0 through 5 define the sector
number.

Byte 1 Bit 5 identifies the drive number. Bits 4 through 0


contain the disk head number to be selected. Bits 6
and 7 are not used.

Byte 0 Bits 7, 6, and 5 identify the class of the command.


Bits 4 through 0 contain the Opcode (see command
byte on page 10

Control Byte
Byte 5 is the control field of the DeB and allows the user to
select options for several types of disk drives. The format of this
byte is as follows:

I s;t I : I : I : I : I : I : I : I: I

Bit 7 Disables the four retries by the controller on all


disk-access commands. Set this bit only during the
evaluation of the performance of a disk drive.

Bit 6 If set to 0 during read commands, a reread is


attempted when an Eee error occurs. If no error
occurs during reread, the command will finish
without an error status. If this bit is set to 1, no
reread is attempted.

Bits 5,4,3 Set to O.

820MB Fixed Disk Drive Adapter March 17, 1986


Bits 2, 1,0 These bits define the type of drive and select the
step option. See the following figure.

Bits 2, 1, 0
0 0 0 This drive is not specified and defaults
to 3 mill i seconds per step.
0 0 1 N/A
0 1 0 N/A
0 1 1 N/A
1 0 0 200 microseconds per step.
1 0 1 70 microseconds per step (specified by BIOS).
1 1 0 3 mi 11 iseconds per step.
1 1 1 3 mi 11 iseconds per step.

March 17,1986 20MB Fixed Disk Drive Adapter 9


Command Byte

Command Data Control Block Remarks

Test Drive Bit 76543210 d = drive (0 or 1)


Ready Byte 0 000 0 0 0 0 0 x = don't care
(Class 0, Byte 1 o0 d x x x x x Bytes 2, 3, 4,
Opcode 00) 5, = don't care.

Recalibrate Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1)


(Class 0, Byte 0 o0 0 0 0 0 0 1 x = don't care
Opcode 00)
Byte 1 o0 d x x x x x r = retries
Byte 5 rOO 0 0 s s s s = Step Option
Bytes 2, 3, 4, = don't care
ch = cyl inder high
Reserved
(Class 0, This Opcode is not used.
Opcode 02)
Request Sense Bit 7 6 5 4 3 2 1 0 d=drive(Oorl)
Status Byte 0 o0 0 0 0 0 1 1 x = don't care
(Class 0, ~----~------+---------~
Opcode 03) Byte 1 o0 d x x x x x Bytes 2, 3, 4,
5, = don't care.
Format Drive Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1)
(Class 0, Byte 0 o0 000 1 0 0 r = retries
Opcode 04) ~-----+----~--------~
Byte 1 o0 d Head No. s = Step Option
Byte 2 ch 10 0 0 0 0 0 ch = cylinder high
Byte 3 Cylinder Low
Byte 4 o0 0 Interleave Interleave 1 to 16
Byte 5 rOO 0 0 s S 5 for 512-byte sectors.

Ready Verify Bit 76543210 d = drive (0 or 1)


(Class 0, Byte 0 o0 0 0 0 101 r = retries
Opcode 05)
Byte 1 o0 d Head No. s = Step Option
Byte 2 ch ISector No. a = retry option on
data ECC
Byte 3 Cy I i nder Low
Byte 4 Block Count ch = cylinder high
Byte 5 r a 000 s s s for 512-byte sectors.

1020MB Fixed Disk Drive Adapter March 17, 1986


Command Data Control Block Remarks

Format Track Bit 7 6 5 4 3 2 1 0 d ~


dr i ve (0 or II
(Class 0, Byte 0 0 o0 o0 1 10 r ~
retries
Opcode 06)
Byte 1 0 o d Head No. s ~
step option
Byte 2 ch 10 o 0 0 0 0 ch ~ cylinder high
Byte 3 Cylinder Low
Byte 4 o 0 01 Interleave Interleave 1 to 16
Byte 5 r 0 0 0 os s s for 512-byte sectors.

Format Bad Bit 7 654 3 2 1 0 d ~


dr ive (0 or 1 )
Track
(Class 0, Byte 0 0 0 0 o0 1 1 1 x ~
don't care
Opcode 07)
Byte 1 0 0 d Head No. s ~
Step Option
Byte 2 ch 10 o 000 0 ch ~ cylinder high
Byte 3 Cylinder Low
Byte 4 o 0 01 Interleave Interleave 1 to 16
Byte 5 r 0 0 0 o s s s for 512-byte sectors.
Read
(Class 0, Bit 7 6 5 4 3 2 1 0 d ~
dr i ve (0 or II
Opcode 08)
Byte 0 0 0 0 0 1 0 0 0 r ~
retries
Byte 1 0 0 d Head No. a ~
retry option on
data ECC error
Byte 2 ch Isector No.
Byte 3 Cyl inder Low s ~ step option
Byte 5 r a 000 s s s ch ~ cyl inder high
Reserved
(Class 0, This Opcode is not used.
Opcode 09)
Write Bit 7 6 5' 4 3 2 1 0 d ~
dr ive (0 or II
(Class 0,
Opcode OA) Byte 0 0 0 0 0 1 0 1 0 r ~
retries
Byte 1 0 0 d Head No. s ~
step option
Byte 2 chlsector No. ch ~ cylinder high
Byte 3 Cy 1 i nder Low
Byte 4 Block Count
Byte 5 rOO 0 0 s s s

March 17, 1986 20MB Fixed Disk Drive Adapter 11


Command Data Control Block Remarks

Seek Bit 7 654 3 2 1 0 d = drive (0 or 1)


(Class 0, Byte 0 0 0 o 0 1 0 1 1 r = retries
Opcode OB)
Byte 1 0 0 d Head No. s = Step Option
Byte 2 ch 10 000 0 0 x = don't care
Byte 3 Cy I i nder Low
Byte 4 x x x x x x x x
Byte 5 rOO 0 0 s s s

In i t i a Ii ze Bit 7 6 5 4 3 2 1 0 Bytes 1, 2, 3, 4, 5, =
Drive
Character- Byte 0 0 000 1 1 0 0 don't care.
istics*
(Class 0,
Opcode OC)
Read ECC Bit 76543 2 1 0 Bytes 1, 2, 3, 4, 5, =
Burst Length
(Class 0, Byte 0 o 0 0 0 1 1 0 1 don't care.
Opcode 00)
Read Data Bit 7 6 5 4 3 2 1 0 Bytes 1, 2, 3, 4, 5, =
from Sector
Buffer Byte 0 o0 0 0 1 1 1 0 don't care.
(Class 0,
Opcode OE)
Write Data to Bit 7 6 5 4 3 2 1 0 Bytes 1, 2, 3, 4, 5, =
Sector Buffer
(Class 0, Byte 0 o 000 1 1 1 1 don't care.
Opcode OF)

RAM Bit 7 654 3 2 1 0 Bytes 1, 2, 3, 4, 5, =


Diagnostic
(Class 7, Byte 0 1 1 1 o 0 a a a don't care.
Opcode 00)

Reserved This Opcode is not used.


(Class 7,
Opcode 01)
Reserved This Opcode is not used.
(Class 7,
Opcode 02)
*Initial ize Drive Characteristics: The DBC must be fol lowed by eight
additional bytes.
Maximum number of cylinders (2 bytes)
Maximum number of heads (1 byte)
Start reduced write current cyl inder (2 bytes)
Start write precompensation cylinder (2 bytes)
Maximum ECC data burst length (1 byte)

1220MB Fixed Disk Drive Adapter March 17, 1986


Command Data Control Block Remarks

Dr i ve Bit 7 6 5 4 3 2 1 0 d = drive (0 or 1)
Diagnostic
(Class 7. Byte 0 1 1 1 0 0 0 1 1 r = retries
Opcode 03)
Byte 1 0 0 d x x x x x s = step option
Byte 2 x x x x x x x x x = don't care
Byte 3 x x x x x x x x
Byte 4 x x x x x x x x
Byte 5 r 0 0 o0 s s s

Controller Bit 7 6 5 4 3 2 1 0 Bytes 1. 2. 3. 4. 5. =


Internal
Diagnostics Byte 0 1 1 1 o0 1 0 0 don't care.
(Class 7.
Opcode 04)

Read Long * Bit 7 6 5 4 3 2 1 0 d = dr i ve (0 or 1)


Track
(Class 7. Byte 0 1 1 1 o0 1 0 1 r = retries
Opcode 05)
Byte 1 o0 d Head No. s = step option
Byte 2 ch I Sector No. ch = cyl inder high
Byte 3 Cy 1 i nder Low
Byte 4 Block Count
Byte 5 rOO 0 0 s s s

Write Long **
(Class 7. Bit 7 6 543 2 1 0 d = drive (0 or 1)
Opcode 06)
Byte 0 1 1 1 o0 1 1 0 s = step option
Byte 1 0 0 d Head No. s = step option
Byte 2 ch Isector No. ch = cy 1 i nder high
Byte 3 Cyl inder Low s = step option
Byte 4 Block Count
Byte 5 rOO 0 0 s s s

* Returns 512 bytes plus 4 bytes of ECC data per sector.


** Requires 512 bytes plus 4 bytes of ECC data per sector.

March 17, 1986 20MB Fixed Disk Drive Adapter 13


Programming Summary
The two least-significant bits of the address bus are sent to the
system board's I/O port decoder, which has two sections. One
section is enabled by the I/O read signal (-lOR) and the other by
the I/O write signal (-lOW). The result is a total of four
read/ write ports assigned to the disk controller board.

The address enable signal (AEN) is asserted by the system board


when DMA is controlling data transfer. When AEN is active, the
I/ 0 port decoder is disabled.

The following figure is a table of the read/write ports.

R!W Port Address Function


Read 320 Read data (from controller to system unit)
Wr i te 320 Write data (from system unit to controller)
Read 321 Read controller hardware status.
Wr i te 321 Controller reset.
Read 322 Read option jumpers
Write 322 Generate controller-select-pulse
Read 323 Not used.
Write 323 Write pattern to DMA and interrupt
mask register.

1420MB Fixed Disk Drive Adapter March 17,1986


Interface
The following lines are used by the disk controller:

AO-AI9 Positive true 20-bit address. The least-significant 10


bits contain the I/O address within the range of hex
320 to hex 323 when an I/O read or write is executed
by the system unit. The full 20 bits are decoded to
address the read-only memory (ROM) between the
addresses of hex C8000 and hex C9FFF.

DO-D7 Positive 8-bit data bus over which data and status
information is passed between the system board and
the controller.

-lOR This signal is active when the system board reads


status or data from the controller under either
programmed I/O or DMA control.

-lOW This signal is active when the system board sends a


command or data to the controller under either
programmed I/O or DMA control.

AEN This signal is active when the DMA in the system


board is generating the I/O Read (-lOR) or I/O
Write (-lOW) signals and has control of the address
and data buses.

RESET This signal forces the disk controller to its initial


power-up condition.

IRQ 5 This signal is active by the controller when enabled to


interrupt the system board on the return ending status
byte from the controller.

DRQ 3 This signal is activated by the controller when data is


available for transfer to or from the controller under
DMA control. This signal remains active until the
system board's DMA channel activates the
DMA-acknowledge signal (-DACK 3) in response.

March 17,1986 20MB Fixed Disk Drive Adapter 15


-DACK 3 This signal is active when negative, and is generated
by the system board DMA channel in response to a
DMA request (DRQ 3).

1620MB Fixed Disk Drive Adapter March 17, 1986


Connectors

The 20MB Fixed Disk Drive Adapter connector and interface


specifications follow.

Land
At Standard TTL Levels Number
Ground-Odd Numbers 1-33
-Reserved 2, 16, 30, 32
-Head Select 2 4
-Write Gate 6
-Seek Complete 8
-Track 000 10
-Wr i te Fau It 12
-Head Select 0 14
Disk -Head Select 1 18 Disk
Drive Adapter
J1 -Index 20 J1

-Ready 22
-Step 24
-D rive Select 1 26
-Drive Select 2 28
-Drive Select 3 30
-Drive Select 4 32
-D i rect ion In 34

March 17,1986 20MB Fixed Disk Drive Adapter 17


-Drive Selected I

Reserved 3,5,7,9
Key 5
+MFM Wr i te Data 13
-MFM Wr i te Data 14
Fixe d +MFM Read Data 17 Fixed
Disk Disk
Driv e -MFM Read Data 18 Adapt er
J2 0 r J3 J2 or J3
Ground Pins 2,4,6,8,10,11,12,15,
16,19,20
All Other Pins Unused

1820MB Fixed Disk Drive Adapter March 17,1986


ISH.3A)
(SH.3)
(SH.3)
ISH.2.S)
=
.
.......
IOHHZ

,-
2

,"'-
IOHHZ
.".
MQ 29
IRQ ~~
DRQ~
IR., ."
'"
ISH. 2. 3)
(SH.2.S) II ~i:
."iI''" 1& PJOR
".
., ....,......
18 PlOW
82 'J6 PRST LS'
(SOCKET>
vee"'6
GND:Z6
A"
AI1
AIS
A"
A"
A ..
AI>
AlB ~.~"--------------------~
AI' rnrr~"------------------~-,

m-

AO

AI

....
.28 "
AV
A26
A2';
A'"
.."
AA

A7
A.
'"All

(SH.2,3) 00
ISH.2.S) 01---
ISH. 2, 3) 1lZ--

~==~~==c===========~
(SH.2.S)
ISH.S)
ISH.S)
(SH.S)
.,--
06--
ISH.S) 07

TA au

20MB Fixed Disk Drive Adapter (Sheet 1 of 4)


, - - - -_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ItFH ROUTA ISH. 31
tv
o
'"
" ,
'"'"" "
.Q'~'-~"~~~~I==j"~.B
-Q~-18 2 A
2&LSlZ

(SH.3) AO=====~=============:iI.
(SH.3)
(SH.3)
AI
A2 },

DO (SH.l.S)

tZ::Z:;===:::::Z======IOL==Z::::;c::L=:::z=======~ ~~: 1'1 D3


(SH.l,3)
(SH.l.3)

(SH.S) ----------------------------i~-------~r_~~~-------C~,,-~.) ~
(SH.4) ~---------------------------__j+-------___1f__t_.."..~

ISH 3) I1FH WTDll.TA.-------~~'-'-~-"

(SH.3) EARlY---------'L>'----'1~""==_'G'"=:_"--t---'

(SH.3) L A T E - - - - - - - - - ' C > " - - -..C>"--t--'l::;:"'-t-:--....-----'


I
CD IN HALF 1/2 OFLS2'+'+

20M B Fixed Disk Drive Adapter (Sheet 2 of 4)


, "
loJIZ( a '""
MIl ISH_1,21
101f (SH.l,21

EN HOST ISH. 1)

ISH, 1) BUSY

'"" I I

'" "
WR 22 LSO'f
III " '"
~WR
~(SH,41

~~ AEN

20 BlJSACK
lDRQ 20 17 IOREQ MFH'JTDTA ~b I1FH IoIT DATA (SH.Z)
MIirQ 1'1 16 MREGI WTGTE 37 WRITE GATE (SH.ll

---"
row vcoCLAMP 28 KO CLAMP (SH.4)
TO>
DA~
2
'
I'>
'='
B LDI
NEG PlJI1P ~2
.".....,..
NEG PUMP
(SH.4)
(SH.4)
I5l1J ,., HIrn'IT 2~ iiIinIT
~ ENRO mmmTA 22
(SH.4)
(SH.4)
NRZ RD DATA
39~
OAI 24
DA2
rn>"
14
XENO """'"
LATE 3'+
EARLY
""""
LATE
EARLY
(SH.4)
(SH.2l
(SH_l)
"
~~'~'_£j2 '!MHZ

ISH. 1,2)
ISH.l,2)
ISH. 1,2)
ISH.l,l)
(SH.l)
ISH 1)
ISH.l)
ISH 1)

-- " (SH.Z)

"""
(SH.2l
(SH.2l
- ISH. 1)
I<lAIO
" (SH.2l

tv
...... 20MB Fixed Disk Drive Adapter (Sheet 3 of 4)
tv
tv

(SH.3) NEG PUMP -----~I..:::,.,:'

+'5VA

"
.OI,..F
~~~~~~~~~-+~~~----~---i,
t:---~~)J!-:"'"'-.---------'lCC CLOCk (SH.3)

LI

'""
4.7,.."1

i=if"GA1N-------'/e
(SH.3)
"
~C;IOPF

'"
(SH.J) veo (LAMP _ _ _ _ _ _ _ _ ~~~/''---"'''L''.y

BD
LS04 S PI RIO
(SH.3) ~ _ _ _ _ _ _ _ _~I{ > . < 2 - - - - - - _ C I : ) 89D~·~I2~V_~~--~---~~~---~---_

(SH.3) NRZ (lO(K----------'1'f>>"'-------~GL) 81.810

IS".',3) 10 M'2 "OCK -----------""J{),;''----------QD


(SH.3) ~-------------------~

"==r-
~~-~---~----LT~---~----­
BEAD

IKTVP
~.'
(SH.3) DISABLE AM _ _ _ _ _ _ _ _ _ ~l'L'-
__R"'I~4_ _ _ _ ____{OD R22 .;v

'Ie -------------------~ 2.8.17


(8H.2) TESTENABLE--------------------<C[Q
R"
~1".7'11

20M B Fixed Disk Drive Adapter (Sheet 4 of 4)


BIOS Listing

The BIOS Listing for the IBM 20MB Fixed Disk Drive Adapter
follows.

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 23


[BM Personal Computer MACRO Assembler VerSion 2.00 I-I
0lSK2 ---- 10/28/85 FIXED DISK BIOS ! 0-28-85

I PAGE 118,121
2 TITLE DISK2 ---- 10/28/85 FIXED DISK BIOS
3
4 ;-- INT 13H -----------------------------
5
6 FIXED DISK I/O INTERFACE
7
8 TH I S I NTERF ACE PROV I DES ACCESS TO F I XED 0 I SKS
9 THROUGH THE IBM F I XED 0 I SK CONTROllER.
10
II ; -- ------- ------------- - - ------------- ------------- ------ - -----
12
13 ; -- ------- - - ------------ - - -------- - ---- -- -- -------- ------- - - -- ---
14 ; THE 81DS ROUT I NES ARE MEANT TO 8E ACCESSED THROUGH
15 ; SOFTWARE INTERRUPTS ONLY. ANY ADDRESSES PRESENT IN
16 THE LISTINGS ARE INCLUDED ONLY FOR COMPLETENESS,
17 NOT FOR REFERENCE. APPL I CAT IONS WH I CH REFERENCE
18 ABSOLUTE ADDRESSES WITH I N THE CODE SEGMENT
19 ; V lOLA TE THE STRUCTURE AND DES I GN OF B [OS.
20 ; -- --
-------- ---- -- - - ---------- ---- - - --------- -------
21
22 INPUT (AH " HEX VALUE)
23
24 (AH)= OOH RESET DISK (DL = 80H,8!HI / DISKETTE
25 (AHi" OIH READ THE STATUS OF THE LAST DISK OPERATION INTO (AU
26 NOTE: DL < 80H - DISKETTE
27 DL > SOH - 0 I SK
28 (AH)= 02H REAO THE DESIRED SECTORS INTO MEMORY
29 (AHI" 03H WRITE THE DESIRED SECTORS FROM MEMORY
30 (AH)" 04H VER I FY THE DES I RED SECTORS
31 (AH)" 05H FORMAT THE OES I RED TRACK
32 (AHI = 06H FORMAT THE DESIRED TRACK AND SET BAD SECTOR FLAGS
33 (AH)= 07H FORMAT THE DRIVE STARTING AT THE DESIRED TRACK
34 (AH)" 08H RETURN THE CURRENT DR [VE PARAMETERS
35
(AHI= 09H [N[TlALIZE DRIVE PAIR CHARACTERISTICS
"
37
38 (AHi" OAH
INTERRUPT 41H POINTS TO DATA BLOCK
READ LONG
39 (AHJ" OBH WR I TE LONG
40 NOTE: READ AND WRITE lONG ENCOMPASS
41 512 BYTES + 4 BYTES OF ECC
42 (AH) " OCH SEEK
43 (AH) " ODH AL TERN ATE DISK RESET (SEE DL I
44 (AH) " OEH READ SECTOR BUFFER
45 (AH) " OFH WR I TE SECTOR BUFFER,
46 (RECOMMENDED PRACT I CE BEFORE FORMATT [NG)
47 (AH) IOH TEST OR I VE READY
48 (AH) IIH RECAL I BRA TE
49 (AH) I2H CONTROLLER RAM 0 [AGNOST I C
50 (AH) I3H DRIVE DIAGNOSTIC
51 (AH) 14H CONTROLLER INTERNAL 0 I AGNOST [C
52
53 REGISTERS USED FOR FIXED DISK OPERATIONS
54
55 (DLI DR[VE NUMBER (80H-87H FOR DISK, VALUE CHECKED)
56 (DHI HEAD NUMBER (0-70 ALLOWED, NOT VALUE CHECKED I
57 (CHI CYLINDER NUMBER (0-10230, NOT VALUE CHECKED) (SEE CU
58 (CLI SECTOR NUMBER ( 1-170, NOT VALUE CHECKED)
59
60 NOTE: HIGH 2 BI TS OF CYL [NDER NUMBER ARE PLACED
61 IN THE HIGH 2 BITS OF THE CL REGISTER
62 (10 BITS TOTAl)
63 (AU NUMBER OF SECTORS (MAXIMUM POSSIBLE RANGE 1-80H,
64 FOR READ/WRITE LONG 1-79H)
65 ( I NTERLEA VE VALI,IE FOR FORMAT I - I 60 I
66 (ES:BXI ADDRESS OF BUFFER FOR READS AND WR [TES,
67 (NOT REQU I RED FOR VER I FY I
68
69 OUTPUT
70 AH " STATUS OF CURRENT OPERATION
71 STATUS BITS ARE DEFINEO IN THE EGlUATES BELOW
72 CY = 0 SUCCESSFUL OPERATION (AH" OOH ON RETURN)
73 CY " I FA[LED OPERATION (AH HAS ERROR REASON)
74
75 NOTE: ERROR IIH [NDICATES THAT THE DATA READ HAD A RECOVERABLE
76 ERROR WHICH WAS CORRECTED BY THE ECC ALGORITHM. THE DATA
77 IS PROBABLY GOOD, HOWEVER THE BIOS ROUT I NE I NO [CA TES AN
78 ERROR TO ALLOW THE CON TROLL [NG PROGRAM A CHANCE TO DEC I DE
79 FOR ITSELF, THE ERROR MAY NOT RECUR IF THE DATA IS
80 REWRITTEN. (ALI CONTAINS THE BURST LENGTH.
81
82 I F DR I VE PARAMETERS WERE REQUESTED,
83
84 DL " NUMBER OF CONSECUTIVE ACKNOWLEDGING DRIVES
85 ATTACHED (0-21 ICONTROlLER CARD ZERO TALLY ONLYI
86 DH " MAX I MUM USEABLE VALUE FOR HEAD NUMBER
87 CH " MAXIMUM USEABLE VALUE FOR CYLINDER NUMBER
88 CL " MAX I MUM USEABLE VALUE FOR SECTOR NUMBER
89 AND CYL I NDER NUMBER H [GH BITS
90
91 IF AN ERROR OCCURS ON READ DRIVE PARAMETERS,
92
93 AH " ERROR CODE (INIT FAILI
94 AL :: CX '" OX " 0 -
95
96 REGISTERS WILL BE PRESERVED EXCEPT WHEN THEY ARE USED TO RETURN
97 INFORMATION.
98
99 NOTE: IF AN ERROR [S REPORTED BY THE D[SK CODE, THE APPROPRIATE
100 ACT I ON I S TO RESET THE 0 [SK, THEN RETRY THE OPERAT I ON.
101
102

24 20MB Fixed Disk Drive Adapter BIOS March 17, 1986


[BM Person .. 1 Computer MACRO Assemb I er Vers I on 2.00 1-2
DISK2 ---- 10/28/85 F[XED DISK BIOS 10-28-B5

103 PAGE
104 ; ----- - - -- ------- - ------- ------- - - ---- - -- - -------- - ------
105 ; ERROR RETURN STATUS (AH):: PH WHEN CY= I
106
107
108 DOFF SENSE FAIL EQU OFFH SENSE OPERAT I ON FA [LED
109 :: OOCC WR I TE-F AUL T EQU OCCH WRITE FAULT ON SELECTED DRIVE
110 OOBB UNDEF-ERR EQU OBSH UNDEF I NED ERROR OCCURRED
I I 1 0080 TIME OUT EQU 080H A TT ACHMENT FA I LED TO RESPOND
112 :: 0040 BAD SEEK EQU 040H SEEK OPERATION FAILED
1 13 0020 BAD-CNTLR EQU 020H CONTROLLER HAS FA [LEO
114 0011 DA TA CORRECTED EQU o 11H ECC CORRECTED DATA ERROR
115 00 I 0 BAD ECC EQU O\OH BAD ECC ON 0 [SK READ
I 16 OOOB BAD-TRACK EQU OOBH BAD TRACK FLAG DETECTED
I 17 0009 DMA -BOUNDARY EQU 009H ATTEMPT TO OMA ACROSS 64K BOUNDARY
I 18 0007 [NIT FAIL EQU 007H DRIVE PARAMETER ACTIVITY FAILED
I 19 0005 BAD RESET EQU 005H RESET FAILED
120 0004 RECaRD NOT FNo EQU 004H REQUESTED SECTOR NOT FOUND
121 0002 BAD ADDR MARK EQU 002H ADDRESS MARK NOT FOUND
122 0001 BAo::::CMo - EQU 00 I H BAD COMMAND PASSED TO 0 I SK I {a
123
124
125 I NTERRUPT AND STATUS AREAS
126
127
;- - - --------- - - - --
- - - --
128 0000 ABSO SEGMENT AT OH
129 0034 ORG 000H·4 F [XED 0 I SK I NTERRUPT VECTOR
130 0034 Ho [SK I NT LABEL DWORO
131 004C ORG o 13H·4 DISK I NTERRUPT VECTOR
132 004C ORG_ VECTOR LABEL DWORD
133 0064 ORG o 19H·4 BOOTSTRAP INTERRUPT VECTOR
134 0064 BOOT _ VEC LABEL oWORD
135 0078 ORG 01 EH·4 DISKETTE PARAMETERS
136 0078 DISKETTE_PARM LABEL DWORD
137 0 I 00 ORG 040H-4 NEW 0 I SKETTE [NTERRUPT VECTOR
138 0100 01 SK_VECTOR LABEL oWORD
139 0104 ORG 041H·4 F I XED 0 [SK PARAMETER VECTOR
140 0 I 04 HF _ TBL_ VEC LABEL DWORD
141 7COO ORG 7COOH BOOTSTRAP LOADER VECTOR
142 7COO BOOT LOCN LABEL FAR
143 7COO ABSO- ENOS
144
145 0000 DATA SEGMENT AT 40H
146
147
006C
006C 1777
ORG
OW , T I MER LOW WORD
148
149
0072
0072 RESET_FLAG
ORG
OW ,
072H
1234H [F KEYBOARD RESET UNDERWAY
150 0074 ORG 074H
151 0074 DISK STATUS DB FIXED DISK STATUS BYTE
152 0075 HF NOM DB COUNT OF FIXED DISK DRIVES
153 0076 CONTROL BYTE DB CONTROL BYTE DR I VE OPT IONS
154 0077 PORT OFF DB PORT OFFSET
155 0078 oATA- ENOS
156
157 0000 CODE SEGMENT
158
159 ; - --- ---- --- - - - - - -------- - - - - -----
160 HARDWARE SPECIFIC VALUES
161 1
162 CONTROLLER I {O PORT
163 > WHEN READ FROM:
164 HF PORT+O READ DATA (FROM CONTROLLER TO CPUI
165 HF-PORT + 1 READ CONTROLLER HARDWARE STATUS
166 - (CONTROLLER TO CPU I
167 HF _PORT+2 READ CONFIGURATION SWITCHES
168 HF PORT + 3 - NOT USED
169 > WHEN WR I TTEN TO:
170 HF PORT+ 0 WR I TE OAT A I FROM CPU TO CONTROLLER I
171 HF-PORT+ I CONTROLLER RESET
172 HF-PORT+2 GENERATE CONTROLLER SELECT PULSE
173 HF-PORT+3 WR I TE PATTERN TO DMA AND INTERRUPT
174 MASK REG! STER
175
176
177
178 CMD BLOCK EQU 8YTE PTR [BP1-B CMO BLOCK HEAD
179 0320 HF PORT EQU 0320H 01 SK PORT
180 0020 INTAOO EQU 020H 8259 PORT
181 0021 INTAO I EQU 021 H 8259 PORT
182 0020 EOI EQU 020H END OF I NTERRUPT COMMAND
183 0008 R I 8USY EQU 00001000B DISK PORT 1 BUSY BIT
184 0004 R I-BUS EQU OOOOOIOOB COMMAND/DATA BIT
185 0002 Rl-IOMOoE EQU 000000 1 DB MODE BIT
1860001 R1::::REQ EQU 0000000 I B REQUEST B[T
187
188 0047 DMA READ EOU 01000111B 1047HI
189 004B DMA-WR [TE EQU 01001011B CHANNEL 3 (04BH)
190 0000 OMA EQU OOOH OMA ADDRESS
191 0082 DMA_H I GH EOU OB2H PORT FOR HIGH 4 BITS OF OMA
192
193 0000 TST ROY CMD EQU 000000008 CNTLR READY { OOHI
194 0001 RECAL CMD EQU 0000000IB RECAL (OIHI
195 0003 SENSE-CMD EQU 00000011 B SENSE 103H)
196 0004 FMToRV CMD EOU 00000 I OOB DRIVE (04Hl
197 0005 CHK TRK CMD EOU 000001018 T CHK ( 05H)
198 0006 FMTTRK CMD EQU 000001108 TRACK 106H)
199 0007 FMTBAO-CMD EQU OOOOOIIIB BAD 107H)
200 0008 READ CMD EQU 0000 I 0008 READ 108H)
20 I OOOA WRITE CMo EQU 000010108 WRITE (OAHI
202 OOOB SEEK CMD EQU OOOOIOIIB SEEK (08H)
203 OOOC I N I T-ORV CMD EOU OOOOIIOOB INIT (OCHI
204 0000 RD ECC CMO EOU 000011018 8URST (DOH)
205 OOOE RD-BUFF CMD EQU 00001110B BUFFR (OEHI
206 OOOF WR-BUFF-CMO EQU 000011118 BUFFR (OFH)
207 OOEO RAM O[AG CMD EOU 1 I 100000B RAM IEOHI
208 00E3 CHK-DRV CMD EQU 11100011 B ORV IE3HI
209 00E4 CNTLR DIAG CMO EQU I I 1001 OOB CNTLR {E4HI
210 00E5 RD LONG CMD EOU I I 100101 B RLONG {E5HI
211 00E6 WR:::LONG:::CMD EQU I I 10011 OB WLONG (E6HI
212
213 OOOB MAX FILE EQU
214 0002 S_MAX FILE EQU

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 25


IBM Personal Computer MACRO Assembler Version 2.00 1-3
0lSK2 ---- 10/Z8/85 FIXED O[SK 8[OS 10-28-85

215 PAGE
216 ASSUME CS:CODE,OS:ABSO
217 0000 ORG OH
218 0000 55 DB 055H I GENER [C B I as HEADER
219 0001 AA DB OAAH
220 OOOZ 08 DB 080 ; 4K MODULE
221
222 ; --- - -------- - - - ----- - - - - --- - - - ----- ---- ----- -- - ---
223 ; FIXED DISK I/O SETUP
224 ;
225 ; ESTABl [SH TRANSFER VECTORS FOR THE F I XED 0 I SK
225 PERFORM POWER ON 0 I AGNOSTI CS
227 ; SHOULD AN ERROR OCCUR A "170 I" MESSAGE IS D I SPLA YEO
228 ;
229 ;
230
231 0003 01 SK SETUP FROC FAR
232 0003 E8 35 - JMP SHORT L3
233 0005 35 39 58 37 32 39 DB '59X7291 IC) COPYRIGHT IBM CORP.' COPYR I GHT NOT I CE
234 31 20 Z8 43 29 20
235 43 4F 50 59 52 49
236 47 48 54 20 49 42
237 40 20 20 43 4F 52
238 50 2E
239 0025 2C 31 39 38 32 ZO DB ',1982,1985,'
240 2C 31 39 38 35 2E
241 0031 20 31 30 ZF 32 38 DB , 10/28/85' RELEASE MARKER
242 2F 38 35
243 D03A L3 :
244 003A 28 CO SUB AX ,AX ADDRESS LOW RAM
245 003C 8E 08 MOV OS,AX
240 003E FA CLI
247 003F A I 004C R MOV AX, WORD PTR ORG VECTOR LOAD 0 I SKETTE [P
248 0042 A3 0100 R MOV WORD PTR 01 SK VECTOR,AX STORE AT I NT 40H
249 0045 A I 004E R MOV AX,WORD PTR ORG VECTOR+2 LOAD D [SKETTE CS
250 0048 A3 0102 R MOV WORD PTR DISK VECTOR+2,AX STORE AT INT 40H
251 0048 C7 06 004C R 0251 R MOV WORD PTR ORG VECTOR, OFFSET 0 I SK 10 F I XED 0 [SK HANDLER
252 0051 8C DE 004E R MDV WORD PTR ORG-VECTOR+2,CS AT [NT 13H
253 0055 B8 0755 R MDV AX, OFFSET Hi) I NT F I XED 0 I SK INTERRUPT
254 0058 A3 0034 R MOV WORD PTR HOI SI< INT ,AX HANDLER AT I NT ODH
255 0058 8C OE 0036 R MOV WORD FTR HDISK-INT+2,CS
256 005F C7 06 0064 R 0192 R MOV WORD FTR SOOT VEC,OFFSET BOOT STRAP BOOTSTRAP ROUT[NE AT
257 0065 8C DE 0066 R MOV WORD PTR BOOT-VEC+2,CS - [NT 19H
258 0069 C7 06 0104 R 03FF R MOV WORD PTR HF TeL VEC, OFFSET FO TBL PARAMETER TABLE AT
259 006F 8C DE 0106 R MDV WORD PTR HF=:TBL=:VEC+2,CS - [NT 41H
260 0073 F8 STI
261
252 ASSUME
263 0074 88 ---- R MOV AX,oATA ESTA8L I SH SEGMENT
254 0077 8E 08 MOV OS,AX
265 0079 C6 06 0074 R 00 MOV DISK STATUS,O RESET THE STATUS INDICATOR
266 007E C6 06 0075 R 00 MOV HF NUM,O ZERO COUNT OF DR I YES
267 0083 C6 06 0077 R 00 MOV PORT OFF, 0 ZERO CARD OFFSET
268 0088 B9 0025 MOV CX,25H RETRY COUNT
269 008B L4:
270 0088 E8 0177 R CALL HO RESET 1 RESET CONTROLLER
271 008E 73 05 JNC L 7- -
272 0090 E2 F9 LOOP L4 TRY RESET AGA I N
273 0092 E9 0154 R JMP ERROR_EX
274 0095 L 7:
275 0095 89 000 I MOV CX,l
216 0098 8A 0080 MOV DX,80H
277 0098 B8 1200 MOV AX,I200H CONTROLLER D I AGNOST I CS
278 009E CO 13 INT I3H CHECK THE I NTERNAL RAM
279 OOAO 73 03 JNC P7 BUFFERS
280 00A2 E9 0154 R JMP ERROR_EX
281 00A5 P7 :
282 00A5 88 1400 MOV AX,I400H CONTROLLER D I AGNOST I CS
283 00A8 CO 13 INT I3H I NTERNAL CHECKSUM AND
284 OOAA 73 03 JNC P9 ECC CIRCUITRY TEST.
285 OOAC E9 0154 R JMP ERROR_EX
285 OOAF P9:
287 OOAF C7 06 006C R 0000 MOV TIMER LOW,O ZERO TIMER
288 00B5 81 3E 0072 R 1234 CMP RESET-FLAG, 1234H KEYBOARD RESET
289 00B8 75 06 JNE P8 -
290 OOBO C7 06 006C R 019A MDV TIMER_LOW,410D SKIP WAIT ON RESET
291 00C3 P8:
292 00C3 FA CLI D I SABLE INTERRUPTS
293 00C4 E4 21 IN AL,INTAOI TIMER
294 ODC6 24 FE ANO AL,OFEH ENABLE T [MER
295 00C8 E6 21 OUT INTA01,AL START TIMER
296 OOCA FB ST I I NTERRUPTS ON
297 00C8 P4:
298 00C8 E8 0177 R· CALL HD RESET 1 RESET CONTROLLER
299 OOCE 72 07 JC p(5 -
300 0000 88 1000 MOV AX,IOOOH TEST TO SEE IF THE DRIVE
301 00D3 CD 13 INT I3H [S READY
302 0005 73 OA JNC P2
303 0007 PIO:
304 0007 AI 006C R MDV AX, Tl MER LOW
305 OODA 30 OIBE CMP AX,446D - 25 SECONDS
306 0000 72 EC JB P4
307 OOOF E8 73 JMP SHORT ERROR_EX
308 OOEI P2:
309 OOEI 88 1100 MDV AX,IIOOH RECAL 18RATE THE OR I YE 0
310 00E4 CO 13 INT I3H
311 OOE6 72 6C JC ERROR_EX
312
313 00E8 88 0900 MOV AX,0900H SET DR I VE PARAMETERS
314 O{)EB CD 13 INT I3H FOR DRIVE 0
315 ODED 72 65 JC ERROR_EX
316
317 OOEF 88 C800 MOV AX ,OC800H DNA TO BUFFER
318 00F2 8E CO MDV ES,AX SET SEGMENT
319 00F4 2B 08 SUB BX,ex
320 00F6 88 OFOO MDV AX,OFOOH WR [TE SECTOR BUFFER
321 00F9 CD 13 INT I3H
322 00,F8 72 57 JC ERROR_EX
323
324 OOFO FE 06 0075 R INC HF NUM DR I VE ZERO RESPONDED
325 0101 BA 0213 MDV OX-;213H EXPANS [ON BOX
326 0104 80 00 MOV Al,O
327 0106 EE OUT OX,AL TURN BOX OFF
328 Ol078A0321 MDV DX,321H TEST IF CONTROLLER

26 20MB Fixed Disk Drive Adapter BIOS March 17,1986


IBM Persona I Computer MACRO Assemb I er ion 2.00 1-'
DISK2 ---- 10/28/85 FIXED DISK BIOS 10-28-85

329 OIOA EC IN AL,DX IS IN THE SYSTEM UNIT


330 OIOB 24 OF AND AL, OFH
331 0100 3C OF CMP AL, OFH
332 OIOF 74 06 JE BOX ON
333 0111 C7 06 006C R 0lA4 MOV TlMER_LOW,420D CONTROLLER I SIN SYSTEM UN I T
334 0I I7
335 0117 BA 0213 MOV DX,213H EXPANS [ON BOX
336011ABOFF MOV AL, QFFH
337 Olle EE OUT aX,AL TURN BOX ON
338 OlIO 69 0001 MOV CX, I ATTEMPT NEXT DR I VES
339 0120 BA 0081 MOV DX,08IH
340 0123 P3:
341 0123 2B CO SUB AX,AX RESET THE CONTROLLER
342 0125 CD 13 INT 13H
343 0127 72 42 JC POD DONE
344 0129 B8 I 100 MOV AX,OIIOOH RECALlBRATE THE DRIVE I
345 012C CD 13 tNT 13H
346 012E 73 OA JNC P5
347 0130 AI 006C R MOV AX,TIMER LOW
348 013330 OIBE CMP AX,446D - 25 SECONDS
349 0136 72 EB JB P3
350 0138 EB 31 JMP SHORT POD_DONE
351 013A P5:
352 013A B8 0900 MOV AX,0900H INITIALIZE DRIVE CHARACTERISTICS
353 0130 CO 13 INT 13H FOR DRIVE I
354 013F 72 2A JC POD DONE
355 0141 FE 06 0075 R INC HF NUM I: TALLY ANOTHER DRIVE
356 0145 81 FA 0081 CMP DX-;-180H + S_MAX_FtLE
357 0149 73 20 JAE POD DONE
358 014B 42 INC OX -
359 014C EB 05 JMP P3
360
361 014E 31 37 30 31 ODOA FI1 DB '1701' ,ODH,OAH POST MESSAGE
362 0006 FI7L EOU I-FI7
363
36' POD ERROR
365
366 0154 ERROR EX:
367 0154 BO OOOF - MOV BP,OFH POD ERROR FLAG
368 0157 2B F6 SUB S I, S I
369 0159 B9 0006 MDV CX,FI7L MESSAGE CHARACTER COUNT
370 015C B7 00 MDV BH,O PAGE ZERO
371 015E OUT_CH:
372 015E 2E: 8A 84 014E R MDV AL,CS:FI7(SI] GET BYTE
373 0163 B4 OE MDV AH,I40 VIDEO OUT
374 0165 CD 10 INT IOH D I SPLA Y CHARACTER
375 0167 46 INC SI NEXT CHAR
376 0168 E2 F4 LOOP OUT_CH DO MORE
377 016A F9 STC
378 016B POD DONE:
379 016B FA - CLl NO INTERRUPTS
380 016C E4 21 IN AL,INTAOI READ THE I NTERRUPT MASK
381 0 I 6E OC 0I OR AL,O IH o I SABLE THE T I MER
382 0170 E6 21 OUT INTAOI,AL
383 0172 FB STI ENABLE INTERRUPTS
384 0173 E8 0232 R CALL OSBL o I SABLE THE CARD MASKS
385 0176 CB RET
386
387
388
389
0177
0 I 77 51
0178 52
HD RESET I
- PUSH
PUSH
C,
PROC

OX
NEAR
SAVE REG I STER

390 0179 B9 0100 MDV CX, 0 I OOH RETRY COUNT


391 017C L6:
392 017C E8 0760 R CALL PORT 0
393 017F 42 INC OX- ADDRESS PORT I
394 0180 EE OUT DX,AL RESET CARD
395 0181 EB 00 JMP 1+2 I/O DELAY AT LEAST +5us
396 0183 EB 00 JMP 1+2 ALLOW T I ME TO CLEAR THE
397 0185 EB 00 JMP $+2 HARDWARE STATUS REGISTER
398 0187 EC IN AL,DX READ THE HARDWARE STATUS
399 018824 3F AND AL,OOIIIIIIB MASK OFF UPPER 2 BITS AND CLEAR CY
400 OIBA 74 03 JZ R3 EXIT IF REGISTER IS CLEARED WITH CY=O
401 DI8C E2 EE LOOP L6 TRY AGAIN
402 018E F9 STC SET ERROR CONDITION CY=I
403 018F R3:
404 018F 5A POP OX RESTORE REG 1 STER
405 0190 59 POP CX
406 0191 C3 RET
407 0192 HD RESET I ENDP
408 0 I 92 DISK_SETUP ENDP

March 17,1986 20MB Fixed Disk Drive Adapter BIOS 27


IBM PersonOiI Computer MACRO Assembler Version 2.00 I-S
DISK2 ---- 10/28/85 FIXED DISK 810S 10-28-85

409 PAGE
410 ; --- I NT 19 H --- ------- --- ------- ------ -- ----------- ---------
411
412 INTERRUPT 19 800T STRAP LOADER
413
414 THE F I XED 0 I SK B I OS REPLACES THE INTERRUPT 19H BOOT
415 STRAP VECTOR WITH A PO I NTER TO TH I S BOOT ROUT I NE AND
416 RESETS THE DEFAULT DISK AND DISKETTE PARAMETER VECTORS
411
418 THE BOOT BLOCK TO BE READ IN WILL 8E ATTEMPTED FROM
419 CYL I NDER 0 SECTOR 1 OF THE DEV I CE.
420
421 THE BOOTSTRAP SEQUENCE IS:
422 ATTEMPT TO LOAD FROM THE DISKETTE INTO THE BOOT
423 LoCAT I ON (0000: 7COOH) WHERE CONTROL I S TRANSFERRED.
424 IF THE DISKETTE FAILS THE FIXED DISK IS TRIED FOR A
42S VALID BOOTSTRAP 8LOCK. A VALID 800T 8LoCK ON THE
426 F I XED 0 I SK CONS I STS OF THE 8YTES 055H OAAH AS THE
427 LAST TWO 8YTES OF THE 8LOCK.
428 IF THE A80VE FAILS CONTROL IS PASSED TO RESIDENT BASIC
429
430
431
432 0192 BOOT STRAP:
433 - ASSUME OS: ABSO, ES: ABSO
434 0192 2B CO SUB AX,AX
43S 0194 8E 08 NOV DS,AX EST A8L I SH SEGMENT
436 0196 B4 CO NOV AH,OCOH
437 0198 CD 15 IN7 ISH READ CONF I GURAT I ON PARAMETERS
438 IF XT OR PC, I NTERRUPTS ARE 0 I SABLEO
439 RESET PARAMETER VECTORS AT THIS POINT.
440
441 o 19A FA CLI
442 0198 CT 06 0104 R 03FF R MoV WORD PTR HF TBL VEC, OFFSET FD TBL
443 01AI 8C OE 0106 R MOV WORD PTR HF-TBL -VEC+2, CS -
444 0lA5 73 OA JNC HO - - ; JMP I F I NT 15 FUNCT I ON IMPLEMENTED
44S
446 0lA7 C7 06 0078 R 0227 R MOV WORD PTR 0 I SKETTE PARM, OFFSET 0 I SKETTE TBL
447 OIAD 8C OE 001A R MOV WORD PTR DISKETTE:::PARM+2,CS -
448 OIBI HO:
449 0181 FB STI
4S0
4S1 ATTEMPT BOOTSTRAP FROM 01 SKETTE
4S2
4S3 01 B2 2B 02 SUB OX,DX OR I VE ZERO
4S4
4SS ESTABLISH ES:BX POINTER
4S6
4S7 0lB4 8E C2 NOV ES ,OX ESTABLISH SEGMENT
4S8 0186 BB 7COO R NOV BX,OFFSET BooT_LOCN SET BX TO 1COOH
4S9
460 CLEAR BOOT_LOCN
461
462 0189 FC CLO DIRECT I ON FORWARD
463 o IBA 33 CO XOR AX, AX
464 018C 89 0100 NOV CX,256 CLEAR 256 WORDS
46S 018F 88 FB NOV DI,8X POINT TO BOOT LOCATION 8UFFER
466 OICI F3/ A8 REP STOSW ZERO THE BOOT LOCAT I ON BUFFER
467
468 0lC3 89 0004 NOV CX,4 SET RETRY COUNT
469 o IC6 HI: IPL SYSTEM
470 o IC6 51 PUSH CX SAVE RETRY COUNT
471 0lC7 2B CO SUB AX,AX RESET THE 0 I SKETTE
472 0lC9 CD 13 INT 13H FILE 10 CALL
473 OICB 72 08 JC H2 IF ERROR, TRY AGAIN
474
47S OICD B8 0201 NOV AX,020!H READ I N THE SINGLE SECTOR
476 0100 B9 000 I NOV CX,I SECTOR I, TRACK 0
477 0103 CO 13 INT 13H FILE 10 CALL •
478 0105 59 H2: POP CX RECOVER RETRY COUNT
479 0106 73 09 JNC H3 CARRY FLAG SET 8'1' UNSUCCESSFUL READ
480
481 0108 80 FC 80 CNP AH,80H IF TIME OUT, NO RETRY
482 OIOB 74 22 JZ H6 TRY FIXED DISK
483
484 0100 E2 E7 LOOP HI DO I T FOR RETRY TIMES
48S OIOF EB IE JNP SHORT H6 UNABLE TO I PL FROM THE 0 I SKETTE
486
487 OIEI 80 3E 7COO R 06 H3: CMP BYTE PTR BOOT_LOCN,06H CHECK FOR FIRST INSTRUCTION INVALID
488 0lE6 72 30 JB HIO IF 800T NOT VAllO, GO TO BASIC
489
490 INSURE DATA PATTERN FIRST 8 WORDS NOT ALL EQUAL
491
492 0lE8 8F 7COO R NOV 01 ,OFFSET BOOT LoCN ; CHECK DATA PATTERN
493 0lE8 89 0008 NOV CX,8 - ; CHECK THE NEXT 8 WORDS
494 OIEE AI 7COO R NOV AX,WORD PTR BOOT_LOCN ; LOAD THE FIRST WORD
49S
496 OIFI 83 C7 02 H4: AOO 01,2 ; PO I NT TO NEXT WORD
497 0lF4 38 05 CNP AX, (01 J ; CHECK DATA PATTERN FOR A FILL PATTERN
498 01F6 EI F9 LoOPZ H4
499 0lF8 74 28 JZ HIO ; BOOT NOT VALID, GO TO BASIC
SOO o IFA H5:
SOl OIFA EA 7COO ---- R JMP 800T _LOCN
S02
S03 ATTEMPT BOOTSTRAP FROM FIXED DISK
S04
SOS 01 FF H6:
S06 01 FF 28 CO SUB AX, AX RESET D (SKETTE
S07 0201 CD 13 INT 13H
S08 0203 89 0003 MOV CX,3 SET RETRY COUNT
S09 0206 8A 0080 NOV DX,ooaOH FIXED DISK ZERO
SIO 0209 H7 : IPL SYSTEM
SII 0209 51 PUSH SAVE RETRY COUNT
SI2 020A 2B CO SUB AX, AX RESET THE F I XED 0 I SK
SI3 020C CD 13 INT 13H FILE 10 CALL
SI4 020E 72 08 JC H8 IF ERROR, TRY AGAIN
SIS
SI6 ES AND BX ALREADY ESTABLISHED
SI1
SI8 0210 B8 0201 NOV AX, 020 1H READ I N THE SINGLE SECTOR
5>9 0213 89 0001 NOV ex, I SECTOR I, TRACK 0
S20 0216 CD 13 INT 13H FILE 10 CALL
S21 0218 59 H8: POP CX RECOVER RETRY COUNT
S22 0219 12 08 JC H9

28 20MB Fixed Disk Drive Adapter BIOS March 17,1986


IBM Personal Comput.l!lr MACRO Assl!lmbll!lr Vl!lrslon 2.00 1-6
OlSK2 ---- 10/28/85 FIXED DISK BIOS 10-28-85

523 0218 AI 70FE R MOV AX, WORD PTR BOOT LOCN+510D


524 021 E 30 AA55 CMP AX, OAA5SH - ; TEST FOR GENER I C BOOT BLOCK
525 0221 74 01 .JZ H5 J GO TO 800T LOCATION
526 0223 H9:

.2.
521
.28
53.
0223 E2 E4

;-----
LOOP H1 ;

UNABLE TO IPL FROM THE DISKETTE OR FIXED DISK


DO IT FOR RETRY TIMES

531 0225
532 0225 CO 18 INT 18H RESIDENT BASIC
533
534 0227 01 SKETTE_ TBL I
.35
536 0227 CF DB 110011 I IB SRT=O, HD UNLOAD=OF - 1 ST SPEC BYTE
537 0228 02 DB 2 HD LOAD= I, MODE=DMA - 2ND SPEC BYTE
538 0229 25 DB 25H MOTOR TIMEOUT AFTER OPERATION
539 022A 02 DB 2 51 2 8YTES PER SECTOR
540 0228 08 DB 8 EOT (LAST SECTOR ON TRACK)
541 022C 2A DB 02AH GAP LENGTH
542 0220 FF DB OFFH DTL
543 022E 50 DB 050H GAP LENGTH FOR FORMAT
544 022F F6 DB OF6H FILL BYTE FOR FORMAT
545
546
0230
0231
19
04
DB 2. HEAD SETTLE T I ME (M I LL I SECONDS)
MOTOR START TIME (118 SECOND)
DB 4
.41
548 ;----- MAKE SURE THAT ALL HOUSEKEEPING IS DONE BEFORE EXIT
'4'
550 0232 D58L PROC NEAR
551 0232 2A CO SUB AL,AL ; RESET I NT IDMA MASK
552 0234 BA 0323 MDV DX,HF _PORT+3 LOAD FOR PORT ADDRESS :3
553 0231 FA eLi 01 SA8LE INTERRUPTS
554 0238 EE DUT DX,AL RESET I NT/DMA MASK CARD a
555 0239 83 C2 04 ADD DX,4
556 023C EE DUT DX,AL RESET INT/DMA MASK CARD 1
557 0230 83 C2 04 ADD DX,4
558 0240 EE DUT aX,AL RESET (NT/DMA MASK CARD 2
559 0241 83 C2 04 ADD OX,4
560 0244 EE DUT DX,AL J RESET INT /DMA MASK CARD :3
'61
562 0245 80 07 MDV AL,07H
563 0247 E6 OA DUT DMA+IO,AL SET DMA MODE TO 0 I SA8LE
564 0249 E4 21 IN AL,INTAOI
565 0248 OC 20 DR AL,020H
566 0240 E6 21 OUT INTAOI,AL oI SABLE I REQ 5
567 024F FB 511 ENABLE INTERRUPTS
568 0250 C3 RET
569 0251 OSBL ENDP
51 •
• 11
512
.13 FIXED DISK BIOS ENTRY POINT
.14
51. ; - --- -- - - -- - ---- - - - - - ------- -- - --------------------------
516
577 0251 DISK 10 PROC FAR
518 - ASSUME OS :DATA,ES:NOTHING
579 0251 80 FA 80 eMP DL,080H TEST FOR FIXED DISK DRIVE
580 0254 73 05 "AE HARD 01 SK YES, HANDLE HERE
581 0256 CO 40 INT 40H - DISKETTE HANDLER
582 0258
583 0258 CA 0002 RET J BACK TO CALLER
.84
585 0258 HARD DISK:
586 0258 FB - STI J ENABLE INTERRUPTS
587 025C OA E4 OR AH,AH
588 025E 75 09 "NZ A3
589 0260 CO 40 INT 40H RESET NEC WHEN AH=O
590 0262 2A E4 SUB AH,AH
591 0264 80 FA 81 e"p DL, (80H+S MAX FILE-I) DL IN LIMITS?
592 0267 77 EF "A RET_2 - -
593 0269 A3:
594 0269 80 FC 08 e"p AH,8 GET PARAMETERS I S A SPEC I AL CASE
595 026C 75 03 "NZ A2
596
597
026E
0271
E9 0380 R
A21 ""P GET_PARM_N

598 0271 55 PUSH BP SAVE THE BASE POINTER


599 0272 8B EC NOV 8P,SP LOAD THE CMD BLOCK PO INTER

6.,
600 0274 83 EC 08 SUB SP,8 ALLOCATE SPACE FOR THE COMMAND BLOCK
ON THE STACK.
602 0277 53 PUSH BX SAVE REGISTERS DURING OPERATION
603 0278 51 PUSH ex
604 0279 52 PUSH ox
605 027A IE PUSH DS
606 0278 06 PUSH ES
607 02IC 56 PUSH 51
608 0270 57 PUSH DI
609 027E 8E ---- R NOV 51 ,DATA
610 0281 8E DE NOV DS,SI J ESTABLISH DATA SEGMENT
6"
612 0283 E8 0200 R CALL DISK_IO_CONT PERFORM THE OPERATION
613
614 0286 SO PUSH AX
615 0287 E8 0232 R CALL DSBL BE SURE 0 I SABLES OCCURRED
616 028A 88 ---- R MOV AX,DATA
617 0280 8E 08 MOV DS,AX ESTA8L I SH SEGMENT
618 028F 58 POP AX RESTORE THE REGI STERS
619 0290 8A 26 0074 R MOV AH,DISK STATUS GET STATUS FROM OPERATION
620 0294 SF POP DI -
621 0295 5E POP 51
622 0296 07 POP ES
623 0297 IF POP OS
624 029B SA POP OX
625 0299 59 POP ex
626 029A 5B POP BX
621
628 0298 83 C4 08 ADD SP,8 ADJUST FOR THE COMMAND BLOCK.
629 029E 50 POP BP RESTORE 8ASE POINTER
630 029F BO FC 01 eMP AH, I SET THE CARRY FLAG TO INDICATE
631 02A2 FS eMe SUCCESS OR FAILURE
632 02A3 CA 0002 RET THROW AWAY SAVED FLAGS
633 02A6 DISK_IO ENDP

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 29


IBM Personal Computer MACRO Assembler Version 2.00 1-7
O[SK2 ---- 10/28/85 FIXED DISK 8[OS 10-28-85

.34 PAGE
635 02A6 MI LA8EL WORD FUNCT [ON TRANSFER TA8LE
636 02A6 032E R OW DISK RESET OOOH
637 02A8 0347 R OW RETURN STATUS 001 H
638 02AA 0350 R OW DISK READ 002H
639 02AC 0359 R OW DISK-WR[TE 003H
640 02AE 0362 R OW 01 SK-VERF 004H
641 0280 0369 R OW FMT TRK DOSH
642 0282 036F R OW FMT-BAD D06H
643 0284 0375 R OW FMT-DRV D07H
644 0286 0326 R OW 8AD-COMMAND OOSH
645 0288 043F R OW [NIT DRV 009H
646 028A 04F4 R OW RD LONG OOAH
647 028C 0501 R OW WR-LONG 008H
648 028E 0515 R OW D 15K SEEK DOCH
649 02CO 032E R OW DISK-RESET OODH
650 02C2 0518 R OW RD 8UFF OOEH
651 02C4 0527 R OW WR-8UFF OOFH
652 02C6 0533 R OW TST ROY OIOH
653 02C8 0539 R OW HOISK RECAL OIIH
654 02CA 053F R OW RAM OTAG QI2H
655 02CC 0545 R OW CHK-DRV o 13H
656 02CE 0548 R OW CNTLR DIAG 014H
657 '" 002A MIL EQU $-M1 -
.58
659 0200 01 SK 10 CONT PROC NEAR
660 0200 80 FC 01 - -CMP AH,OIH RETURN STATUS
661 0203 74 72 JE RETURN_STATUS
•• 2
CONVERT DR I VE NUM8ER TO 0 8ASED RANGE

...
663 0205 80 EA 80 5UB DL ,080H
664 0208 80 FA 08 e"p DL,MAX FILE LEGAL DR I VE TEST
665 0208 73 49 JAE 8AO_COMMAND

667 0200 C6 06 0074 R 00 "OV


•• 8
•• 9 SET UP COMMAND 8LOCK
.70
671 02E2 FE C9 DEC CL SECTORS 0-16 FOR CONTROLLER
672 02E4 C6 46 F8 00 "OV CMD 8LOCK+0, 0 SET TO ZERO THE OP CODE
673 02E8 88 4E FA "OV CMD-BLOCK+2,CL SECTOR AND HIGH 2 6 [TS CYL I NOER
674 02E8 88 6E F8 "OV CMD-8LOCK+3,CH CYL I NDER LOW
675 02EE 88 46 FC "OV CMD-BLOCK+4, AL [NTERLEAVE / 8LOCK COUNT
676 02FI AO 0076 R "OV AL, CONTROL BYTE CONTROL 8YTE (STEP OPT [ON)
677 02F4 88 46 FD "OV CMD_8LOCK+5,AL SET THE CONTROL F [ELD
.78
.79 CALCULATE THE PORT OFFSET
.80
681 02F7 8A EA "OV CH,DL SAVE DL
682 02F9 80 CA 0I OR DL,1
683 02FC FE CA DEC OL
684 02FE DO E2 5HL OL,I GENERATE OFFSET
685 0300 88 16 0077 R "OV PORT OFF ,Dl STORE OFFSET
686 0304 8A 05 "OV OL,eH RESTORE Dl
687 0306 80 E2 01 AND DL,I MAKE DR I VE 0 OR I
688 0309 81 05 "OV CL,5 SHI FT COUNT
689 0308 02 E2 5HL OL,Cl DRIVE NUMBER (0,1)
690 0300 OA 06 OR DL,DH HEAD NUMBER
691 030F 88 56 F9 "OV CMD_BLOCK+ I ,DL SET THE DR [VE AND HEAD
.92
693 0312 66 C8 "OV CX,AX CALCULATE JUMP ADDRESS
694 0314 8A CO "OV CL,CH GET I NTO LOW BYTE
695 031632 ED XOR CH,CH ZERO HIGH BYTE
696 031801 EI 5AL CX, I -2 FOR TA8lE LOOKUP
697 031A 88 FI "OV S I, CX PUT INTO S I FOR BRANCH
b98 031C 83 F9 2A e"p CX,MIL TEST WITHIN RANGE
699 031F 73 05 JNB 8AD COMMAND
700 0321 2E: FF A4 02A6 R J"P WORD PTR CS:[SI+OFFSET MIl ; GO DO THE COMMAND
70 I 0326 8AD COMMAND:
702 0326 C6 06 0074 R 01 - MOV DISK STATUS,8AD CMD SET 8AD COMMAND ERROR
703 0328 80 00 "OV AL,O- -
704 0320 C3 RET ; EXIT
705 032E D[SK_IO_CONT ENDP
70.
707 ; ---------- - ----------- - -- ----- ------ - -------
708 ; RESET THE DISK SYSTEM (AH '" OOOH) :
709
710
711 032E D[SK RESET PROC NEAR
712 032E E8 0760 R - CALL PORT 0 RESET PORT
713 0331 42 INC ox - PORT I ADDRESS
714 0332 EE OUT DX,AL RESET CARD
715
716
0333
0335
E8
E8
00
00
J"P
J"P
"2
'.2
I/O DELAY AT LEAST +5us
ALLOW T I ME TO CLEAR THE
717
718
0337
0339
E8
EC
00 J"P
IN
'.2
AL,DX
HARDWARE STATUS REG (STER
READ THE HARDWARE STATUS
719 033A 24 3F AND AL,OOIIIIIIB MASK OFF UPPER 2 BITS AND CLEAR CY
720 033C 74 06 JZ ORI EXIT IF REGISTER IS CLEARED WITH CY",O
721 033E C6 06 0074 R 05 "OV 01 SK_ST ATUS, 8AD _RESET SET THE ERROR COND I T I ON
722 0343 C3 RET EX[T
723 0344 DRI:
724 0344 E9 043F R J"P SET THE DRIVE PARAMETERS
725
72b 0347 DISK_RESET ENDP
727
728
729 DISK STATUS ROUTINE (AH '" OOIH)
730 ; -------- -------------- ----------------- -- - ------- - ------
731
732 0347 RETURN STATUS PROC NEAR
733 0347 AO 0074 R - MOV AL,DISK STATUS OBTA[N PREVIOUS STATUS
734 034A C6 06 0074 R 00 "OV 01 SK_STATUS, 0 RESET STATUS
735 034F C3 RET
736 0350 RETURN_STATUS ENDP
737
738 ; -- ---- ------------ - ---------
739 ; OISK READ ROUTINE (AH = 002H) :
740
741
742 0350 DISK READ PROC NEAR
743 0350 80 47 - MDV I MODE 8YTE FOR DMA READ
744 0352 C6 46 F8 OS "OV ~~D D~~5~;~~. READ CMD
745 0356 E9 055E R J"P DMA-OPN -
746 0359 DISK_READ ENDP
747

30 20MB Fixed Disk Drive Adapter BIOS March 17, 1986


IBM Personal Computer MACRO Assembler VersIon 2.00 1-6
0lSK2 ---- 10/28/85 FIXED DISK BIOS 10-28-85

746 ; --- - - --- - - -- --- - - - - - - - - ---


749 ; DISK WRITE ROUT[NE IAH = 003H) :
750
751
752 0359 DISK WR[TE PROC NEAR
753 0359 80 48 - MOV AL,DMA WR I TE ; MODE BYTE FOR DMA WR I TE
754 035B C6 46 F8 OA MOV CMD 8LOCK+O,WRITE CMD
755 035F E9 055E R JMP DMA-OPN -
756 0362 DISK_WRITE ENOP
757
756 . - - ----- ---- - --- - - --------- - - --------- --
759 ; DISK VER[FY IAH = 004H)
760
761
762 0362 DISK VERF PROC NEAR
763 0362 C6 46 F6 as - MOV CMD 8LOCK+O,CHK TRK CMO
764 0366 E9 054F R JMP NOMA OPN --
765 0369 DISK_VERF ENDP-
766
767 ; --- - - --- - - - - -- - - -- -- ----- - --- - - - - --- - - - -- -- - - - - - -- - - - --
766 ; FORMATTING IAH = 005H 006H OOTHI :
769
770
771 0369 FMT TRK PROC NEAR ; FORMAT TRACK (AH = 005H I
772 0369 C6 46 F6 06 - MOV CMO 8LOCK+O,FMTTRK CMO
773 0360 EB OA JMP SHORT FMT _CONT -
774 D36F FMT _ TRK ENOP
775
776 D36F FMT 8AD PROC NEAR FORMAT BAD TRACK (AH = 006Hl
777 036F C6 46 F6 07 - MOV CMO 8LOCK+O,FMTBAD CMD
776 0373 E8 04 JMP SHORT FMT_CONT -
779 0375 FMT _8AD ENDP
760
761 0375 FMT ORV PROC NEAR FORMAT DR[VE IAH = 007H)
782 0375 C6 46 F6 04 - MOV CMD_BLOCK +0, FMTDRV _ CMD
763 0379 FMT _DR V ENDP
764
765 0379 FMT CONTI
766 0379 60 66 FA CO - AND CMD 8LOCK+2,IIOOOOOOB i ZERO OUT SECTOR FJELD
767 0370 E9 054F R JMP NDMA_OPN
786
769
790 GET PARAMETERS AH = 8) :
791
792
793 0380 GET PARM N LABEL NEAR
794 0380 GET-PARM- PROC FAR GET DR I VE PARAMETERS
795 0380 IE - PUSH DS SAVE REGI STERS
796 0381 06 PUSH ES
797 0382 53 PUSH 8X
796
799 ASSUME OS:ABSO
600 0383 2B CO 5U8 AX,AX ESTABLISH ADDRESSING
60 I 0385 8E 08 MOV OS, AX
602 0387 C4 IE 0104 R LES 8X,HF _TBL_VEC
603
604 ASSUME OSIDATA
605 0388 88 ---- R MOV AX,DATA
606 038E 8E 08 MOV OS,AX EST ABL I SH SEGMENT
607 0390 60 EA 60 SU8 DL,80H
606 0393 80 FA 06 CMP DL,MAX FILE TEST WITH I N RANGE
609 0396 73 57 JAE G4 -
610 0398 C6 06 0074 R 00 MOV DISK STATUS,O RESET THE STATUS [NDICATOR
61! 0390 8A EA MOV CH,Oe SAVE THE DRIVE
612 039F 60 CA 01 OR OL, I
613 03A2 FE CA DEC OL
614 03A4 DO E2 SHL DL,I GENERATE OFFSET
615 03A6 66 16 0077 R MOV PORT OFF tOl STORE OFFSET
616 03AA 6A D5 MOV DL,cR RESTORE OL
617 03AC 60 E2 01 AND OL, 0000000 I B DRIVE 0 OR DRIVE I
616 03AF 6A E2 MOV AH,Dl
619 03B I E6 0760 R CALL PORT 0
620 03B4 42 INC OX - PORT_2 ADDRESS
621 03B5 42 INC OX
622 03B6 EC IN AL,DX READ SW I TCH SEll [NGS
623 0387 6D FC 00 CMP AH,D DRIVE 0 OR 1
624 03BA 75 04 JNZ GO
625 03BC DO E6 SHR AL, I R [GHT JUST I FY THE SW ITCH BITS
626 038E DO E6 SHR AL,I
627 03CO GO:
626 03CO 24 03 AND AL,OOOOOOl18 ISOLATE THE TABLE BITS
629 03C2 81 04 MOV CL,4 T ABLE LENGTH IS 16 BYTES
630 03C4 02 EO SHL Al,Cl ADJUST
631 03C6 2A E4 SU8 AH,AH
632 03C8 03 08 ADO 8X,AX
633 03CA 26: 68 07 MOV AX,ES: (BX] MAX NUMBER OF CYLINDERS
634 03CO 2D 0002 SU8 AX ,2 ADJUST FOR O-N
635 AND RESERVE lAST TRACK
636 0300 8A E8 MOV CH,Al
637 0302 25 0300 AND AX,0300H HIGH TWO 8[TS OF CYLINDER
636 0305 DI E6 SHR AX,I
639 0301 DI E6 SHR AX,I
640 0309 DC I! OR AL,OIIH SECTORS
641 030B 8A C6 MOV Cl-,AL
642 0300 26: 6A 77 02 MOV DH,ES: [8X] [2] HEADS
643 03EI FE CE DEC DH O-N RANGE
644 03E3 6A 16 0015 R MOV DL,HF NUM DR I VE COUNT
645 03E7 28 CO SU8 AX, AX-
646 03E9
647 03E9 58 POP 8X RESTORE REGISTERS
646 03EA 07 POP ES
649 03E8 IF POP OS
65D 03EC CA 0002 RET 2 EXIT
651 03EF G4:
652 03EF C6 06 0014 R 07 MOV DISK STATUS, (N[T FA(L OPERATION FAILED
653 03F4 84 07 MOV AH,INIT FAIL -
654 03F6 2A CO SU8 AL,Al -
655 03F8 28 02 SUB OX,OX
656 03FA 28 C9 SU8 CX,CX
657 03FC F9 STC SET ERROR FLAG
656 03FO E8 EA JMP G5 EXIT
659 03FF ENOP

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 31


IBM P.rsonal Computer MACRO Assembler
DISK2 ---- 10/28/85 FIXED DISK BIOS
Version 2.00
10-28-85
1-'

..•••,
•• 0

•• 2
PAGE

I NIT I AL I ZE DR I VE CHARACTER I ST I CS

•••
•••
FIXED DISK PARAMETER TABLE

...•••
•••
•• 7

.70
THE TABLE IS COMPOSED OF A BLOCK DEFINED AS:

(I
(I
(I
WORD)
BYTE)
WORD)
-
-
-
MAXIMUM NUMBER OF CYLINDERS
MAXIMUM NUMBER OF HEADS
STARTING REDUCED WRITE CURRENT CYL
.71 (I WORD) - STARTING WRITE PRECOMPENSATION CYL

."
.72
.,.
.7.
II
II
BYTE}
BYTE)
-
-
MAXIMUM ECC DATA BURST LENGTH
CONTROL BYTE IDRIVE STEP OPTION)

.7..77 BIT
BIT
1 DISABLE DISK-ACCESS RETRIES
6 DISABLE ECC RETRIES

.7. BITS 5-3 ZERO


BITS 2-0 DRIVE OPTION

..,
.7'
•• 0

•• 2
•••
II
(1
(I
(I
(I
(I
BYTE)
BYTE)
BYTE)
WORD)
BYTEl
BYTE)
-
-
-
-
-
-
STANDARD TIME OUT VALUE (SEE BELOW)
TIME OUT VALUE FOR FORMAT DRIVE
T I ME OUT VALUE FOR CHECK OR I VE
LAND I NG ZONE
SECTORS/TRACK
RESERVED FOR FUTURE USE
•••
••• - TO DYNAMICALLY DEFINE A SET OF PARAMETERS
•••
•• 7
BUILD A TABLE OF VALUES AND PLACE THE
CORRESPONDING VECTOR INTO INTERRUPT 41 •

..•••••••••,
•• 0
NOTE: THE DEFAULT TABLE IS VECTORED
AN INTERRUPT 19H (BOOTSTRAP)
IN FOR

...••••••
•• 2 ON THE CARD SW ITCH SETT I NGS

ON:
DRP/E 0

I
DRIVE I

I
.'7 I -1- -2- I -3- -4-:
•••
•••
OFF I :
• 00

.0..0.
'01
'02
TRANSLATION TABLE

DRIVE 0
1/2
: DRIVE I
3/4
: TABLE ENTRY

'0'
'0. ON ON : ON ON

.0..,0
'07
'0.
ON OFF
OFF ON
OFF OFF
:
:
:
ON OFF
OFF ON
OFF OFF
:
:
:

..
.11
912
.,,.
913 03FF FD_TBL:

,----- DRIVE TABLE 0


91.
917 03FF 0132 OW 03060 MAX CYLINDERS
918 0401 04 DB 0.0 MAX HEADS
919 0402 0132 OW 03060 START REDUCED WRITE CURRENT CYL
920 0404 0000 OW 0 START WRITE PRECOMPENSATION CYL
921 0406 OB DB OBH MAX ECC BURST DATA LENGTH
922 0401 05 DB OOOOOlOIB CONTROL BYTE
923 0408 10 DB OIOH STANDARD TIME OUT
924 0409 CO DB OCOH T I ME OUT FOR FORMAT DR I VE
925 0401. 28 DB 028H TIME FOR CHECK DRIVE
926 040B 0132 OW 03060 LANDING ZONE

.2.'.0
921 0400 II DB 0170 SECTORS/TRACK
928 040E 00 DB 0 RESERVED
;----- OR I VE TABLE I
.31
932 040F 0264 OW 06120 MAX CYL I NDERS
933 0411 04 DB 0.0 MAX HEADS
934 0412 0264 OW 06120 START REDUCED WRITE CURRENT CYL
935 0414 0000 OW 0 START WRITE PRECOMPENSATION CYL
936 0416 OB DB OBH MAX ECC BURST DATA LENGTH
931 0411 05 DB 0000010lB CONTROL BYTE
938 0418 28 DB 028H STANDARD TIME OUT
939 0419 EO DB OEOH T I ME OUT FOR FORMAT DR I VE
940 041A 42 DB 042H T I ME FOR CHECK DR I VE
941 041B 0297 OW 06630 LAND I NG ZONE
942 0410 11 DB 0110 SECTORS/TRACK
943 041E 00 DB 0 RESERVED
•••
••• ;----- DRIVE TABLE 2
•••
947 041F 0267 OW 06150 MAX CYLI NOERS
948 0421 04 DB 0.0 MAX HEADS
949 0422 0267 OW 06150 START REDUCED WRITE CURRENT CYL
950 0424 01 2C OW 03000 START WRITE PRECOMPENSATION CYL
951 0426 OB DB OBH MAX ECC BURST DATA LENGTH
952 0427 05 DB OOOOOIOIB CONTROL BYTE
953 0428 28 DB 028H STANDARD TIME OUT
954 0429 EO DB OEOH TIME OUT FOR FORMAT DRIVE
955 042A 42 DB 042H TIME FOR CHECK DRIVE
956 042B 0267 OW 06150 LAND I NG ZONE
957 0420 It DB 0170 SECTORS/TRACK

..•••,
958 042E 00 DB 0 RESERVED

•• 0 ;----- DRIVE TABLE 3

962 042F 0132 OW 03060 MAX CYLINDERS


963 0431 08 DB 080 MAX HEADS
964 0432 0132 OW 03060 START REDUCED WR I TE CURRENT CYL
965 0434 0080 OW 01280 START WRITE PRECOMPENSATION CYL
966 0436 OB DB OBH MAX ECC BURST DATA LENGTH
961 0431 05 DB OOOOOIOIB CONTROL BYTE
968 0438 28 DB 028H STANDARD TIME OUT
969 0439 EO DB OEOH T I ME OUT FOR FORMAT DR I VE
910 0431. 42 DB 042H T I ME FOR CHECK DR I VE
911 04380150 OW 03360 LAND I NG ZONE
912 0430 II DB 0110 SECTORS I TRACK
913 043E 00 DB 0 RESERVED

32 20MB Fixed Disk Drive Adapter BIOS March 17, 1986


IBM Persona! Computer MACRO Assembler Version 2.00 (-10
0lSK2 ---- 10/28/85 FIXED DISK 810S 10-28-85

97.
975 ; ----- - -- ------ ---- - - --------- -------- ----------- -----
976 ; INITIALIZE DRIVE (AH = 09H) :
977
978
979 043F PROC NEAR
980
981 DO OR I VE ZERO
982
983 043F C6 46 F8 OC "OV CMD BLOCK+O, INIT ORV CMD
984 0443 C6 46 F9 00 "OV CMD-BLDCK+I,O - - SET FOR DR I VE 0
985 0447 E8 0458 R CALL INIT DRV R SEND THE PARAMETERS
986 044A 72 08 JC INIT::::DRV::::OUT ERROR?
987
988 DO DRIVE ONE
989
990 044C C6 46 F8 OC "OV CMD 8LOCK+O,INIT DRV CMD
99 I 0450 C6 46 F9 20 "OV CMD-BLOCK+l,OOtOOOOOB SET TO DRIVE I
992 0454 E8 0458 R CALL INIT_DRV_R SEND THE PARAMETERS
993 0457 INIT DRV OUT;
994 0457 C3 - RET EXIT
995 0458 lNIT_ORV
996
997 0458 INIT DRV R PROC NEAR
998 0458 2A CO - SUB AL,AL
999 045A E8 057C R CALL COMMAND I SSUE THE COMMAND
10000450 73 01 JNC BI OX = PORT 0 AFTER CALL
1001 045F C3 RET
\ 002 0460 61 :
1003 0460 8C 09 "OV CX,DS SAVE SEGMENT
1004
1005 ASSUME DS:ABSO
1006 0462 28 CO SUB AX ,AX
1007 0464 8E 08 "OV DS,AX ESTA8L I SH SEGMENT
10080466 C4 IE 0104 R LES 8X ,HF TBL VEC LOAD THE TABLE VECTOR
1009 046A 8E 09 "OV DS,CX- - RESTORE SEGMENT
1010
101 I ASSUME DS:DATA
1012 . - - - - ------ - -- - - ---- - - - - ---- -----
1013 ; DETERMINE PARAMETER TABLE OFFSET
1014 US I NG CONTROLLER PORT TWO AND
1015 DRIVE NUMBER SPECIFIER (0-1)
1016
1017 046C 42 INC OX
1018 0460 42 INC ox ADDRESS PORT 2
1019 046E EC IN AL,DX READ THE SW ITCH SETT I NGS
1020 046F 8A 66 F9 "OV AH ,CMD_BLOCK+ I
1021 047280 E4 20 ANO AH,OOIOOOOOB DRIVE 0 OR I
1022 0475 75 04 JNZ B2
1023 0477 DO E8 SHR AL, I ADJUST
1024 0479 00 E8 SHR AL, I
1025 0478 B2:
1026 0478 24 03 ANO AL,Ol18 ISOLATE
1027 0470 81 04 "OV CL,4
1028 047F 02 EO SHL AL,CL ADJUST
10290481 2A E4 SUB AH,AH
1030 0483 03 08 AOO 8X ,AX
1031 04858409 "OV AH,OOOOl0018 SET MASK FOR DATA MODE CPU TO CARD
1032
1033 SEND DRIVE PARAMETERS MOST SIGNIFICANT BYTE FIRST
1034
10350487 SF 0001 "OV DI, I SEND MS8 OF MAX CYLINDER
1036 048A E8 04E9 R CALL INIT DRV S
1037 0480 72 4C JC 83 - -
1038
1039 048F 8F 0000 "DV PI,O SEND LS8 OF MAX CYL I NDER
1040 0492 E8 04E9 R CALL INIT DRV S
1041 0495 72 44 JC 83 - -
1042
1043 0497 8F 0002 "DV 01,2 SEND THE MAX I MUM HEADS
1044 049A E8 04E9 R CALL INIT DRV S
1045 0490 72 3C JC 83 - -
1046
1047 049F 8F 0004 "OV DI,4 SEND MS8 OF REDUCE WR I TE CURRENT
1048 04A2 E8 04E9 R CALL INIT DRV S CYL I NDER
1049 04A5 72 34 JC 83 - -
t 050
1051 04A7 8F 0003 "OV o [,3 SEND LSB OF REDUCE WRITE CURRENT
1052 04AA E8 04E9 R CALL INIT DRV S CYLINDER
1053 04AD 72 2C JC 83 - -
1054
1055 04AF BF 0006 "OV o [,6 SEND MSB OF WR I TE PRECOMP CYL I NDER
1056 04B2 E8 04E9 R CALL INIT DRV S
1057 0485 72 24 JC 83 - -
\ 058
1059 04B7 SF 0005 "OV DI,5
1060 048A E8 04E9 R CALL INIT DRV S
1061 048072 IC JC B3 - -
1062
1063 04BF 6F 0007 "OV 01,7 SEND ECC BURST LENGTH
1064 04C2 E8 04E9 R CALL [NIT DRV S
1065 04C5 72 14 JC 83 - -
1066
1067 04C7 BF 0008 "OV 01,8 LOAD THE CONTROL BYTE AND PLACE IN
1068 04CA 26: 8A 01 "OV AL, ES: [8X+D I] MEMORY AT 40:76H
1069 04CD A2 0076 R "OV CONTROL_ 8YTE, AL
1070
1071 040026 C9 SUB CX,CX
1072 0402 B4 OF "DV AH,OOOOl1118
10730404 85:
1074 0404 E8 0680 R CALL HD WA IT GO WA I T FOR THE STATE TO HAPPEN
1075 0407 73 09 JNC B6- JMP TO READ THE STATUS 8YTE
1076 0409 E2 F9 LOOP B5 TRY AGAIN
1077 0408 83:
1078 0408 C6 06 0074 R 07 "OV DISK STATUS,INIT_FAIL OPERATION FAILED
1079 04EO F9 STC SET THE ERROR eOND I T I ON
1080 04E I C3 RET
1081 04E2 B6:
1082 04E2 4A OEC DX ADDRESS PORT 0
1083 04E3 EC IN AL,DX READ STATUS BYTE OF THE OPERATION
1084 04E4 24 02 ANO AL,2 MASK ERROR 81T
1085 04E6 75 F3 JNZ 83 ERROR 81T SET?
1086 04E8 C3 RET
1087 04E9 INIT_DRV_R ENDP

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 33


IBM Personal Computer MACRO Assembler Vers,on 2.00 \-11
DISK2 ---- 10/28/85 FIXED DISK BIOS 10-28-85

1088
1089 SEND THE BYTE OUT TO THE CONTROLLER
\ 090
\09\ 04E9 INIT DRV S PROC NEAR
1092 04E9 E8 0680 R - CALL HD WA I T GO WA I T FOR REQUEST
1093 04EC 12 05 JC D'- AFTER CALL OX = PORT 1
1094 04EE 411. DEC DX ADDRESS PORT 0
1095 04EF 26: MOV AL,ES: [BX+Ol ]
10<;16 04F2 EE OUT aX,AL WRITE THE OATil. TO THE CARD
1097 04F3 01 :
1098 04F3 C3 RET
1099 04F4 lNIT_DRV_S ENDP
1100
1101
I 102 READ LONG (AH = OAHI :
1 103
I 104
1I0504F4 RD_LONG PROC NEAR
1106 04F4 E8 050E R CALL CHK LONG ; CHECK LIM I TS
1101 04F7 12 SF JC GS -
1108 04F9 C6 46 F8 E5 MDV CMD BLOCK+O,RD LONG CMD
I 109 04FO BO 47 MDV AL,DMA READ - -
I I \ 0 04FF EB 50 JMP SHORT - DMA OPN
I I I I 050 I ENDP -
II \2
1113
1114 ,----
;
WR ITE LONG (AH = OBHI :
1115
1116
1111 050 I WR_LONG PROC NEAR
1118 0501 E8 050E R CALL CHK LONG ; CHECK LIM I TS
1 I 19 0504 12 52 JC GS -
1120 0506 C6 46 F8 E6 MOV CMD BLOCK + 0, WR LONG CMD
1 121 05011. 80 4B MDV AL,DMA WRITE - -
I 122 050C E8 50 JMP SHORT - OMA OPN
1123 050E WR_LONG ENOP -
1124
1125 050E CHK LONG PROC NEAR
1126 050E 811. 46 FC - MOV AL,CMD BLOCK+4 LOAD THE NUMBER OF SECTORS
11210511 3C 80 CMP AL,080H COMPARE WITH LIMITS
1128 0513 F5 CMC SET THE COND I T I ON
1129 0514 C3 RET
11300515 CHK_LONG ENDP

::.~~
1133 SEEK IAH = OCH) :
1134
1135
1136 0515 DISK SEEK PROC NEAR
1131 0515 C6 46 F8 OB - MOV CMD BLOCK+O, SEEK CMD
11380519 E8 34 JMP SHORT NOMA OPN-
11390518 01 SK_SEEK ENDP -
1140
1141
1142 READ SECTOR BUFFER (AH = OEHI :
1143
1144
1145 051B RD BUFF PROC NEAR
1146 0518 C6 46 F8 OE - MOV CMO BLOCK+O,RD BUFF CMD
1141 051F C6 46 FC 01 MDV CMD-BLOCK+4,1 - - ONLY ONE BLOCK
1148 0523 BO 41 MDV AL,OMA READ
1149 0525 EB 31 JMP SHORT - DMA_OPN
I 150 0527 RD_BUFF ENDP
1151
1152
1153
1154
,-----
;
WR I TE SECTOR 8UFFER (AH = OFHI
1155
1156 0521 WR BUFF PROC NEAR
11510521 C6 46 F8 OF - MOV CMO BLOCK + 0 • WR BUFF CMD
1158 052B C6 46 Fe 01 MDV CMD-BLOCK+4, 1 - - ONLY ONE BLOCK
1159 052F BO 4B MOV AL,OMA WRITE
1160 0531 EB 28 JMP SHORT - OMA _ OPN
11610533 WR _BUFF ENDP
1162
1163 ._-------------------------------------------------------
1164 ; TEST DISK READY (AH = OIOHI :
1165
1166
1 167 0533 TST ROY PROC NEAR
1168 0533 C6 46 F8 00 - MOV CMD 8LOCK+O, TST ROY CMD
1169 0537 EB 16 JMP SHORT NDMA_OPN -
1110 0539 TST_ROY ENDP
1111
1112 ; --- ------ - ---------- ------------- ----
1113 ; RECAL I BRATE (AH = 011HI :
1114
1175
11760539 HD I SK RECAL PROC NEAR
1111 0539 C6 46 F8 01 - MOV CMD BLOCK+O,RECAL CMD
11180530 EB 10 JMP SHORT NOMA OPN -
1119053F HDISK_RECAL ENDP -

34 20MB Fixed Disk Drive Adapter BIOS March 17, 1986


IBM Personal Computer MACRO Assembler VersIon 2.00 [-12
0lSK2 ---- 10/28/85 FIXED DISK 810S 10-28-85

180 PAGE
181 ; - - ---------------- ----------- - ------- - --- - - --- ----------
182 ; CONTROLLER RAM DIAGNOSTICS IAH = 012HI :
183
184
185 053F RAM DIAG PROC NEAR
186 053F C6 46 F8 EO - MOV CMD BLOCK+O,RAM DIAG CMD
181 0543 E8 OA J"P SHORT NOMA OPN -
188 0545 RAM_D I Ar::. ENOP -
189
190
1191 DR I VE 0 I AGNOSTI CS (AH = 013HI :
1192 ; ------ -- ---- ------ - ---------------- --------- ------ - -----
1193
1194 0545 CHK DRV PROC
11950545 C6 46 F8 E3 - MOV
1196 0549 E8 04 J"P
1191 0546 CHK_DRV ENOP
1198
1199 ; --- - -------- ------ --------------------------- ----------
1200 ; CONTROLLER INTERNAL DIAGNOSTICS {AH = 014Hl :
1201
1202
1203 0548 CNTLR DI AG PROC NEAR
1204 0548 C6 46 F8 E4 - MOV CMD BLOCK + 0 ,CNTLR 0 I AG CMO
1205 054F CNTLR_D I AG ENDP --
1206
1201 ; ------- -- ----- ------- ------ - --------- --------- ----- - ----
1208 ; SUPPORT ROUT! NES
1209
1210
1211054F NOMA OPN:
1212 054F BO 02 - MOV AL,02H
1213 0551 E8 057C R CALL COMMAND I S SUE THE COMMAND
1214 0554 72 22 JC Gil
1215 0556 EB 16 J"P SHORT G3
1216 0558 G8:
12110558 C6 06 0074 R 09 "OY
1218 0550 C3 RET
1219 055E OMA OPN:
1220 055E E8 06A5 R - CALL OMA SETUP SET UP FOR OMA OPERAT I ON
1221 0561 72 F5 JC G8 -
1222 0563 BO 03 "OY AL,03H
1223 0565 E8 051C R CALL COMMAND I SSUE THE COMMAND
1224 0568 12 OE JC Gil
1225 056A BO 03 "OY AL,03H
1226 056C E6 OA OUT DMA+l0,AL INITIALIZE THE DISK CHANNEL
1227 056E G3:
1228 056E FA CLI NO INTERRUPTS
1229 056F E4 21 IN AL,INTAOI READ THE MASK
1230 0511 24 OF AND AL,ODFH ENABLE IRQ-5
1231 0513 E6 21 OUT INTA01,AL WR I TE THE MASK OUT
1232 0515 E8 0700 R CALL WAIT_INT PROCEDURE DOES ST I
1233 0518 Gil:
1234 0518 E8 05AD R CALL ERROR_CHK SEE I F THERE I S AN ERROR
1235 051B C3 RET EXIT
1236
1237 ; --------- --------- ----------------- - -------------------
1238 ; COMMAND
1239 ; INPUT TH I S ROUT I NE OUTPUTS THE COMMAND BLOCK
1240
1241 AL = CONTROLLER DMA/INTERRUPT REGISTER MASK
1242
1243
1244
1245 051C COMMAND PROC NEAR
1246 051C E8 0160 R CALL PORT 0 GET THE BASE ADDRESS
1241 051F 42 INC OX -
1248 0580 42 INC OX ADDRESS PORT 2
12490581 EE OUT DX,AL I SSUE CONTROLLER SELECT PULSE
1250 0582 42 INC OX ADDRESS PORT 3
1251 0583 2B C9 SUB CX,CX WA IT COUNT
1252 0585 EE OUT DX,AL WRITE DMA MASK REGISTER
1253 0586 4A DEC OX
1254 0581 4A DEC OX ADDRESS PORT 1
1255 0588 WAIT BUSY:
1256 0588 EC - IN AL,DX READ THE HARDWARE STATUS
1251 0589 24 OF AND AL,OFH
1258 0586 3C 00 C"P AL,Rl BUSY OR RI BUS OR Rl REQ ; CHECK FOR BUSY,COMMAND
1259 0580 14 09 JE CI - - -; AND REQUEST BITS
1260 058F E2 F1 LOOP WA I T BUSY KEEP TRY I NG
1261 0591 C6 06 0014 R 80 "OY 01 SK::::STATUS, T I ME_OUT
1262 0596 F9 STC SET THE ERROR CONo I T I ON
1263 0597 C3 RET ERROR RETURN
1264 0598 CI:
1265 0598 B9 0006 "OY CX,6 SET FOR 6 BYTES OF COMMAND
1266 0598 4A DEC OX ADDRESS PORT 0
1261 059C 88 F5 "OY SI,BP SAVE THE BASE POINTER
1268 059E 83 ED 08 SUB BP,8 SET FIRST BYTE OF COMMAND BLOCK
1269 05AI FA CLI NO I NTERRUPTS I N COMMAND SEQUENCE
1210 05A2 CM3:
1271 05A2 8A 46 00 "OY AL, {BP] GET A COMMAND BYTE
1212 05A5 EE OUT DX,AL ALLOW AT LEAST 2us BETWEEN EACH BYTE
1213 05A6 45 INC BP ON SEND I NG THE COMMAND SEQUENCE.
1274 05A1 E2 F9 LOOP C"3 DO MORE
1215 05A9 88 EE "OY BP,SI RESTORE THE BASE POINTER
1216 05A8 F8 STI I NTERRUPTS BACK ON
1211 05AC C3 RET
1218 05AD COMMAND ENDP

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 35


IBM Person"l Computer MACRO Assembler Version 2.00 1-13
DISK2 ---- 10/28/85 FIXED DISK 8105 10-28-85

1219 PAGE
1280
1281
:
;
-- - -- -- -- - -- - -- -- -- ----- - - -- --- --- - -- -- - - -- - --- - ---- ---
1282 ; SENSE STATUS BYTES
1283 ; BYTE 0
1284 ; BIT 1 ADDRESS VALID, WHEN SET
1285 ; B[T 6 SPARE, SET TO ZERO
1286 ; BITS 5-4 ERROR TYPE
1281 ; BITS 3-0 ERROR CODE
1288 ;
1289 ; BYTE 1
1290 BITS 7-6 ZERO
1291 ; 81T 5 DRIVE (0-1)
1292 ; B[TS 4-0 HEAD NUMBER
1293 ;
1294 ; BYTE 2
1295 ; 81TS 1-5 CYL! NDER HIGH
1296 ; BITS 4-0 SECTOR NUMBER
1291 ;
1298 ; BYTE 3
1299 ; B[TS 1-0 CYLI NOER LOW
1300 ;
1301 i - ---- - - ---------- ----- ----------- ----------------------
1302
1303 05AD ERROR CHK PROC NEAR
1304 05AD AO 0074 R - MOV AL,DISK STATUS ; CHECK IF THERE WAS AN ERROR
1305 0580 OA CO OR AL,AL - ; ANYTHING IN AL?
13060582 15 01 JNZ 021
1301 0584 C3 RET
1308
1309 .-------------- ---- --------------
t 31 0 ; PERFORM SENSE STATUS
1311
1312 SENSE STATUS CAN BE ISSUED MULTIPLE
1313 TIMES
13140585 G21 :
13150585 C6 46 F8 03 MDV CMD BLOCK+O, SENSE CMO
13160569 2A CO SUB AL,AL - WRITE ZERO IN INT/OMA MASK
13110568 E8 051C R CALL COMMAND [SSUE SENSE STATUS COMMAND
1318 058E 1226 JC 024 CANNOT RECOVER-EX I T WITH COMMAND
1319 ERROR
1320 05CO 28 FF SUB DI,OI SET [NDEX PO I NTER TO ZERO
1321 05C2 89 0004 MDV CX,4 READ FOUR BYTES
1322 05C5 84 DB MDV AH,OOOOIOIIB SET MASK FOR DATA MODE CARD TO CPU
1323 05C7 G22:
1324 05C1 E8 0680 R CALL HO WA I T GO WAIT FOR DATA INPUT STATE
1325 05CA 72 lA JC G24
1326 05CC 4A DEC OX ADDRESS PORT 0
1327 05CD EC IN AL,DX READ THE DATA BYTE
1328 05CE 88 43 F8 MDV [OI+CMD BLDCK],AL STORE AWAY SENSE BYTES
1329 0501 47 INC 01 - NEXT DATA LOCAT[ON
t 330 0502 E2 F3 LOOP 022 LOOP TILL ALL FOUR READ.
1331 0504 B4 OF MDV AH,OOOO! II IB SET THE MASK FOR STATUS MODE
1332 0506 E8 0680 R CALL HD WAIT GO WAIT FOR STATUS STATE
1333 0509 12 DB JC G24
1334 05DB 4A DEC OX ADDRESS PORT 0
1335 05DC EC IN AL,OX READ THE STATUS BYTE
1336 0500 A8 02 TEST AL,2 SENSE OPERATION FAIL?
1331 05DF 14 OF JZ STAT_ERR GO GET THE ERROR.
1338
1339 05E 1 C6 06 0074 R FF MDV DISK_STATUS. SENSE_FA I L SET SENSE OPERAT[ON FAIL
1340 05E6 G24:
1341 05E6 F9 STC
1342 05E7 C3 RET
1343 05E8 ERROR_CHK ENDP
1344
1345 05E8 061E R T_O OW TYPE 0 ERROR TYPE .JUMP T A8LE
1346 05EA 062B R OW TYPE-I
1341 05EC 0660 R OW TYPE-2
1348 OSEE 061A R ow TYPE::)
1349
1350 05FO STAT ERR:
1351 05FO 8A 5E F8 - MOV BL,CMD BLOCK+O GET ERROR BYTE
1352 05F3 8A C3 MDV AL,BL -
1353 05F5 24 OF AND AL,OFH
1354 05F7 80 E3 30 AND BL,00110000B ISOLATE THE TYPE OF ERROR
1355 05FA 2A FF SUB BH,BH
1356 05FC BI 03 MDV Cl,3
1351 05FE 03 EB SHR BX, CL ; AD.JUST
13580600 2E: FF A1 05E8 R JMP WORD PTR CS:{8X + OFFSET T_O)
1359
1360 0605 TYPEO TABLE LABEL BYTE
1361 0605 00 20 40 CC 80 00 - DB 0, BAD _ CNTLR ,BAD_SEEK, WR I TE_F AUL T , T [ME_OUT. 0 ,BAD_CNTLR
1362 20
1363 060C 00 40 DB o ,BAD SEEK
1364 = 0009 TYPEO_LEN EQU - S-TYPEO_TABLE
1365
1366 060E TYPE 1 TABLE LABEL BYTE
1361 060E 04 10 02 00 04 - DB RECORD NOT FND. BAD ECC, BAD ADDR MARK. 0, RECORD NOT FNO
1368061340 00 00 II DB DB BAD SEEK ,0-;-0 ,DATA C:ORRECTED,BAO-TRACK --
1369 = OOOA TYPE I_LEN EQU- S-TYPEI_TABLE -
1310
1371 0618 TYPE2 TABLE LABEL BYTE
1372 0618 01 02 01 - DB BAD CMO ,BAD ADDR MARK ,BAD CMD
1313 = 0003 TYPE2_LEN EQU- S-TYPE2_TABLE -
1374
1315 061B TYPE3 TABLE LABEL BYTE
- DB
1316 061B 20 20
1371= 0003 TYPE3_LEN ~~~_CNTL~~ ~~~E~~~~~L~AD _ ECC

36 20MB Fixed Disk Drive Adapter BIOS March 17,1986


IBM Personal Computer MACRO Assernbler Version 2.00 1-14
DISK2 ---- 10/28/85 FIXED DISK BIOS 10-28-85

1318 PAGE
1319 TYPE 0 ERROR
1380
1381 ablE
1382 ablE BB 0605 R MOV eX,OFFSET TYPED TABLE
1383 Ob21 3C 09 eMp AL,TYPEO LEN - CHECK I F ERROR I S OEF I NED
1384 0623 13 62 "AE UNDEF ERR L
1385 0625 2E: 01 XLAT CS:TYPEO TABLE T ABLE LOOKUP
! 386 Ob21 A2 0014 R MOV 01 SK_STATUS,AL SET ERROR CODE
1381 062A C3 RET
1388
1389 :------ TYPE I ERROR
t 390
1391 062B TYPE_l :
1392 Ob2B BB ObOE R MOV BX,OFFSET TYPE I_TABLE
1393 Ob2E 8B CB MOV CX,AX
1394 0630 3C OA eMP AL, TYPE 1 LEN CHECK I F ERROR IS OEF I NED
1395 0632
139b Ob34
13 53
2E: 01
"AE
XLAT
UNOEF ERR L
CS:TYPEI TABLE T ABLE LOOKUP
1391 Ob36 A2 0014 R MOV DISK STATUS,AL SET ERROR CODE
1398 0639 80 E 1 08 AND CL,OSH CORRECTED ECC
1399 063C 80 F9 OB eMP CL ,08H
1400 Ob3F 15 29 "NZ G30
140 I
1402 OBTAIN ECC ERROR BURST LENGTH
1403
1404 0641 C6 46 F8 00 MOV ~~~ A~LOCK + 0 ,RD _ ECC _ CMO
1405 Ob45 2A CO SUB
1406 0641 E8 051C R CALL COMMAND I SSUE THE COMMAND
1401 064A 12 IE X G30
1408 064C B4 OB MOV AH,OOOOI01IB SET MASK FOR DATA INPUT CARD TO CPU
1409 Ob4E E8 06BO R CALL HD WAI T GO WAIT FOR THE INPUT STATE
1410 0651
1411 0653
12
4A
17 "e
DEC
GiO
OX ADDRESS PORT 0
1412 Ob54 EC IN AL,OX READ THE LENGTH OF THE ERROR
1413 0655 8A C8 MOV CL,AL CORRECTED AND SAVE IN CL
1414 0657 B4 OF MOV AH,OOOOIIIIB SET MASK FOR STATUS STATE
14150659 E8 0680 R CALL HD WAI T GO WAIT FOR STATUS STATE
1416 065C
1417 Ob5£
72
4A
OC "e
DEC
G30
OX ADDRESS PORT 0
1418 065F £C IN AL.DX READ THE STATUS BYTE
14190660 A8 02 TEST AL,2 ERROR BIT SEn
1420 0662
1421 0664
14
C6
Ob
06 0074 R 20
"Z
MOV
G30
01 SK_ST ATUS, BAD_CNTLR
1422 Ob69 F9 STG
1423 066A G30 :
1424 066A 8A Cl MOV AL,CL
1425 066C C3 RET
1426
1427 TYPE 2 ERROR
1428
1429 0660
1430 0660 BB 0618 R MOV BX, OFFSET TYPE2 TABLE
1431 Ob70 3C 03 eMp AL. TYPE2 LEN - CHECK I F ERROR I S DEF I NED
1432 0672 13 13 "AE UNDEF ERR L
1433 0674 2£: 07 XLAT CS :TYPE2 TABLE TABLE LOOKUP
1434 0676 A2 0074 R "OV DISK_STATUS,AL SET ERROR CODE
1435 0679 C3 RET
1436
1437 TYPE 3 ERROR
143B
1439 061A
1440 067A BB 061B R MOV BX, OFFSET TYPE3 TABLE
1441 0670 3C 03 eMp AL, TYPE3 LEN - CHECK I F ERROR I S OEF I NED
1442 067F 13 06 "AE UNDEF ERR L
1443 0681 2E: 07 XLAT CS: TYPE3 TABLE T ABLE LOOKUP
1444 0683 A2 0074 R "OV 01 SK_STATUS,AL SET ERROR CODE
1445 0686 C3 RET
1446
1447 0687 UNDEF ERR L:
1448 Ob87 C6 Ob 0074 R BB - MOV DISK_STATUS, UNDEF _ERR
1449 068C C3 RET
1450
1451 .- - - - - -- - - - - - - -- - - - - -- - - - - -- - - - - - - --
- - -
1452 ; ON ENTRY AH CONTA I NS THE CONTROLLER BUS STATUS DECODE :
1453
1454 .; - MASK USED TO CHECK THE HARDWARE STATUS. :
- - - - - - - -- - - - - - - - -- - - - -- - - - -- - - - - -- - - - - - - - - -- -- - - - - - ---
-
1455 Ob80 HD_WAIT PROC NEAR
1456 0680 51 PUSH CX SAVE CX
1451 068E 2B C9 SUB CX, CX SET THE LOOP COUNT
1458 0690
1459 0690 E8 0760 R CALL PORT 0
1460 0693 42 INC OX - PORT 1 ADDRESS
1461 0694 £C IN AL,DX READ-THE HARDWARE STATUS
1462 0695 24 OF AND AL,OOOOIIIIB CLEAR UPPER NIBBLE OF HARDWARE STATUS
1463 0697 3A C4 eMp AL,AH CHECK THE STATE WITH THE MASK
1464 0699
\ 465 069B
74
E2
08
F3
"Z
LOOP
L2
LI
.)MP t F o. K Wt TH CARRY CLEARED
TRY AGAIN
1466 0690 C6 06 0074 R 80 "OV o t SK_ST ATUS. T I ME_OUT
1467 06A2 F9 STe SET ERROR CONO I T I ON
1468 06A3 L2:
1469 06A3 59 ex RESTORE CX
1470 06A4 C3
1471 06A5

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 37


IBM Personal Computer MACRO Assembler Version 2.00 1-15
DISK2 ---- 10128185 FIXED DISK BIDS 10-28-85

1472 PAGE
1413 ; -------------- -----------------------------
1474 DMA SETUP
1475 ; - THIS ROUTfNE SETS UP FOR DMA OPERATIONS.
1476 INPUT
1477 (ALl =
MODE BYTE FOR THE DMA
1478 (ES:BX) =
ADDRESS TO READ/WRITE THE DATA
1479 OUTPUT
1480 ; (AX' DESTROYED
148 I ; ----------- - -------------------------------------------
1482
1483 06A5 DMA SETUP PROC NEAR
1484 06A5 80 7E FC 81 - CMP CMO BLOCK +4,81 H BLOCK COUNT OUT OF RANGE
1485 06A9 72 02 JB JI -
1486
1487 06AB F9 STC SET THE ERROR COND I T I ON
1488 06AC C3 RET
1489
1490 D6AD ,)1:
1491 06AD FA CLI NO MORE INTERRUPTS
1492 D6AE E6 DC OUT DMA+12,AL SET THE FIRSTfLAST FIF
1493 06BO BI 04 MOY CL,4 SH 1FT COUNT
1494 0682 E6 08 OUT OMA+ I I,AL OUTPUT THE MODE 8YTE
1495 0684 8C CO MOY AX,ES GET THE ES VALUE
1496 D6B6 D3 CO ROL AX,CL ROTATE LEFT
1497 06B8 8A E8 MOY CH,AL GET HIGHEST NIBBLE OF ES TO CH
1498 068A 24 FO AND AL,OFOH ZERO THE LOW NIBBLE FROM SEGMENT
1499 D6BC 03 C3 ADD AX,BX TEST FOR CARRY FROM ADD I T I ON
1500 D6BE 80 05 00 AOC CH,O CARRY MEANS HIGH 4 B[TS MUST BE [NC
1501
1502 06CI 88 FO MDY S[ ,AX SAVE START ADDRESS
1503 06C3 E6 06 OUT DMA+6,AL OUTPUT LOW ADDRESS
1504 06C5 8A C4 MOY AL,AH
1505 06C7 E6 06 OUT DMA+6,AL OUTPUT HIGH ADDRESS
1506 06C9 8A C5 MOY AL,CH GET HIGH 4 BITS
1507 06CS 24 OF AND AL,OFH
1508 06CO E6 82 OUT DMA_HIGH,AL OUTPUT THE HIGH 4 BITS TO PAGE REG
1509
1510 ;------ DETERMINE COUNT
1511
1512 06CF 8A 66 FC MOY AH,CMD BLOCK+4 RECOVER BLOCK COUNT
t 513 0602 DO E4 SHL AH, I - , MULTIPLY BY 512 BYTES PER SECTOR
1514 0604 32 CO XOR AL,AL ; CLEAR LOW BYTE
1515060648 DEC AX AND DECREMENT VALUE BY ONE
t 516
1517 HANDLE READ AND WRITE LONG (5160 BYTE BLOCKS)
1518
15190607 80 7E F8 E5 CMP CMD BLDCK+O,RD LONG CMD
1520 06DB 74 06 JE ADD4 --
1521
1522 0600 80 7E F8 E6 CMP
1523 06El 75 OF JNE
1524 06E3 ADD4:
1525 06E3 88 0204 MOY AX,516D ONE BLOCK (512) PLUS 4 BYTES ECC
1526 06E6 53 PUSH BX
1527 06E7 2A FF SUB BH,8H
1528 06E9 8A 5E FC MOY BL,CMD BLOCK+4
1529 D6EC 52 PUSH OX -
1530 D6ED F7 E3 MUL BX BLOCK COUNT TIMES 516
1531 06EF 5A POP OX
1532 06FO 58 POP BX
1533 D6FI 48 DEC AX ADJUST
1534 06F2 ,)20:
1535 06F2 86 C8 MOY CX,AX SAVE COUNT VALUE
1536 06F4 E6 07 OUT OMA+7,AL LOW BYTE OF COUNT
1537 OoF6 8A C4 MOY AL,AH
1538 06F8 E6 07 OUT DMA+7,AL HIGH BYTE OF COUNT
1539 06FA F8 ST I INTERRUPT 5 BACK ON
1540 06FB 88 C6 MOY AX,51 RECOVER ADDRESS VALUE
1541 06FD 03 Cl ADO AX,CX ADD, TEST FOR 64K OVERFLOW
1542 06FF C3 RET RETURN TO CALLER,
1543 CY SET BY ABOVE I F ERROR
1544 0700 DMA_SETUP ENDP

38 20MB Fixed Disk Drive Adapter BIOS March 17,1986


IBM Personal Computer MACRO Assembler Vers'on 2.00 1-16
DISK2 ---- 10{28{85 FIXED DISK BIOS 10-28-85

1545
1546
1541
:
PAGE
-;~ ~ ~-~~~--- - - - -- -- ---- -----------
1548 ; - THIS ROUTINE WAITS FOR THE FIXED DISK
1549 ; CONTROLLER TO SIGNAL THAT AN INTERRUPT
1550 ; HA S OCCURRED.
155 I
1552
1553 0700 WAIT INT PROC NEAR
1554 - ASSUME DS:ABSO
1555 0700 FB STI TURN ON INTERRUPTS
1556 0101 8C DB MO' BX,DS SAVE OS
1551 0103 2B CO SUB AX,AX
1558 0705 8E 08 MO' OS,AX EST ABL I SH SEGMENT
1559 0701 C4 36 0104 R LES SI,HF_TBL_VEC LOAD THE TABLE VECTOR
1560
1561 ASSUME OS: DATA, ES: NOTH I NG
1562 070B 8E DB MO' DS,BX RESTORE OS
1563
1564 ; -- SET TIMEOUT VALUES
1565
1566 0700 2A FF SUB SH,BH
1561 010F 26: 8A 5C 09 MO' BL ,BYTE PTR ES: [S[] (9) LOAD THE STANDARD T I ME OUT
1568 0113 8A 66 F8 MO' AH,CMD BLOCK+O
1569 0716 80 FC 04 eMP AH,FMTDRV_CMD
1510 0719 15 06 JNZ 05
1511
1512 071B 26: 8A 5C OA MO' BL,BYTE PTR ES:[S[)[OAH] LOAD THE FORMAT DR I VE
1513 071F EB 09 JMP SHORT O. T[ME OUT VALUE
15740721 80 FC E3 W5: CMP AH,CHK_DRV_CMD
1575 0724 75 04 JNZ O.
1576
1577 0726 26: 8A 5C OB MO' BL,BYTE PTR ES:[SI)[OBH) ; LOAD THE CHECK DR I VE
1578 07211. W4: CLEAR ~Y Tl ME OUT VALUE
1579 072A F8 eLC
1580 072B B8 9000 MO' AX,9000H DEV I CE WA I T INTERRUPT
1581 072E CO 15 INT 15H
1582 0730 FB ST I ENABLE [NTERRUPTS FOR PC AND
1583 XT MACH I NES.
1584 0131 2B C9 SUB CX,CX SET THE LOOP COUNT
1585
1586 WA [T FOR 1NTERRUPT
1587
1588 0733 WI:
1589 0733 E8 0160 R CALL PORT 0
1590 0736 42 INC ox - PORT I ADDRESS
1591 0131 EC IN AL,OX READ-THE HARDWARE STATUS
1592 0138 11.8 20 TEST AL,020H 0[0 I NTERRUPT OCCUR
1593 07311. 15 Oil. JNZ 02 .JUMP [F YES
1594
1595 013C E2 F5 LOOP 01 INNER LOOP
1596 013E 4B DEC BX
1591 073F 75 F2 JNZ 01 OUTER LOOP
1598
1599 0741 C6 06 0074 R 80 MOV DISK STATUS,TIME_OUT
1600 0746 W2:
1601 0746 411. DEC ox ADDRESS PORT 0
1602 0747 EC IN AL,DX READ THE STATUS BYTE
1603 0748 24 02 AND AL,2 ISOLATE THE ERROR B[T
1604 074A 08 06 0074 R OR DISK STATUS,AL SAVE I N THE STATUS
1605 074E 83 C2 03 ADO DX,3- PORT 3 ADDRESS
1606 0151 32 CO XOR AL,AL ZERO-
1607 0753 EE OUT OX,AL RESET I NTERRUPT MASK
1608 0754 C3 RET
1609
1610 0755 ENDP
1611
1612 ;--- HD INT
1613
1614 FIXED DISK INTERRUPT ODH ROUTINE IRQ-5
1615
1616
1617
1618 0155 PRoe NEAR
16190755 50 PUSH AX SAVE WORK REGISTER
1620 0156 BO 01 MOV AL,07H SET OMA MODE TO 0 I SABLE
1621 0158 E6 OA OUT DMA+IO,AL
1622 01511. FA eLi NO INTERRUPTS
1623 075B E4 21 IN AL,INTAOI LOAD THE I NTERRUPT ENABLE MASK
1624 0150 OC 20 OR AL,020H TURN OFF FIXED DISK IRQ-5
1625 015F E6 21 OUT INTAOI,AL REPLACE THE MA SK
1626 0761 BO 20 MOV AL,EOI LOAD THE END OF INTERRUPT MASK
1627 0763 E6 20 OUT [NTAOO,AL CLEAR THE ACT [VE I NTERRUPT LEVEL
1628 0165 FB STI I NTERRUPTS BACK ON
1629076688 9100 MOV AX,9100H DEV ICE POST
1630 0169 CO 15 INT 15H INTERRUPT
1631 016B 58 POP AX RESTORE AX
1632 016C CF IRET
16330160 ENDP
1634
1635
1636
: -~~~~~---------------- - -------- ---------
1631 GENERATE PROPER PORT VALUE
1638 BASED ON THE PORT OFFSET
1639
1640
1641 0160 PORT_O PROe NEAR
1642 0760 BA 0320 MOV OX,HF PORT BASE VALUE
1643 0170 02 16 0011 R ADO OL,PORT_OFF ADD [N OFFSET VALUE (00,04,08,OC)
1644 0174 C3 RET
1645 0175 PORT_O ENOP
1646
1647 0775 END ADDRESS LABEL BYTE
1648 0175 CODE ENDS
1649 END

March 17, 1986 20MB Fixed Disk Drive Adapter BIOS 39


Notes:

4020MB Fixed Disk Drive Adapter BIOS March 17, 1986


Index

~
addresses, port 14 fixed disk controller 1
fixed disk drive types 3

[!J
BIOS listings 23
block diagram 2 interface 15
interface signals
AEN 15
AO-AI9 15
-DACK 3 16
DO-D7 15
command summary 10 DRQ 3 15
connectors 17 -lOR 15
control byte 8 -lOW 15
controller, fixed disk 1 IRQ 5 15
RESET 15

[EJ
data register 7
description 1 logic diagrams 19

[!]
error tables 5

March 17, 1986 20MB Fixed Disk Drive Adapter Index-l


port addresses 14 sense bytes 4
programming specifications 17
considerations 3 status register 4
programming summary 14 switch settings 3

registers 1 TTL levels 17

Index-220MB Fixed Disk Drive Adapter March 17, 1986

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy