V-Gears 0
Free Final Fantasy VII engine.
FieldPartyInstruction Class Reference

A party instruction. More...

#include <FieldPartyInstruction.h>

Inheritance diagram for FieldPartyInstruction:
Collaboration diagram for FieldPartyInstruction:

Public Member Functions

virtual void ProcessInst (Function &func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen) override
 Processes the instruction. More...
 
- Public Member Functions inherited from KernelCallInstruction
virtual bool IsKernelCall () const
 Checks if the instruction is a call to a kernel function. More...
 
- Public Member Functions inherited from Instruction
virtual std::ostream & Print (std::ostream &output) const
 Print the instruction to a stream. More...
 
virtual bool IsJump () const
 Checks if the instruction is a jump of some sort. More...
 
virtual bool IsCondJump () const
 Checks if the instruction is a conditional jump. More...
 
virtual bool IsUncondJump () const
 Checks if the instruction is an unconditional jump. More...
 
virtual bool IsStackOp () const
 Checks if the instruction is a stack operation. More...
 
virtual bool IsFuncCall () const
 Checks if the instruction is a call to a script function. More...
 
virtual bool IsReturn () const
 Checks if the instruction is a return statement. More...
 
virtual bool IsKernelCall () const
 Checks if the instruction is a call to a kernel function. More...
 
virtual bool IsLoad () const
 Checks if the instruction is a load operation. More...
 
virtual bool IsStore () const
 Checks if the instruction is a store operation. More...
 
virtual uint32 GetDestAddress () const
 Returns the destination address of a jump instruction. More...
 
virtual void ProcessInst (Function &function, ValueStack &stack, Engine *engine, CodeGenerator *code_gen)=0
 Process an instruction for code generation. More...
 
uint32 GetOpcode () const
 Retrieves the instruction opcode. More...
 
void SetOpcode (uint32 opcode)
 Sets the instruction opcode. More...
 
uint32 GetAddress () const
 Retrieves the instruction address. More...
 
void SetAddress (uint32 address)
 Sets the instruction address. More...
 
std::string GetName () const
 Retrieves the instruction name (the opcode name). More...
 
void SetName (std::string name)
 
int16 GetStackChange () const
 Checks how much the instruction changes the stack pointer. More...
 
void SetStackChange (int16 stack_change)
 Defines how much the instruction changes the stack pointer. More...
 
std::vector< ValuePtrGetParams () const
 Retrieves the list of instruction parameters. More...
 
ValuePtr GetParam (uint32 index) const
 Retrieves a instruction parameter. More...
 
void SetParams (std::vector< ValuePtr > params)
 Sets the instructions parameters. More...
 
void AddParam (ValuePtr value)
 Adds a parameter to the instructions. More...
 
std::string GetCodeGenData () const
 Retrieves metadata for code generation. More...
 
void SetCodeGenData (std::string code_gen_data)
 Sets metadata for code generation. More...
 
bool LabelRequired () const
 Checks if the instruction requires a label. More...
 
void SetLabelRequired (bool required)
 Indicates if the instruction needs a label. More...
 

Private Member Functions

void ProcessGOLDU (CodeGenerator *code_gen)
 Processes a GOLDU opcode. More...
 
void ProcessGOLDD (CodeGenerator *code_gen)
 Processes a GOLDD opcode. More...
 
void ProcessSTITM (CodeGenerator *code_gen)
 Processes a STITM opcode. More...
 
void ProcessDLITM (CodeGenerator *code_gen)
 Processes a DLITM opcode. More...
 
void ProcessCKITM (CodeGenerator *code_gen)
 Processes a CKITM opcode. More...
 
void ProcessPRTYE (CodeGenerator *code_gen)
 
void ProcessCHGLD (CodeGenerator *code_gen)
 Processes a CHGLD opcode. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Instruction
