VSMX
Jump to navigation
Jump to search
Description
Virtual Script Machine Instructions (VSMX) file
Used on:
- RAF file (and so, on Coldboot.raf) with a filename extension .jsx
- some PSP rco
History:
does also have a VSMX decompile option (rcomage vsmxdec --decompile) but it's very buggy and usually doesn't work right (Try hex editing the version? (at 0x4) from 0x20000 to 0x10000.).
File Layout
(section naming need to be wikifyed):
VSMX header Compiled code/instructions Data/String constants (method) name table/Object property global symbols/Variable/function names
Header
Offset | Size | Example (h) | Value (conversion) | Notes |
0x00 | 0x04 | 0x56534D58 | "VSMX" | Magic |
0x04 | 0x04 | 0x00000200 | 0002.0000 | Version?
|
0x08 | 0x04 | 0x34000000 | 0x34 (52) | header length |
0x0C | 0x04 | - | length of compiled code/instructions section | |
0x10 | 0x04 | - | offset of data section | |
0x14 | 0x04 | - | length of data | |
0x18 | 0x04 | - | number of data(seen: 1 or 2) | |
0x1C | 0x04 | - | offset of name table | |
0x20 | 0x04 | - | length of name | |
0x24 | 0x04 | - | number of name | |
0x28 | 0x04 | - | offset of global symbols | |
0x2C | 0x04 | - | length of global symbols | |
0x30 | 0x04 | - | number of global symbols |
Compiled instructions
- Instructions length: 8 bytes
Instructions format should be wikifyed.
OpCode (short) | Mnemonics | Note1 | Note2 |
---|---|---|---|
0x00 | NOP | - | - |
0x01 | ASSGN | Assignment Operators | - |
0x02 | ADD | Arithmetic Operators | - |
0x03 | SUB | Arithmetic Operators | - |
0x04 | MUL | Arithmetic Operators | - |
0x05 | DIV | Arithmetic Operators | - |
0x06 | MOD | Arithmetic Operators | - |
0x07 | TO_NUMBER | - | - |
0x08 | CSIGN | - | - |
0x09 | NOT | - | - |
0x0A | INC | Arithmetic Operators | - |
0x0B | DEC | Arithmetic Operators | - |
0x0C | POST_INC | - | - |
0x0D | POST_DEC | - | - |
0x0E | CMPEQ | Compare Operators | - |
0x0F | CMPNEQ | Compare Operators | - |
0x10 | CMPSEQ | Compare Operators | - |
0x11 | CMPSNEQ | Compare Operators | - |
0x12 | CMPLT | Compare Operators | - |
0x13 | CMPLE | Compare Operators | - |
0x14 | CMPGE | Compare Operators | - |
0x15 | CMPGT | Compare Operators | - |
0x16 | INSTANCEOF | - | - |
0x17 | IN | - | - |
0x18 | TYPEOF | - | - |
0x19 | BIT_AND | Bitwise Operators | - |
0x1A | BIT_XOR | Bitwise Operators | - |
0x1B | BIT_OR | Bitwise Operators | - |
0x1C | BIT_NOT | Bitwise Operators | - |
0x1D | LSHIFT | Bitwise Operators | - |
0x1E | S_RSHIFT | Bitwise Operators | - |
0x1F | U_RSHIFT | - | - |
0x20 | COPY | - | - |
0x21 | SWAP | - | - |
0x22 | REMOVE | - | - |
0x23 | PUSH_UNDEFINED | - | - |
0x24 | PUSH_NULL | - | - |
0x25 | PUSH_BOOL | - | - |
0x26 | PUSH_INT | - | - |
0x27 | PUSH_FLOAT | - | - |
0x28 | PUSH_STRING | - | - |
0x29 | PUSH_OBJECT | - | - |
0x2A | PUSH_FUNC | - | - |
0x2B | PUSH_ARRAY | - | - |
0x2C | PUSH_THIS | - | - |
0x2D | PUSH_LOCAL | - | - |
0x2E | PUSH_GLOBAL | - | - |
0x2F | GETATTR | - | - |
0x30 | GETATTR_KEEPOBJ | - | - |
0x31 | SETATTR | - | - |
0x32 | DELATTR | - | - |
0x33 | APPEND_ATTR | - | - |
0x34 | GETITEM | - | - |
0x35 | GETITEM_KEEPOBJ | - | - |
0x36 | SETITEM | - | - |
0x37 | DELITEM | - | - |
0x38 | APPEND_ITEM | - | - |
0x39 | JUMP | - | - |
0x3A | JUMPT | - | - |
0x3B | JUMPF | - | - |
0x3C | CALL_FUNC | - | - |
0x3D | CALL_METHOD | - | - |
0x3E | CALL_CONSTRUCTOR | - | - |
0x3F | RET | - | - |
0x40 | THROW | - | - |
0x41 | TRYBLK_IN | - | - |
0x42 | TRYBLK_OUT | - | - |
0x43 | CATCH_FINALLYBLK_IN | - | - |
0x44 | CATCH_FINALLYBLK_OUT | - | - |
0x45 | HALT | - | - |
0x46 | DEBUG_FILE | - | - |
0x47 | DEBUG_LINE | - | - |
0x48 | GETITEM_KEEPOBJNAME | - | - |
0x49 | PUSH_VECTOR | - | - |
0x4A | GET_VECTOR_ELEMENT | - | - |
0x4B | GET_VECTOR_ELEMENT_KEEPVECTOR | - | - |
0x4C | ASSGN_VECTOR_ELEMENT | - | - |
0x4D | SETATTR_VECTOR_ELEMENT | - | - |
0x4E | SETITEM_VECTOR_ELEMENT | - | - |
Arithmetic Operators
May be move later to PlayStation_JavaScript or make it as template
Arithmetic operators are used to perform arithmetic between variables and/or values.
OpCode (VSMX) | Mnemonics (VSMX) | Syntax (PSJS) | Description: |
---|---|---|---|
0x02 | ADD | + | Addition |
0x03 | SUB | - | Subtraction |
0x04 | MUL | * | Multiplication |
0x05 | DIV | / | Division |
0x06 | MOD | % | Modulus (division remainder) |
0x0A | INC | ++ | Increment |
0x0B | DEC | -- | Decrement |
Bitwise Operators
Bit operators work on 32 bits numbers.
Any numeric operand in the operation is converted into a 32 bit number.
OpCode (VSMX) | Mnemonics (VSMX) | Syntax (PSJS) | Description: |
---|---|---|---|
0x19 | BIT_AND | & | AND |
0x1B | BIT_OR | | | OR |
0x1C | BIT_NOT | ~ | NOT |
0x1A | BIT_XOR | ^ | XOR |
0x1D | LSHIFT | << | Left Shift |
0x1E | S_RSHIFT | >> | Right Shift |
Compare Operators
Comparison and Logical operators are used to test for true or false.
Comparison operators are used in logical statements to determine equality or difference between variables or values.
OpCode (VSMX) | Mnemonics (VSMX) | Syntax (PSJS) | Description: |
---|---|---|---|
0x0E | CMPEQ | == | Equality |
0x10 | CMPSEQ | === | Strict Equal value and equal type |
0x0F | CMPNEQ | != | Inequality |
0x11 | CMPSNEQ | !== | Strict not equal value or not equal type |
0x15 | CMPGT | > | Greater Than |
0x14 | CMPGE | >= | Greater Than or Equal To |
0x12 | CMPLT | < | Less Than |
0x13 | CMPLE | <= | Less Than or Equal To |
- http://es5.github.io/#x11.9.3 The Abstract Equality Comparison Algorithm
- http://es5.github.io/#x11.9.6 The Strict Equality Comparison Algorithm
Logical Operators
Comparison and Logical operators are used to test for true or false.
Logical operators are used to determine the logic between variables or values.
OpCode (VSMX) | Mnemonics (VSMX) | Syntax (PSJS) | Description: |
---|---|---|---|
- | || | or | |
- | && | and |
|