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

69
11_libraries/mathffp.md Normal file
View file

@ -0,0 +1,69 @@
[← Home](../README.md) · [Libraries](README.md)
# Math Libraries — Floating Point
## Overview
AmigaOS provides multiple math libraries for floating-point operations. The 68000 has no FPU, so all math is done in software unless a 68881/68882/68040/68060 FPU is present.
---
## Library Stack
| Library | Format | Description |
|---|---|---|
| `mathffp.library` | FFP (Motorola Fast Floating Point) | Original Amiga format (32-bit) |
| `mathieeesingbas.library` | IEEE 754 single (32-bit) | IEEE single precision |
| `mathieeedoubbas.library` | IEEE 754 double (64-bit) | IEEE double precision |
| `mathtrans.library` | FFP | Transcendental functions (sin, cos, sqrt) |
| `mathieeesingtrans.library` | IEEE single | IEEE single transcendentals |
| `mathieeedoubtrans.library` | IEEE double | IEEE double transcendentals |
---
## FFP Format
Motorola FFP is NOT IEEE 754:
```
Bits 318: 24-bit mantissa (normalised, implicit 1.xxx)
Bits 71: 7-bit exponent (excess-64)
Bit 0: sign (0=positive, 1=negative)
```
---
## Using IEEE Math
```c
struct Library *MathIeeeSingBasBase =
OpenLibrary("mathieeesingbas.library", 0);
float a = 3.14f;
float b = 2.0f;
float c = IEEESPMul(a, b); /* 6.28 */
float d = IEEESPAdd(a, b); /* 5.14 */
float e = IEEESPDiv(a, b); /* 1.57 */
CloseLibrary(MathIeeeSingBasBase);
```
---
## 68881/68882 FPU
When an FPU is present, the math libraries are replaced with ROM patches that use native FPU instructions. The application code is identical — the library transparently switches to hardware.
```c
if (SysBase->AttnFlags & AFF_68881) {
/* 68881/68882 FPU present */
}
if (SysBase->AttnFlags & AFF_FPU40) {
/* 68040 internal FPU */
}
```
---
## References
- NDK39: `libraries/mathffp.h`, `libraries/mathieeesp.h`