Anonymous

Changes

From Final Fantasy Inside

FF7/Battle/Battle Scenes/Battle Script

930 bytes added, 05:10, 23 May 2019
m
20 revisions imported
|-
| align="center" | 1Xh
| [[FF7/Battle/Battle_Scenes/Battle_AI_Addresses| Address]]
|-
| align="center" | 2Xh
|}
<br/>
They are stored as DWords, but the X will determine how many bytes to use: 0 = bit, 1 = Byte, 2 = Word, 3 = DWordThree bytes
Now that we've seen the stack, here are the opcodes:
|-
| 0Xh
| 2 byte Memory Address
|
| Type 0X stored at translated Address
|-
| 1Xh
| 2 byte Memory Address
|
| Argument Type 1XAddress value with a scope of X
|-
! style="background:rgb(224,224,224)" align="center" colspan = "4" | Mathematical and Bit-wise Operators
|-
| 60h
| One Byte1 byte Value
|
| Argument of type 01
|-
| 61h
| Two Bytes2 byte Value
|
| Argument of type 02
|-
| 62h
| Four Bytes3 byte Value
|
| Argument of type 03
|-
| 70h
| Two Bytes2 byte Script Address
| One of any type
| Jumps to script address in argument if pop is 0
|-
| 71h
| Two Bytes2 byte Script Address
| One of any type
| Jumps to script address in argument if pop and top of stack are not equal
|-
| 72h
| Two Bytes2 byte Script Address
|
| Jumps to script address in argument
| colspan="3" align="center"| This ends the script
|-
| style="background:rgb(255,255,204);" | 74h| style="background:rgb(255,255,204);" || style="background:rgb(255,255,204);" | One of any type| style="background:rgbPops one value from stack. (255,255,204Not used);" | Unknown Effect
|-
| 75h
| 80h
|
| One of type 0X or 2X, One Two of any type| First pop ANDed with masked by second pop.
|-
| 81h
|
| One of any type
| If pop is Type 01, Type 01 with count of number of bits set in pop<br/>If pop is Type 02, Type 02 filled with value of first non-null value in pop
|-
| 84h
|
| One of any type
| Pops variable one value from stack.
|-
| 92h
|
| Two of any type
| First pop is attack ID to perform. Second pop action type (0x20 - enemy attack or 0x24 - display string)<br>
|-
| 93h
|
| One of type 1X, one of type 00
| If second pop is 1, takes value at local address 2010 and writes value at [[FF7/Savemap#Save_Memory_Bank_1.2F2|memory bank1bank 1/2 ]] at offset specified by first pop<br/> otherwise If second pop is 0, data at memory bank1/2 at offset specified by first pop is stored at local address 2010.<br/>Otherwise, command is ignored.
|-
| 96h
| Displays string to debug console, replacing "%d"s with pops
|-
| style="background:rgb(255,255,204);" | A1h| style="background:rgb(255,255,204);" | ?| style="background:rgb(255,255,204);" | ?Two values of any type| style="background:rgbPops two values from stack (255,255Not Used,204but valid command);" | ?
|-
|}
<br/>
GENERAL NOTES:
*Commands Command 90h and 95h are is overloaded.
*If a type 2X is popped and any type is accepted, only the first value will be considered.
*If specific type is expected and that type is not available, the game with either crash or ignore that entire line.
*TRUE and FALSE are stored as type 00 as '1' and '0' respectively.
*Commands 74h and A1h are never used, but have been documented as valid commands.
*Commands 75h and 96h only appear in the Character AI found in the KERNEL.BIN.
*Commands of group 2X, BX, CX, DX, EX, and FX are treated as NOPs. The script will ignore them and continue processing. Also, any 5X, 6X, 7X, 8X, and 9X value that isn't listed above appear to be treated the same way, but it's safest to use a value from the 2X group. An incorrect 0X, 1X, 3X, or 4X will have unintended side-effects.
 
0X & 1X CODES NOTES:
*Valid values for X are 0, 1, 2, and 3.
**These will store a bit, byte, word, and dword respectively.
3X CODES NOTES:
The pushed value is, thus, the MP cost of the defined ability as a type 02. Note that 0x00 to 0xFF are standard magic and always loaded, while 0x100+ are the unique abilities loaded through scene.bin.
 
92 CODE NOTES:
*Second pop must be one of the following:
:[[FF7/Command_data|Command index]] in case of character AI
:20h - For enemy attack
:22h - Force execution of script (referenced by first pop)
:24h - Pauses battle engine while string is displayed (in conjunction with code 93)