Difference between revisions of "FF7/Field/Script/Opcodes/D5 COS"

From Final Fantasy Inside
< FF7‎ | Field‎ | Script‎ | Opcodes
Jump to navigation Jump to search
(Creation of COS page)
 
Line 23: Line 23:
 
* '''const UByte''' ''M'': Multiplicand, or address to retrieve value if ''B2'' is non-zero.
 
* '''const UByte''' ''M'': Multiplicand, or address to retrieve value if ''B2'' is non-zero.
 
* '''const UByte''' ''A'': Addition, or address to retrieve value if ''B3'' is non-zero.
 
* '''const UByte''' ''A'': Addition, or address to retrieve value if ''B3'' is non-zero.
* '''const UByte''' ''C'': Variable for cos angle, or source address to retrieve value if ''B4'' is non-zero.
+
* '''const UByte''' ''S'': Variable for cos angle, or source address to retrieve value if ''B4'' is non-zero.
  
 
==== Description ====
 
==== Description ====
  
  Var[B1][D] = ( ( Math.cos(Var[B4][C]) * M) + A) >> 12
+
  Var[B1][D] = ( ( Math.cos(Var[B4][S]) * M) + A) >> 12
  
 
Creates a variable from the another variable, with COS, a multiplicand and an addition factor
 
Creates a variable from the another variable, with COS, a multiplicand and an addition factor

Revision as of 16:56, 16 September 2020

  • Opcode: 0xD5
  • Short name: COS
  • Long name: COS Calculation

Memory layout

0xD5 B1 / B2 B3 / B4 D M A C

Arguments

  • const Bit[4] B1: Destination bank.
  • const Bit[4] B2: Bank to retrieve M, or zero if M is specified as a literal value.
  • const Bit[4] B3: Bank to retrieve A, or zero if A is specified as a literal value.
  • const Bit[4] B4: Bank to retrieve S, or zero if S is specified as a literal value.
  • const UByte D: Destination address.
  • const UByte M: Multiplicand, or address to retrieve value if B2 is non-zero.
  • const UByte A: Addition, or address to retrieve value if B3 is non-zero.
  • const UByte S: Variable for cos angle, or source address to retrieve value if B4 is non-zero.

Description

Var[B1][D] = ( ( Math.cos(Var[B4][S]) * M) + A) >> 12

Creates a variable from the another variable, with COS, a multiplicand and an addition factor