Immediate opcodes
Immediate opcodes are operations which do not take items from the stack, but read values stored immediately after the opcode in the program's memory. Uxntal has 4 immediate opcodes:
- The literal LIT.
- The jump !routine, immediate of JMP.
- The conditional ?routine, immediate of JCN.
- The subroutine routine, immediate of JSR.
The immediate jump opcodes are slightly faster than their standard opcode counterparts, but do not have modes and cannot be used to do stack arithmetic. The address value of the immediate opcodes are stored in memory as relative shorts, enabling routines making use of these opcodes to be moved around in the program's memory.
Quoting is the act of deferring an operation, for example, a program that does either odd()
or even()
, could use JMP2 to unquote a function pointer passed via the stack.
@fn ( odd* even* val -- ) #01 AND JMP SWP2 POP2 JMP2