Execution Control

Overview

Execution control instructions directly affect the state of the currently running program.

These are native CPU instructions. They may terminate execution, report a fatal program error, or explicitly perform no operation.

For control flow within a running program, including branches and subroutines, see Branching.


Program termination

HALT — Halt Program

HALT

Immediately terminates the currently running program and returns control to the shell.

Operands

This instruction takes no operands.

Modified registers

Register Description
pc Set to 0.

Examples

-- Stop execution normally.
HALT

Notes

  • HALT indicates normal program termination.
  • No further instructions from the current program are executed.
  • Control returns to the shell.

ERROR — Abort with Error

ERROR <message>

Immediately terminates the currently running program with an error and returns control to the shell.

Alias: HCF

Operands

Position Name Type Range Description
1 message String value Error message to report.

Modified registers

Register Description
pc Set to 0.
er Error message supplied by the program.

Examples

-- Terminate with an error.
ERROR "INVALID INPUT"

HCF behaves identically to ERROR:

-- Halt and catch fire.
HCF "OH NO"

Notes

  • ERROR sets er to the supplied message before terminating the program.
  • No further instructions from the current program are executed.
  • Control returns to the shell.
  • The terminated program cannot inspect or handle the resulting error.

No operation

PASS — No Operation

PASS

Performs no operation and continues execution normally.

Alias: NOP

Operands

This instruction takes no operands.

Modified registers

This instruction does not modify any registers.

Examples

-- Explicitly do nothing.
PASS

NOP behaves identically to PASS:

NOP

Notes

  • PASS has no effect on registers or program state.
  • Execution continues normally with the next instruction.
  • PASS may be useful as a placeholder or as the target of a label that intentionally performs no work.