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

A math instruction. More...

#include <FieldMathInstruction.h>

Inheritance diagram for FieldMathInstruction:
Collaboration diagram for FieldMathInstruction:

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 StoreInstruction
virtual bool IsStore () const
 Checks if the instruction is a store operation. 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 ProcessSaturatedPLUS (CodeGenerator *code_gen)
 
void ProcessSaturatedPLUS2 (CodeGenerator *code_gen)
 
void ProcessSaturatedMINUS (CodeGenerator *code_gen)
 
void ProcessSaturatedMINUS2 (CodeGenerator *code_gen)
 
void ProcessSaturatedINC (CodeGenerator *code_gen)
 
void ProcessSaturatedINC2 (CodeGenerator *code_gen)
 
void ProcessSaturatedDEC (CodeGenerator *code_gen)
 
void ProcessSaturatedDEC2 (CodeGenerator *code_gen)
 
void ProcessRDMSD (CodeGenerator *code_gen)
 
void ProcessSETBYTE_SETWORD (CodeGenerator *code_gen)
 
void ProcessBITON (CodeGenerator *code_gen)
 Processes a BITON opcode. More...
 
void ProcessBITOFF (CodeGenerator *code_gen)
 Processes a BITON opcode. More...
 
void ProcessPLUSx_MINUSx (CodeGenerator *code_gen, const std::string &op)
 
void ProcessINCx_DECx (CodeGenerator *code_gen, const std::string &op)
 
void ProcessRANDOM (CodeGenerator *code_gen)
 

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 math instruction.

Member Function Documentation

◆ ProcessBITOFF()

void FieldMathInstruction::ProcessBITOFF ( CodeGenerator code_gen)
private

Processes a BITON opcode.

Opcode: 0x83 Short name: BITOFF Long name: Reset Bit

Memory layout (4 bytes) |0x83|D/S|A|B|

Arguments

  • const Bit[4] D: Destination bank.
  • const Bit[4] S: Source bank.
  • const UByte A: Destination address.
  • const UByte Bit: The number of the bit to turn off.

Sets the nth bit in the "A" location, where n is a number between 0-7 supplied in B. A value of zero in B will reset the least significant bit. If the Source Bank is 0 then the bit to be set is taken from "Bit". If the Source Bank is an 8 bit bank, then the bit is the address in that bank where the operand is.

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

◆ ProcessBITON()

void FieldMathInstruction::ProcessBITON ( CodeGenerator code_gen)
private

Processes a BITON opcode.

Opcode: 0x82 Short name: BITON Long name: Set Bit

Memory layout (4 bytes) |0x82|D/S|A|B|

Arguments

  • const Bit[4] D: Destination bank.
  • const Bit[4] S: Source bank.
  • const UByte A: Destination address.
  • const UByte Bit: The number of the bit to turn on.

Sets the nth bit in the "A" location, where n is a number between 0-7 supplied in B. A value of zero in B will set the least significant bit. If the Source Bank is 0 then the bit to be set is taken from "Bit". If the Source Bank is an 8 bit bank, then the bit is the address in that bank where the operand is.

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

◆ ProcessINCx_DECx()

void FieldMathInstruction::ProcessINCx_DECx ( CodeGenerator code_gen,
const std::string &  op 
)
private

◆ ProcessInst()

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

Processes the instruction.

Parameters
[in]funcFunction to process.
[out]stackFunction stack.
[in]engineEngine. Unused.
[in]code_genCode generator.

Implements Instruction.

◆ ProcessPLUSx_MINUSx()

void FieldMathInstruction::ProcessPLUSx_MINUSx ( CodeGenerator code_gen,
const std::string &  op 
)
private

◆ ProcessRANDOM()

void FieldMathInstruction::ProcessRANDOM ( CodeGenerator code_gen)
private

◆ ProcessRDMSD()

void FieldMathInstruction::ProcessRDMSD ( CodeGenerator code_gen)
private

◆ ProcessSaturatedDEC()

void FieldMathInstruction::ProcessSaturatedDEC ( CodeGenerator code_gen)
private

◆ ProcessSaturatedDEC2()

void FieldMathInstruction::ProcessSaturatedDEC2 ( CodeGenerator code_gen)
private

◆ ProcessSaturatedINC()

void FieldMathInstruction::ProcessSaturatedINC ( CodeGenerator code_gen)
private

◆ ProcessSaturatedINC2()

void FieldMathInstruction::ProcessSaturatedINC2 ( CodeGenerator code_gen)
private

◆ ProcessSaturatedMINUS()

void FieldMathInstruction::ProcessSaturatedMINUS ( CodeGenerator code_gen)
private

◆ ProcessSaturatedMINUS2()

void FieldMathInstruction::ProcessSaturatedMINUS2 ( CodeGenerator code_gen)
private

◆ ProcessSaturatedPLUS()

void FieldMathInstruction::ProcessSaturatedPLUS ( CodeGenerator code_gen)
private

◆ ProcessSaturatedPLUS2()

void FieldMathInstruction::ProcessSaturatedPLUS2 ( CodeGenerator code_gen)
private

◆ ProcessSETBYTE_SETWORD()

void FieldMathInstruction::ProcessSETBYTE_SETWORD ( CodeGenerator code_gen)
private

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