FF8/Field/Script/Opcodes
By Aali, myst6re and Shard.
The language
The field script language in ff8 is a simple assembly language with a stack. Here is an example:
stack = []
PSHM_W 1024 # push var1024 onto the stack (stack = [var1024]) PSHN_L 6 # push number 6 onto the stack (stack = [6Â ; var1024]) CAL EQ # compare the two numbers at the top of the stack, pop this numbers, and push the result (1 or 0) into the stack (stack = [1 or 0]) JPF LABEL1 # if the popped top of the stack is 0, jump to LABEL1 (stack = []) PSHN_L 0 # push 0 at the top of the stack (stack = [0]) POPM_W 1024 # pop the top of the stack into var1024 (stack = []) JMP LABEL2 # goto LABEL2 LABEL1 PSHN_L 1 # push 1 at the top of the stack (stack = [1]) POPM_W 1024 # pop the top of the stack into var1024 (stack = []) LABEL2 ...
In standard code, it's equivalent to:
if(var1024 == 6) { var1024 = 0; } else { var1024 = 1; }
Reading Documentation
Each Opcode's page lists all the parameters for that function in the order you would put them on the stack before the function call. The inline argument is listed separately, if the function requires one. For example, on the page for SET3, the parameters are listed like this:
- XCoord
- YCoord
- ZCoord
- SET3
Which means when you call SET3, the ZCoord is the top item on the stack, YCoord is under it, and XCoord is under that, for example
PSHN_L 402 (XCoord) PSHN_L -381 (YCoord) PSHN_L 20 (ZCoord) SET3 17 (walkmesh triangle ID)
Opcode list
Opcode | Name | Function Type |
---|---|---|
000 |
000 NOP (Unused) |
Script Processing |
001 | Script Processing | |
002 | Script Processing | |
003 | Script Processing | |
004 |
004 GJMP (Unused) |
Script Processing |
005 | Script Processing | |
006 | Script Processing | |
007 | Memory | |
008 | Memory | |
009 | Memory | |
00A | Memory | |
00B | Memory | |
00C | Memory | |
00D | Memory | |
00E | Memory | |
00F | Memory | |
010 | Memory | |
011 | Memory | |
012 | Memory | |
013 | Memory | |
014 | Script Processing | |
015 | Script Processing | |
016 | Script Processing | |
017 | Script Processing | |
018 | Script Processing | |
019 | Script Processing | |
01A | Entity | |
01B |
01B DEBUG (Unused) |
|
01C | Script Processing | |
01D | Entity | |
01E | Entity | |
01F | Field related | |
020 | Field related | |
021 | Music and Sound | |
022 | ||
023 | Entity | |
024 | Entity | |
025 | Entity | |
026 | Entity | |
027 | Entity | |
028 | Entity | |
029 | Field related | |
02A | Field related | |
02B | Entity | |
02C | Animation | |
02D | Animation | |
02E | Animation | |
02F | Animation | |
030 | Animation | |
031 | Animation | |
032 | Animation | |
033 | Animation | |
034 | Animation | |
035 | Animation | |
036 | Animation | |
037 | Animation | |
038 | Field related | |
039 | Entity | |
03A | Entity | |
03B | Entity | |
03C | Script Processing | |
03D | ||
03E | Entity | |
03F | ||
040 | ||
041 | ||
042 | ||
043 | ||
044 | Script Processing | |
045 | Animation | |
046 |
046 MESW (Unused) |
|
047 | Message | |
048 | Script Processing | |
049 | Message | |
04A | Message | |
04B | Message | |
04C | Message | |
04D | Misc | |
04E | Misc | |
04F | Movie | |
050 | Script Processing | |
051 | Party management | |
052 | Entity | |
053 | ||
054 | ||
055 | ||
056 | Timer | |
057 | Entity | |
058 | Entity | |
059 | Entity | |
05A | Entity | |
05B | ||
05C | Field related | |
05D | Field related | |
05E | Field related | |
05F | Message | |
060 | Entity | |
061 | Entity | |
062 | Entity | |
063 | Entity | |
064 | Message | |
065 | Message | |
066 | ||
067 | Entity | |
068 | Entity | |
069 | Battle | |
06A | Battle | |
06B | Field related | |
06C | Field related | |
06D | Input | |
06E | Input | |
06F | Message | |
070 | ||
071 | ||
072 | ||
073 | ||
074 | ||
075 | ||
076 | ||
077 | Script Processing | |
078 | ||
079 | ||
07A | ||
07B | ||
07C | ||
07D | Script Processing | |
07E | Field related | |
07F | ||
080 | ||
081 | ||
082 | ||
083 | ||
084 | ||
085 | ||
086 | Party Management | |
087 | Party Management | |
088 | Party Management | |
089 | Party Management | |
08A | Party Management | |
08B | Party Management | |
08C | Party Management | |
08D | Party Management | |
08E |
08E ISMEMBER (Unused) |
Party Management |
08F | ||
090 | ||
091 | ||
092 | ||
093 | Entity | |
094 |
094 MESFORCUS (Unused) |
|
095 | Field related | |
096 | Field related | |
097 | Field related | |
098 | Field related | |
099 | Field related | |
09A | Field related | |
09B | Field related | |
09C | Timer | |
09D | Timer | |
09E |
09E SHADETIMER (Unused) |
|
09F | ||
0A0 | ||
0A1 | ||
0A2 |
0A2 STOPVIBRATE (Unused) |
|
0A3 | Movie | |
0A4 | Timer | |
0A5 | Field related | |
0A6 | Field related | |
0A7 | Script Processing | |
0A8 | Field related | |
0A9 | Field related | |
0AA | Field related | |
0AB | ||
0AC | ||
0AD | Field related | |
0AE |
0AE ENDING (Unused) |
|
0AF | ||
0B0 | ||
0B1 | ||
0B2 | ||
0B3 | ||
0B4 | Music and Sound | |
0B5 | Music and Sound | |
0B6 | ||
0B7 | ||
0B8 | ||
0B9 | Timer | |
0BA | ||
0BB | ||
0BC | Music and Sound | |
0BD | Music and Sound | |
0BE | ||
0BF | Music and Sound | |
0C0 | Music and Sound | |
0C1 | Music and Sound | |
0C2 | Music and Sound | |
0C3 | Music and Sound | |
0C4 | Music and Sound | |
0C5 |
0C5 ALLSEPOS (Unused) |
Music and Sound |
0C6 | Music and Sound | |
0C7 | Music and Sound | |
0C8 | Music and Sound | |
0C9 | Music and Sound | |
0CA | Music and Sound | |
0CB | Music and Sound | |
0CC | Battle | |
0CD | Music and Sound | |
0CE |
0CE BGANIMEFLAG (Unused) |
|
0CF | ||
0D0 | ||
0D1 | ||
0D2 | ||
0D3 | ||
0D4 | ||
0D5 | ||
0D6 | ||
0D7 |
0D7 LSCROLLA2 (Unused) |
|
0D8 | ||
0D9 |
0D9 DSCROLLP2 (Unused) |
|
0DA |
0DA LSCROLLP2 (Unused) |
|
0DB |
0DB CSCROLLP2 (Unused) |
|
0DC | ||
0DD | ||
0DE | Menus | |
0DF | Menus | |
0E0 | ||
0E1 | ||
0E2 | ||
0E3 | ||
0E4 | ||
0E5 | Entity | |
0E6 | Entity | |
0E7 | Animation | |
0E8 | ||
0E9 | ||
0EA | ||
0EB | ||
0EC | ||
0ED | Field related | |
0EE | Field related | |
0EF | Script processing | |
0F0 | ||
0F1 | ||
0F2 | ||
0F3 | ||
0F4 | ||
0F5 | ||
0F6 | Entity | |
0F7 | Entity | |
0F8 | Field related | |
0F9 | Field related | |
0FA | ||
0FB | Entity | |
0FC |
0FC GETDRESS (Unused) |
Entity |
0FD | Entity | |
0FE | ||
0FF | ||
100 | ||
101 | ||
102 | ||
103 | ||
104 | ||
105 | ||
106 | Message | |
107 | ||
108 | ||
109 | Party Management | |
10A | Field related | |
10B | ||
10C | ||
10D | Field related | |
10E |
10E RFACEDIRI (Unused) |
|
10F | ||
110 | ||
111 | ||
112 | ||
113 | ||
114 | ||
115 |
115 PCOPYINFO (Unused) |
|
116 | Message | |
117 | Field related | |
118 | ||
119 |
119 AXISSYNC (Unused) |
|
11A | Menus | |
11B | Menus | |
11C | ||
11D | Party Management | |
11E | Menus | |
11F | Field related | |
120 |
120 DSCROLL3 (Unused) |
|
121 | ||
122 | ||
123 | ||
124 | ||
125 | Item/Magic/Card/GF | |
126 | ||
127 | ||
128 | ||
129 | Menus | |
12A | ||
12B | ||
12C |
12C PMOVECANCEL (Unused) |
|
12D | ||
12E | Menus | |
12F | Menus | |
130 | Menus | |
131 | Party Management | |
132 | ||
133 | ||
134 | ||
135 | ||
136 | ||
137 | Menus | |
138 | ||
139 | ||
13A | Menus | |
13B | ||
13C | ||
13D | ||
13E | ||
13F | ||
140 | ||
141 | ||
142 | Entity | |
143 | Entity | |
144 | ||
145 | Party Management | |
146 | Party Management | |
147 |
147 GETHP (Unused) |
Party Management |
148 | ||
149 | ||
14A | ||
14B | ||
14C | Input | |
14D |
14D KEYON2 (Unused) |
Input |
14E | ||
14F | ||
150 | ||
151 | Item/Magic/Card/GF | |
152 | Item/Magic/Card/GF | |
153 | Item/Magic/Card/GF | |
154 | ||
155 | ||
156 | Menus | |
157 | ||
158 | ||
159 | ||
15A | Menus | |
15B |
15B OPENEYES (Unused) |
|
15C | ||
15D |
15D BLINKEYES (Unused) |
|
15E | Item/Magic/Card/GF | |
15F | Item/Magic/Card/GF | |
160 | Item/Magic/Card/GF | |
161 | Item/Magic/Card/GF | |
162 | ||
163 |
163 SETPARTY2 (Unused) |
|
164 | Timer | |
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | Item/Magic/Card/GF | |
171 | Animation | |
172 | Animation | |
173 | Animation | |
174 | Animation | |
175 | ||
176 | ||
177 | ||
178 | Music and Sound | |
179 | Music and Sound | |
180 | ||
181 | Field related | |
182 | Field related | |
183 | Menus |