User Tools

Site Tools


ocmbytecode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ocmbytecode [2023/04/23 14:55] – [Opcodes 40..4F] nopsledocmbytecode [2023/04/23 15:05] (current) – [Preliminary documentation for "compat" module] nopsled
Line 604: Line 604:
 ===== Opcodes 60..6F ===== ===== Opcodes 60..6F =====
  
-=== Opcode 0x60 (96): Enclose Smallint ===+=== Opcode 0x60 (96): Enclose Smallint (enclose) ===
 stack input: A smallint stack input: A smallint
  
Line 611: Line 611:
 Note: the blob that gets returned is non-refcounted and lives until explicit destruction (for example by opcode 08) Note: the blob that gets returned is non-refcounted and lives until explicit destruction (for example by opcode 08)
  
-=== Opcode 0x61 (97): Get Enclosed Smallint ===+=== Opcode 0x61 (97): Get Enclosed Smallint (disclose) ===
 stack input: A blob that encloses a small integer, created by opcode 60 stack input: A blob that encloses a small integer, created by opcode 60
  
 stack output: The enclosed small integer stack output: The enclosed small integer
  
-=== Opcode 0x62 (98): Get Significant Bits ===+=== Opcode 0x62 (98): Get Significant Bits (countbits) ===
 stack input: Object of any type stack input: Object of any type
  
 stack ouput: Significant bit in that object. For smallints and bigints its the minimal number of bits to represent the absolute value of that number, for blobs the number of bytes multiplied by 8 and for arrays the sum of the number of significant bits of all entries. stack ouput: Significant bit in that object. For smallints and bigints its the minimal number of bits to represent the absolute value of that number, for blobs the number of bytes multiplied by 8 and for arrays the sum of the number of significant bits of all entries.
  
-=== Opcode 0x63 (99): Immediate Crypted Byte ===+=== Opcode 0x63 (99): Immediate Crypted Byte (0x??w) ===
 immediate data: 1 byte (encrypted if OCM code encryption is enabled) immediate data: 1 byte (encrypted if OCM code encryption is enabled)
  
Line 628: Line 628:
 note: Is often used to refer to the dictionary index where the data is stored. note: Is often used to refer to the dictionary index where the data is stored.
  
-=== Opcode 0x64 (100): Immediate Crypted Word ===+=== Opcode 0x64 (100): Immediate Crypted Word (0x?w) ===
 immediate data: 1 16-bit-word (encrypted if OCM code encryption is enabled) immediate data: 1 16-bit-word (encrypted if OCM code encryption is enabled)
  
 effect: pushes the signed 16 bit value of the immediate operand to the stack as small number effect: pushes the signed 16 bit value of the immediate operand to the stack as small number
  
-=== Opcode 0x65 (101): Immediate Crypted BigInt ===+=== Opcode 0x65 (101): Immediate Crypted BigInt (value) ===
 immediate data: 1 big int (encrypted if OCM code encryption is enabled) immediate data: 1 big int (encrypted if OCM code encryption is enabled)
  
Line 640: Line 640:
 note: If the OCM module uses the DWORD-based decryptor (it doesn't start with 03 01 in that case, we did not encounter such a module yet), it is important to know that the immediate arg is decrypted in three parts: (1) initial length byte, (2) extra length bytes, optional, (3) data bytes. note: If the OCM module uses the DWORD-based decryptor (it doesn't start with 03 01 in that case, we did not encounter such a module yet), it is important to know that the immediate arg is decrypted in three parts: (1) initial length byte, (2) extra length bytes, optional, (3) data bytes.
  
-=== Opcode 0x66 (102): Immediate Crypted Blob ===+=== Opcode 0x66 (102): Immediate Crypted Blob (value) ===
 immediate data: 1 blob (encrypted if OCM code encryption is enabled) immediate data: 1 blob (encrypted if OCM code encryption is enabled)
  
Line 647: Line 647:
 note: If the OCM module uses the DWORD-based decryptor (it doesn't start with 03 01 in that case, we did not encounter such a module yet), it is important to know that the immediate arg is decrypted in three parts: (1) initial length byte, (2) extra length bytes, optional, (3) data bytes. note: If the OCM module uses the DWORD-based decryptor (it doesn't start with 03 01 in that case, we did not encounter such a module yet), it is important to know that the immediate arg is decrypted in three parts: (1) initial length byte, (2) extra length bytes, optional, (3) data bytes.
  
