WITH
Enable a special behavior for the subsequent instruction.
| Opcode | Bytes | Cycles | Form |
|---|---|---|---|
| $01 | 1 | 1 | with carry |
| $01 | 1 | 1 | with euclid |
| Control flag | Output |
|---|---|
| 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 carryorwith euclidaccording to the subsequent instruction, even though they share the same opcode. -
If the subsequent instruction is
add,subtract, orcompare:with carryincludes the carry flag (CF) in the calculation. See the instruction documentation for details. -
If the subsequent instruction is a
divide:with euclidrequests 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,
withdoes 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