Changes

Jump to navigation Jump to search

FF8/Field/Script/Opcodes

1,002 bytes added, 16:39, 8 July 2012
no edit summary
== 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
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;
}
 
== Opcode list ==
 
[[FF8/Field/Script/Opcodes/000 NOP|000 NOP]] ''(Unused)''
[[FF8/Field/Script/Opcodes/001 CAL|001 CAL]]
Anonymous user

Navigation menu