Skip to main content

WITH

Enable a special behavior for the subsequent instruction.

OpcodeBytesCyclesFormExample
$0111WITH CARRYWITH CARRY
$0111WITH EUCLIDWITH EUCLID
Control flagOutput
with (WF)This flag is always 1.

Notes

  • Sets the with flag (WF) for the next instruction only. It will be automatically cleared afterwards.

  • For clarity, the assembly syntax uses WITH CARRY or WITH EUCLID according to the subsequent instruction, even though they share the same opcode.

  • If the subsequent instruction is ADD, SUBTRACT, or COMPARE: WITH CARRY includes the carry flag (CF) in the calculation. See the instruction documentation for details.

  • If the subsequent instruction is an DIVIDE: WITH EUCLID requests Euclidean integer division instead of truncated division. See the instruction documentation for details.

  • If the subsequent instruction is not one of the documented forms, the behavior is undefined apart from clearing the with flag (WF). Generally it has no effect; however, future versions may introduce additional behavior.

  • Unlike all other instructions, WITH does not clear the skip flag (SF). This allows the pair of instructions to be skipped, for example:

    COMPARE I:0, 3
    IF ZERO # DIVIDE ONLY IF I:0 EQUALS 3
    WITH EUCLID
    DIVIDE I:4, I:8