MOS *commands (star commands)

Any line starting with * (or OSCLI from assembly) is interpreted as a command by the MOS, not as input to the current language. MOS dispatches commands in this order:

  1. Resident MOS commands (built into the MOS ROM — *FX, *KEY, *CONFIGURE, *TV, etc.)
  2. Currently-active filing system commands (*LOAD, *SAVE, *CAT, etc.)
  3. All sideways ROMs in priority order (highest slot first) — via Service Call 4 (“Offer Command”)
  4. Final fallback: try to *RUN <filename> via the current filing system

If nothing claims the command, MOS raises error 254 Bad command (see errors).

For programmatic invocation from assembly:

LDA #<command_str
LDY #>command_str
JSR &FFF7        ; OSCLI - same dispatch as user typing *cmd
; command_str must be terminated by &0D (CR)

For the filing-system-specific commands (*LOAD, *SAVE, *INFO, etc.) see filing-systems and the per-FS pages.

Master MOS resident commands (per master-rm Ch C)

CommandMin abbrevExecuted byPurpose
*ADFS*A.MOSMake ADFS the current filing system
*APPENDFSAppend lines of input to a file
*BUILDFSCreate a file from lines of input
*CATFSDisplay disc/directory catalogue
*CLOSEFSClose all sequential files
*CODEMOSRun resident machine-code program via USERV with A=0
*CONFIGURE*CO.MOSSet CMOS RAM configuration
*CREATEFSCreate a file of given size
*DELETEFSDelete a named file or files
*DISC*DI.MOSMake DFS the current filing system
*DUMPFSDisplay file in hex + ASCII
*EXFSDisplay file information
*EXECFSTake subsequent input from a file
*FXMOSOSBYTE call — see osbyte
*GOMOSExecute machine-code program at given address
*GOIOMOSExecute machine-code in I/O processor (host even if Tube active)
*HELP*H.MOS+ROMsPer-ROM help text; *HELP <subject> to drill down
*IGNORE*IG.MOSEquivalent to *FX 6
*INSERT*INS.MOSInsert ROM number n into ROM map from reset
*KEY*K.MOSDefine soft key strings (red function keys, cursors, COPY)
*LIBFSMOSDefine filing system from which LIB is taken
*LINEMOSRun resident machine-code program via USERV with A=1
*LOADFSLoad file into memory
*MOTOR*M.MOSCassette motor relay on/off
*MOVEFSMove files between filing systems
*OPTFSSet filing-system options
*PRINTFSDisplay file as pure ASCII
*ROMMOSMake ROM filing system current
*ROMSMOSDisplay ROM contents (slot + name + version + ON/OFF state)
*RUNFSLoad + execute machine-code program
*SAVEFSSave block of memory as a file
*SHADOW*SH.MOSDefine usage of shadow memory
*SHOWMOSDisplay soft-key string allocation
*SHUTFSClose all files on all filing systems
*SPOOLFSSend all output to a file
*SPOOLONFSAppend all output to a file
*SRDATAMOSReserve sideways RAM for data use (paged-rom)
*SRREADMOSCopy sideways RAM to main RAM
*SRROMMOSReserve sideways RAM for ROM-style addressing
*SRWRITEMOSCopy main RAM to sideways RAM
*STATUS*ST.MOSDisplay CMOS RAM configuration
*TAPE*T.MOSMake CFS the current filing system
*TIME*TI.MOSDisplay date and time from CMOS RTC
*TVMOSAdjust vertical screen alignment + interlace
*TYPEFSDisplay file in GSREAD format without line numbers
*UNPLUG*UNP.MOSDirect MOS to ignore specified ROM
*XMOSEnable more than one external second processor

Filing-system commands

The “Executed by FS” entries above dispatch to whichever filing system is currently selected — DFS / ADFS / CFS / NFS / RFS each implement their own versions. Additional FS-specific commands include:

  • DFS: *ENABLE, *BACKUP, *COPY, *ACCESS, *FREE, *COMPACT, *RENAME, *WIPE, *DESTROY, *VERIFY, *FORMAT (Master DFS only — Issue 1 DFS used external utilities).
  • ADFS: *MOUNT, *DISMOUNT, *DIR, *BACK, *BYE, *COMPACT, *COPY, *BACKUP, *VERIFY, *FORMAT, *ACCESS, *FREE, *INFO, *MAP, *RENAME, *TITLE, *WIPE.
  • NFS / ANFS: *I AM, *BYE, *PASS, *NOTIFY, *REMOTE, *FS, *FLIP, *LCAT, *LEX, *WIPE, *PROT, *UNPROT, *PS, *POLLPS.

