We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
XBA: Difference between revisions
From SnesLab
(→External Links: Clark link) |
(endianness) |
||
Line 36: | Line 36: | ||
'''XBA''' is a [[65c816]] instruction that exchanges the high byte (B) and low byte (typically called A) of the [[C accumulator]]. It works even in [[6502 emulation mode]]. In [[65816 native mode]], its standard mnemonic is still "XBA" even when the accumulator is 16-bits wide. An alternative mnemonic is "SWA." | '''XBA''' is a [[65c816]] instruction that exchanges the high byte (B) and low byte (typically called A) of the [[C accumulator]]. It works even in [[6502 emulation mode]]. In [[65816 native mode]], its standard mnemonic is still "XBA" even when the accumulator is 16-bits wide. An alternative mnemonic is "SWA." | ||
XBA can be used to convert [[big endian]] data to [[little endian]] and vice versa. | |||
The [[negative flag]] will match the most significant bit of the new low byte (A) of the accumulator. | The [[negative flag]] will match the most significant bit of the new low byte (A) of the accumulator. |
Revision as of 09:24, 24 July 2024
Basic Info | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Implied (type 1) | EB | 1 byte | 3 cycles |
Flags Affected | |||||||
---|---|---|---|---|---|---|---|
N | V | M | X | D | I | Z | C |
. | . | . | . | . | . |
XBA is a 65c816 instruction that exchanges the high byte (B) and low byte (typically called A) of the C accumulator. It works even in 6502 emulation mode. In 65816 native mode, its standard mnemonic is still "XBA" even when the accumulator is 16-bits wide. An alternative mnemonic is "SWA."
XBA can be used to convert big endian data to little endian and vice versa.
The negative flag will match the most significant bit of the new low byte (A) of the accumulator. The zero flag will be set if and only if the new low byte (A) of the accumulator is zero, otherwise it is cleared.
Syntax
XBA SWA
See Also
External Links
- Eyes & Lichty page 524, on XBA: https://archive.org/details/0893037893ProgrammingThe65816/page/524
- Labiak page 204 on XBA: https://archive.org/details/Programming_the_65816/page/n214
- snes9x implementation of XBA: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3261
- undisbeliever on XBA: https://undisbeliever.net/snesdev/65816-opcodes.html#xba-exchange-the-b-and-a-accumulators
- Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.10.3