Expand documentation suite: 30+ articles enriched with diagrams, code examples, and hardware details

Graphics: text_fonts (bitmap layout, styles), sprites (DMA, multiplexing), gfx_base (chipset detection), rastport (draw modes, clipping), ham_ehb (mermaid fixes), display_modes (HAM palettes)

Devices: scsi (per-model interfaces, Gayle limits, CD-ROM, native vs vendor drivers), console (ANSI sequences, CON:/RAW:), parallel (CIA registers, pinout), timer (resource exhaustion), gameport (quadrature, XOR state)

Libraries: workbench (WBStartup, AppWindow/Icon/MenuItem), rexxsyslib (ARexx port hosting, command parsing), diskfont (font directory, colour fonts), keymap (rawkey codes, dead keys), locale (catalogue system, date formatting), layers (ClipRect, refresh types), utility (TagItem chains), icon (DiskObject, ToolTypes), iffparse (IFF structure, ByteRun1), expansion (Zorro AutoConfig)

Networking: tcp_ip_stacks (major rewrite - Amiga vs Unix architecture, SANA-II pipeline, PPP/SLIP dial-up, Ethernet cards, MiSTer), bsdsocket (pure API ref), sana2 (buffer hooks, driver requirements), protocols (all code examples). Deduplicated overlap between the three files.

Toolchain: debugging (Enforcer patterns, SnoopDOS, GDB remote, kprintf checklist), sasc (pragma encoding, __saveds idioms), stormc (NEW - StormC IDE, C++, PowerPC)

References: error_codes (DOS, Exec, trackdisk, Intuition error tables)
Driver development: rtg_driver (Native driver analysis, P96 tuning)

All 22 README indexes updated. Root README synced with stormc.md entry.
This commit is contained in:
Ilia Sharin 2026-04-23 21:37:26 -04:00
parent 0ded078134
commit f61c26b542
38 changed files with 6402 additions and 1065 deletions

View file