See filing-systems for the API + per-FS detail.

Sideways-ROM commands

Any sideways ROM can claim a command via paged-ROM service-call 4 (“Offer Command”) at boot or dynamically. The ROM gets to inspect the *command text and either claim or pass through. See paged-roms and service-calls.

Common ROM-provided commands include:

  • BASIC ROM: *BASIC (to enter the language)
  • EDIT ROM: *EDIT, *FORMAT (text formatter)
  • VIEW ROM: *VIEW, *VFORM
  • TERMINAL ROM: *TERMINAL

Notable Master MOS commands in detail

*GO / *GOIO

*GO <addr>             — execute at <addr> in current language processor
*GOIO <addr>           — execute at <addr> in I/O processor (host)

*GOIO is critical when a Tube co-processor is active and you need code that touches host-side I/O to run on the host. Without it, code at <addr> runs on the parasite where it has no I/O access.

*CODE / *LINE (USERV dispatch)

*CODE and *LINE invoke a user-installed handler at the address stored in USERV (&0200/&0201), with A=0 (CODE) or A=1 (LINE). The handler can implement custom commands, languages, or extensions. See calls USERV section.

*CONFIGURE / *STATUS

Reads/writes the Master’s CMOS RAM configuration store (cmos-rtc) — keyboard speed, default mode, filing system, network station, tube selection, etc. Settings persist across power-off via the battery-backed CMOS chip.

*CONFIGURE FILE 4        — default FS = ROM 4 (typically ADFS)
*CONFIGURE LANG 12       — default language = ROM 12 (typically BASIC)
*CONFIGURE MODE 135      — default mode = shadow MODE 7
*CONFIGURE TV 0,1        — *TV 0,1 at every boot (no vertical offset, interlace)
*CONFIGURE NOBOOT        — disable auto-boot
*STATUS                  — list all current settings

CMOS layout in cmos-rtc section “Master CMOS layout”.

*FX (= OSBYTE shortcut)

*FX <a> [, <x> [, <y>]]

Equivalent to OSBYTE A=<a>, X=<x>, Y=<y>. The single most-used MOS command — every documented OSBYTE has an *FX form. See osbyte for the directory.

*KEY

*KEY <key number> <string>

Defines what string is generated when the user presses a function key (or COPY / cursor keys). Strings can include MOS-format pipe escapes: |M = CR, |J = LF, |" = literal ", |< = pipe itself, |@ = NUL, |!byte = top-bit-set byte, etc.

Soft keys live in the soft-key buffer — at &0B00-&0BFF on Model B (256 bytes), or &8000-&83FF on Master (1 KB; see os-workspace).

*HELP

The Master extends *HELP to an interactive query system. *HELP <subject> queries each ROM in priority order via service call &18 (“Interactive Help”); each ROM can offer additional information about subjects it knows. With no parameter, *HELP lists every ROM by slot, name and version.

Dispatch internals

When you type a *command (or call OSCLI):

  1. MOS calls CLIV (&0208) which jumps to the MOS internal CLI handler.
  2. The handler strips the leading * and any leading spaces.
  3. It matches the first word against the MOS resident commands above (longest match; abbreviations like *A. resolve to *ADFS if unambiguous).
  4. If no resident-MOS match, it issues service call &04 (“Offer Command”) to all sideways ROMs in priority order. Each ROM can claim or pass.
  5. If still no claim, it issues service call &27 to the active filing system as *RUN <text>.
  6. If still no claim, error 254 Bad command.

You can intercept the entire process by hooking CLIV — but be careful, as MOS uses CLIV internally for things like *RUN. Better to claim service call &04 from a service ROM.

See also


This wiki is curated by Claude following the LLM-Wiki methodology — a human curates source documents, the LLM compiles structured cross-linked markdown. Content may contain errors, omissions, or stale claims. For authoritative information refer to the original source documents in the bbc-documents GitHub archive.