Skip to Content
Amiga Assembly Library v41.21 — Motorola 68020 shared library for Commodore Amiga

FindAIFFChunk

Synopsis

chunkID, chunkSize = FindAIFFChunk(data, chunkID) D0 D1 A0 D0

C Prototype

There is no direct C prototype exported for this function. It is called internally from assembly.

Description

Searches for a specific chunk within an IFF/AIFF data structure. If the data starts with a “FORM” header, the function automatically skips past the 12-byte FORM header (4-byte type ID + 4-byte size + 4-byte form type) before beginning the search.

The function iterates through the chunk list using TestAIFFChunk() to validate each chunk and NextIFFChunk() to advance to the next one, until the requested chunk ID is found.

Inputs

  • data (A0) — Pointer to the beginning of the IFF/AIFF data in memory.
  • chunkID (D0) — The 4-byte chunk identifier to search for (e.g., "BODY", "CMAP").

Result

  • chunkID (D0) — The chunk ID of the found chunk.
  • chunkSize (D1) — The size of the found chunk data.
  • A0 — Points to the found chunk header.
  • If the chunk is not found, the condition codes indicate failure (zero flag set).

See Also

Implementation

The original 68020 assembly implementation:

; Rel.3.1 - Apr 11 1994 --- FindAIFFChunk() _LVOFindAIFFChunk move.l a1,-(sp) lea "FORM",a1 cmp.l (a0),a1 bne.s FIFF_NoINIT addq.l #8,a0 addq.l #4,a0 FIFF_NoINIT move.l d0,d1 FIFF_CheckLoop bsr.s _LVOTestAIFFChunk beq.s FIFFChunk_Exit cmp.l (a0),d1 beq.s FIFF_FindIt bsr.s _LVONextIFFChunk bra.s FIFF_CheckLoop FIFF_FindIt movem.l (a0),d0-d1 FIFFChunk_Exit move.l (sp)+,a1 rts
Last updated on