ワンクリックで
using-cmhg
Describes the CMHG file format and CMunge usage. Use when CMHG files are required for RISC OS modules.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Describes the CMHG file format and CMunge usage. Use when CMHG files are required for RISC OS modules.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Guidance for registering RISC OS allocations with the RISC OS Open allocation service. Use when the user wants to register a module name, SWI chunk, error block, *command, filetype, system variable, or any other RISC OS allocation. Also use when the user asks "how do I register X", "I need to allocate X", or wants to send an allocation request to RISC OS Open.
Create, extend, review, and repair RISC OS CI pipelines, especially GitHub Actions and GitLab CI files, optional matching `.robuild.yaml` or `.robuild.yml` files for build-service jobs, 32-bit and 64-bit builds, build-service testing, artifact packaging, and draft releases. Use when Codex needs to work on `.github/workflows/*.yml`, `.gitlab-ci.yml`, `example-ci.yml`, `.robuild.yaml`, `.robuild.yml`, `riscos-project create-ci`, build.riscos.online integration, or RISC OS packaging/testing patterns for AIF, RM, and library-export projects.
Create useful pull requests or merge requests with clear reviewer-focused descriptions. Use when opening a PR or MR, especially when the description should explain the problem, summarise the changes, and record testing in a standard structure.
How to design modules for RISC OS. Use when creating new modules, designing interfaces to modules, porting a library to be used in a new module, or extending the existing interfaces of modules.
Port C projects to RISC OS using `riscos-cport`, RISC OS makefiles, and Norcroft/RISC OS build validation. Use when a repository needs a RISC OS library or command-line port, especially when you need to create a `RISCOS/` tree, generate `Makefile,fe1` files, or repair source for the RISC OS toolchain.
Read and translate RISC OS ObjAsm/ARM assembly into another language, PyModule, tests, or interface documentation. Use when converting `s/*` assembler modules, reconstructing SWI behaviour, validating comments against generated tables/disassembly, or proving binary-compatible data layout and boundary behaviour.
| name | using-cmhg |
| description | Describes the CMHG file format and CMunge usage. Use when CMHG files are required for RISC OS modules. |
| metadata | {"author":"gerph@gerph.org"} |
| license | MIT |
| allowed-tools | Bash(riscos-prm:*) |
CMunge is an enhanced, free alternative to the Acorn C Module Header Generator (CMHG). It generates ARM assembly "veneers" that allow RISC OS relocatable modules to be written in C or C++. It supports 26-bit, 32-bit, and 64-bit ARM architectures.
CMunge [options] <infile>
Key options:
-o <file>: Output object (AOF) file.-s <file>: Output assembly file.-d <file>: Output C header file.-26bit: Target legacy 26-bit ARM (default).-32bit: Target 32-bit compatible ARM.-64bit: Target 64-bit (AArch64) ARM for GCC.-p / -px: Pre-process input file (standard / extended).-throwback: Enable error reporting to editors.-zoslib / -zoslibpath: Use OSLib header styles.title-string: Internal module name.help-string: Descriptive name and version.initialisation-code: C function called on load.finalisation-code: C function called on unload.module-is-initialised-early: (CMunge) Requests early initialization for ROM.service-call-handler: C function for service calls.swi-chunk-base-number: Base SWI number.swi-handler-code: Central SWI handler C function.swi-decoding-table: Lists SWI names and optional specific handlers.command-keyword-table: Defines *Commands and their handlers — see references/command-tables.md.generic-veneers: General purpose C wrappers.vector-handlers: Wrappers for claiming RISC OS vectors - see references/vectors.mdevent-handler: Wrappers for RISC OS events.error-base (CMunge): Base error number for the module.error-identifiers (CMunge): Automatically generates error definitions.vector-traps (CMunge): Advanced vector chaining handlers — see references/vector-traps.md.library-initialisation-code / library-enter-code: Override C library entry symbols.These files describe common generic veneer usage patterns:
OS_CallEvery, OS_CallAfter, and OS_RemoveTickerEvent.OS_AddCallBack/OS_RemoveCallBack deferred work.OS_SetVarVal type 16 read/write code variables.workspace, function descriptors.OS_DynamicArea handlers.OS_Claim.OS_ClaimOSSWI handlers.ErrorV handling.carry-capable:.All of these use the same CMHG mechanism:
generic-veneers: EntryName/HandlerName
CMHG generates EntryName, which is the address passed to the OS or another module. The C function HandlerName is called by the veneer with:
_kernel_oserror *HandlerName(_kernel_swi_regs *r, void *pw);
The handler reads and writes the register block according to the owning API's ABI, not according to CMHG itself.
General information on CMHG syntax, C handler ABI, claiming, and filtering is in the Service Calls overview.
These files describe common CMHG service-call-handler usage patterns:
Service_UKCompression and Service_ModulePreInit patching hooksService_APCSBacktrace diagnostic extension and minidump hooksService_ErrorStarting and related Wimp error-report monitoring hooksService information may often also be found through the riscos-prm --url Service_... command.
swi-decoding-table: JUnitXML Create/SWI_Create TestSuite/SWI_TestSuite TestCase/SWI_TestCase Close/SWI_Close
Can be comma separated, thus:
swi-decoding-table: JUnitXML Create/SWI_Create, TestSuite/SWI_TestSuite, TestCase/SWI_TestCase Close/SWI_Close
And the comma separated parts can be split if the comma is the last entry on the line:
swi-decoding-table: JUnitXML Create/SWI_Create,
TestSuite/SWI_TestSuite,
TestCase/SWI_TestCase,
Close/SWI_Close
Which makes for nice aligned text.
riscos/Services.h.
This can be included using C preprocessor includes, like this:#include "riscos/Services.h"
service-call-handler: Mod_Service Service_ModeChange
For more information on the CMHG file format, see references/cmhg-syntax.md.
For examples and detailed syntax of the *Command tables, see references/command-tables.md.
vectors including a worked example, see references/vector-traps.md.vector-traps docuemnt for a worked example in references/vector-traps.md.