Skip to main content

Debug and Codepage Primitives

Opcodes beginning with FE are reserved for the debug primitives. These primitives have known fixed operation length and behave as (multibyte) NOP operations.

However, when invoked in a TVM instance with debug mode enabled, these primitives can produce a specific output into the text debug log of the TVM instance, never affecting the TVM state.

DEBUG and DEBUGSTR are the two debug primitives, they cover all opcodes that start with FE. Other primitives listed here have opcodes from the same set. When debug is enabled, they have their specified effects. When debug is disabled, they behave as NOP.

TVM Instructions Content List

OpcodeFift syntaxStackDescriptionGas
Please enter a search query
No results found

Debug Primitives

xxxxxxx
Opcode
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax
xxxxxxxxxxxxxxxxx
Stack
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description
xxxx
Gas
FEnn{nn} DEBUG-0 <= nn < 24026
FEFnssss{string} DEBUGSTR
{string} {x} DEBUGSTRI
-0 <= n < 16. Length of ssss is n+1 bytes.
{string} is a string literal.
DEBUGSTR: ssss is the given string.
DEBUGSTRI: ssss is one-byte integer 0 <= x <= 255 followed by the given string.
26
FE00DUMPSTK-Dumps the stack (at most the top 255 values) and shows the total stack depth.26
FE2is[i] DUMP-Dumps s[i].26

Codepage primitives

xxxxxxx
Opcode
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Fift syntax
xxxxxxxxxxxxxxxxx
Stack
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Description
xxxx
Gas
FFnn[nn] SETCP-Selects TVM codepage 0 <= nn < 240. If the codepage is not supported, throws an invalid opcode exception.26
FF00SETCP0-Selects TVM (test) codepage zero as described in this document.26
FFFz[z-16] SETCP-Selects TVM codepage z-16 for 1 <= z <= 15. Negative codepages -13...-1 are reserved for restricted versions of TVM needed to validate runs of TVM in other codepages. Negative codepage -14 is reserved for experimental codepages, not necessarily compatible between different TVM implementations, and should be disabled in the production versions of TVM.26
FFF0SETCPXc - Selects codepage c with -2^15 <= c < 2^15 passed in the top of the stack.26

TVM Instructions Content List