docs(amiga): complete AmigaOS 3.1/3.2 developer reference — 172 files across 17 sections

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.
This commit is contained in:
Ilia Sharin 2026-04-23 12:16:52 -04:00
parent f07a368bf1
commit 21751c0025
172 changed files with 19701 additions and 0 deletions

102
08_graphics/sprites.md Normal file
View file

@ -0,0 +1,102 @@
[← Home](../README.md) · [Graphics](README.md)
# Hardware Sprites — SimpleSprite, MoveSprite
## Overview
The Amiga has **8 hardware sprites**, each 16 pixels wide with 3 colours + transparent. Sprites are DMA-driven — the Copper sets their pointers each frame and the display hardware renders them with zero CPU overhead.
---
## Sprite DMA Data Format
Each sprite scanline is two words (4 bytes):
```
Word 0 (DATA): bits 150 = pixel colour bit 0 for this line
Word 1 (DATB): bits 150 = pixel colour bit 1 for this line
Pixel colour = (DATB_bit << 1) | DATA_bit
00 = transparent
01 = colour 1 (from sprite palette)
10 = colour 2
11 = colour 3
```
### Sprite Header
```
WORD 0: VSTART (vertical start position) + HSTART high bits
WORD 1: VSTOP (vertical stop position) + control bits
```
### End marker
```
WORD 0: 0x0000
WORD 1: 0x0000
```
---
## Sprite Colour Palette
| Sprite pair | Colour registers | Custom addresses |
|---|---|---|
| 01 | `COLOR17``COLOR19` | `$DFF1A2``$DFF1A6` |
| 23 | `COLOR21``COLOR23` | `$DFF1AA``$DFF1AE` |
| 45 | `COLOR25``COLOR27` | `$DFF1B2``$DFF1B6` |
| 67 | `COLOR29``COLOR31` | `$DFF1BA``$DFF1BE` |
Sprite pairs can be **attached** to form a single 15-colour sprite (using both sets of 2 bits = 4 bits per pixel).
---
## OS-Level Sprite API
```c
/* graphics.library */
struct SimpleSprite ss;
WORD sprnum;
/* Obtain a free sprite: */
sprnum = GetSprite(&ss, -1); /* -1 = any available */
if (sprnum >= 0) {
ss.x = 100;
ss.y = 50;
ss.height = 16;
/* Move sprite to position: */
MoveSprite(NULL, &ss, 100, 50);
/* Set sprite image data: */
ChangeSprite(NULL, &ss, spriteData);
/* Release: */
FreeSprite(sprnum);
}
```
---
## Sprite Pointer Registers
| Register | Address | Sprite |
|---|---|---|
| `SPR0PTH/L` | `$DFF120$DFF122` | Sprite 0 |
| `SPR1PTH/L` | `$DFF124$DFF126` | Sprite 1 |
| `SPR2PTH/L` | `$DFF128$DFF12A` | Sprite 2 |
| `SPR3PTH/L` | `$DFF12C$DFF12E` | Sprite 3 |
| `SPR4PTH/L` | `$DFF130$DFF132` | Sprite 4 |
| `SPR5PTH/L` | `$DFF134$DFF136` | Sprite 5 |
| `SPR6PTH/L` | `$DFF138$DFF13A` | Sprite 6 |
| `SPR7PTH/L` | `$DFF13C$DFF13E` | Sprite 7 |
These must be set every frame — typically via the Copper list.
---
## References
- HRM: *Amiga Hardware Reference Manual* — Sprites chapter
- NDK39: `graphics/sprite.h`
- ADCD 2.1: `GetSprite`, `MoveSprite`, `ChangeSprite`, `FreeSprite`