Difference between revisions of "Shenmue Script"
Jump to navigation
Jump to search
(→Stack) |
|||
Line 26: | Line 26: | ||
|- | |- | ||
| 0x28 - 0x2F || 0010 1xxx nnnnnnnn nnnnnnnn || Execute the n function in set | | 0x28 - 0x2F || 0010 1xxx nnnnnnnn nnnnnnnn || Execute the n function in set | ||
|} | |||
==== Jump ==== | |||
{| class="wikitable" | |||
|- | |||
! Opcode !! Code !! Description | |||
|- | |- | ||
| 0x15 || 0001 0101 nnnnnnnn || Jumps by the amount of n | | 0x15 || 0001 0101 nnnnnnnn || Jumps by the amount of n |
Revision as of 19:48, 2 May 2019
Stack
The stack is used for operations on data. Data is pushed onto the stack and an operation will than be executed on them.
Registers
There is a stack base and stack pointer.
A return value register is also available for function calls, which can be used by the next opcodes.
Instructions
Each opcode is 1 byte in size.
0x00 - 0x7F
Memory, Move, Function operators
0x00 - 0x3F
00xx nnnn
x = intermediate size (1 = 1 byte, 2 = 2 byte, 3 = 4 byte)
n = command
Opcode | Code | Description |
---|---|---|
0x13 | 0001 0011 nnnnnnnn | Writes n somewhere |
0x18 - 0x1F | 0001 1xxx nnnnnnnn | Execute the n function in set |
0x28 - 0x2F | 0010 1xxx nnnnnnnn nnnnnnnn | Execute the n function in set |
Jump
Opcode | Code | Description |
---|---|---|
0x15 | 0001 0101 nnnnnnnn | Jumps by the amount of n |
0x25 | 0010 0101 nnnnnnnn nnnnnnnn | Jumps by the amount of n |
0x35 | 0011 0101 nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn | Jumps by the amount of n |
0x40 - 0x7F
Intermediate value reading.
01xx ddnn
x = intermediate size (1 = 1 byte, 2 = 2 byte, 3 = 4 byte)
d = command
n = subcommand
Opcode | Code | Description |
---|---|---|
0x50 - 0x5F | 0101 xxxx nnnnnnnn | Writes n somewhere(stack?) (1 byte) |
0x60 - 0x6F | 0110 xxxx nnnnnnnn nnnnnnnn | Writes n somewhere(stack?) (2 byte) |
0x70 - 0x7F | 0111 xxxx nnnnnnnn nnnnnnnn nnnnnnnn nnnnnnnn | Writes n somewhere(stack?) (4 byte) |
0x80 - 0xBF (0x80 - 0xA6)
Arithmetic, Comparision/Relational, Logical, Bitwise, Compound assignment operators
Opcode | Code | Description |
---|---|---|
0x80 | 1000 0000 | Read |
0x81 | 1000 0001 | Write |
0x82 | 1000 0010 | MOBJ accessor? |
0x83 | 1000 0011 | MOBJ accessor? |
0x84 | 1000 0100 | MOBJ accessor? |
0x85 | 1000 0101 | MOBJ accessor? |
0x86 | 1000 0110 | MOBJ accessor? |
0x87 | 1000 0111 | MOBJ accessor? |
0x88 | 1000 1000 | != |
0x89 | 1000 1001 | != |
0x8A | 1000 1010 | >= |
0x8B | 1000 1011 | > |
0x8C | 1000 1100 | <= |
0x8D | 1000 1101 | < |
0x8E | 1000 1110 | ~ |
0x8F | 1000 1111 | &= |
0x90 | 1001 0000 | = |
0x91 | 1001 0001 | ^= |
0x92 | 1001 0010 | += |
0x93 | 1001 0011 | -= |
0x94 | 1001 0100 | *= |
0x95 | 1001 0101 | /= |
0x96 | 1001 0110 | %= |
0x97 | 1001 0111 | <<= |
0x98 | 1001 1000 | >>= |
0x9D | 1001 1101 | float cast |
0x9E | 1001 1110 | signed cast |
0x9F | 1001 1111 | <= |
0xA0 | 1010 0000 | < |
0xA1 | 1010 0001 | >= (<= inverted) |
0xA2 | 1010 0010 | > (< inverted) |
0xA3 | 1010 0011 | + |
0xA4 | 1010 0100 | - |
0xA5 | 1010 0101 | * |
0xA6 | 1010 0110 | / |
0xC0 - 0xFF
Invalid
Function Sets
Position | Function Count | Description |
---|---|---|
140559C98 | 1 | Set 1 - Removed function |
140559CA0 | 5 | Set 2 - Memory functions (unused) |
140559CD0 | 466 | Set 3 - General Shenmue stuff |
140A4F1E0 | 1 | Set 4 - Unknown |
140A4F1E8 | 1 | Set 5 - Unknown |
140A4F1F0 | 47 | Set 6 - SCNF stuff |
140554210 | 8 | Set 7 - Unknown |
Function Set (140559CA0)
Function | Description |
---|---|
deleted | ? |
memset | memset |
memcpy | memcpy |
strcpy | strcpy |
sub_14018FFE0 | Reads 140EB1B30 |
Function Set (140559CD0)
Function | Description |
---|---|
sub_140190350 | |
sub_14009B750 | |
sub_14009B790 | |
sub_14009B830 | |
sub_1401905B0 | |
sub_140177D30 | |
sub_1401B8460 | |
sub_14009B890 | |
sub_140190BC0 | |
sub_140190630 | |
sub_1401919B0 | |
sub_140191B60 | |
sub_1401953F0 | |
sub_140192370 | |
sub_140193750 | |
deleted | |
sub_1401937A0 | |
sub_1401937C0 | |
sub_1401938F0 | |
sub_140193920 | |
sub_140193980 | |
sub_140193990 | |
sub_1401939A0 | |
sub_140193A00 | |
sub_140194B70 | |
sub_140194E00 | |
sub_1401950F0 | |
sub_140195380 | |
sub_140195AB0 | |
sub_1401954A0 | |
sub_140195550 | |
sub_140196160 | |
sub_1401972C0 | |
sub_1401972D0 | |
sub_1401973E0 | |
sub_140197450 | |
sub_1401974F0 | |
sub_1402CBD90 | |
sub_1401AB600 | |
sub_1401ABE60 | |
sub_1401ADEF0 | |
sub_1401AE230 | |
sub_1401AE3A0 | |
sub_1401AE730 | |
sub_1401AE8A0 | |
sub_1401B4210 | |
sub_1401B7270 | |
sub_1401B7450 | |
sub_1401B8100 | |
sub_1401B8150 | |
sub_1401B8250 | |
sub_1401975F0 | |
sub_1401976A0 | |
sub_140191D10 | |
sub_140192000 | |
sub_1401ACE20 | |
deleted | |
deleted | |
deleted | |
sub_1401A8EF0 | |
sub_1401A8F20 | |
sub_1401A9000 | |
sub_1401A9080 | |
sub_1401AE0C0 | |
sub_1401B4500 | |
sub_1401AE6B0 | |
sub_140195C90 | |
sub_140193A80 | |
sub_1401B55D0 | |
sub_1401977A0 | |
sub_1401A2EE0 | |
sub_1401A34C0 | |
sub_1401B7470 | |
sub_1401B7530 | |
sub_1401B75B0 | |
sub_1401C1E10 | |
sub_140190D30 | |
sub_1401ADC20 | |
sub_140190A90 | |
sub_14018FA80 | |
sub_140198720 | |
sub_1401B4550 | |
sub_1401B45C0 | |
sub_1401B4650 | |
sub_1401B4660 | |
sub_1401BED00 | |
sub_1401BED30 | |
sub_1401BEDC0 | |
sub_1401BEDE0 | |
sub_140194530 | |
sub_1401BEE40 | |
sub_1401BEE50 | |
sub_1401978E0 | |
sub_1401ACE90 | |
sub_1401B8370 | |
sub_1401B8390 | |
sub_140191CD0 | |
sub_1401AAE20 | |
sub_1401AAE10 | |
sub_1401AAC00 | |
sub_1401AAC70 | |
sub_1401AACE0 | |
sub_1401AAE30 | |
sub_1401AAE70 | |
sub_1401AAEA0 | |
sub_140195DB0 | |
sub_1401B78D0 | |
sub_1401B7C00 | |
sub_140193C00 | |
sub_1401B7620 | |
sub_140194D20 | |
sub_140193D00 | |
sub_1401962B0 | |
sub_1401B7770 | |
sub_1401ABF20 | |
sub_1401AC1E0 | |
deleted | |
sub_1401AE9A0 | |
sub_1400A9420 | |
sub_1400A9430 | |
sub_1400A9440 | |
sub_1400A9450 | |
sub_1400A9460 | |
sub_1400A9470 | |
sub_1400A9480 | |
sub_1400A94A0 | |
... |
Function Set (140A4F1F0)
Function | Description |
---|---|
sub_140191580 | |
sub_1401915C0 | |
sub_1401A8DC0 | |
sub_1401A8E60 | |
sub_14000F380 | |
sub_14000F380 | |
sub_1401A9240 | |
sub_1401A92A0 | |
sub_1401A9440 | |
sub_1401A9460 | |
sub_1401A9470 | |
sub_1401A94D0 | |
sub_1401916A0 | |
sub_1401916A0 | |
sub_1401A91D0 | |
sub_1401A9200 | |
sub_140196560 | |
sub_140196760 | |
sub_1401A9190 | |
sub_1401A91B0 | |
sub_1401966A0 | |
sub_140196760 | |
sub_1401A9520 | |
sub_1401A9570 | |
sub_1401A9590 | |
sub_1401A95C0 | |
sub_1401A9150 | |
sub_1401A9170 | |
sub_1401A94D0 | |
sub_1401A9470 | |
sub_1401A9240 | |
sub_1401A92A0 | |
sub_1401A9240 | |
sub_1401A92A0 | |
sub_1401A92C0 | |
sub_1401A9380 | |
sub_1401A9B50 | |
sub_1401A9BB0 | |
sub_1401A9460 |
Function Set (140554210)
Function | Description |
---|---|
sub_14019F120 | |
sub_14019F3D0 | |
sub_14019F330 | |
sub_1401A1EB0 | |
sub_1401A1F20 | |
sub_1401A1F90 | |
sub_14006D3F0 | |
sub_14000F380 |