#ifndef FZL_OPCODES_H #define FZL_OPCODES_H // Available opcodes typedef enum { FZL_OPCODE_LOADCONST = 0xF00001, // Load const into T (temp) reg FZL_OPCODE_CALL_BUILTIN = 0xF00002, // Call builtin function FZL_OPCODE_PUSHNUM = 0xF00003, // Push number into stack FZL_OPCODE_PUSHBOOL = 0xF00004, // Push boolean into stack FZL_OPCODE_MK_ENVTABLE = 0xF10001, // Allocate new environment table FZL_OPCODE_RM_ENVTABLE = 0xF10002, // Free environment table FZL_OPCODE_STORE = 0xF10003, // Push variable to environment table FZL_OPCODE_LOOKUP_ENV = 0xF10004, // Lookup name in environment table FZL_OPCODE_WRITE = 0xF10005, // Wirte into variable FZL_OPCODE_LOAD_LOCAL = 0xF10006, // Load local variable FZL_OPCODE_STORE_LOCAL = 0xF10007, // Store local variable FZL_OPCODE_JMP = 0xF20001, // Jump to specified IP address FZL_OPCODE_JZ = 0xF20002, // Jump if top value in dstack is zero FZL_OPCODE_CALL = 0xF30001, // Call function FZL_OPCODE_RET = 0xF30002, // Return from function FZL_OPCODE_CALL_EXTERN = 0xF30003, // Call external function FZL_OPCODE_ALLOC_OBJECT = 0xFA0001, // Allocate N slots FZL_OPCODE_GET_FIELD = 0xFA0002, // Get field N of an object at dstack FZL_OPCODE_SET_FIELD = 0xFA0003, // Set field N of an object at dstack FZL_OPCODE_ESCAPE_OBJECT = 0xFA0004, // Make parent envtable as owner FZL_OPCODE_DEREFERENCE = 0xFA0005, // Dereference address FZL_OPCODE_ADD = 0xA00001, // Sum two numbers in dstack FZL_OPCODE_SUB = 0xA00002, // Subract two numbers in dstack FZL_OPCODE_MUL = 0xA00003, // Multiply two numbers in dstack FZL_OPCODE_DIV = 0xA00004, // Divide two numbers in dstack FZL_OPCODE_POW = 0xA00005, // Power first number in dstack by second FZL_OPCODE_MOD = 0xA00006, // Get module of two numbers in dstack FZL_OPCODE_NEG = 0xA00007, // Negotiate number in dstack FZL_OPCODE_BUILD_STR = 0xA10001, // Build a string from N values in dstack FZL_OPCODE_CMP_EQ = 0xB00001, // Equal FZL_OPCODE_CMP_NEQ = 0xB00002, // Not equal FZL_OPCODE_CMP_LT = 0xB00003, // Less than FZL_OPCODE_CMP_LTEQ = 0xB00004, // Less than or equal FZL_OPCODE_CMP_GT = 0xB00005, // Greater than FZL_OPCODE_CMP_GTEQ = 0xB00006, // Greater than or equal FZL_OPCODE_CMP_EQ_STR = 0xB10001, // Strings equality FZL_OPCODE_CMP_NEQ_STR = 0xB10002, // Strings non-equality FZL_OPCODE_CMP_EQ_OBJ = 0xB20001, // Objects equality (by pointer) FZL_OPCODE_CMP_NEQ_OBJ = 0xB20002, // Objects non-equality (by pointer) FZL_OPCODE_AND = 0xC00001, // A && B FZL_OPCODE_OR = 0xC00002, // A || B FZL_OPCODE_NOT = 0xD00001, // !A } fzl_opcode_t; #endif // FZL_OPCODES_H