Changes

Jump to navigation Jump to search

FF8/Field/Script/Opcodes

8,102 bytes added, 05:22, 23 May 2019
m
13 revisions imported
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:
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 = [])
In standard code, it's equivalent to:
 
if(var1024 == 6) {
var1024 = 0;
}
== 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 [[FF8/Field/Script/Opcodes/01E_SET3|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)
SET3 17 (walkmesh triangle ID)
== Opcode list ==
[[FF8/Field/Script/Opcodes/000 NOP|000 NOP]] ''(Unused)'' [[FF8/Field/Script/Opcodes/001 CAL|001 CAL]] [[FF8/Field/Script/Opcodes/002 JMP|002 JMP]] [[FF8/Field/Script/Opcodes/003 JPF|003 JPF]] [[FF8/Field/Script/Opcodes/004 GJMP|004 GJMP]] ''(Unused)'' [[FF8/Field/Script/Opcodes/005 LBL|005 LBL]] [[FF8/Field/Script/Opcodes/006 RET|006 RET]] [[FF8/Field/Script/Opcodes/007 PSHN_L|007 PSHN_L]] [[FF8/Field/Script/Opcodes/008 PSHI_L|008 PSHI_L]] [[FF8/Field/Script/Opcodes/009 POPI_L|009 POPI_L]] [[FF8/Field/Script/Opcodes/00A PSHM_B|00A PSHM_B]] [[FF8/Field/Script/Opcodes/00B POPM_B|00B POPM_B]] [[FF8/Field/Script/Opcodes/00C PSHM_W|00C PSHM_W]] [[FF8/Field/Script/Opcodes/00D POPM_W|00D POPM_W]] [[FF8/Field/Script/Opcodes/00E PSHM_L|00E PSHM_L]] [[FF8/Field/Script/Opcodes/00F POPM_L|00F POPM_L]] [[FF8/Field/Script/Opcodes/010 PSHSM_B|010 PSHSM_B]] [[FF8/Field/Script/Opcodes/011 PSHSM_W|011 PSHSM_W]] [{| class="wikitable sortable" border="1"! Opcode! Name! Function Type|-| 000|[[FF8/Field/Script/Opcodes/000_NOP|000 NOP]] ''(Unused)''| Script Processing|-| 001|[[FF8/Field/Script/Opcodes/001_CAL|001 CAL]]| Script Processing|-| 002|[[FF8/Field/Script/Opcodes/002_JMP|002 JMP]]| Script Processing|-| 003|[[FF8/Field/Script/Opcodes/003_JPF|003 JPF]]| Script Processing|-| 004|[[FF8/Field/Script/Opcodes/004_GJMP|004 GJMP]] ''(Unused)''| Script Processing|-| 005|[[FF8/Field/Script/Opcodes/005_LBL|005 LBL]]| Script Processing|-| 006|[[FF8/Field/Script/Opcodes/006_RET|006 RET]]| Script Processing|-| 007|[[FF8/Field/Script/Opcodes/007_PSHN_L|007 PSHN_L]]| Memory|-| 008|[[FF8/Field/Script/Opcodes/008_PSHI_L|008 PSHI_L]]| Memory|-| 009|[[FF8/Field/Script/Opcodes/009_POPI_L|009 POPI_L]]| Memory|-| 00A|[[FF8/Field/Script/Opcodes/00A_PSHM_B|00A PSHM_B]]| Memory|-| 00B|[[FF8/Field/Script/Opcodes/00B_POPM_B|00B POPM_B]]| Memory|-| 00C|[[FF8/Field/Script/Opcodes/00C_PSHM_W|00C PSHM_W]]| Memory|-| 00D|[[FF8/Field/Script/Opcodes/00D_POPM_W|00D POPM_W]]| Memory|-| 00E|[[FF8/Field/Script/Opcodes/00E_PSHM_L|00E PSHM_L]]| Memory|-| 00F|[[FF8/Field/Script/Opcodes/00F_POPM_L|00F POPM_L]]| Memory|-| 010|[[FF8/Field/Script/Opcodes/010_PSHSM_B|010 PSHSM_B]]| Memory|-| 011|[[FF8/Field/Script/Opcodes/011_PSHSM_W|011 PSHSM_W]]| Memory|-| 012|[[FF8/Field/Script/Opcodes/012_PSHSM_L|012 PSHSM_L]]| Memory|-| 013|[[FF8/Field/Script/Opcodes/013_PSHAC|013 PSHAC]]| Memory|-| 014|[[FF8/Field/Script/Opcodes/014_REQ|014 REQ]]| Script Processing|-| 015|[[FF8/Field/Script/Opcodes/015_REQSW|015 REQSW]]| Script Processing|-| 016|[[FF8/Field/Script/Opcodes/016_REQEW|016 REQEW]]| Script Processing|-| 017|[[FF8/Field/Script/Opcodes/017_PREQ|017 PREQ]]| Script Processing|-| 018|[[FF8/Field/Script/Opcodes/018_PREQSW|018 PREQSW]]| Script Processing|-| 019|[[FF8/Field/Script/Opcodes/019_PREQEW|019 PREQEW]]| Script Processing|-| 01A|[[FF8/Field/Script/Opcodes/01A_UNUSE|01A UNUSE]]| Entity|-| 01B|[[FF8/Field/Script/Opcodes/01B_DEBUG|01B DEBUG]] ''(Unused)''||-| 01C|[[FF8/Field/Script/Opcodes/01C_HALT|01C HALT]]| Script Processing|-| 01D|[[FF8/Field/Script/Opcodes/01D_SET|01D SET]]| Entity|-| 01E|[[FF8/Field/Script/Opcodes/01E_SET3|01E SET3]]| Entity|-| 01F|[[FF8/Field/Script/Opcodes/01F_IDLOCK|01F IDLOCK]]| Field related|-| 020|[[FF8/Field/Script/Opcodes/020_IDUNLOCK|020 IDUNLOCK]]| Field related|-| 021|[[FF8/Field/Script/Opcodes/021_EFFECTPLAY2|021 EFFECTPLAY2]]| Music and Sound|-| 022|[[FF8/Field/Script/Opcodes/022_FOOTSTEP|022 FOOTSTEP]]||-| 023|[[FF8/Field/Script/Opcodes/023_JUMP|023 JUMP]]| Entity|-| 024|[[FF8/Field/Script/Opcodes/024_JUMP3|024 JUMP3]]| Entity|-| 025|[[FF8/Field/Script/Opcodes/025_LADDERUP|025 LADDERUP]]| Entity|-| 026|[[FF8/Field/Script/Opcodes/026_LADDERDOWN|026 LADDERDOWN]]| Entity|-| 027|[[FF8/Field/Script/Opcodes/027_LADDERUP2|027 LADDERUP2]]| Entity|-| 028|[[FF8/Field/Script/Opcodes/028_LADDERDOWN2|028 LADDERDOWN2]]| Entity|-| 029|[[FF8/Field/Script/Opcodes/029_MAPJUMP|029 MAPJUMP]]| Field related|-| 02A|[[FF8/Field/Script/Opcodes/02A_MAPJUMP3|02A MAPJUMP3]]| Field related|-| 02B|[[FF8/Field/Script/Opcodes/02B_SETMODEL|02B SETMODEL]]| Entity|-| 02C|[[FF8/Field/Script/Opcodes/02C_BASEANIME|02C BASEANIME]]| Animation|-| 02D|[[FF8/Field/Script/Opcodes/02D_ANIME|02D ANIME]]| Animation|-| 02E|[[FF8/Field/Script/Opcodes/02E_ANIMEKEEP|02E ANIMEKEEP]]| Animation|-| 02F|[[FF8/Field/Script/Opcodes/02F_CANIME|02F CANIME]]| Animation|-| 030|[[FF8/Field/Script/Opcodes/030_CANIMEKEEP|030 CANIMEKEEP]]| Animation|-| 031|[[FF8/Field/Script/Opcodes/031_RANIME|031 RANIME]]| Animation|-| 032|[[FF8/Field/Script/Opcodes/032_RANIMEKEEP|032 RANIMEKEEP]]| Animation|-| 033|[[FF8/Field/Script/Opcodes/033_RCANIME|033 RCANIME]]| Animation|-| 034|[[FF8/Field/Script/Opcodes/034_RCANIMEKEEP|034 RCANIMEKEEP]]| Animation|-| 035|[[FF8/Field/Script/Opcodes/035_RANIMELOOP|035 RANIMELOOP]]| Animation|-| 036|[[FF8/Field/Script/Opcodes/036_RCANIMELOOP|036 RCANIMELOOP]]| Animation|-| 037|[[FF8/Field/Script/Opcodes/037_LADDERANIME|037 LADDERANIME]]| Animation|-| 038|[[FF8/Field/Script/Opcodes/038_DISCJUMP|038 DISCJUMP]]| Field related|-| 039|[[FF8/Field/Script/Opcodes/039_SETLINE|039 SETLINE]]| Entity|-| 03A|[[FF8/Field/Script/Opcodes/03A_LINEON|03A LINEON]]| Entity|-| 03B|[[FF8/Field/Script/Opcodes/03B_LINEOFF|03B LINEOFF]]| Entity|-| 03C|[[FF8/Field/Script/Opcodes/03C_WAIT|03C WAIT]]| Script Processing|-| 03D|[[FF8/Field/Script/Opcodes/03D_MSPEED|03D MSPEED]]||-| 03E|[[FF8/Field/Script/Opcodes/03E_MOVE|03E MOVE]]| Entity|-| 03F|[[FF8/Field/Script/Opcodes/03F_MOVEA|03F MOVEA]]||-| 040|[[FF8/Field/Script/Opcodes/040_PMOVEA|040 PMOVEA]]||- 

Navigation menu