From Atariki
Revision as of 01:05, 11 gru 2004;
view current revision←Older revision |
Newer revision→
Date: 28 Dec 1995 15:20:18 -0500
From: CONRADUS@plearn.edu.pl (KMK)
A message to Operating Systems/Disk Operating Systems developers.
Dear developer!
We are pleased to present you a preliminary document about our
IDE hard drive interface for Atari 130XE (and compatible)
computers. As existing Disk Operating Systems aren't able to use
all the capabilities we provided, we are kindly asking you to
upgrade the latest versions of your work and implement the
specific IDE features, those have been described below. The four
general problems we found trying to use any of the existing
DOSes, are as follows:
1) All DOSes we tested, i.e. SpartaDOS 3.2g, SpartaDOS X 4.20,
MyDOS 4.53 and BWDOS 1.10, when they have been executed, seem to
force the DUNIT (301) value to 1. Such action is not
necessary, because the DUNIT is already set by the XL OS's RESET
routines, and is obnoxious, because, as a result, the DOS is
unable to read its config files, when the system has been started
from a partition other, than D1:.
2) All the DOSes we tested are unable to read/write 512-byte
sectors, so they are unable to work in the IDE native mode (see
below). The interface provides the emulation mode to handle 256-
byte sector operations, but, as a result, the drive is unable to
reach its full speed. Especially any writes to the hard drive are
very slow. The implementation of the 512 byte allocation units
may also be profitable in the future, if we decide to add support
for DMA transfers.
3) All the DOSes we tested are unable to handle big partitions
(i.e. over 16 MB limit). The implementation of the 512 byte
allocation units may solve this problem in a part (the limit
would be 32 MB per partition then), but, if you decide to
implement big partitions handling, we advise you to consider
about using the 23-bit sector addressing in conjuntion with the
larger allocation units (see below for details).
4) All the DOSes we tested are unable to handle disks D10-D15.
Operating Systems developers please note, that there is no
necessity to set the DUNIT value in the OS BOOT routine, as the
DUNIT is already set by previous RESET routines.
We hope, that you will take these problems into consideration,
decide to support the features described below and don't hesitate
to send us your comments, if any.
Regards
Konrad Kokoszkiewicz
E-mail: conradus@plearn.edu.pl
S-mail: ul. Tomaszowska 95/37
PL-26-420 Nowe Miasto nad Pilica
POLAND
***
IDE Hard Drive Interface v.1.0 - a preliminary document
Copyright (c) 1995-1996 by Jacek Zuk and Konrad Kokoszkiewicz
Made in Poland
***
The IDE package contains:
1) the IDE interface
2) a power supply
3) a cable to connect the interface with a drive
4) utilities disk with MyDOS 4.53
5) this document
Index rerum
I. Introduction
II. Capabilities overview
III. How to make it work (step by step)
IV. Keystrokes
V. Write-protection feature
VI. Executing non-DOS software
VII. Dual drive configuration
VIII. Software development information
IX. Memory usage
X. Error messages
I. Introduction
Seven years ago, when I first heard about hard drives for the
Atari 8-bit, a 20 MB SCSI device's price was over 600 USD and, of
course, was out of reach for people in a country on the wrong
side of the Iron Courtain, where wages were about 20 USD per
month. The 1050 floppy drive was a dream - what would I say about
the hard one...?
Over the next six years many things have been changed. Among
others, the Iron Courtain got rusty, we have started earning more
money, got some new Atari computers and, simultaneously, the
prices of hard drives have gone down dramatically... and one day
I realised, that it is possible to obtain an IDE hard drive for
the beloved 8-bit Atari with very reasonable price! But there
still was no documentation and the only one, that I knew, was a
theory about writing 'new device' handlers for the XL operating
system...
The most important thing on my "way to the hard drive" has
happened, when a friend of mine has found a "Technical Reference
Manual" for a Caviar WDAC2200. I read this paper very carefully,
then went to Jack - a person, who looks to know everything about
wires and other strange gadgets, those have been fixed inside and
seem to make it work. About a week later Jack said, that there
was no objections (contraindications, as we used to say) to build
an interface - so the project started.
The last year we spent thinking, talking, building the hardware
(Jack), writing the software (me), testing, fixing bugs, catching
incompatibilities, and learning, learning, learning. We have
discovered a lot of strange things about Ataris and IDE hard
drives (some of them have been mentioned below). Finally, we are
pleased to present you our results - we tried to make them as
professional, as it have been allowed by the limited (2k) ROM
space, not very "elastic" operating system and not very great
processing power of the Atari 8-bit computer. I hope you will
agree, that we did a good job.
II. Capabilities overview
The Interface's internal software provides two modes: native and
emulation. The native mode uses a 512 byte physical block as a
logical data sector, the emulation mode uses the physical block
to store two 256 byte logical data sectors. ALL existing DOSes
require the emulation mode to work properly.
Maximum drive capacity: 8388607 physical blocks on each device.
Maximum number of partitions: 15
Maximum capacity of a partition: 8388607 logical sectors
Logical sector length: 256 or 512 bytes (larger blocks will be
implemented in the future)
Average speed: 58 kilobytes per second (native mode, R/W)
32 kilobytes per second (emulation mode, reading)
7 kilobytes per second (emulation mode, writing)
Booting from any partition
Write protection capability
8 jumpers to set the device number for the operating system
Note, that ALL existing DOSes limit the partition size to 16 MB.
III. How to make it work (step by step)
1) Make sure, that the power on your computer is turned off.
2) Insert the interface to the connector at the back side of the
computer.
3) Connect the interface and a 3,5" IDE drive with the cable.
Caution: You may damage the drive if the interface cable is not
connected properly. Make sure, that pin 1 on the cable (red line)
is connected to pin 1 on the drive and on the interface (red
dot).
4) Connect the power supply and the drive.
5) Insert the utilities disk into drive 1.
6) Turn on the power on the hard drive and on the computer
holding down the SHIFT key. Make sure, if the drive is spinning
up properly. If not, turn the power off, check the connections
and try again. Note, that some very old drives need A LOT of
power, so our power supply may not be sufficient.
7) Be patient - the Interface waits some seconds when the drive
is spinning up.
8) When the MyDOS is ready to use, execute the FDISK.COM file.
9) A menu should appear. If you see a message like "Device not
found" instead, please turn the power off, check the connection
between the interface and the computer, then try again. Check the
jumper position.
10) Select the "Surface test" from the main menu. Your drive will
be tested for bad sectors. If the test finishes without any
message, the drive is in good condition - no bad sectors have
been found.
11) Select the "Partitioning" from the main menu. "Total" will
indicate you total amount of 512 byte sectors, that have been
found on the drive, "Remain" - total amount of sectors, that
haven't been allocated yet, "Specs" will show a number of
cylinders, heads and sectors per track.
12) Use arrows to select a drive you want to be a partition.
13) Press the RETURN key and type in a number of sectors, that
you want to be allocated to the partition. Note, that it is a
number of real, 512 byte sectors, so if you specify 32767, the
DOS partition will have 65534 logical, 256-byte sectors.
14) Press RETURN to confirm the number of sectors or press ESC
key to cancel.
15) If you want to have more partitions, repeat the last three
steps as many as you want.
16) Press the TAB key and select a partition, that you want to be
the BOOT partition. If you are the SpartaDOS X user and you want
to have the CONFIG.SYS on the hard drive, the BOOT partition must
be D1:, so you should change the physical number of your floppy
drive to D2: or another.
17) Press RETURN key to set the BOOT partition.
18) Press the TAB key to move the cursor to the menu at the
bottom right corner of the screen.
19) Select the "Opts" option.
20) Select the boot type according to your system configuration:
- "control", if you want to boot up MyDOS (or another DOS) from
other partition than D1: The interface will take full control
over the boot process.
- "pass", if you want to boot up MyDOS (or another DOS) from D1:
The interface will pass the control over the boot process to the
operating system. Select this option, if you have any troubles
with the "controlled" boot up - the interface, taking the control
over the boot process, uses some hints that may not work with
some DOSes, cartridges or upgraded (customized) operating
systems. You MUST select this option, if you are the SpartaDOS X
user.
21) Press ESC to exit the "Options" menu
22) Select the "Write" option to write the new partition table to
the drive.
23) Press ESC to return to the main menu
24) Select the "Soft format" option from the menu. The FDISK will
attempt to build new directories on the attached partitions.
Note, that the SpartaDOS 3.2 does not provide such action - to do
it, you must use a separated formatter, as the P_FORMAT.COM.
25) Exit the FDISK.
26) Write the DOS file(s) to the BOOT partition. If you are the
MyDOS user, select the "H" option from the DUP menu. If you are
the SpartaDOS 3.2 user, copy the DOS to the BOOT partition and
use the BOOT command to make the disk bootable.
27) Press SELECT/RESET to cause the cold boot. The DOS will load
itself from the drive - the installation process is completed.
Some IDE drives used to clear the BUSY and assert the READY bits
in their internal status registers *before* the spin-up process
is finished - the drive looks to be ready, but isn't ready in
fact and cannot execute any commands (very strange, by the
way...). To prevent such troubles during power up, the internal
software waits about 5 seconds before taking any action with the
IDE controller. This delay is not necessary during the cold boot,
that has been caused by pressing SELECT/RESET or via OS entry
RESETCD (477). In such case the internal software uses a fast
initialization method. However, if you turn the power switch off
and on very quickly, the initial routines may not recognize this
boot process as a real power up. As a result, the boot process
will crash. To prevent such problems, after turning the power
off, you should always wait 10-15 seconds before turning it on
again. This time should be sufficient to invalidate internal
flags, that have been located in RAM.
IV. Keystrokes
SHIFT/RESET disables the drive. The drive will remain spinning,
but the partitions will not respond to operating system requests
(error 138). To enable it again just press the RESET key.
SELECT/RESET forces the cold boot.
V. Write-protection feature
The IDE hard drive interface provides the write-protection
feature to minimize a risk of accidental data damage caused by
viruses, damaged software or children. When a partition is
locked, there's NO POSSIBILITY to write data to this partition or
unlock it by asserting commands, causing a cold boot or turning
the power off and on. Damaging a write-protected partition by
writing accidental data to random memory locations is also
*practically* impossible - the risk is very small.
VI. Executing non-DOS software with the hard drive
Some software, especially games and demos, have their own disk
formats and cannot be copied to a partition. However, the IDE
software provides limited capabilities to execute such programs.
If you selected the "controlled" hard drive boot when
partitioning the drive and your BOOT partition is not the D1:,
you may run the non-DOS disk from the floppy drive. To do it,
insert the disk into the floppy disk drive then press SELECT and
RESET keys holding down the SHIFT key. The internal software of
the IDE Interface will pass its initialization routines and your
computer will boot up from the floppy. The hard drive will be
"invisible" for the system.
If you want to execute such software from the hard drive, you
must provide a small partition to use it in such manner. Though
the D10-D15 partitions are invisible for existing operating
systems and cannot be accessed by DOS, they may be booted as
well. When you are partitioning your drive, create a small (up to
520 physical blocks) disk, for example D10:. When you complete
the installation and make the drive work, execute the FHCOPY.COM
file from the utilities disk, then copy your floppy to the D10:.
Now execute the FDISK, select the "Partitioning" option from the
main menu, then press the TAB key twice to move the cursor to the
menu at the bottom right corner of the screen. Select the "Opts"
option, then set the "Drive redirection" to D10:. If the
"controlled" boot-up has been selected, you must change it now to
the "pass" mode. Write new partition table, exit the FDISK and
reboot the system - the non-DOS program will load itself from the
hard drive. To return to the previous configuration, insert the
utilities disk to your floppy disk drive, reboot the system
holding down the SHIFT key, then execute the FDISK, reset the
"Drive redirection" to D1: and "Boot type" to its previous state,
write the new partition table, exit the FDISK and reboot the
system.
VII. Dual drive configuration
The IDE drive interface is able to handle two IDE devices
configured as master and slave drives (please refer the drive
manual to connect it and set up properly). However, some drives,
when they are configured to work as the slave device, used to
wait some seconds before they start spinning. For this reason,
the Interface DOES NOT INITIALIZE the slave drive during power up
or reset. It would make little sense, because the drive is not
spinning (i.e. is not ready) at that time. As a result, the slave
drive remains not initialized, even if the boot process has been
finished and the system looks to be ready to use.
If the slave drive have finished the spin-up process, there are
two ways to make it work properly:
1) assert the ALL RESET command (see next section), or
2) force the system to read a sector from any partition, that
have been allocated to the slave drive - if the drive is ready,
it will be recalibrated automatically.
Please DO NOT start the operating system from the slave drive
partitions.
VIII. Software development information
The IDE drive partitions operate as normal floppy drives or
ramdisks and can be accessed via OS DISKINT (453) and SIOINT
(459) routines. All the partitions recognize the following
commands:
1) Standard subset
R - read a sector - this command reads a specified logical sector
from a specified partition. It reads ALWAYS THE WHOLE LOGICAL
SECTOR, i.e. 256 or 512 bytes, according to the current mode and
regardless of the DBYT value. The sector number is a 24-bit
value, the most significant byte (now called DAUX3) is located at
307 (this byte was unused by the XL OS). Sector numbers less
than 00001 or greater than maximum sector number for the
specified partition are invalid and will cause the error 144.
P - put a sector - writes data to a specified logical sector on a
specified partition. There are the same restrictions, as
mentioned above. This command will return status 144 when
attempting to execute on a write-protected partition.
W - write a sector - the same, as "P" command.
S - read status block - transfers the 4-byte disk status to the
memory. The bit of the first byte are as follows:
7 - not used by the hard drive
6 - write protection enabled
5 - double density drive (always 1)
4 - master present (usually 1)
3 - slave present
2 - not used by the hard drive
1 - not used by the hard drive
0 - not used be the hard drive
The second byte provides reversed (eor'ed with F) value of the
IDE controller error register. The bits are as follows:
7 - BBD - Bad block detected
6 - ECC - Error correction code (uncorrectable error)
5 - NUL - unused, always 1
4 - IDNF - ID not found (target sector could not be found)
3 - NUL - unused, always 1
2 - AC - Aborted command
1 - TK0 - Track 0 error (unable to find a valid track 0)
0 - DAMNF - Data address mark not found
The normal (default) value of this byte is F. The next byte has
a dummy value 0. The last byte of the status block holds the
number of retries for the software IDE handler in ROM.
N - read configuration - reads the 12-byte PERCOM block to the
memory. The values returned by a partition are as follows:
0 - number of tracks (always 1)
1 - revision number (0 = 1.0)
2 - total number of logical sectors, the middle byte
3 - total number of logical sectors, the low byte
4 - total number of logical sectors, the high byte
5 - additional information:
bit 3 - IDE hard drive partition (always 1)
bit 2 - double density drive (always 1)
bit 1 - 8 inch floppy disk drive (always 0)
6 - number of bytes per logical sector, high byte
7 - number of bytes per logical sector, low byte
8 - unused, always F
9 - value 9
10 - value 4
11 - value 5
The last three bytes contain an identifier of the hard drive type
("IDE").
2) Specific ones
6 - sleep drive - stops the drives and deactivates their
internal controllers. See ALL RESET command for the DCB variables
details.
7 - all reset - resets, recalibrates and reinitializes both
hard drives. It is the only way to exit the Sleep mode. This
command needs the number of any partition stored to the DUNIT
(301). The master drive must be present while asserting this
command, otherwise the timeout error will occur.
C - identify drive - transfers the 512 bytes of data, that
specify the drive's parameters. The fields are as follows (F =
fixed value, V = variable, R = reserved, should be zero):
0 - vendor specific information, bits are as follows:
15 - 0, reserved for non-magnetic devices (F)
14 - vendor specific (F)
13 - vendor specific (F)
12 - vendor specific (F)
11 - vendor specific (F)
10 - vendor specific (F)
9 - vendor specific (F)
8 - vendor specific (F)
7 - removable media device, if 1 (F)
6 - removable controller and/or device, if 1 (F)
5 - vendor specific (F)
4 - vendor specific (F)
3 - vendor specific (F)
2 - vendor specific (F)
1 - vendor specific (F)
0 - reserved (R)
2 - number of cylinders (F)
4 - reserved (R)
6 - number of heads (F)
8 - vendor specific
10 - vendor specific
12 - number of sectors per track (F)
14 - vendor specific
16 - vendor specific
18 - vendor specific
20-39 - serial number, ASCII characters (F)
40 - vendor specific
42 - vendor specific
44 - number of ECC bytes transferred on LONG operations (F)
46-53 - firmware revision, ASCII characters (F)
54-93 - controller model number, ASCII characters (F)
94 - numbers of sectors/interrupt R/W multiples, bits:
15-8 - vendor specific
7-0 - 0 = READ/WRITE MULTIPLE not implemented (F)
1-F = maximum number of sectors that can be
transferred per interrupt on READ/WRITE MULTIPLE commands (F).
96 - reserved (R)
98 - capabilities, bits:
15 - reserved (R)
14 - reserved (R)
13 - 1 = standard standby timer values are supported
0 = standby timer values are vendor specific (F)
12 - reserved (R)
11 - 1 = IORDY supported (F)
0 = IORDY may be supported (F)
10 - 1 = IORDY can be disabled (F)
9 - 1 = LBA supported (F)
8 - 1 = DMA supported (F)
7-0 - vendor specific (F)
100 - reserved (R)
102 - PIO data transfer cycle timing (F)
104 - DMA data transfer cycle timing (F)
106-511 - reserved
All values are in standard low/high convention. Some parameters
are defined as a string of ASCII characters. For the string
"Copyright", the character "C" is the first byte, "o" is the
second byte etc. When such fields are transferred, the order of
transmission is:
- the 1st character ("C") is on bits 15 through 8 of the 1st word
- the 2nd character ("o") is on bits 7 through 0 of the 1st word
- the 3rd character ("p") is on bits 15 through 8 of the 2nd word
- the 4th character ("y") is on bits 7 through 0 of the 2nd word
etc.
Note, that the DMA transfers, although may be supported by the
drive itself, may not be supported by the current version of the
interface's hardware. Please also refer the SLEEP DRIVE command
to get an information about the DCB variables.
E - force media change - forces the interface to re-read the
partition table from the drive.
All other commands will cause error 139 (negative acknowledge).
Note, that the software does not provide a FORMAT DISK command -
it hasn't been implemented to prevent an accidental data damage.
The drive must be formatted using a separated program.
Operating system developers should note, that the internal
software of the IDE Interface changes the DUNIT (301) to the
BOOT partition number during boot up.
IX. Memory usage
The Interface's internal software uses the following RAM
locations: 1 and 4-C. The PDVMSK (247), PDVRS (248) and
DCB variables (especially DAUX3 307) should be used only in
their proper functions (please DO NOT use them as temporary data
registers!). The 400-6FF area should also remain intact
during the cold boot.
X. Error messages
You can get the following error reports from the IDE drive:
138 - Timeout error - attempting to read or write data to a
partition, that is physically allocated to the slave drive, while
the slave drive is busy, not ready or does not exist at all; or
attempting to assert the ALL RESET command, while the master
drive is not present. It may occur, if you accidentally
disconnect the master drive or disconnect the slave drive without
reconfiguring your system. It may also indicate a damaged
partition table - please reboot your system. If this action
doesn't cause any effect, you must use the FDISK to repair the
partition table. See also section VII. - "Dual drive
configuration".
139 - Invalid command
144 - Device done error:
1) the software attempted to write data to a write-protected
partition.
2) the software attempted to read or write data outside of the
limits, those are valid for the partition.
3) there is a bad sector on the partition. Please assert the "S"
command to get the value of the internal IDE error register.
4) the interface's software is unable to handle your drive.
Please run the FDISK and select the "Surface test" from the main
menu. If the test fails and you know, that your drive is in good
condition (no bad blocks) for sure, please assert the IDENTIFY
DRIVE command (from a BASIC, for example), copy the buffer to a
file and send the file to us.
Konrad M.Kokoszkiewicz (KMK)
E-mail: conradus@plearn.edu.pl
** Ea natura multitudinis est:
** aut servit humiliter, aut superbe dominatur. (Livius)
********************************************************