Difference between revisions of "AND"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "= {BA} {{IE_BA}} = AND bitwise operand on the current value and the immediate. See Also: {B0} {{IE_B0}}{B2} {{IE_B2}}...")
 
m (Xifanie moved page Event Instruction BA to AND)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= {BA} {{IE_BA}} =
 
= {BA} {{IE_BA}} =
AND bitwise operand on the current value and the immediate.
+
{{IE_BA_ex}}
  
 +
{{IE_BA_desc}}
  
See Also: [[Event_Instruction_B0|{B0} {{IE_B0}}]] ― [[Event_Instruction_B2|{B2} {{IE_B2}}]] ― [[Event_Instruction_B4|{B4} {{IE_B4}}]] ― [[Event_Instruction_B6|{B6} {{IE_B6}}]] ― [[Event_Instruction_B8|{B8} {{IE_B8}}]] ― [[Event_Instruction_B9|{B9} {{IE_B9}}]] ― [[Event_Instruction_BC|{BC} {{IE_BC}}]] ― [[Event_Instruction_BE|{BE} {{IE_BE}}]]
 
  
 +
See also: [[Event_Instruction_BB|{BB} {{IE_BB}}]] ― [[Event_Instruction_BE|{BE} {{IE_BE}}]]
  
 +
 +
== Variable : Half-Word (hex) ==
 
{{Variables}}
 
{{Variables}}
  
  
 
{{Immediate}}
 
{{Immediate}}

Latest revision as of 05:02, 23 February 2021

{BA} AND

AND(xVARI,xVALU)

AND bitwise operand | Variable = Variable AND ImmediateValue

This command compares the individual bits of the value within a Variable and a specific ImmediateValue, and produces a single binary output. This makes this a good way to disable a specific bit within a byte without changing the rest of the bits.

With AND, the resulting bit outputs are set to 1 (TRUE) only if both values' bit inputs are 1.

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 remove the Dead status (which is bit 0x20), but leave their other statii unchanged, you would UnitAddress their Unit ID, LoadAddress their stats at 0x0058 & 0x01BB into temporary variables (let's say 0x0070 & 0x0071), and then run AND(x0070,x00DF) and AND(x0071,x00DF), before using SaveAddress to put the corrected values back. Because the Dead status is in bit 0x20, a value of DF means that every bit except 0x20 is set to 1. As a result, the other statii in that byte will remain unchanged, but by forcing 0x20 to be set to 1 in the ImmediateValue, it will zero out the Dead bit in the final result.


See also: {BB} ANDVar{BE} ZERO


Variable : Half-Word (hex)

Click here for the list of Variables


Immediate Value : Half-Word (hex)

Value that will be use along with the operand to change the address' value.