static int INST_TYPE_BINARY_OP
 Binary operation (e.g. More...
 
static int INST_TYPE_BOOL_NEGATE
 Boolean negation. More...
 
static int INST_TYPE_CALL
 Regular function call. More...
 
static int INST_TYPE_COND_JUMP
 Conditional jump. More...
 
static int INST_TYPE_DUP
 Instruction duplicates the most recent stack entry. More...
 
static int INST_TYPE_JUMP
 Unconditional jump. More...
 
static int INST_TYPE_KERNEL_CALL
 Kernel functions. More...
 
static int INST_TYPE_LOAD
 Load value from memory. More...
 
static int INST_TYPE_RETURN
 Return from regular function call. More...
 
static int INST_TYPE_STACK
 Stack allocation or deallocation (altering stack pointer). More...
 
static int INST_TYPE_STORE
 Store value in memory. More...
 
static int INST_TYPE_UNARY_OP_PRE
 Unary operation (e.g. More...
 
static int INST_TYPE_UNARY_OP_POST
 Unary operation with operator placed after the operator. More...
 
- Protected Member Functions inherited from RefCounted
 RefCounted ()
 
virtual ~RefCounted ()
 
- Protected Attributes inherited from Instruction
uint32 opcode_
 The instruction opcode. More...
 
uint32 address_
 The instruction address. More...
 
std::string name_
 The instruction name (opcode name). More...
 
int16 stack_change_
 How much this instruction changes the stack pointer by. More...
 
std::vector< ValuePtrparams_
 Array of parameters used for the instruction. More...
 
std::string code_gen_data_
 String containing metadata for code generation. More...
 
bool label_required_ = false
 Indicates if a label is required. More...
 

Detailed Description

A party instruction.

Member Function Documentation

◆ ProcessCHGLD()

void FieldPartyInstruction::ProcessCHGLD ( CodeGenerator code_gen)
private

Processes a CHGLD opcode.

Opcode: 0x3B Short name: CHGLD Long name: Check gil Memory layout (6 bytes) |0x39|B1/B2|A1|A2|

Arguments

  • const Bit[4] B1: Destination bank 1.
  • const Bit[4] B2: Destination bank 2.
  • const UByte A1: Destination address 1.
  • const UByte A2: Destination address 2.

Copies the amount of gil the party has into the destination addresses. As the gil amount is a four-byte value, the arguments require two destination addresses to place two two-byte values into. Address 1 takes the lower two bytes of the gil amount, while address 2 takes the higher two bytes.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessCKITM()

void FieldPartyInstruction::ProcessCKITM ( CodeGenerator code_gen)
private

Processes a CKITM opcode.

Opcode: 0x5A Short name: CKITM Long name: Check item Memory layout (3 bytes) |0x5A|B|I|A|

Arguments

  • const UByte B: Bank to store result.
  • const UShort I: Item ID to check.
  • const UByte A: Address to store result.

Copies the amount of item I the player has in their inventory, to the bank and address specified.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessDLITM()

void FieldPartyInstruction::ProcessDLITM ( CodeGenerator code_gen)
private

Processes a DLITM opcode.

Opcode: 0x59 Short name: STITM Long name: Set item Memory layout (4 bytes) |0x59|B1/B2|T|T|A|

Arguments

  • const Bit[4] B1: Source bank 1, or zero if T is set as a constant value.
  • const Bit[4] B2: Source bank 2, or zero if A is set as a constant value.
  • const UShort T: Type of item to remove, or source address to retrieve item type from.
  • const UByte A: Amount of item to remove, or source address to retrieve quantity from.

Removes a quantity of an item from the inventory. Either the item is removed explicitly with values, in which case B1 and B2 are zero, or the item type and quantity are retrieved from memory. In this case, bank B1 and address T retrieve the item type, whilst bank B2 and address A retrieve the quantity to remove.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessGOLDD()

void FieldPartyInstruction::ProcessGOLDD ( CodeGenerator code_gen)
private

Processes a GOLDD opcode.

Opcode: 0x40 Short name: GOLDD Long name: Gil Down Memory layout (6 bytes) |0x39|0|A|A|A|A| or |0x39|B/0|A|0|0|0|

Arguments

  • Decrease by a constant amount:
    • const UByte 0: Zero.
    • const ULong A: Amount to increase.
  • Decrease by an amount found in memory:
    • const Bit[4] B: Source bank.
    • const UByte A: Source address.
    • const UByte[3] 0: Three zero bytes.

Decreases the amount of gil by a constant amount, or by an amount found in the source bank B and address A. The total gil can't get below 0.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessGOLDU()

void FieldPartyInstruction::ProcessGOLDU ( CodeGenerator code_gen)
private

Processes a GOLDU opcode.

Opcode: 0x39 Short name: GOLDU Long name: Gil Up Memory layout (6 bytes) |0x39|0|A|A|A|A| or |0x39|B/0|A|0|0|0|

Arguments

  • Increase by a constant amount:
    • const UByte 0: Zero.
    • const ULong A: Amount to increase.
  • Increase by an amount found in memory:
    • const Bit[4] B: Source bank.
    • const UByte A: Source address.
    • const UByte[3] 0: Three zero bytes.

Increases the amount of gil by a constant amount, or by an amount found in the source bank B and address A. The total gil is capped above by 0xFFFFFFFF; attempts to increment further will fail.

Parameters
[in,out]code_genCode generator to append lines.

◆ ProcessInst()

void FieldPartyInstruction::ProcessInst ( Function func,
ValueStack stack,
Engine engine,
CodeGenerator code_gen 
)
overridevirtual

Processes the instruction.

Parameters
[in]funcFunction to process.
[out]stackFunction stack.
[in]engineThe engine. Unused
[in,out]code_genCode generator to append lines.

Implements Instruction.

◆ ProcessPRTYE()

void FieldPartyInstruction::ProcessPRTYE ( CodeGenerator code_gen)
private

◆ ProcessSTITM()

void FieldPartyInstruction::ProcessSTITM ( CodeGenerator code_gen)
private

Processes a STITM opcode.

Opcode: 0x58 Short name: STITM Long name: Set item Memory layout (4 bytes) |0x58|B1/B2|T|T|A|

Arguments

  • const Bit[4] B1: Source bank 1, or zero if T is set as a constant value.
  • const Bit[4] B2: Source bank 2, or zero if A is set as a constant value.
  • const UShort T: Type of item to add, or source address to retrieve item type from.
  • const UByte A: Amount of item to add, or source address to retrieve quantity from.

Adds a new item to the inventory. Either the item is added explicitly with values, in which case B1 and B2 are zero, or the item type and quantity are retrieved from memory. In this case, bank B1 and address T retrieve the item type, whilst bank B2 and address A retrieve the quantity to add.

Parameters
[in,out]code_genCode generator to append lines.

The documentation for this class was generated from the following files: