We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

XOR (Super FX): Difference between revisions

From SnesLab
Jump to: navigation, search
(immediate admode)
(→‎References: hid archive URL)
 
(20 intermediate revisions by the same user not shown)
Line 7: Line 7:
|'''Speed'''
|'''Speed'''
|+
|+
|
|[[Immediate]]
|3DC
|3FCn
|2 bytes
|2 bytes
|
|
|+
|+
|[[Immediate]]
|[[Implied]] (type 1)
|3FC
|3DCn
|2 bytes
|2 bytes
|
|
Line 29: Line 29:
|[[Zero Flag|Z]]
|[[Zero Flag|Z]]
|+
|+
|
|0?
|
|0?
|
|0?
|
|.?
|
|?
|
|.?
|
|?
|}
|}


'''XOR''' is an undocumented<sup>[dubious]</sup> (XOR is mentioned on page 2-2-7 of the Nintendo documentation) [[Super FX]] instruction that performs an exculsive or.
'''XOR''' is a poorly documented (XOR is mentioned on [https://archive.org/details/SNESDevManual/book2/page/n101 page 2-2-7 of Book II] of the Nintendo documentation and in the index) [[Super FX]] instruction that performs an exculsive or.
 
In this article, we assume the information in [1] is correct.  Snes9x has a file that denotes that XOR does, in fact, occupy the opcode space between C1 and CF.<sup>[4]</sup>
 
It probably restores the [[ALT0]] state like [[OR]].  The speeds are probably the same as two byte OR as well.
 
The low nybble of the opcode specifies either the immediate value or which general register to use, like OR.  We can deduce this by contradiction because if it were the high nybble instead, [[RPIX]] would have the same opcode as XOR R<sub>4</sub> making them indistinguishable.


It probably restores the [[ALT0]] state like [[OR]].
[[HIB]]'s opcode is C0 and it appears to not care whether ALT1/ALT2 are set.  If that is the case, then we can conclude that like OR, R<sub>0</sub> is not available as XOR's operand and neither can zero be the immediate value.  (But R<sub>0</sub> can still be the source register.)


The source and destination registers should be specified in advance using [[WITH]], [[FROM]], or [[TO]].  Otherwise, R<sub>0</sub> serves as the default.
The source and destination registers should be specified in advance using [[WITH]], [[FROM]], or [[TO]].  Otherwise, R<sub>0</sub> serves as the default.
Line 52: Line 58:
=== See Also ===
=== See Also ===
* [[AND (Super FX)]]
* [[AND (Super FX)]]
* [[OR (Super FX)]]
* [[NOT]]
* [[NOT]]
* [[EOR]]
* [[EOR]]
* [[OR (SPC700)]]


=== References ===
=== References ===
* https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial#Instruction_Set_Table
# https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial#Instruction_Set_Table
* Example 3 on [https://archive.org/details/SNESDevManual/book2/page/n149 page 2-8-10 of Book II] of the official Super Nintendo development manual
# Example 3 on [https://archive.org/details/SNESDevManual/book2/page/n149 page 2-8-10 of Book II] of the official Super Nintendo development manual
# [https://archive.org/details/SNESDevManual/book2/page/n412 Index page 7 of 7 of Book II], lbid.
# https://github.com/snes9xgit/snes9x/blob/master/fxdbg.cpp#L1126


[[Category:ASM]]
[[Category:ASM]]

Latest revision as of 19:14, 12 August 2024

Basic Info
Addressing Mode Opcode Length Speed
Immediate 3FCn 2 bytes
Implied (type 1) 3DCn 2 bytes
Flags Affected
B ALT1 ALT2 O/V S CY Z
0? 0? 0? .? ? .? ?

XOR is a poorly documented (XOR is mentioned on page 2-2-7 of Book II of the Nintendo documentation and in the index) Super FX instruction that performs an exculsive or.

In this article, we assume the information in [1] is correct. Snes9x has a file that denotes that XOR does, in fact, occupy the opcode space between C1 and CF.[4]

It probably restores the ALT0 state like OR. The speeds are probably the same as two byte OR as well.

The low nybble of the opcode specifies either the immediate value or which general register to use, like OR. We can deduce this by contradiction because if it were the high nybble instead, RPIX would have the same opcode as XOR R4 making them indistinguishable.

HIB's opcode is C0 and it appears to not care whether ALT1/ALT2 are set. If that is the case, then we can conclude that like OR, R0 is not available as XOR's operand and neither can zero be the immediate value. (But R0 can still be the source register.)

The source and destination registers should be specified in advance using WITH, FROM, or TO. Otherwise, R0 serves as the default.

Syntax

XOR Rn
XOR #n

See Also

References

  1. https://en.wikibooks.org/wiki/Super_NES_Programming/Super_FX_tutorial#Instruction_Set_Table
  2. Example 3 on page 2-8-10 of Book II of the official Super Nintendo development manual
  3. Index page 7 of 7 of Book II, lbid.
  4. https://github.com/snes9xgit/snes9x/blob/master/fxdbg.cpp#L1126