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.
81 lines
1.9 KiB
Markdown
81 lines
1.9 KiB
Markdown
[← Home](../README.md) · [Libraries](README.md)
|
|
|
|
# iffparse.library — IFF File Parsing
|
|
|
|
## Overview
|
|
|
|
IFF (Interchange File Format) is EA/Commodore's universal container format. `iffparse.library` provides stream-oriented parsing/writing of IFF files. Common IFF types: ILBM (images), 8SVX (audio), ANIM (animation), FTXT (formatted text).
|
|
|
|
---
|
|
|
|
## IFF Structure
|
|
|
|
```
|
|
FORM <size> <type>
|
|
<chunk_id> <size> <data...>
|
|
<chunk_id> <size> <data...>
|
|
...
|
|
```
|
|
|
|
All values are big-endian. Chunks are padded to even byte boundaries.
|
|
|
|
---
|
|
|
|
## Key Functions
|
|
|
|
```c
|
|
struct Library *IFFParseBase = OpenLibrary("iffparse.library", 0);
|
|
struct IFFHandle *iff = AllocIFF();
|
|
|
|
/* Open from file: */
|
|
iff->iff_Stream = (ULONG)Open("image.iff", MODE_OLDFILE);
|
|
InitIFFasDOS(iff);
|
|
OpenIFF(iff, IFFF_READ);
|
|
|
|
/* Register chunks we want to stop at: */
|
|
StopChunk(iff, ID_ILBM, ID_BMHD);
|
|
StopChunk(iff, ID_ILBM, ID_BODY);
|
|
StopChunk(iff, ID_ILBM, ID_CMAP);
|
|
|
|
/* Parse: */
|
|
LONG error;
|
|
while ((error = ParseIFF(iff, IFFPARSE_SCAN)) == 0) {
|
|
struct ContextNode *cn = CurrentChunk(iff);
|
|
switch (cn->cn_ID) {
|
|
case ID_BMHD:
|
|
ReadChunkBytes(iff, &bmhd, sizeof(bmhd));
|
|
break;
|
|
case ID_CMAP:
|
|
ReadChunkBytes(iff, palette, cn->cn_Size);
|
|
break;
|
|
case ID_BODY:
|
|
ReadChunkBytes(iff, bodydata, cn->cn_Size);
|
|
break;
|
|
}
|
|
}
|
|
|
|
CloseIFF(iff);
|
|
Close((BPTR)iff->iff_Stream);
|
|
FreeIFF(iff);
|
|
```
|
|
|
|
---
|
|
|
|
## Common Chunk IDs
|
|
|
|
| FORM Type | Chunk | Description |
|
|
|---|---|---|
|
|
| `ILBM` | `BMHD` | Bitmap header (width, height, depth) |
|
|
| `ILBM` | `CMAP` | Colour map (R,G,B triples) |
|
|
| `ILBM` | `BODY` | Image body data |
|
|
| `ILBM` | `CAMG` | Amiga display mode |
|
|
| `8SVX` | `VHDR` | Voice header |
|
|
| `8SVX` | `BODY` | Audio sample data |
|
|
| `ANIM` | `ANHD` | Animation header |
|
|
| `ANIM` | `DLTA` | Delta frame data |
|
|
|
|
---
|
|
|
|
## References
|
|
|
|
- NDK39: `libraries/iffparse.h`, `datatypes/pictureclass.h`
|