FF8/Field/Script/Opcodes

From Final Fantasy Inside
< FF8‎ | Field‎ | Script
Revision as of 10:18, 3 March 2015 by my_wiki>Shard
Jump to navigation Jump to search

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 001 CAL Script Processing
002 002 JMP Script Processing
003 003 JPF Script Processing
004 004 GJMP (Unused) Script Processing
005 005 LBL Script Processing
006 006 RET Script Processing
007 007 PSHN_L Memory
008 008 PSHI_L Memory
009 009 POPI_L Memory
00A 00A PSHM_B Memory
00B 00B POPM_B Memory
00C 00C PSHM_W Memory
00D 00D POPM_W Memory
00E 00E PSHM_L Memory
00F 00F POPM_L Memory
010 010 PSHSM_B Memory
011 011 PSHSM_W Memory
012 012 PSHSM_L Memory
013 013 PSHAC Memory
014 014 REQ Script Processing
015 015 REQSW Script Processing
016 016 REQEW Script Processing
017 017 PREQ Script Processing
018 018 PREQSW Script Processing
019 019 PREQEW Script Processing
01A 01A UNUSE Entity
01B 01B DEBUG (Unused)
01C 01C HALT Script Processing
01D 01D SET Entity
01E 01E SET3 Entity
01F 01F IDLOCK Field related
020 020 IDUNLOCK Field related
021 021 EFFECTPLAY2 Music and Sound
022 022 FOOTSTEP
023 023 JUMP Entity
024 024 JUMP3 Entity
025 025 LADDERUP Entity
026 026 LADDERDOWN Entity
027 027 LADDERUP2 Entity
028 028 LADDERDOWN2 Entity
029 029 MAPJUMP Field related
02A 02A MAPJUMP3 Field related
02B 02B SETMODEL Entity
02C 02C BASEANIME Animation
02D 02D ANIME Animation
02E 02E ANIMEKEEP Animation
02F 02F CANIME Animation
030 030 CANIMEKEEP Animation
031 031 RANIME Animation
032 032 RANIMEKEEP Animation
033 033 RCANIME Animation
034 034 RCANIMEKEEP Animation
035 035 RANIMELOOP Animation
036 036 RCANIMELOOP Animation
037 037 LADDERANIME Animation
038 038 DISCJUMP Field related
039 039 SETLINE Entity
03A 03A LINEON Entity
03B 03B LINEOFF Entity
03C 03C WAIT Script Processing
03D 03D MSPEED
03E 03E MOVE Entity
03F 03F MOVEA
040 040 PMOVEA
041 041 CMOVE
042 042 FMOVE
043 043 PJUMPA
044 044 ANIMESYNC Script Processing
045 045 ANIMESTOP Animation
046 046 MESW (Unused)
047 047 MES Message
048 048 MESSYNC Script Processing
049 049 MESVAR Message
04A 04A ASK Message
04B 04B WINSIZE Message
04C 04C WINCLOSE Message
04D 04D UCON Misc
04E 04E UCOFF Misc
04F 04F MOVIE Movie
050 050 MOVIESYNC Script Processing
051 051 SETPC Party management
052 052 DIR Entity
053 053 DIRP
054 054 DIRA
055 055 PDIRA
056 056 SPUREADY Timer
057 057 TALKON Entity
058 058 TALKOFF Entity
059 059 PUSHON Entity
05A 05A PUSHOFF Entity
05B 05B ISTOUCH
05C 05C MAPJUMPO Field related
05D 05D MAPJUMPON Field related
05E 05E MAPJUMPOFF Field related
05F 05F SETMESSPEED Message
060 060 SHOW Entity
061 061 HIDE Entity
062 062 TALKRADIUS Entity
063 063 PUSHRADIUS Entity
064 064 AMESW Message
065 065 AMES Message
066 066 GETINFO
067 067 THROUGHON Entity
068 068 THROUGHOFF Entity
069 069 BATTLE Battle
06A 06A BATTLERESULT Battle
06B 06B BATTLEON Field related
06C 06C BATTLEOFF Field related
06D 06D KEYSCAN Input
06E 06E KEYON Input
06F 06F AASK Message
070 070 PGETINFO
071 071 DSCROLL
072 072 LSCROLL
073 073 CSCROLL
074 074 DSCROLLA
075 075 LSCROLLA
076 076 CSCROLLA
077 077 SCROLLSYNC Script Processing
078 078 RMOVE
079 079 RMOVEA
07A 07A RPMOVEA
07B 07B RCMOVE
07C 07C RFMOVE
07D 07D MOVESYNC Script Processing
07E 07E CLEAR Field related
07F 07F DSCROLLP
080 080 LSCROLLP
081 081 CSCROLLP
082 082 LTURNR
083 083 LTURNL
084 084 CTURNR
085 085 CTURNL
086 086 ADDPARTY Party Management
087 087 SUBPARTY Party Management
088 088 CHANGEPARTY Party Management
089 089 REFRESHPARTY Party Management
08A 08A SETPARTY Party Management
08B 08B ISPARTY Party Management
08C 08C ADDMEMBER Party Management
08D 08D SUBMEMBER Party Management
08E 08E ISMEMBER (Unused) Party Management
08F 08F LTURN
090 090 CTURN
091 091 PLTURN
092 092 PCTURN
093 093 JOIN Entity
094 094 MESFORCUS (Unused)
095 095 BGANIME Field related
096 096 RBGANIME Field related
097 097 RBGANIMELOOP Field related
098 098 BGANIMESYNC Field related
099 099 BGDRAW Field related
09A 09A BGOFF Field related
09B 09B BGANIMESPEED Field related
09C 09C SETTIMER Timer
09D 09D DISPTIMER Timer
09E 09E SHADETIMER (Unused)
09F 09F SETGETA
0A0 0A0 SETROOTTRANS
0A1 0A1 SETVIBRATE
0A2 0A2 STOPVIBRATE (Unused)
0A3 0A3 MOVIEREADY Movie
0A4 0A4 GETTIMER Timer
0A5 0A5 FADEIN Field related
0A6 0A6 FADEOUT Field related
0A7 0A7 FADESYNC Script Processing
0A8 0A8 SHAKE Field related
0A9 0A9 SHAKEOFF Field related
0AA 0AA FADEBLACK Field related
0AB 0AB FOLLOWOFF
0AC 0AC FOLLOWON
0AD 0AD GAMEOVER Field related
0AE 0AE ENDING (Unused)
0AF 0AF SHADELEVEL
0B0 0B0 SHADEFORM
0B1 0B1 FMOVEA
0B2 0B2 FMOVEP
0B3 0B3 SHADESET
0B4 0B4 MUSICCHANGE Music and Sound
0B5 0B5 MUSICLOAD Music and Sound
0B6 0B6 FADENONE
0B7 0B7 POLYCOLOR
0B8 0B8 POLYCOLORALL
0B9 0B9 KILLTIMER Timer
0BA 0BA CROSSMUSIC
0BB 0BB DUALMUSIC
0BC 0BC EFFECTPLAY Music and Sound
0BD 0BD EFFECTLOAD Music and Sound
0BE 0BE LOADSYNC
0BF 0BF MUSICSTOP Music and Sound
0C0 0C0 MUSICVOL Music and Sound
0C1 0C1 MUSICVOLTRANS Music and Sound
0C2 0C2 MUSICVOLFADE Music and Sound
0C3 0C3 ALLSEVOL Music and Sound
0C4 0C4 ALLSEVOLTRANS Music and Sound
0C5 0C5 ALLSEPOS (Unused) Music and Sound
0C6 0C6 ALLSEPOSTRANS Music and Sound
0C7 0C7 SEVOL Music and Sound
0C8 0C8 SEVOLTRANS Music and Sound
0C9 0C9 SEPOS Music and Sound
0CA 0CA SEPOSTRANS Music and Sound
0CB 0CB SETBATTLEMUSIC Music and Sound
0CC 0CC BATTLEMODE Battle
0CD 0CD SESTOP Music and Sound
0CE 0CE BGANIMEFLAG (Unused)
0CF 0CF INITSOUND
0D0 0D0 BGSHADE
0D1 0D1 BGSHADESTOP
0D2 0D2 RBGSHADELOOP
0D3 0D3 DSCROLL2
0D4 0D4 LSCROLL2
0D5 0D5 CSCROLL2
0D6 0D6 DSCROLLA2
0D7 0D7 LSCROLLA2 (Unused)
0D8 0D8 CSCROLLA2
0D9 0D9 DSCROLLP2 (Unused)
0DA 0DA LSCROLLP2 (Unused)
0DB 0DB CSCROLLP2 (Unused)
0DC 0DC SCROLLSYNC2
0DD 0DD SCROLLMODE2
0DE 0DE MENUENABLE Menus
0DF 0DF MENUDISABLE Menus
0E0 0E0 FOOTSTEPON
0E1 0E1 FOOTSTEPOFF
0E2 0E2 FOOTSTEPOFFALL
0E3 0E3 FOOTSTEPCUT
0E4 0E4 PREMAPJUMP
0E5 0E5 USE Entity
0E6 0E6 SPLIT Entity
0E7 0E7 ANIMESPEED Animation
0E8 0E8 RND
0E9 0E9 DCOLADD
0EA 0EA DCOLSUB
0EB 0EB TCOLADD
0EC 0EC TCOLSUB
0ED 0ED FCOLADD Field related
0EE 0EE FCOLSUB Field related
0EF 0EF COLSYNC Script processing
0F0 0F0 DOFFSET
0F1 0F1 LOFFSETS
0F2 0F2 COFFSETS
0F3 0F3 LOFFSET
0F4 0F4 COFFSET
0F5 0F5 OFFSETSYNC
0F6 0F6 RUNENABLE Entity
0F7 0F7 RUNDISABLE Entity
0F8 0F8 MAPFADEOFF Field related
0F9 0F9 MAPFADEON Field related
0FA 0FA INITTRACE
0FB 0FB SETDRESS Entity
0FC 0FC GETDRESS (Unused) Entity
0FD 0FD FACEDIR Entity
0FE 0FE FACEDIRA
0FF 0FF FACEDIRP
100 100 FACEDIRLIMIT
101 101 FACEDIROFF
102 102 SARALYOFF
103 103 SARALYON
104 104 SARALYDISPOFF
105 105 SARALYDISPON
106 106 MESMODE Message
107 107 FACEDIRINIT
108 108 FACEDIRI
109 109 JUNCTION Party Management
10A 10A SETCAMERA Field related
10B 10B BATTLECUT
10C 10C FOOTSTEPCOPY
10D 10D WORLDMAPJUMP Field related
10E 10E RFACEDIRI (Unused)
10F 10F RFACEDIR
110 110 RFACEDIRA
111 111 RFACEDIRP
112 112 RFACEDIROFF
113 113 FACEDIRSYNC
114 114 COPYINFO
115 115 PCOPYINFO (Unused)
116 116 RAMESW Message
117 117 BGSHADEOFF Field related
118 118 AXIS
119 119 AXISSYNC (Unused)
11A 11A MENUNORMAL Menus
11B 11B MENUPHS Menus
11C 11C BGCLEAR
11D 11D GETPARTY Party Management
11E 11E MENUSHOP Menus
11F 11F DISC Field related
120 120 DSCROLL3 (Unused)
121 121 LSCROLL3
122 122 CSCROLL3
123 123 MACCEL
124 124 MLIMIT
125 125 ADDITEM Item/Magic/Card/GF
126 126 SETWITCH
127 127 SETODIN
128 128 RESETGF
129 129 MENUNAME Menus
12A 12A REST
12B 12B MOVECANCEL
12C 12C PMOVECANCEL (Unused)
12D 12D ACTORMODE
12E 12E MENUSAVE Menus
12F 12F SAVEENABLE Menus
130 130 PHSENABLE Menus
131 131 HOLD Party Management
132 132 MOVIECUT
133 133 SETPLACE
134 134 SETDCAMERA
135 135 CHOICEMUSIC
136 136 GETCARD
137 137 DRAWPOINT Menus
138 138 PHSPOWER
139 139 KEY
13A 13A CARDGAME Menus
13B 13B SETBAR
13C 13C DISPBAR
13D 13D KILLBAR
13E 13E SCROLLRATIO2
13F 13F WHOAMI
140 140 MUSICSTATUS
141 141 MUSICREPLAY
142 142 DOORLINEOFF Entity
143 143 DOORLINEON Entity
144 144 MUSICSKIP
145 145 DYING Party Management
146 146 SETHP Party Management
147 147 GETHP (Unused) Party Management
148 148 MOVEFLUSH
149 149 MUSICVOLSYNC
14A 14A PUSHANIME
14B 14B POPANIME
14C 14C KEYSCAN2 Input
14D 14D KEYON2 (Unused) Input
14E 14E PARTICLEON
14F 14F PARTICLEOFF
150 150 KEYSIGHNCHANGE
151 151 ADDGIL Item/Magic/Card/GF
152 152 ADDPASTGIL Item/Magic/Card/GF
153 153 ADDSEEDLEVEL Item/Magic/Card/GF
154 154 PARTICLESET
155 155 SETDRAWPOINT
156 156 MENUTIPS Menus
157 157 LASTIN
158 158 LASTOUT
159 159 SEALEDOFF
15A 15A MENUTUTO Menus
15B 15B OPENEYES (Unused)
15C 15C CLOSEEYES
15D 15D BLINKEYES (Unused)
15E 15E SETCARD Item/Magic/Card/GF
15F 15F HOWMANYCARD Item/Magic/Card/GF
160 160 WHERECARD Item/Magic/Card/GF
161 161 ADDMAGIC Item/Magic/Card/GF
162 162 SWAP
163 163 SETPARTY2 (Unused)
164 164 SPUSYNC Timer
165 165 BROKEN
166 166 UNKNOWN1
167 167 UNKNOWN2
168 168 UNKNOWN3
169 169 UNKNOWN4
170 170 UNKNOWN5 Item/Magic/Card/GF
171 171 UNKNOWN6 Animation
172 172 UNKNOWN7 Animation
173 173 UNKNOWN8 Animation
174 174 UNKNOWN9 Animation
175 175 UNKNOWN10
176 176 UNKNOWN11
177 177 UNKNOWN12
178 178 UNKNOWN13 Music and Sound
179 179 UNKNOWN14 Music and Sound
180 180 UNKNOWN15
181 181 UNKNOWN16 Field related
182 182 UNKNOWN17 Field related
183 183 UNKNOWN18 Menus