**Gayle** is Commodore's custom gate-array chip providing **ATA/IDE** hard drive and **PCMCIA Type II** card slot interfaces. It appears in two models with different silicon revisions:
The IDE registers are at base `$DA0000` on both models. The critical difference is **byte-lane mapping**: the A1200 places 8-bit ATA registers on **odd byte offsets** within each 4-byte window, while the A600 uses even offsets.
#### A600 IDE Registers
| Address | ATA Register | R/W |
|---|---|---|
| `$DA0000` | Data (16-bit) | RW |
| `$DA0004` | Error (R) / Features (W) | RW |
| `$DA0008` | Sector Count | RW |
| `$DA000C` | Sector Number (LBA 7:0) | RW |
| `$DA0010` | Cylinder Low (LBA 15:8) | RW |
| `$DA0014` | Cylinder High (LBA 23:16) | RW |
| `$DA0018` | Drive/Head (LBA 27:24) | RW |
| `$DA001C` | Status (R) / Command (W) | RW |
| `$DA101C` | Alternate Status / Device Control | RW |
#### A1200 IDE Registers
| Address | ATA Register | R/W |
|---|---|---|
| `$DA0000` | Data (16-bit) | RW |
| `$DA0005` | Error (R) / Features (W) | RW |
| `$DA0009` | Sector Count | RW |
| `$DA000D` | Sector Number (LBA 7:0) | RW |
| `$DA0011` | Cylinder Low (LBA 15:8) | RW |
| `$DA0015` | Cylinder High (LBA 23:16) | RW |
| `$DA0019` | Drive/Head (LBA 27:24) | RW |
| `$DA001D` | Status (R) / Command (W) | RW |
| `$DA101D` | Alternate Status / Device Control | RW |
> [!IMPORTANT]
> The A1200 byte-lane offset (+1 from A600) is because Gayle maps 8-bit ATA registers on the **odd byte lane** of the 16-bit Amiga bus. IDE drivers must account for this — a single driver cannot blindly use the same offsets for both machines. Check the Gayle ID first.
### PIO Data Transfer
IDE data transfers use 16-bit word access to the Data register:
```asm
; Read one sector (512 bytes = 256 words) from IDE
; a0 = destination buffer
lea $DA0000, a1 ; IDE data register
move.w #255, d0 ; 256 words
.read_loop:
move.w (a1), (a0)+ ; read word from IDE → buffer
dbf d0, .read_loop
```
---
## PCMCIA Interface
Both A600 and A1200 support a **Type II PCMCIA** (PC Card) slot:
> The IDE interrupt bit position differs between A600 and A1200 Gayle revisions. Always check the Gayle ID register before masking interrupt bits.
### Interrupt Service Routine
```asm
; Gayle ISR (INT6 handler)
gayle_isr:
move.b $DA9000, d0 ; read GAYLE_INT_STATUS
btst #7, d0 ; IDE interrupt? (A1200)
beq.s .check_pcmcia
; Handle IDE interrupt
move.b $DA001D, d1 ; read ATA status to clear INTRQ
bclr #7, $DA9000 ; clear Gayle IDE IRQ
bra.s .done
.check_pcmcia:
btst #6, d0 ; PCMCIA interrupt?
beq.s .done
; Handle PCMCIA...
bclr #6, $DA9000 ; clear PCMCIA IRQ
.done:
rte
```
---
## PCMCIA Power Control
Gayle controls PCMCIA card power (5V standard; 3.3V on A1200 rev 1D+):
```c
/* $DA9008 GAYLE_CONTROL bits */
#define GAYLE_POW (1<<7) /* PCMCIA power on/off */
#define GAYLE_WS (1<<6) /* Wait states for PCMCIA access */
```
---
## AmigaOS IDE Access
AmigaOS accesses Gayle IDE through the standard device driver stack:
```
Application → dos.library → File System Handler → scsi.device / ata.device → Gayle IDE
```
Applications never access Gayle registers directly:
```c
/* Standard file access — no direct Gayle interaction */
BPTR fh = Open("DH0:myfile", MODE_NEWFILE);
Write(fh, data, length);
Close(fh);
```
The A600 uses `scsi.device` from Kickstart ROM. The A1200 uses `ata.device` (also called `ide.device` in some OS versions) which includes A1200-specific byte-lane handling.