Difference between revisions of "Template:IE BC desc"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 
OR bitwise operand | Variable = Variable OR ImmediateValue
 
OR bitwise operand | Variable = Variable OR ImmediateValue
 +
 +
This command compares the individual bits of the value between a Variable and a specific ImmediateValue, and produces a single binary output.
 +
 +
With OR, the resulting bit outputs are set to 1 (TRUE) if either value's bit input is 1. This makes this a good way to enable a specific bit within a byte without changing the rest of the bits.
 +
 +
The bits available within a single byte are:
 +
* 0x80
 +
* 0x40
 +
* 0x20
 +
* 0x10
 +
* 0x08
 +
* 0x04
 +
* 0x02
 +
* 0x01
 +
 +
So, for example, if you want to edit a unit's Battle Stats to add the Control flag (which is bit 0x08), but leave the other flags such as their Team untouched, you would LoadAddress the byte into an editable variable, then OR that variable against a value of 0008: OR(xVARI,x0008). This uses a zero value on every bit except 08, which uses a one value, forcing the output to always have Control flagged, while leaving the rest of the bits from the variable unaltered.

Latest revision as of 18:30, 7 May 2021

OR bitwise operand | Variable = Variable OR ImmediateValue

This command compares the individual bits of the value between a Variable and a specific ImmediateValue, and produces a single binary output.

With OR, the resulting bit outputs are set to 1 (TRUE) if either value's bit input is 1. This makes this a good way to enable a specific bit within a byte without changing the rest of the bits.

The bits available within a single byte are:

  • 0x80
  • 0x40
  • 0x20
  • 0x10
  • 0x08
  • 0x04
  • 0x02
  • 0x01

So, for example, if you want to edit a unit's Battle Stats to add the Control flag (which is bit 0x08), but leave the other flags such as their Team untouched, you would LoadAddress the byte into an editable variable, then OR that variable against a value of 0008: OR(xVARI,x0008). This uses a zero value on every bit except 08, which uses a one value, forcing the output to always have Control flagged, while leaving the rest of the bits from the variable unaltered.