-=== Opcode 0x67 (103): Start Threads ===+=== Opcode 0x67 (103): Start Threads (threads) ===
 stack input: common thread arg (any type); //n// blobs containing byte code; smallint //n// (at top of stack) stack input: common thread arg (any type); //n// blobs containing byte code; smallint //n// (at top of stack)
  
 effect: Starts pseudo-parallel execution of all n blobs. Execution of the main code (that invoked this opcode) stops until all threads are finished or the threaded evaluation mode is cancelled. All threads have their own stack, each containing just the common arg. Also every thread has its private alternate stack. effect: Starts pseudo-parallel execution of all n blobs. Execution of the main code (that invoked this opcode) stops until all threads are finished or the threaded evaluation mode is cancelled. All threads have their own stack, each containing just the common arg. Also every thread has its private alternate stack.
  
-=== Opcode 0x68 (104): Set Time Slice Length ===+=== Opcode 0x68 (104): Set Time Slice Length (timeslice) ===
 stack input: smallint or bigint //len// stack input: smallint or bigint //len//
  
 effect: Sets the time slice length for this subthread to //len//. That is the number of bytecode instructions executed for this thread until execution continues with another thread. The current timeslice is unmodified, it just affects the following slices. effect: Sets the time slice length for this subthread to //len//. That is the number of bytecode instructions executed for this thread until execution continues with another thread. The current timeslice is unmodified, it just affects the following slices.
  
-=== Opcode 0x69 (105): Cancel Threaded Execution ===+=== Opcode 0x69 (105): Cancel Threaded Execution (killthreads) ===
 effect: Aborts executing of all subthreads and immediately continues the main thread past its start threads opcode. effect: Aborts executing of all subthreads and immediately continues the main thread past its start threads opcode.
  
-=== Opcode 0x6A (106): Push To Main Thread Stack ===+=== Opcode 0x6A (106): Push To Main Thread Stack (tomain) ===
 stack input: a value of any type stack input: a value of any type
  
Line 667: Line 667:
 note: This opcode does only make sense in subthreads. note: This opcode does only make sense in subthreads.
  
-=== Opcode 0x6B (107): Pop From Main Thread Stack ===+=== Opcode 0x6B (107): Pop From Main Thread Stack (frommain) ===
 effect: Pops the top value from the stack of the suspended main thread effect: Pops the top value from the stack of the suspended main thread
  
Line 674: Line 674:
 note: This opcode does only make sense in subthreads. note: This opcode does only make sense in subthreads.
  
-=== Opcode 0x6C (108): Copy From Main Thread Stack ===+=== Opcode 0x6C (108): Copy From Main Thread Stack (peekmain) ===
 effect: Copies the top value from the stack of the suspended main thread effect: Copies the top value from the stack of the suspended main thread
  
Line 681: Line 681:
 note: This opcode does only make sense in subthreads. note: This opcode does only make sense in subthreads.
  
-=== Opcode 0x6D (109): gettimeofday ===+=== Opcode 0x6D (109): gettimeofday (gettimeofday) ===
 stack output: seconds since midnight (tv_sec) as bigint (next to top); microseconds within current second (tv_usec) as bigint (top of stack) stack output: seconds since midnight (tv_sec) as bigint (next to top); microseconds within current second (tv_usec) as bigint (top of stack)
  
-=== Opcode 0x6E (110): mktime ===+=== Opcode 0x6E (110): mktime (mktime) ===
 stack input: 6 smallint or bigint values in the following order: seconds, minutes, hours, day (1-based), month (0-based), year (top of stack) stack input: 6 smallint or bigint values in the following order: seconds, minutes, hours, day (1-based), month (0-based), year (top of stack)
  
 stack output: the corresponding unix timestamp stack output: the corresponding unix timestamp
  
-=== Opcode 0x6F (111): localtime ===+=== Opcode 0x6F (111): localtime (localtime) ===
 stack input: a small/big int containing a unix timestamp stack input: a small/big int containing a unix timestamp
  
Line 1245: Line 1245:
 This list shows an overview over the opcodes C2..E0 (from compat, a module inside init.ocm). The numbers are **relative** opcode numbers, i.e. the opcode minus the base opcode of C2. This list shows an overview over the opcodes C2..E0 (from compat, a module inside init.ocm). The numbers are **relative** opcode numbers, i.e. the opcode minus the base opcode of C2.
  
-<code> +=== Opcode 0xC2 (194): Extracts a subblob of a given (length) beginning at position (index) from blob (blob.part) === 
-dd 0 (0xc2) ; DATA XREFinitproc:loc_4166r+If the length is -1, the subblob is taken until the end of the blob.
  
-dd offset BCX_00_Subblob ; DATA XREFinitproc+42r+stack inputstring; index; length 
  
- ; string index length -> substring+stack output: substring
  
-Marcus: If length == -1, take until end of blob.+ 
 +<code>
  
 dd 1 (0xc3) dd 1 (0xc3)
ocmbytecode.1682261746.txt.gz · Last modified: 2023/04/23 14:55 by nopsled

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki