Pravda VM opcodes

Code Mnemonic Description
0x00 stop Stops program execution.
0x01 jump Alters the program execution counter to the value of the first item of the stack.
0x02 jumpi If the boolean value in head of the stack is true, then alters the program execution counter to the value of the second item in the stack.
0x04 call Firstly, it pushes current program counter to a separate stack (the so called 'call stack'). Then, it alters the program execution counter to the value of the first item of the stack.
0x05 ret Alters the program execution counter to the value of the first item of the call stack (see CALL opcode).
0x06 pcall Takes two words by which it is followed. They are address a and the number of parameters n, respectively. Then it executes the program with the address a and only passes there $n$ top elements of the stack.
0x07 lcall Takes three words by which it is followed.They are address a, function f and the number of parameters n, respectively. Then it executes the function f of the library (which is a special form of program) with address a and only passes there $n$ top elements of the stack.
0x08 scall Takes id of the function from the standard library and executes it.
0x10 pop Removes the first item from the stack.
0x11 push Pushes the data primitive following the opcode to the stack. Refs are prohibited
0x12 dup Duplicates the first item of the stack.
0x13 dupn Duplicates the (n+1)-th item of the stack where n is the first item in the stack.
0x14 swap Swaps the first two items in the stack.
0x15 swapn Swaps the second item of the stack with the (n+1)-th item of the stack where n is the first item in the stack.
0x20 new Puts the data following the opcode to the heap. Pushes the reference to the stack. Refs in structs and ref arrays are prohibited.
0x21 array_get Takes the reference to the array and the index from the stack.Pushes to the stack a primitive at index in array corresponding by the given reference.
0x22 struct_get Takes the reference to the struct and key from the stack.Pushes to the stack a primitive at the key in the struct corresponding by the given reference.
0x24 array_mut Takes the reference to array, primitive and index from the stack.Puts a primitive at index in the array corresponding by the given reference.
0x25 struct_mut Takes the key, primitive and reference to the struct from the stack.Puts a primitive at the key in struct corresponding by the given reference.
0x27 primitive_put Puts the top item from the stack to the memory.Pushes the reference to the stack.
0x28 primitive_get Uses the top item from the stack as referenceto to data in the program memory. Pushes retrieved data to the stack.
0x29 new_array Takes the type of the desired array from the stack. Takes the length of the desired array from the stack. Pushes the new array reference to the stack.
0x30 length Takes the reference to the array or Bytes or Utf8 from the stack. Pushes the length of the given array, Bytes or Utf8 to the stack.
0x50 sput Pops the first item from the stack, interprets it as key. Pops the second item from the stack, interprets it as value. Puts a (key -> value) record to program's storage. If value is a ref, the correspondent value will be taken from the heap. The referenced value shouldn't be RefArray and shouldn't be Struct with refs in the field values.
0x51 sget Pops the first item from the stack, interprets it as key, retrieves the corresponding record from the program storage and pushes the record to the stack. Otherwise throws an exception.
0x52 sdrop Pops the first item from the stack, interprets it as key and removes the corresponding record from the program storage.
0x53 sexist Pops the first item from the stack, interprets it as key and checks the existence of the record corresponding to the key in the program storage.
0x60 add Makes '+' operation on two top items from the stack. Pushes the result to the stack.
0x61 mul Makes '*' operation on two top items from the stack. Pushes the result to the stack.
0x62 div Makes '/' operation on two top items from the stack. Pushes the result to the stack.
0x63 mod Makes '%' operation on two top items from the stack. Pushes the result to the stack.
0x67 lt Checks that the top stack item is less than the subsequent stack item. Pushes the Bool result to the stack.
0x68 gt Checks that the top stack item is greater than the subsequent stack item. Pushes the Bool result to the stack.
0x80 not Logical NOT (negation).Pops items from the stack. If it is 'true' pushes 'false' to the stack. If it is 'false' pushes 'true' to the stack.
0x81 and Makes 'and' operation on two items from the stack. Pushes the result to the stack.
0x82 or Makes 'or' operation on two items from the stack. Pushes the result to the stack.
0x83 xor Makes 'xor' operation on two items from the stack. Pushes the result to the stack.
0x84 eq Checks that the top stack item is equal to the subsequent stack item. Pushes the Bool result to the stack.
0x90 cast Casts the primitive to another type.
0x91 concat Takes two items from stack. Concatenates them and puts the result to the stack.
0x92 slice Takes the start index, end index and item from the stack. Makes a slice of item and puts the result to the stack.
0xA0 from Gives the current executor address.
0xA1 meta
0xA2 paddr Gives the current program address.
0xA5 pcreate Takes the address (pubKey), bytecode, and its ed25519 signature. If the signature is valid and the program didn't exist before at the specified address, creates a new program.
0xA6 pupdate Takes the address of the existing program, code and signature. The signature is computed from the concatenation of an old code and a new code of the program
0xA7 code Take the address of a program. Pushes program bytecode to the stack
0xA8 seal Takes the address of the existing program and signature of code with a seal mark. The signature is computed from the concatenation of the 'Seal' word (in UTF8 encoding) and the current program code.
0xA9 throw Takes a string from the stack and throws an error with description as the given string that stops the program.
0xAA event Takes string and arbitrary data from the stack, create a new event with a name as the given string and with the given data.
0xAB callers Gets caller's 'call stack' (see CALL opcode) and pushes it to the stack
0xAC height Gets the current height of the blockchain and pushes it to the stack.
0xAD hash Gets the hash of the last block and pushes it to the stack.
0xAE time Gets the timestamp of the last block and pushes it to the stack.
0xAF pexist Takes the address (pubKey). Returns true if the program with the given address exists, otherwise false
0xB0 vupdate Takes address (pubKey). Returns true if the program with the given address exists, otherwise false.
0xC0 transfer Gets two parameters a and n from the stack and transfers n native coins from the executor account to the account a.
0xC1 ptransfer Gets two parameters a and n from the stack and transfers n native coins from the current program account to the account a
0xC2 balance Takes the address from the stack, pushes the native coin balance to the stack