amiga-bootcamp/11_libraries/workbench.md
Ilia Sharin 21751c0025 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.
2026-04-23 12:17:35 -04:00

1.8 KiB

← Home · Libraries

workbench.library — Workbench Integration

Overview

workbench.library provides APIs for interacting with the Workbench desktop: AppWindows, AppIcons, AppMenuItems, and startup message handling.


WBStartup Message

When launched from Workbench, a program receives a WBStartup message instead of CLI arguments:

struct WBStartup {
    struct Message sm_Message;
    struct MsgPort *sm_Process;   /* process that sent us */
    BPTR   sm_Segment;            /* our loaded segment */
    LONG   sm_NumArgs;            /* number of arguments */
    char  *sm_ToolWindow;         /* tool window spec */
    struct WBArg *sm_ArgList;     /* argument array */
};

struct WBArg {
    BPTR   wa_Lock;    /* directory lock */
    BYTE  *wa_Name;    /* filename */
};

Handling WBStartup

struct WBStartup *wbmsg = NULL;
if (!argc) {  /* launched from Workbench */
    WaitPort(&((struct Process *)FindTask(NULL))->pr_MsgPort);
    wbmsg = (struct WBStartup *)GetMsg(
        &((struct Process *)FindTask(NULL))->pr_MsgPort);
    /* Process wbmsg->sm_ArgList for file arguments */
}
/* ... do work ... */
if (wbmsg) {
    Forbid();
    ReplyMsg((struct Message *)wbmsg);
}

AppWindow / AppIcon / AppMenuItem

/* Register a window to receive file drops: */
struct AppWindow *appwin = AddAppWindow(1, 0, win, port, NULL);
/* When user drags files to the window, receive AppMessage on port */

struct AppMessage {
    struct Message am_Message;
    UWORD  am_Type;        /* AMTYPE_APPWINDOW, etc. */
    ULONG  am_UserData;
    ULONG  am_ID;
    LONG   am_NumArgs;     /* number of files dropped */
    struct WBArg *am_ArgList; /* array of file references */
    /* ... */
};

RemoveAppWindow(appwin);

References

  • NDK39: workbench/workbench.h, workbench/startup.h