ocmbytecode
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
ocmbytecode [2023/04/13 16:16] – [Opcodes 00..0F] nopsled | ocmbytecode [2023/04/14 08:38] – [Opcodes 70..7F] nopsled | ||
---|---|---|---|
Line 367: | Line 367: | ||
effect: if the selector is not zero, the true blob is executed (as in Opcode 31), otherwise the false blob is executed. | effect: if the selector is not zero, the true blob is executed (as in Opcode 31), otherwise the false blob is executed. | ||
- | === Opcode 0x33 (51): While === | + | === Opcode 0x33 (51): While (while) |
stack input: condition flag (smallint) | stack input: condition flag (smallint) | ||
Line 376: | Line 376: | ||
note: The blob reference on the alternate stack is **not** removed by this instruction, | note: The blob reference on the alternate stack is **not** removed by this instruction, | ||
- | === Opcode 0x34 (52): Push to alternate stack === | + | === Opcode 0x34 (52): Push to alternate stack (toalt) |
stack input: value of any type | stack input: value of any type | ||
Line 383: | Line 383: | ||
effect: The value is moved from the standard stack to the alternate stack | effect: The value is moved from the standard stack to the alternate stack | ||
- | === Opcode 0x35 (53): Pop from alternate stack === | + | === Opcode 0x35 (53): Pop from alternate stack (fromalt) |
**alternate** stack input: value of any type | **alternate** stack input: value of any type | ||
Line 390: | Line 390: | ||
effect: The value is moved from the alternate stack to the standard stack | effect: The value is moved from the alternate stack to the standard stack | ||
- | === Opcode 0x36 (54): Peek alternate stack === | + | === Opcode 0x36 (54): Peek alternate stack (peekalt) |
**alternate** stack input: value of any type (not removed by this instruction) | **alternate** stack input: value of any type (not removed by this instruction) | ||
Line 397: | Line 397: | ||
effect: The value is **copied** from the alternate stack to the standard stack | effect: The value is **copied** from the alternate stack to the standard stack | ||
- | === Opcode 0x37 (55): Push 0 === | + | === Opcode 0x37 (55): Push 0 (0) === |
stack output: smallint containing 0 | stack output: smallint containing 0 | ||
- | === Opcode 0x38 (56): Push 1 === | + | === Opcode 0x38 (56): Push 1 (1) === |
stack output: smallint containing 1 | stack output: smallint containing 1 | ||
- | === Opcode 0x39 (57): Push 2 === | + | === Opcode 0x39 (57): Push 2 (2) === |
stack output: smallint containing 2 | stack output: smallint containing 2 | ||
- | === Opcode 0x3A (58): Push 3 === | + | === Opcode 0x3A (58): Push 3 (3) === |
stack output: smallint containing 3 | stack output: smallint containing 3 | ||
- | === Opcode 0x3B (59): Push 4 === | + | === Opcode 0x3B (59): Push 4 (4) === |
stack output: smallint containing 4 | stack output: smallint containing 4 | ||
- | === Opcode 0x3C (60): Push 5 === | + | === Opcode 0x3C (60): Push 5 (5) === |
stack output: smallint containing 5 | stack output: smallint containing 5 | ||
- | === Opcode 0x3D (61): Push 6 === | + | === Opcode 0x3D (61): Push 6 (6) === |
stack output: smallint containing 6 | stack output: smallint containing 6 | ||
- | === Opcode 0x3E (62): Push 7 === | + | === Opcode 0x3E (62): Push 7 (7) === |
stack output: smallint containing 7 | stack output: smallint containing 7 | ||
- | === Opcode 0x3F (63): Push 8 === | + | === Opcode 0x3F (63): Push 8 (8) === |
stack output: smallint containing 8 | stack output: smallint containing 8 | ||
Line 695: | Line 695: | ||
===== Opcodes 70..7F ===== | ===== Opcodes 70..7F ===== | ||
- | === Opcode | + | === Opcode |
stack input: object of any type | stack input: object of any type | ||
stack output: The type tag of that object (see top of the page) | stack output: The type tag of that object (see top of the page) | ||
- | === Opcode 0x71 (113): Get Random Number === | + | === Opcode 0x71 (113): Get Random Number |
stack input: smallint //n// of values to skip | stack input: smallint //n// of values to skip | ||
stack output: The number generated by the user RNG after skipping //n// values. | stack output: The number generated by the user RNG after skipping //n// values. | ||
- | === Opcode 0x72 (114): Set User RNG Autoskip === | + | === Opcode 0x72 (114): Set User RNG Autoskip |
stack input: smallint //n// | stack input: smallint //n// | ||
effect: Enables autoskipping, | effect: Enables autoskipping, | ||
- | === Opcode 0x73 (115): Seed and Enable Stream Decryptor === | + | === Opcode 0x73 (115): Seed and Enable Stream Decryptor |
stack input: smallint //n// as 16 bit seed value. | stack input: smallint //n// as 16 bit seed value. | ||
Line 717: | Line 717: | ||
note: This will indicate that the following bytes are encrypted. | note: This will indicate that the following bytes are encrypted. | ||
- | === Opcode 0x74 (116): Load Stream Decryptor Table === | + | === Opcode 0x74 (116): Load Stream Decryptor Table (decrypttable) |
stack input: A reference to a block of bytes. The size must be a power of 2 | stack input: A reference to a block of bytes. The size must be a power of 2 | ||
effect: Replaces the standard table in the Stream PRNG by the one given as parameter | effect: Replaces the standard table in the Stream PRNG by the one given as parameter | ||
- | === Opcode 0x75 (117): Load Native Module === | + | === Opcode 0x75 (117): Load Native Module |
stack input: A blob containing a (possibly compressed) module of native code | stack input: A blob containing a (possibly compressed) module of native code | ||
Line 729: | Line 729: | ||
effect: The contents of that blob gets loaded into the virtual machine. The first 0x60 bytes of the blob are a header for the module that, amongst other things, contains the name of the module which is used to identify it. The module is decompressed, | effect: The contents of that blob gets loaded into the virtual machine. The first 0x60 bytes of the blob are a header for the module that, amongst other things, contains the name of the module which is used to identify it. The module is decompressed, | ||
- | === Opcode 0x76 (118): Unload native module === | + | === Opcode 0x76 (118): Unload native module |
stack input: A module handle (as smallint) | stack input: A module handle (as smallint) | ||
Line 736: | Line 736: | ||
effect: Unloads the given native module. If it is not named " | effect: Unloads the given native module. If it is not named " | ||
- | === Opcode 0x77 (119): Call a native module === | + | === Opcode 0x77 (119): Call a native module |
stack input: args for the native module (type(s) module specific); module handle (smallint at top) | stack input: args for the native module (type(s) module specific); module handle (smallint at top) | ||
Line 743: | Line 743: | ||
effect: Runs the native code associated with the given module handle. It removes the module handle from the stack before running that module. The module itself can do to the stack whatever it wants. | effect: Runs the native code associated with the given module handle. It removes the module handle from the stack before running that module. The module itself can do to the stack whatever it wants. | ||
- | === Opcode 0x78 (120): Run Unloaded Native Module === | + | === Opcode 0x78 (120): Run Unloaded Native Module |
stack input: possible module args; a blob containing a non-compressed module (at top; like for Opcode 75) | stack input: possible module args; a blob containing a non-compressed module (at top; like for Opcode 75) | ||
Line 750: | Line 750: | ||
effect: Executes the native code from the blob given as parameter. The blob is relocated and exports are loaded (unless it is a " | effect: Executes the native code from the blob given as parameter. The blob is relocated and exports are loaded (unless it is a " | ||
- | === Opcode 0x79 (121): Get Module Name === | + | === Opcode 0x79 (121): Get Module Name (modname) |
stack input: module handle (as smallint) | stack input: module handle (as smallint) | ||
stack ouput: blob containing name of that module | stack ouput: blob containing name of that module | ||
- | === Opcode 0x7A (122): Get Module Handle === | + | === Opcode 0x7A (122): Get Module Handle |
stack input: blob containing of module name | stack input: blob containing of module name | ||
stack ouput: smallint containing module handle | stack ouput: smallint containing module handle | ||
- | === Opcode 0x7B (123): Create Module For Blob === | + | === Opcode 0x7B (123): Create Module For Blob (modcreate) |
stack input: module name (blob next to top); module contents (blob at top) | stack input: module name (blob next to top); module contents (blob at top) | ||
Line 767: | Line 767: | ||
Creates an entry in the module list that references the address range of the blob. | Creates an entry in the module list that references the address range of the blob. | ||
- | === Opcode 0x7C (124): Create Bytecode Module === | + | === Opcode 0x7C (124): Create Bytecode Module |
stack input: module contents (blob); module name (blob at top, optional) | stack input: module contents (blob); module name (blob at top, optional) | ||
Line 774: | Line 774: | ||
Copies the blob contents into the interpreter as bytecode module. If top of stack is <= 8 chars, it is treated as a name. Otherwise the standard name " | Copies the blob contents into the interpreter as bytecode module. If top of stack is <= 8 chars, it is treated as a name. Otherwise the standard name " | ||
- | === Opcode 0x7D (125): Run OCM Module === | + | === Opcode 0x7D (125): Run OCM Module |
stack input: smallint containing module handle. | stack input: smallint containing module handle. | ||
Line 786: | Line 786: | ||
| | ||
- | === Opcode 0x7E (126): Seed User RNG === | + | === Opcode 0x7E (126): Seed User RNG (rng.seed) |
stack input: smallint; blob (at top of stack) | stack input: smallint; blob (at top of stack) | ||
ocmbytecode.txt · Last modified: 2023/04/23 15:05 by nopsled