Last update:
3 V 2019

== Extensions ==
* Information
* Downloads
== 65C816 XL OS ==
* Information
* Change log
* Compatibility list
* Download
== IDE Plus ==
* Information
* Download
== Fixes ==
* Downloads
== U-BASIC ==
* Information
* Downloads
== MultiBASIC ==
* Information
* Change log
* Download
== SysInfo ==
* Information
* Download
== Other stuff ==
* Downloads


The "KMK/JŻ IDE" ATA Interface

The interface known as "KMK/JŻ IDE" is an ATA/ATAPI host adapter for Atari XE computers, where by ATA and ATAPI I mean mostly IDE disk drives and ATAPI CD-ROMs. It plugs into the CARTRIDGE/ECI connector at the back of the computer. The prototype was designed (hardware-wise) and built in 1995 by Jacek Żuk (JŻ), and the software was written by me (KMK) - hence the interface's name, "KMK/JŻ". The device was first publicly shown at an Atari meeting in January 1996.

The interface is a type of peripheral which is sometimes called "new device". It uses a clever mechanism invented by Atari engineering (in 1982), which allows the system to automatically detect and initialize I/O devices at startup time. It contains a bit of own RAM and ROM occupied by the routines responsible for handling the disk transfers. If the user program or the DOS calls the Sector I/O interface (aka SIO), the XL OS activates this external memory for the transfer time, jumps to the handler, and being back restores the normal memory state (the interface's memory disappears from the 6502 address space). This also gets some support - but not much - from the computer's hardware.

You can learn more about it in Atariki (Polish).

Interface operation

The data is transferred from and to the disk in PIO mode (not DMA), through a 16-bit data port. The driver works in CHS mode. The reason to use CHS instead of LBA is quite prosaic:

  1. in the years back when we built the interface, few disks supported LBA, the vast majority worked in CHS only;
  2. the LBA mode is optional for ATA devices even now, and CHS is always present being simply obligatory. Even some Compact-Flash cards happen to know CHS only!

Although the CHS is used, the data transfer is very fast. Depending on the partition "density" (below) it may vary from about 35 to about 64 kilobytes per second while transferring files under SpartaDOS X. That's quite a bit for an 8-bit computer like Atari XL/XE is, and also quite a bit for a hard disk interface for this computer - the KMK/JŻ IDE is definitely the fastest one.

To be honest, it ought to be said, that the SpartaDOS X is a very fast DOS (that is, it imposes relatively little filesystem overhead to I/O operations). Another popular DOS for Atari - MyDOS - can't reach a half of the Sparta X performance, and this must be taken into account when comparing the speed of disk devices.

The limits

The interface's built-in ATA driver, or shortly HD BIOS, was designed in 1995 and the limit of disk capacity then assumed was about 20 times greater than the actual capacity the drives of that time were able to do. This limit is 8 GB per drive (24-bit logical sector addressing, i.e. 16777216 sectors, 512 bytes each).

This area can be subdivided into 16 partitions; each one is addressed by 24-bit value too, and so the maximum size of a partition is 8 GB as well, or 16777215 sectors, because sector 0 does not exist on Atari disks.

Sector sizes, that can be used, are 128, 256 and 512 bytes. A physical sector in ATA has 512 bytes, the remaining "densities" are emulated by the BIOS. The 256 and 512 BPS modes are for DOS and filesystems, the remaining one emulates the 1050 floppy disk density, and is implemented to facilitate running software, which requires it for a reason.

As one can guess, the 512 BPS mode is very fast, the 256 BPS middling, ad the remaining one rather slow. Specifically, in emulated densities (128 and 256 BPS) reads are fast enough, but writes are slow. It is enough to say, that is in 256 BPS the writing speed reaches 15-16 kilobytes per second, you're lucky. But in 512 BPS it will easily reach 50 kilobytes per second on the same disk. All this is about file transfers under a DOS.

The limits above belong to the interface's BIOS, but they're next to none in comparison with limits imposed by existing DOSes. "The big three" of the most advanced Disk Operating Systems for Atari looked so until recent time:

  • MyDOS 4.50/4.53: a limit of 8 partitions x 16 MB = 128 MB disk capacity available. Using the BIOS redirection mechanism (D1: to any of the remaining 15 partitions) you can actually "use" up to 256 MB - but seeing only 128 MB at a time.
  • SpartaDOS 3.2g: 9 partitions x 16 MB = 144 MB available at a time, redirection facilities effective as above.
  • SpartaDOS X 4.2x: as SpartaDOS 3.2g.

In the second half of the 2006 a progress was made in this area. The leading one is now SpartaDOS X, which outclassed the competitors completely: the 4.39RC increases the number of disks "visible" at a time to 15, and the maximum partition size grows up to 32 MB. This makes 15 x 32 = 480 MB possible to use by DOS, and so three times more than before. Still, it is not much in comparison with today's disks, or even with interface's limits being 12 years old.

The firmware

The software which allows to partition the disk and configure the interface is distributen in a form of utility floppy. The two most important programs are:

  • KMKDIAG - a diagnostic program to check, if the interface and the attached disk work and cooperate properly;
  • FDISK II - the main partitioning and configuration utility.

The main ATA driver, or BIOS, as it was said above, resides in the interface's ROM. This ROM is 1.5k in older units, and 3k (or rather two banks, 1.5k each) in newer ones. The amount of interface's memory visible for the computer is displayed by the diagnostic program, so it is rather easy to find out, when in doubt.

The 1.5k ROM interfaces are called "single-bank", and the others "double-bank" units. The entire BIOS v.1.x series (the current version is 1.11) works with either type. But the single-bank BIOS takes up almost entire available space, and it is almost impossible to fix anything (when a bug appears), not to mention adding new features. Thus I started a new 2.0 series, which will be only compatible with the double-banked interfaces. The new BIOS is not at the prototyping stage.

More, as usual, in Atariki:

For English speaking people the download section has the KMK/JŻ Interface User's Manual, written in English and available in PDF format. © KMK
free counters