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

MOVW (SPC700): Difference between revisions

From SnesLab
Jump to: navigation, search
m (Jeffythedragonslayer moved page MOVW to MOVW (SPC700): SPC700 in title)
(made flags affected more prominent)
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''MOVW''' is an [[SPC700]] instruction that moves a value to or from [[YA]].
{| class="wikitable" style="float:right;clear:right;width:40%"
 
!colspan="5"|Basic Info
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Basic Info (to YA)
|+
|+
|'''Direction'''
|'''Addressing Mode'''
|'''Addressing Mode'''
|'''Opcode'''
|'''Opcode'''
Line 9: Line 8:
|'''Speed'''
|'''Speed'''
|+
|+
|
|to YA
|[[Direct Page Addressing | Direct Page]]
|BA
|BA
|2 bytes
|2 bytes
|5 cycles
|5 cycles
|+
|from YA
|[[Direct Page Addressing | Direct Page]]
|DA
|2 bytes
|4 cycles
|}
|}


{| class="wikitable" style="float:right;clear:right;width:30%"
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Flags Clobbered (to YA)
!colspan="9"|Flags Affected
|+
|Direction
|[[Negative Flag|N]]
|[[Overflow Flag|V]]
|[[Direct Page Flag|P]]
|[[Break Flag|B]]
|[[Half-Carry Flag|H]]
|[[Interrupt Enable Flag|I]]
|[[Zero Flag|Z]]
|[[Carry Flag|C]]
|+
|+
|to YA
|N
|N
|V
|P
|B
|H
|I
|Z
|C
|+
|
|.
|.
|.
|.
Line 33: Line 41:
|.
|.
|.
|.
|
|
|}
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Basic Info (from YA)
|+
|'''Addressing Mode'''
|'''Opcode'''
|'''Length'''
|'''Speed'''
|+
|
|DA
|2 bytes
|4 cycles
|}
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Flags Clobbered (from YA)
|+
|N
|V
|P
|B
|H
|I
|Z
|Z
|C
|.
|+
|+
|from YA
|.
|.
|.
|.
Line 72: Line 54:
|.
|.
|}
|}
'''MOVW''' (Move Word) is an [[SPC700]] instruction that moves a 16-bit [[direct page]] value to or from the [[YA]] register.  There are no variations of MOVW that do not operate on YA.  MOVW performs a read cycle on the low byte of the destination, but not the source.<sup>[2]</sup>
The operands are stored in the instruction stream in the opposite order they appear in the assembler source. In the assembler source, the operand on the right is the source and the operand on the left is the destination.
=== Example ===
From the [[IPL ROM]],
<pre>
MOVW YA, $F6 ; load the byte at direct page location $F6 into A and the byte at direct page location $F7 into Y
MOVW $00, YA ; store the value in Y to direct page location $01 and the value in A to direct page location $00
</pre>


=== See Also ===
=== See Also ===
* [[MOV]]
* [[MOV]]
* [[MOV1]]
* [[ADDW]]
* [[SUBW]]
* [[CMPW]]
=== References ===
# Official Super Nintendo development manual on MOVW: Table C-11 in [https://archive.org/details/SNESDevManual/book1/page/n233 Appendix C-8 of Book I]
# [https://www.romhacking.net/documents/197 anomie's SPC700 doc]


[[Category:ASM]]
[[Category:ASM]]
[[Category:SPC700]]
[[Category:SPC700]]
[[Category:16-bit Data Transmission Commands]]
[[Category:16-bit Data Transmission Commands]]
[[Category:Two-byte Instructions]]

Latest revision as of 14:05, 30 July 2024

Basic Info
Direction Addressing Mode Opcode Length Speed
to YA Direct Page BA 2 bytes 5 cycles
from YA Direct Page DA 2 bytes 4 cycles
Flags Affected
Direction N V P B H I Z C
to YA N . . . . . Z .
from YA . . . . . . . .

MOVW (Move Word) is an SPC700 instruction that moves a 16-bit direct page value to or from the YA register. There are no variations of MOVW that do not operate on YA. MOVW performs a read cycle on the low byte of the destination, but not the source.[2]

The operands are stored in the instruction stream in the opposite order they appear in the assembler source. In the assembler source, the operand on the right is the source and the operand on the left is the destination.

Example

From the IPL ROM,

MOVW YA, $F6	; load the byte at direct page location $F6 into A and the byte at direct page location $F7 into Y
MOVW $00, YA	; store the value in Y to direct page location $01 and the value in A to direct page location $00

See Also

References

  1. Official Super Nintendo development manual on MOVW: Table C-11 in Appendix C-8 of Book I
  2. anomie's SPC700 doc