mirror of
https://github.com/alfishe/amiga-bootcamp.git
synced 2026-06-13 00:26:28 +00:00
Comprehensive technical documentation covering: - Hardware: OCS/ECS/AGA custom chip registers, Copper & Blitter deep dives - Boot sequence: cold boot through startup-sequence - Binary format: HUNK executable spec, relocation, debug info - Linking & ABI: .fd files, LVO tables, register calling conventions - Exec kernel: tasks, interrupts, memory, signals, semaphores - AmigaDOS: file I/O, FFS/OFS layout, CLI/Shell scripting - Graphics: planar bitmaps, Copper programming, HAM/EHB modes - Intuition: screens, windows, IDCMP, BOOPSI - Devices: trackdisk, SCSI, serial, timer, audio, keyboard - Libraries: utility, expansion, IFFParse, locale, ARexx - Networking: bsdsocket API, SANA-II, TCP/IP stack comparison - Toolchain: GCC, vasm/vlink, SAS/C, NDK, debugging - Reverse engineering: IDA/Ghidra setup, compiler fingerprints, case studies - CPU & MMU: 68040/060 emulation libs, PMMU, cache management - Driver development: SANA-II, Picasso96/RTG, AHI audio All files include breadcrumb navigation. No local paths or proprietary content.
72 lines
1.7 KiB
Markdown
72 lines
1.7 KiB
Markdown
[← Home](../README.md) · [Devices](README.md)
|
||
|
||
# audio.device — DMA Audio Channels
|
||
|
||
## Overview
|
||
|
||
`audio.device` provides access to the Amiga's 4 DMA audio channels. Each channel plays 8-bit PCM samples from Chip RAM at programmable rates.
|
||
|
||
---
|
||
|
||
## Channel Allocation
|
||
|
||
```c
|
||
UBYTE allocationMap[] = { 1, 2, 4, 8 }; /* channel masks */
|
||
struct IOAudio *aio = (struct IOAudio *)
|
||
CreateIORequest(port, sizeof(struct IOAudio));
|
||
aio->ioa_Request.io_Message.mn_Node.ln_Pri = 0;
|
||
aio->ioa_Data = allocationMap;
|
||
aio->ioa_Length = sizeof(allocationMap);
|
||
OpenDevice("audio.device", 0, (struct IORequest *)aio, 0);
|
||
/* aio->ioa_AllocKey = allocation key for this channel */
|
||
```
|
||
|
||
---
|
||
|
||
## Playing a Sample
|
||
|
||
```c
|
||
aio->ioa_Request.io_Command = CMD_WRITE;
|
||
aio->ioa_Request.io_Flags = ADIOF_PERVOL;
|
||
aio->ioa_Data = sampleData; /* MUST be in Chip RAM */
|
||
aio->ioa_Length = sampleLength; /* in bytes */
|
||
aio->ioa_Period = 428; /* ~8287 Hz (PAL) */
|
||
aio->ioa_Volume = 64; /* 0–64 */
|
||
aio->ioa_Cycles = 1; /* 0 = loop forever */
|
||
BeginIO((struct IORequest *)aio);
|
||
```
|
||
|
||
### Period Calculation
|
||
|
||
```
|
||
Period = clock_constant / desired_frequency
|
||
PAL: clock = 3546895 Hz → Period = 3546895 / freq
|
||
NTSC: clock = 3579545 Hz → Period = 3579545 / freq
|
||
```
|
||
|
||
| Frequency | Period (PAL) |
|
||
|---|---|
|
||
| 8287 Hz | 428 |
|
||
| 11025 Hz | 322 |
|
||
| 22050 Hz | 161 |
|
||
| 28867 Hz | 124 (minimum safe) |
|
||
|
||
---
|
||
|
||
## Channel Registers
|
||
|
||
| Channel | Address | Description |
|
||
|---|---|---|
|
||
| 0 | `$DFF0A0` | AUD0 (left) |
|
||
| 1 | `$DFF0B0` | AUD1 (right) |
|
||
| 2 | `$DFF0C0` | AUD2 (right) |
|
||
| 3 | `$DFF0D0` | AUD3 (left) |
|
||
|
||
Each channel: pointer (PTH/PTL), length (LEN), period (PER), volume (VOL).
|
||
|
||
---
|
||
|
||
## References
|
||
|
||
- NDK39: `devices/audio.h`
|
||
- HRM: audio DMA chapter
|