MSC Commands (Smash 4)

From OpenSA: Smash Engine Documentation Wiki
Jump to: navigation, search

MSC Commands

NOTE: Commands that have 0 parameters are only regarding the ACTUAL command arguments. They can and DO pop args off of the stack depending on the command (such as return)


Hex ID Label Description Parameters
Type Label Description
0x00 nop Does nothing but take up space
0x02 BeginSub Seen at the beginning of every MSC script. May have something to do with parameters Short unknown
Short Local Variable count
0x03 End Ending command. Seen at the end of every script
0x04 jump Exact same as else Integer Jump address
0x05 jump Exact same as else Integer Jump address
0x06 return_6 Pops and returns a value from stack
0x07 return_7 Returns no value but ends script early
0x08 return_8 Pops and returns a value from stack, sets a different return flag than 6/7
0x09 return_9 Returns no value but ends script early, sets a different return flag than 6/7
0xA pushInteger Pushes an integer onto the stack Integer Value Value to push
0xB pushVariable Pushes a variable onto the stack Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0xD pushShort Pushes a 2 byte short onto the stack Short Value Value to push
0xE Add ints Pops 2 integers off the stack and returns the sum of them
0xF Subtract ints Pops 2 integers off the stack and returns the difference of them
0x10 Multiply ints Pops 2 integers off the stack and returns the product of them
0x11 Divide ints Pops 2 integers off the stack and returns the dividend of them
0x12 Modulo ints Pops 2 integers off the stack and returns the remainder of the two divided
0x13 Negation of int Pops 1 integer off the stack and returns the number negated (e.g. 3 returns -3 and vice versa)
0x14 Increment int by 1 Takes a global or local variable and increases the value by 1 Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x15 Decrement int by 1 Takes a global or local variable and decreases the value by 1 Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x16 BitwiseAnd Takes 2 variables off of the stack and returns a bitwise and of the two
0x17 BitwiseOr Takes 2 variables off of the stack and returns a bitwise or of the two
0x18 BitwiseNot Takes 1 variable off of the stack and returns a bitwise not of it
0x19 BitwiseXor Takes 2 variables off of the stack and returns a bitwise xor of the two
0x1A Leftshift
0x1B Rightshift
0x1C Set_Variable Pops value to assign to the variable from the stack. Can be integer, function pointer, or another variable Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x1D Increment int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x1E Decrement int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x1F Multiply int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x20 Divide int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x21 Modulo int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x22 And int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x23 Or int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x24 Xor int by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x25 equals Equals comparison command
0x26 not_equals Not equals comparison command
0x27 less_than Less than comparison command
0x28 less_or_equals Less than or equals comparison command
0x29 greater Greater than comparison command
0x2A greater_or_equal Greater than or equals comparison command
0x2B not Boolean not
0x2C printf Byte Index Index of the string to format and print
0x2D call_func Calls a function by it's ID Byte ParamCount Param Count to pass to the called function
Byte functionID ID of the function to call
0x2E unk_2E Might be some form of try block? used before calls to other functions Integer EndingOffset Offset to the end of the expression body
0x2F call_Func2 Seems to be the same as 0x2D but always after 0x2e and calls the function from a function pointer? pops the function pointer from stack Byte ParamCount Number of parameters to pass to the called function
0x30 Call_Func3 Byte unknown
0x31 Call_Func4 Calls a function using the index of it's script offset in the Script Offsets Chunk Byte Index
0x32 Push Pushes the return of the last command onto stack
0x33 Pop Pops a value off of the stack and returns it
0x34 if if statement. Gets it's comparison method and parameters from the stack Integer EndingOffset Ending offset of the if body
0x35 ifNot Integer EndingOffset Ending offset of the ifNot body
0x36 else Integer endingOffset Offset where the else body ends.
0x38 Int to Float Converts an int on the stack to float and puts it back in the same spot Byte Distance back from top of stack to convert 0 = top of stack, 1 = second from top, etc.
0x39 Float to Int Converts a float on the stack to an int and puts it back in the same spot Byte Distance back from top of stack to convert 0 = top of stack, 1 = second from top, etc.
0x3A Add Float
0x3B Subtract Float
0x3C Multiply Float
0x3D Divide Float
0x3E Negate Float Makes the float negative if positive or vice versa
0x41 floatVarSet Assigns a value to a variable Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x42 Increment float by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x43 Decrement float by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x44 Multiply float by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x45 Divide float by X Byte Variable Type 0 for local, 1 for global
Short ID Variable ID
0x46 Float Greater than
0x47 Float Less than or Equal to
0x48 Float Less than
0x49 Float Not Equals
0x4A Float Equals
0x4B Float Greater than or Equal to