We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
MOV (SPC700): Difference between revisions
From SnesLab
(linkify ARAM) |
(missing "." in manual) |
||
(35 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{| class="wikitable" style="float:right;clear:right;width: | {| class="wikitable" style="float:right;clear:right;width:45%" | ||
!colspan="8"|Basic Info (Group 1) | !colspan="8"|Basic Info (Group 1) | ||
|+ | |+ | ||
Line 7: | Line 7: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Immediate Addressing | Immediate]] | ||
|E8 | |E8 | ||
|2 bytes | |2 bytes | ||
|3 cycles | |3 cycles | ||
|+ | |+ | ||
| | |[[Implied]] (type 1) | ||
|E6 | |E6 | ||
|1 byte | |1 byte | ||
|3 cycles | |3 cycles | ||
|+ | |+ | ||
| | |[[Implied]] (type 1) | ||
|BF | |BF | ||
|1 byte | |1 byte | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|E4 | |E4 | ||
|2 bytes | |2 bytes | ||
|3 cycles | |3 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by X]] | ||
|F4 | |F4 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|E5 | |E5 | ||
|3 bytes | |3 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Absolute Indexed by X]] | ||
|F5 | |F5 | ||
|3 bytes | |3 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Absolute Indexed by Y]] | ||
|F6 | |F6 | ||
|3 bytes | |3 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed Indirect by X]] | ||
|E7 | |E7 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indirect Indexed by Y]] | ||
|F7 | |F7 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles | ||
|+ | |+ | ||
| | |[[Immediate Addressing | Immediate]] | ||
|CD | |CD | ||
|2 bytes | |2 bytes | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|F8 | |F8 | ||
|2 bytes | |2 bytes | ||
|3 cycles | |3 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by Y]] | ||
|F9 | |F9 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|E9 | |E9 | ||
|3 bytes | |3 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Immediate Addressing | Immediate]] | ||
|8D | |8D | ||
|2 bytes | |2 bytes | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|EB | |EB | ||
|2 bytes | |2 bytes | ||
|3 cycles | |3 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by X]] | ||
|FB | |FB | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|EC | |EC | ||
|3 bytes | |3 bytes | ||
Line 99: | Line 99: | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="8"|Flags | !colspan="8"|Flags Affected (Group 1) | ||
|+ | |||
|[[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]] | |||
|+ | |+ | ||
|N | |N | ||
|. | |. | ||
|. | |. | ||
Line 116: | Line 116: | ||
|. | |. | ||
|. | |. | ||
|Z | |||
|. | |. | ||
|} | |} | ||
{| class="wikitable" style="float:right;clear:right;width: | {| class="wikitable" style="float:right;clear:right;width:45%" | ||
!colspan="8"|Basic Info (Group 2) | !colspan="8"|Basic Info (Group 2) | ||
|+ | |+ | ||
Line 128: | Line 128: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Implied]] (type 1) | ||
|C6 | |C6 | ||
|1 byte | |1 byte | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Implied]] (type 1) | ||
|AF | |AF | ||
|1 byte | |1 byte | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|C4 | |C4 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by X]] | ||
|D4 | |D4 | ||
|2 bytes | |2 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|C5 | |C5 | ||
|3 bytes | |3 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Absolute Indexed by X]] | ||
|D5 | |D5 | ||
|3 bytes | |3 bytes | ||
|6 cycles | |6 cycles | ||
|+ | |+ | ||
| | |[[Absolute Indexed by Y]] | ||
|D6 | |D6 | ||
|3 bytes | |3 bytes | ||
|6 cycles | |6 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed Indirect by X]] | ||
|C7 | |C7 | ||
|2 bytes | |2 bytes | ||
|7 cycles | |7 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indirect Indexed by Y]] | ||
|D7 | |D7 | ||
|2 bytes | |2 bytes | ||
|6 cycles | |6 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|D8 | |D8 | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by Y]] | ||
|D9 | |D9 | ||
|2 bytes | |2 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|C9 | |C9 | ||
|3 bytes | |3 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|CB | |CB | ||
|2 bytes | |2 bytes | ||
|4 cycles | |4 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Indexed by X]] | ||
|DB | |DB | ||
|2 bytes | |2 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Absolute Addressing | Absolute]] | ||
|CC | |CC | ||
|3 bytes | |3 bytes | ||
Line 210: | Line 205: | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="8"|Flags | !colspan="8"|Flags Affected (Group 2) | ||
|+ | |+ | ||
|N | |[[Negative Flag|N]] | ||
|V | |[[Overflow Flag|V]] | ||
|P | |[[Direct Page Flag|P]] | ||
|B | |[[Break Flag|B]] | ||
|H | |[[Half-Carry Flag|H]] | ||
|I | |[[Interrupt Enable Flag|I]] | ||
|Z | |[[Zero Flag|Z]] | ||
|C | |[[Carry Flag|C]] | ||
|+ | |+ | ||
|. | |. | ||
Line 231: | Line 226: | ||
|} | |} | ||
{| class="wikitable" style="float:right;clear:right;width: | {| class="wikitable" style="float:right;clear:right;width:40%" | ||
!colspan="8"|Basic Info (Group 3) | !colspan="8"|Basic Info (Group 3) | ||
|+ | |+ | ||
Line 239: | Line 234: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|7D | |7D | ||
|1 byte | |1 byte | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|DD | |DD | ||
|1 byte | |1 byte | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|5D | |5D | ||
|1 byte | |1 byte | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|FD | |FD | ||
|1 byte | |1 byte | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|9D | |9D | ||
|1 byte | |1 byte | ||
Line 266: | Line 261: | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="8"|Flags | !colspan="8"|Flags Affected (Group 3) | ||
|+ | |||
|[[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]] | |||
|+ | |+ | ||
|N | |N | ||
|. | |. | ||
|. | |. | ||
Line 283: | Line 278: | ||
|. | |. | ||
|. | |. | ||
|Z | |||
|. | |. | ||
|} | |} | ||
{| class="wikitable" style="float:right;clear:right;width: | {| class="wikitable" style="float:right;clear:right;width:40%" | ||
!colspan="8"|Basic Info (Group 3 cont.) | !colspan="8"|Basic Info (Group 3 cont.) | ||
|+ | |+ | ||
Line 295: | Line 290: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Implied Addressing | Implied]] (type 1) | ||
|BD | |BD | ||
|1 byte | |1 byte | ||
|2 cycles | |2 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Addressing | Direct Page]] | ||
|FA | |FA | ||
|3 bytes | |3 bytes | ||
|5 cycles | |5 cycles | ||
|+ | |+ | ||
| | |[[Direct Page Immediate]] | ||
|8F | |8F | ||
|3 bytes | |3 bytes | ||
Line 312: | Line 307: | ||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="8"|Flags | !colspan="8"|Flags Affected (Group 3 cont.) | ||
|+ | |+ | ||
|N | |[[Negative Flag|N]] | ||
|V | |[[Overflow Flag|V]] | ||
|P | |[[Direct Page Flag|P]] | ||
|B | |[[Break Flag|B]] | ||
|H | |[[Half-Carry Flag|H]] | ||
|I | |[[Interrupt Enable Flag|I]] | ||
|Z | |[[Zero Flag|Z]] | ||
|C | |[[Carry Flag|C]] | ||
|+ | |+ | ||
|. | |. | ||
Line 338: | Line 333: | ||
* In Group 2, MOV moves values from registers to ARAM. | * In Group 2, MOV moves values from registers to ARAM. | ||
* In Group 3, MOV moves values from registers to registers or from ARAM to ARAM. | * In Group 3, MOV moves values from registers to registers or from ARAM to ARAM. | ||
Most MOV variations that target memory perform a read cycle on the destination, which will reset T2OUT.<sup>[3]</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. | |||
The official manual is missing a "." after each Z in the NVPBHIZC column for Groups 1 & 3. | |||
=== Syntax === | |||
<pre> | |||
Group 1: | |||
MOV A, #imm | |||
MOV A, (X) | |||
MOV A, (X)+ | |||
MOV A, dp | |||
MOV A, dp+X | |||
MOV A, !abs | |||
MOV A, !abs+X | |||
MOV A, !abs+Y | |||
MOV A, [dp+X] | |||
MOV A, [dp]+Y | |||
MOV X, #imm | |||
MOV X, dp | |||
MOV X, dp+Y | |||
MOV X, !abs | |||
MOV Y, #imm | |||
MOV Y, dp | |||
MOV Y, dp+X | |||
MOV Y, !abs | |||
Group 2: | |||
MOV (X), A | |||
MOV (X)+, A | |||
MOV dp, A | |||
MOV dp+X, A | |||
MOV !abs, A | |||
MOV !abs+X, A | |||
MOV !abs+Y, A | |||
MOV [dp+X], A | |||
MOV [dp]+Y, A | |||
MOV dp, X | |||
MOV dp+Y, X | |||
MOV !abs, X | |||
MOV dp, Y | |||
MOV dp+X, Y | |||
MOV !abs, Y | |||
Group 3: | |||
MOV A, X | |||
MOV A, Y | |||
MOV X, A | |||
MOV Y, A | |||
MOV X, SP | |||
MOV SP, X | |||
MOV dp<d>, dp<s> | |||
MOV dp, #imm | |||
</pre> | |||
Some people find the official MOV mnemonic cumbersome and prefer to use an assembler that supports [[65c816]]-style mnemonics such as [[TAX]] and [[TAY]]. | |||
=== See Also === | |||
* [[MOVW]] | |||
* [[MOV1]] | |||
=== External Links === | === External Links === | ||
# Official Super Nintendo development manual on MOV: [https://archive.org/details/SNESDevManual/book1/page/n228 Appendix C-3 of Book I] | |||
# [https://archive.org/details/SNESDevManual/book1/page/n229 Appendix C-4 of Book I] lbid | |||
# [https://www.romhacking.net/documents/197 anomie's SPC700 doc] | |||
[[Category:ASM]] | [[Category:ASM]] | ||
[[Category:SPC700]] | [[Category:SPC700]] | ||
[[Category:8-bit Data Transmission Commands]] |
Latest revision as of 14:50, 30 July 2024
Basic Info (Group 1) | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Immediate | E8 | 2 bytes | 3 cycles | ||||
Implied (type 1) | E6 | 1 byte | 3 cycles | ||||
Implied (type 1) | BF | 1 byte | 4 cycles | ||||
Direct Page | E4 | 2 bytes | 3 cycles | ||||
Direct Page Indexed by X | F4 | 2 bytes | 4 cycles | ||||
Absolute | E5 | 3 bytes | 4 cycles | ||||
Absolute Indexed by X | F5 | 3 bytes | 5 cycles | ||||
Absolute Indexed by Y | F6 | 3 bytes | 5 cycles | ||||
Direct Page Indexed Indirect by X | E7 | 2 bytes | 6 cycles | ||||
Direct Page Indirect Indexed by Y | F7 | 2 bytes | 6 cycles | ||||
Immediate | CD | 2 bytes | 2 cycles | ||||
Direct Page | F8 | 2 bytes | 3 cycles | ||||
Direct Page Indexed by Y | F9 | 2 bytes | 4 cycles | ||||
Absolute | E9 | 3 bytes | 4 cycles | ||||
Immediate | 8D | 2 bytes | 2 cycles | ||||
Direct Page | EB | 2 bytes | 3 cycles | ||||
Direct Page Indexed by X | FB | 2 bytes | 4 cycles | ||||
Absolute | EC | 3 bytes | 4 cycles |
Flags Affected (Group 1) | |||||||
---|---|---|---|---|---|---|---|
N | V | P | B | H | I | Z | C |
N | . | . | . | . | . | Z | . |
Basic Info (Group 2) | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Implied (type 1) | C6 | 1 byte | 4 cycles | ||||
Implied (type 1) | AF | 1 byte | 4 cycles | ||||
Direct Page | C4 | 2 bytes | 4 cycles | ||||
Direct Page Indexed by X | D4 | 2 bytes | 5 cycles | ||||
Absolute | C5 | 3 bytes | 5 cycles | ||||
Absolute Indexed by X | D5 | 3 bytes | 6 cycles | ||||
Absolute Indexed by Y | D6 | 3 bytes | 6 cycles | ||||
Direct Page Indexed Indirect by X | C7 | 2 bytes | 7 cycles | ||||
Direct Page Indirect Indexed by Y | D7 | 2 bytes | 6 cycles | ||||
Direct Page | D8 | 2 bytes | 4 cycles | ||||
Direct Page Indexed by Y | D9 | 2 bytes | 5 cycles | ||||
Absolute | C9 | 3 bytes | 5 cycles | ||||
Direct Page | CB | 2 bytes | 4 cycles | ||||
Direct Page Indexed by X | DB | 2 bytes | 5 cycles | ||||
Absolute | CC | 3 bytes | 5 cycles |
Flags Affected (Group 2) | |||||||
---|---|---|---|---|---|---|---|
N | V | P | B | H | I | Z | C |
. | . | . | . | . | . | . | . |
Basic Info (Group 3) | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Implied (type 1) | 7D | 1 byte | 2 cycles | ||||
Implied (type 1) | DD | 1 byte | 2 cycles | ||||
Implied (type 1) | 5D | 1 byte | 2 cycles | ||||
Implied (type 1) | FD | 1 byte | 2 cycles | ||||
Implied (type 1) | 9D | 1 byte | 2 cycles |
Flags Affected (Group 3) | |||||||
---|---|---|---|---|---|---|---|
N | V | P | B | H | I | Z | C |
N | . | . | . | . | . | Z | . |
Basic Info (Group 3 cont.) | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Implied (type 1) | BD | 1 byte | 2 cycles | ||||
Direct Page | FA | 3 bytes | 5 cycles | ||||
Direct Page Immediate | 8F | 3 bytes | 5 cycles |
Flags Affected (Group 3 cont.) | |||||||
---|---|---|---|---|---|---|---|
N | V | P | B | H | I | Z | C |
. | . | . | . | . | . | . | . |
MOV is an SPC700 instruction that moves a value. There are a large number of variations for this instruction, and they are divided into three groups:
- In Group 1, MOV moves values from ARAM to registers.
- In Group 2, MOV moves values from registers to ARAM.
- In Group 3, MOV moves values from registers to registers or from ARAM to ARAM.
Most MOV variations that target memory perform a read cycle on the destination, which will reset T2OUT.[3] 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.
The official manual is missing a "." after each Z in the NVPBHIZC column for Groups 1 & 3.
Syntax
Group 1: MOV A, #imm MOV A, (X) MOV A, (X)+ MOV A, dp MOV A, dp+X MOV A, !abs MOV A, !abs+X MOV A, !abs+Y MOV A, [dp+X] MOV A, [dp]+Y MOV X, #imm MOV X, dp MOV X, dp+Y MOV X, !abs MOV Y, #imm MOV Y, dp MOV Y, dp+X MOV Y, !abs Group 2: MOV (X), A MOV (X)+, A MOV dp, A MOV dp+X, A MOV !abs, A MOV !abs+X, A MOV !abs+Y, A MOV [dp+X], A MOV [dp]+Y, A MOV dp, X MOV dp+Y, X MOV !abs, X MOV dp, Y MOV dp+X, Y MOV !abs, Y Group 3: MOV A, X MOV A, Y MOV X, A MOV Y, A MOV X, SP MOV SP, X MOV dp<d>, dp<s> MOV dp, #imm
Some people find the official MOV mnemonic cumbersome and prefer to use an assembler that supports 65c816-style mnemonics such as TAX and TAY.
See Also
External Links
- Official Super Nintendo development manual on MOV: Appendix C-3 of Book I
- Appendix C-4 of Book I lbid
- anomie's SPC700 doc