@ -4,7 +4,29 @@
## Overview
`graphics.library` manages all display output, drawing primitives, and custom chip programming. `GfxBase` is the library base containing display state, chip revision info, and the system copper lists.
`graphics.library` is the core drawing library in AmigaOS. It manages all display output, drawing primitives, font rendering, and custom chip programming. `GfxBase` — the library base — contains the system's display state, chip revision info, system copper lists, and the display mode database.
```mermaid
flowchart TD
subgraph "GfxBase — Global Graphics State"
AV["ActiView<br/>(current display)"]
COP["copinit<br/>(system copper list)"]
CHIP["ChipRevBits0<br/>(OCS/ECS/AGA detection)"]
FONTS["TextFonts<br/>(system font list)"]
MODES["ModesList<br/>(display mode database)"]
VBF["VBlankFrequency<br/>(50=PAL, 60=NTSC)"]
end
APP["Application"] -->|"OpenLibrary"| GFX["graphics.library"]
GFX --> AV
GFX --> COP
GFX --> CHIP
AV -->|"MakeVPort / MrgCop /<br/>LoadView"| HW["Custom Chips<br/>(Agnus/Denise)"]
style GFX fill:#e8f4fd,stroke:#2196f3,color:#333
style HW fill:#c8e6c9,stroke:#2e7d32,color:#333
```
---
@ -15,7 +37,7 @@
struct GfxBase {
struct Library LibNode;
struct View *ActiView; /* currently active View */
struct copinit *copinit; /* system copper list init */
struct copinit *copinit; /* system copper list initialisation */
LONG *cia; /* CIA base (deprecated) */
LONG *blitter; /* blitter base (deprecated) */
UWORD *LOFlist; /* long-frame copper list pointer */
@ -24,26 +46,26 @@ struct GfxBase {
struct bltnode *blttl; /* blitter queue tail */
struct bltnode *bsblthd;
struct bltnode *bsblttl;
struct Interrupt vbsrv; /* vertical blank server list */
struct Interrupt timsrv;
struct Interrupt bltsrv;
struct Interrupt vbsrv; /* vertical blank server chain */
struct Interrupt timsrv; /* timer server chain */
struct Interrupt bltsrv; /* blitter-done server chain */
struct List TextFonts; /* system font list */
struct TextFont *DefaultFont; /* default system font */
struct TextFont *DefaultFont; /* default system font (topaz.8) */
UWORD Modes; /* current display mode bits */
BYTE VBlankFrequency; /* 50 (PAL) or 60 (NTSC) */
BYTE DisplayFlags; /* PAL/NTSC/GENLOCK flags */
UWORD NormalDisplayColumns;
UWORD NormalDisplayRows;
UWORD NormalDisplayColumns; /* default display width */
UWORD NormalDisplayRows; /* default display height */
UWORD MaxDisplayColumn;
UWORD MaxDisplayRow;
UWORD ChipRevBits0; /* chip revision flags */
UWORD ChipRevBits0; /* chip revision flags — see below */
/* ... many more fields ... */
struct MonitorSpec *monitor_id;
struct List MonitorList;
struct List MonitorList; /* installed monitors */
struct List ModesList; /* display mode database */
UBYTE MemType; /* memory type flags */
/* OS 3.x additions */
APTR ChunkyToPlanarPtr; /* c2p conversion routine */
APTR ChunkyToPlanarPtr; /* c2p conversion routine pointer */
};
```
@ -51,14 +73,16 @@ struct GfxBase {
## Chip Revision Detection
The `ChipRevBits0` field identifies which chipset generation is present — essential for FPGA cores that need to report their emulated chipset level:
```c
/* graphics/gfxbase.h */
#define GFXB_BIG_BLITS 0 /* big blitter (ECS Agnus) */
#define GFXB_HR_AGNUS 0 /* same — hi-res Agnus */
#define GFXB_BIG_BLITS 0 /* big blitter (ECS Agnus — 1MB chip) */
#define GFXB_HR_AGNUS 0 /* hi-res Agnus (same bit as above) */
#define GFXB_HR_DENISE 1 /* ECS Denise (SuperHires, scan-doubling) */
#define GFXB_AA_ALICE 2 /* AGA Alice (A1200/A4000) */
#define GFXB_AA_LISA 3 /* AGA Lisa */
#define GFXB_AA_MLISA 4 /* AGA Lisa (modified) */
#define GFXB_AA_LISA 3 /* AGA Lisa (A1200/A4000) */
#define GFXB_AA_MLISA 4 /* AGA modified Lisa */
#define GFXF_BIG_BLITS (1<<0)
#define GFXF_HR_AGNUS (1<<0)
@ -66,20 +90,140 @@ struct GfxBase {
#define GFXF_AA_ALICE (1<<2)
#define GFXF_AA_LISA (1<<3)
#define GFXF_AA_MLISA (1<<4)
```
/* Check for AGA: */
if (GfxBase->ChipRevBits0 & GFXF_AA_ALICE) {
/* AGA chipset — 8-bit planar, 256 colours in indexed mode */
### Detecting the Chipset
```c
struct GfxBase *GfxBase = (struct GfxBase *)
OpenLibrary("graphics.library", 0);
if (GfxBase->ChipRevBits0 & GFXF_AA_ALICE)
{
/* AGA chipset (A1200/A4000) */
/* 8-bit planar, 256 colours, 24-bit palette */
}
else if (GfxBase->ChipRevBits0 & GFXF_HR_DENISE)
{
/* ECS chipset (A3000/A600) */
/* SuperHires, productivity modes, scan-doubler */
}
else if (GfxBase->ChipRevBits0 & GFXF_HR_AGNUS)
{
/* ECS Agnus with OCS Denise (A500+/A2000 upgraded) */
/* 1 MB Chip RAM support, but no ECS display features */
}
else
{
/* OCS chipset (original A500/A1000/A2000) */
/* 512 KB Chip RAM, 4096 colour palette */
}
```
| Bits Set | Chipset | Systems |
|---|---|---|
| None | OCS | A500, A1000, A2000 |
| `HR_AGNUS` | ECS Agnus only | A500+ (Fat Agnus upgrade) |
| `HR_AGNUS + HR_DENISE` | Full ECS | A600, A3000 |
| `AA_ALICE + AA_LISA` | AGA | A1200, A4000, CD32 |
---
## PAL vs NTSC Detection
```c
if (GfxBase->VBlankFrequency == 50)
{
/* PAL: 50 Hz, 312 lines/field, 625 total (interlaced) */
/* Standard resolution: 320×256 */
}
else /* 60 */
{
/* NTSC: 60 Hz, 262 lines/field, 525 total (interlaced) */
/* Standard resolution: 320×200 */
}
/* DisplayFlags also has the info: */
if (GfxBase->DisplayFlags & PAL) /* PAL system */
if (GfxBase->DisplayFlags & NTSC) /* NTSC system */
```
---
## PAL vs NTSC
## The Display Pipeline
```mermaid
flowchart TD
subgraph "Application"
VP["ViewPort<br/>(one per screen)"]
end
subgraph "GfxBase Pipeline"
MV["MakeVPort(view, vp)<br/>→ build copper instructions<br/>for this viewport"]
MC["MrgCop(view)<br/>→ merge all viewport copper<br/>into single list"]
LV["LoadView(view)<br/>→ install merged copper list<br/>into hardware"]
end
subgraph "Hardware"
COP["Copper DMA<br/>executes copper list"]
CHIPS["Custom Chips<br/>display image"]
end
VP --> MV --> MC --> LV --> COP --> CHIPS
style MV fill:#fff9c4,stroke:#f9a825,color:#333
style MC fill:#fff9c4,stroke:#f9a825,color:#333
style LV fill:#fff9c4,stroke:#f9a825,color:#333
```
### Key Display Functions
| Function | Purpose |
|---|---|
| `MakeVPort(view, vp)` | Generate copper instructions for one ViewPort |
| `MrgCop(view)` | Merge all ViewPort copper lists into unified system list |
| `LoadView(view)` | Install the merged copper list into the hardware (LOF/SHF) |
| `WaitTOF()` | Wait for top of frame (vertical blank) — used to sync display updates |
| `WaitBOVP(vp)` | Wait for the beam to pass a specific ViewPort |
---
## Blitter Queue
GfxBase maintains a queue of pending Blitter operations (`blthd`/`blttl`). When an application calls `BltBitMap`, the operation may be queued and executed asynchronously by the Blitter interrupt:
```c
if (GfxBase->VBlankFrequency == 50) /* PAL: 50Hz, 625 lines */
if (GfxBase->VBlankFrequency == 60) /* NTSC: 60Hz, 525 lines */
/* Start a blit — may be queued: */
BltBitMap(srcBM, sx, sy, dstBM, dx, dy, w, h, 0xC0, 0xFF, NULL);
/* Wait for ALL pending blits to complete: */
WaitBlit();
/* Or use OwnBlitter/DisownBlitter for exclusive access: */
OwnBlitter(); /* blocks until blitter is free, then locks it */
/* ... direct blitter register access ... */
DisownBlitter(); /* release for other tasks */
```
---
## System Fonts
```c
/* Get the default system font: */
struct TextFont *sysFont = GfxBase->DefaultFont;
Printf("System font: %s, size %d\n",
sysFont->tf_Message.mn_Node.ln_Name,
sysFont->tf_YSize);
/* Enumerate all loaded fonts: */
struct Node *node;
for (node = GfxBase->TextFonts.lh_Head;
node->ln_Succ;
node = node->ln_Succ)
{
Printf("Font: %s\n", node->ln_Name);
}
```
---
@ -88,3 +232,6 @@ if (GfxBase->VBlankFrequency == 60) /* NTSC: 60Hz, 525 lines */
- NDK39: `graphics/gfxbase.h`
- ADCD 2.1: graphics.library autodocs
- See also: [views.md](views.md) — View/ViewPort construction
- See also: [copper.md](copper.md) — Copper coprocessor
- See also: [display_modes.md](display_modes.md) — display mode database