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.
1.8 KiB
1.8 KiB
Compiler Pragmas and Inline Stubs
Overview
AmigaOS library calls use register-based calling conventions (arguments in D0–D7/A0–A6). C compilers need pragmas or inline stubs to generate the correct register assignments instead of stack-based calls.
Three Mechanisms
| Method | Compiler | How it works |
|---|---|---|
| Pragmas | SAS/C | #pragma libcall directive |
| Inline headers | GCC | Inline asm functions in <inline/lib.h> |
| Proto headers | All | <proto/lib.h> — auto-selects pragma or inline |
Pragma Example (SAS/C)
#pragma libcall DOSBase Open 1e 2102
/* Translates to: LVO = -0x1E = -30
Args: D1 = arg1 (name), D2 = arg2 (mode)
Result: D0 */
Inline Example (GCC)
/* inline/exec.h */
static __inline APTR
AllocMem(ULONG byteSize, ULONG requirements)
{
register APTR _res __asm("d0");
register ULONG _byteSize __asm("d0") = byteSize;
register ULONG _requirements __asm("d1") = requirements;
register struct ExecBase *_SysBase __asm("a6") = SysBase;
__asm volatile (
"jsr -198(%%a6)"
: "=r"(_res)
: "r"(_byteSize), "r"(_requirements), "r"(_SysBase)
: "d1","a0","a1","cc","memory"
);
return _res;
}
Generating Pragmas/Inlines from FD Files
# fd2pragma (Aminet: dev/misc/fd2pragma.lha):
fd2pragma exec_lib.fd exec_lib.sfd TO pragmas/exec_pragmas.h SPECIAL 6
fd2pragma exec_lib.fd exec_lib.sfd TO inline/exec.h SPECIAL 70
Proto Headers
/* proto/exec.h — portable wrapper: */
#ifdef __SASC
#include <pragmas/exec_pragmas.h>
#elif defined(__GNUC__)
#include <inline/exec.h>
#endif
extern struct ExecBase *SysBase;
References
- NDK39:
pragmas/,inline/,proto/directories 13_toolchain/fd_files.md— FD file format