A small AmigaDOS command that reports whether AmigaOS exposes card.resource.
  • C 55.5%
  • Makefile 33.1%
  • Assembly 11.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-24 12:35:03 +02:00
tests Initial HasPCMCIA utility 2026-08-22 14:36:03 +02:00
.gitignore Initial HasPCMCIA utility 2026-08-22 14:36:03 +02:00
haspcmcia.c Minimize HasPCMCIA runtime footprint 2026-08-24 11:24:44 +02:00
LICENSE Initial HasPCMCIA utility 2026-08-22 14:36:03 +02:00
Makefile Minimize HasPCMCIA runtime footprint 2026-08-24 11:24:44 +02:00
README.md Clarify amiga-gcc build instructions 2026-08-24 12:35:03 +02:00
startup.s Minimize HasPCMCIA runtime footprint 2026-08-24 11:24:44 +02:00
VERSION Initial HasPCMCIA utility 2026-08-22 14:36:03 +02:00

HasPCMCIA

HasPCMCIA is a small AmigaDOS command that reports whether AmigaOS exposes card.resource, the supported operating-system interface for the A600/A1200 PCMCIA slot.

It performs capability detection rather than guessing the machine model from its CPU or chipset. It does not access Gayle registers directly and does not require a card to be inserted.

Usage

HasPCMCIA [QUIET|VERSION|?]

Without arguments, the command prints one of:

PCMCIA interface available
No PCMCIA interface found

QUIET suppresses output. VERSION prints the command version. ? prints the usage line and returns RETURN_OK; it is a non-interactive help request rather than full ReadArgs() template prompting.

Return codes follow AmigaDOS conventions:

Result Return code
card.resource is available RETURN_OK (0)
card.resource is unavailable RETURN_WARN (5)
Help requested with ? RETURN_OK (0)
Invalid arguments RETURN_ERROR (10)

AmigaDOS If statements must be used in a command file. For example:

HasPCMCIA QUIET
If WARN
  Echo "No PCMCIA interface"
Else
  Echo "PCMCIA interface available"
EndIf

tests/Test-HasPCMCIA is a ready-made command file that prints either RETURN_WARN or RETURN_OK. Copy it to the Amiga and run it with Execute.

The result indicates that the operating system publishes a compatible PCMCIA interface. It does not identify the exact Amiga model and does not report whether a card is currently inserted.

Building

Build a 68000-compatible Amiga Hunk executable with amiga-gcc (in my case Stefan Reinauer's fork):

make
make check

The executable is written to build/HasPCMCIA. The default 68000 build uses the AmigaOS 1.3 NDK interfaces and a minimal CLI-only startup stub. It links with -nostdlib, parses the raw AmigaDOS command tail, initializes SysBase, and opens dos.library only when output is required. This avoids pulling in the general-purpose nix13 startup, argc/argv, Workbench-launch, autoinit, and libc machinery. HasPCMCIA is an AmigaDOS command and does not support direct Workbench startup.

With amiga-gcc 16.1, the resulting stripped Hunk executable is 784 bytes, down from 2,944 bytes with the general nix13 runtime.

Native validation

The minimal-runtime Version 1.0 build was exercised on disposable systems:

  • Emulated 68000 A500, Kickstart 34.5 and Workbench 34.34: no card.resource; normal output, silent QUIET, VERSION, ?, and completion checkpoints all passed. An AmigaDOS If WARN branch directly confirmed RETURN_WARN.
  • Emulated 68000 A600, Kickstart 37.300 and Workbench 37.71: card.resource available; normal output, silent QUIET, VERSION, ?, and completion checkpoints all passed. The corresponding If WARN/Else branch directly confirmed RETURN_OK.
  • A physical A1200 running Kickstart 47.96 and Workbench 47.2: normal and quiet detection, mixed-case and quoted option parsing, explicit version output, AmigaDOS Version, ?, and invalid argument handling all passed. A test-only copy pointed at a nonexistent resource also verified normal and quiet RETURN_WARN behavior.

Distribution

HasPCMCIA is MIT licensed. Binary redistribution does not require accompanying source code, but distributions must retain the copyright and permission notice from LICENSE.