Editing VSMX
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= Description = | =Description= | ||
Virtual Script Machine Instructions (VSMX) | Virtual Script Machine Instructions (VSMX) file | ||
* | Used on: | ||
*[[Rich_Appearance_Format_(RAF)|RAF file]] (and so, on [[Coldboot.raf]]) with a filename extension .jsx | |||
*some PSP rco | |||
History: | |||
*http://endlessparadigm.com/forum/showthread.php?tid=21485 | |||
[[Rcomage]] can compile/decompile .jsx (VSMX) <=> .JS (need to change the VSMX version at offset 0x04 to 01 (PSP?) instead of 02 (PS3?) | |||
<pre> | |||
** | but it's very buggy and usually doesn't work right | ||
* | </pre> | ||
=File Layout= | |||
(section naming need to be wikifyed): | |||
*<span style="background-color:#00ffdd; color:#000000;"> VSMX header</span> | |||
*<span style="background-color:#ffffdd; color:#000000;"> Compiled code/instructions</span> | |||
*<span style="background-color:#ffdddd; color:#000000;"> Data/String constants</span> | |||
*<span style="background-color:#ddddff; color:#000000;"> (method) name table/Object property</span> | |||
*<span style="background-color:#ddffdd; color:#000000;"> global symbols/Variable/function names</span> | |||
= | = Header = | ||
{| class="wikitable" style="text-align: center;" | {| class="wikitable" style="text-align: center;" | ||
| | |- | ||
| style="background-color:#56534D; color:#ffffff;" |'''Offset''' | |||
|-{{cellcolors| | | style="background-color:#56534D; color:#ffffff;" |'''Size''' | ||
| style="background-color:#56534D; color:#ffffff;" |'''Example (hex)'''<BR />from coldboot.jsx | |||
| style="background-color:#56534D; color:#ffffff;" |'''Value (conversion)''' | |||
| style="background-color:#56534D; color:#ffffff;" |'''Notes''' | |||
|-{{cellcolors|#00ffdd}} | |||
| 0x00 || 0x04 || 0x56534D58 || VSMX || Magic | | 0x00 || 0x04 || 0x56534D58 || VSMX || Magic | ||
|-{{cellcolors| | |-{{cellcolors|#00ffdd}} | ||
| 0x04 || 0x04 || 0x00000200 || 2.0 || Mayor version.Minor version (PSP=1.0) (PS3=2.0) | | 0x04 || 0x04 || 0x00000200 || 2.0 || Mayor version.Minor version (PSP=1.0) (PS3=2.0) | ||
|-{{cellcolors|#ffffdd}} | |-{{cellcolors|#ffffdd}} | ||
| 0x08 || 0x04 || 0x34000000 || 0x34 || absolute offset of | | 0x08 || 0x04 || 0x34000000 || 0x34 || absolute offset of compiled code/instructions section (also, header length) | ||
|-{{cellcolors|#ffffdd}} | |-{{cellcolors|#ffffdd}} | ||
| 0x0C || 0x04 || 0x30100000 || 0x1030 || length of | | 0x0C || 0x04 || 0x30100000 || 0x1030 || length of compiled code/instructions section (the number of entries can be deduced by dividing / 8) | ||
|-{{cellcolors|#ffdddd}} | |-{{cellcolors|#ffdddd}} | ||
| 0x10 || 0x04 || 0x64100000 || 0x1064 || absolute offset of STRING table | | 0x10 || 0x04 || 0x64100000 || 0x1064 || absolute offset of STRING table | ||
Line 48: | Line 64: | ||
|} | |} | ||
* | *VSMX files are used on: | ||
** | **PSP (inside RCO's from video/music UMDs, and two lftv firmware RCO's in flash0/vsh/resource/...) | ||
** | **PS3 (inside .RAF's) | ||
**PSVita & PS4 (unknown) | |||
*Table access related opcodes: | |||
**0x28 PUSH_STRING | |||
**0x2F GETATTR | |||
**0x2E PUSH_GLOBAL | |||
= Compiled instructions = | |||
See [http://pastebin.com/vRCDzXt1 Pastebin] (without the header) of the coldboot. | *Instructions length: 2x4 bytes? | ||
*See [http://pastebin.com/vRCDzXt1 Pastebin] (without the header) of the coldboot. | |||
{| class="wikitable" | {| class="wikitable sortable" | ||
|- | |- | ||
! '''OpCode (short)''' | |||
! '''Mnemonics''' (official) | |||
! '''Mnemonics''' (rcomage) | |||
! '''Note1''' | |||
! '''Note2''' | |||
|- | |- | ||
| | | 0x00 || NOP || - || - || - | ||
|- | |- | ||
| 0x01 || ASSGN || ASSIGN || Assignment Operators || - | |||
|- | |- | ||
| 0x02 | | 0x02 || ADD || ADD || Arithmetic Operators || - | ||
|- | |- | ||
| 0x03 || | | 0x03 || SUB || - || Arithmetic Operators || - | ||
|- | |- | ||
| 0x04 | | 0x04 || MUL || MULTIPLY || Arithmetic Operators || - | ||
|- | |- | ||
| 0x05 | | 0x05 || DIV || DIVIDE || Arithmetic Operators || - | ||
|- | |- | ||
| 0x06 | | 0x06 || MOD || - || Arithmetic Operators || - | ||
|- | |- | ||
| 0x07 | | 0x07 || TO_NUMBER || - || - || - | ||
|- | |- | ||
| 0x08 | | 0x08 || CSIGN || NEGATE || - || - | ||
|- | |- | ||
| 0x09 | | 0x09 || NOT || - || - || - | ||
|- | |- | ||
| 0x0A | | 0x0A || INC || - || Arithmetic Operators || - | ||
|- | |- | ||
| 0x0B || | | 0x0B || DEC || - || Arithmetic Operators || - | ||
|- | |- | ||
| 0x0C | | 0x0C || POST_INC || - || - || - | ||
|- | |- | ||
| 0x0D | | 0x0D || POST_DEC || - || - || - | ||
|- | |- | ||
| 0x0E || CMPEQ || TEST_EQUAL || 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 || END_STATEMENT || - || - | |||
|- | |- | ||
| | | 0x23 || PUSH_UNDEFINED || CONST_NULL || - || - | ||
|- | |- | ||
| | | 0x24 || PUSH_NULL || - || - || - | ||
|- | |- | ||
| | | 0x25 || PUSH_BOOL || - || - || - | ||
|- | |- | ||
| 0x26 || PUSH_INT || CONST_INT || - || - | |||
|- | |- | ||
| | | 0x27 || PUSH_FLOAT || CONST_FLOAT || - || - | ||
|- | |- | ||
| | | 0x28 || PUSH_STRING || CONST_STRING || - || - | ||
|- | |- | ||
| | | 0x29 || PUSH_OBJECT || - || - || - | ||
|- | |- | ||
| | | 0x2A || PUSH_FUNC || FUNCTION || - || byte 4 uses a "flag" | ||
|- | |- | ||
| | | 0x2B || PUSH_ARRAY || - || - || - | ||
|- | |- | ||
| | | 0x2C || PUSH_THIS || - || - || - | ||
|- | |- | ||
| 0x2D || PUSH_LOCAL || UNNAMED_VARIABLE || - || - | |||
|- | |- | ||
| | | 0x2E || PUSH_GLOBAL || NAME || - || - | ||
|- | |- | ||
| | | 0x2F || GETATTR || PROPERTY || - || - | ||
|- | |- | ||
| | | 0x30 || GETATTR_KEEPOBJ || METHOD || - || - | ||
|- | |- | ||
| | | 0x31 || SETATTR || SET || - || - | ||
|- | |- | ||
| | | 0x32 || DELATTR || - || - || - | ||
|- | |- | ||
| | | 0x33 || APPEND_ATTR || - || - || - | ||
|- | |- | ||
| 0x34 || GETITEM || - || - || - | |||
|- | |- | ||
| | | 0x35 || GETITEM_KEEPOBJ || - || - || - | ||
|- | |- | ||
| | | 0x36 || SETITEM || ARRAY_INDEX_ASSIGN || - || - | ||
|- | |- | ||
| | | 0x37 || DELITEM || - || - || - | ||
|- | |- | ||
| | | 0x38 || APPEND_ITEM || - || - || - | ||
|- | |- | ||
| | | 0x39 || JUMP || JUMP || - || - | ||
|- | |- | ||
| 0x3A || JUMPT || - || - || - | |||
|- | |- | ||
| | | 0x3B || JUMPF || JUMP_IF_FALSE || - || - | ||
|- | |- | ||
| | | 0x3C || CALL_FUNC || - || - || - | ||
|- | |- | ||
| | | 0x3D || CALL_METHOD || CALL_METHOD || - || - | ||
|- | |- | ||
| | | 0x3E || CALL_CONSTRUCTOR || CALL_INBUILT / CALL_NEW <!-- different versions of rcomage --> || - || - | ||
|- | |- | ||
| | | 0x3F || RET || RETURN || - || - | ||
|- | |- | ||
| 0x40 || THROW || - || - || - | |||
|- | |- | ||
| | | 0x41 || TRYBLK_IN || - || - || - | ||
|- | |- | ||
| | | 0x42 || TRYBLK_OUT || - || - || - | ||
|- | |- | ||
| | | 0x43 || CATCH_FINALLYBLK_IN || - || - || - | ||
|- | |- | ||
| 0x44 || CATCH_FINALLYBLK_OUT || - || - || - | |||
|- | |- | ||
| | | 0x45 || HALT || END_SCRIPT || - || - | ||
|- | |- | ||
| | | 0x46 || DEBUG_FILE || - || - || - | ||
|- | |- | ||
| | | 0x47 || DEBUG_LINE || - || - || - | ||
|- | |- | ||
| 0x48 || GETITEM_KEEPOBJNAME || - || - || - | |||
|- | |- | ||
| | | 0x49 || PUSH_VECTOR || UNKNOWN_49 || - || - | ||
|- | |- | ||
| | | 0x4A || GET_VECTOR_ELEMENT || UNKNOWN_4a || - || - | ||
|- | |- | ||
| 0x4B || GET_VECTOR_ELEMENT_KEEPVECTOR || - || - || - | |||
|- | |- | ||
| | | 0x4C || ASSGN_VECTOR_ELEMENT || - || - || - | ||
|- | |- | ||
| | | 0x4D || SETATTR_VECTOR_ELEMENT || UNKNOWN_4d || - || - | ||
|- | |- | ||
| | | 0x4E || SETITEM_VECTOR_ELEMENT || - || - || - | ||
|- | |||
|- | |||
| | |||
|- | |- | ||
|} | |} | ||
== Arithmetic Operators == | |||
May be move later to [[ | May be move later to [[PlayStation_JavaScript]] or make it as template | ||
Arithmetic operators are used to perform arithmetic between variables and/or values. | Arithmetic operators are used to perform arithmetic between variables and/or values. | ||
Line 268: | Line 258: | ||
! OpCode ([[VSMX|VSMX]]) | ! OpCode ([[VSMX|VSMX]]) | ||
! Mnemonics ([[VSMX|VSMX]]) | ! Mnemonics ([[VSMX|VSMX]]) | ||
! Syntax ([[ | ! Syntax ([[PlayStation_JavaScript|PSJS]]) | ||
! Description: | ! Description: | ||
|- | |- | ||
Line 284: | Line 274: | ||
|- | |- | ||
| 0x0B || DEC || -- || Decrement | | 0x0B || DEC || -- || Decrement | ||
|- | |- | ||
|} | |} | ||
== Bitwise Operators == | |||
Bit operators work on 32 bits numbers. | Bit operators work on 32 bits numbers. | ||
Line 303: | Line 289: | ||
! OpCode ([[VSMX|VSMX]]) | ! OpCode ([[VSMX|VSMX]]) | ||
! Mnemonics ([[VSMX|VSMX]]) | ! Mnemonics ([[VSMX|VSMX]]) | ||
! Syntax ([[ | ! Syntax ([[PlayStation_JavaScript|PSJS]]) | ||
! Description: | ! Description: | ||
|- | |- | ||
| 0x19 || BIT_AND || & || AND | | 0x19 || BIT_AND || & || AND | ||
|- | |- | ||
| 0x1B || BIT_OR || <nowiki>|</nowiki> || OR | | 0x1B || BIT_OR || <nowiki>|</nowiki> || OR | ||
|- | |- | ||
| 0x1C || BIT_NOT || ~ || NOT | | 0x1C || BIT_NOT || ~ || NOT | ||
|- | |||
| 0x1A || BIT_XOR || ^ || XOR | |||
|- | |- | ||
| 0x1D || LSHIFT || << || Left Shift | | 0x1D || LSHIFT || << || Left Shift | ||
Line 320: | Line 306: | ||
|} | |} | ||
== Compare Operators == | |||
Comparison and Logical operators are used to test for true or false. | Comparison and Logical operators are used to test for true or false. | ||
Line 331: | Line 317: | ||
! OpCode ([[VSMX|VSMX]]) | ! OpCode ([[VSMX|VSMX]]) | ||
! Mnemonics ([[VSMX|VSMX]]) | ! Mnemonics ([[VSMX|VSMX]]) | ||
! Syntax ([[ | ! Syntax ([[PlayStation_JavaScript|PSJS]]) | ||
! Description: | ! Description: | ||
|- | |- | ||
| 0x0E || CMPEQ || == || Equality | | 0x0E || CMPEQ || == || Equality | ||
|- | |||
| 0x10 || CMPSEQ || === || Strict Equal value and equal type | |||
|- | |- | ||
| 0x0F || CMPNEQ || != || Inequality | | 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 | | 0x12 || CMPLT || < || Less Than | ||
|- | |- | ||
| 0x13 || CMPLE || <= || Less Than or Equal To | | 0x13 || CMPLE || <= || Less Than or Equal To | ||
|- | |- | ||
|} | |} | ||
Line 355: | Line 341: | ||
*http://es5.github.io/#x11.9.6 The Strict 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. | Comparison and Logical operators are used to test for true or false. | ||
Line 366: | Line 352: | ||
! OpCode ([[VSMX|VSMX]]) | ! OpCode ([[VSMX|VSMX]]) | ||
! Mnemonics ([[VSMX|VSMX]]) | ! Mnemonics ([[VSMX|VSMX]]) | ||
! Syntax ([[ | ! Syntax ([[PlayStation_JavaScript|PSJS]]) | ||
! Description: | ! Description: | ||
|- | |- | ||
Line 375: | Line 361: | ||
|} | |} | ||
{{File Formats}}<noinclude>[[Category:Main]]</noinclude> | {{File Formats}}<noinclude>[[Category:Main]]</noinclude> |