We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
MVN: Difference between revisions
From SnesLab
(added parameter descriptions) |
(→External Links: hid archive URL for Labiak) |
||
(22 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{| class="wikitable" style="float:right;clear:right;width:50%" | {| class="wikitable" style="float:right;clear:right;width:50%" | ||
!colspan="8"|Basic Info | !colspan="8"|Basic Info | ||
Line 13: | Line 7: | ||
|'''Speed''' | |'''Speed''' | ||
|+ | |+ | ||
| | |[[Block Move]] | ||
|54 | |54 | ||
|3 bytes | |3 bytes | ||
|7 cycles per byte moved | |7 cycles per byte moved | ||
|} | |} | ||
[[File:mvn.png|thumb]] | |||
{| class="wikitable" style="float:right;clear:right;width:30%" | {| class="wikitable" style="float:right;clear:right;width:30%" | ||
!colspan="9"|Flags | !colspan="9"|Flags Affected | ||
|+ | |+ | ||
|N | |[[Negative Flag|N]] | ||
|V | |[[Overflow Flag|V]] | ||
|M | |[[M Flag|M]] | ||
|X | |[[X Flag|X]] | ||
|D | |[[Decimal Flag|D]] | ||
|I | |[[I Flag|I]] | ||
|Z | |[[Zero Flag|Z]] | ||
|C | |[[Carry Flag|C]] | ||
|+ | |+ | ||
|. | |. | ||
Line 40: | Line 36: | ||
|. | |. | ||
|} | |} | ||
'''MVN''' (Block Move Negative) is a [[65c816]] instruction that copies a contiguous block of memory. It is intended to copy a block from a higher address to a lower address (moving it in the negative direction). No flags are affected. | |||
In [[Eyes & Lichty]], the "N" in the mnemonic stands for "Next" not "Negative." | |||
MVN works even in [[emulation mode]], but the blocks must be in the [[zeropage]]. | |||
=== Parameters === | === Parameters === | ||
Line 47: | Line 49: | ||
* the first operand byte specifies the destination bank the block will be in | * the first operand byte specifies the destination bank the block will be in | ||
* the second operand byte specifies the source bank the block starts out in | * the second operand byte specifies the source bank the block starts out in | ||
=== Execution Sequence === | |||
The following loop is repeated until the value in the C double accumulator is $FFFF: | |||
* one byte is copied from the address in X to the address in Y | |||
* both X and Y are incremented | |||
* C is decremented | |||
If interrupted, the current byte finishes copying before servicing the interrupt. The destination bank is written to [[DBR]]. | |||
=== Assembler Syntax === | |||
[[Asar]]: | |||
<pre> | |||
MVN srds | |||
</pre> | |||
where "sr" is the source bank, and "ds" is the destination bank, with nothing in between them.<sup>[1]</sup> | |||
=== See Also === | === See Also === | ||
* [[MVP]] | * [[MVP]] | ||
* [[DMA]] | |||
=== External Links === | === External Links === | ||
* [[Eyes & Lichty]] | * [[Eyes & Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/466 page 466] on MVN | ||
* [[Labiak]] | * [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n163 page 153] on MVN | ||
* snes9x implementation of MVN: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3011 | * snes9x implementation of MVN: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3011 | ||
* undisbeliever on MVN: https://undisbeliever.net/snesdev/65816-opcodes.html#mvn-block-move-next | * undisbeliever on MVN: https://undisbeliever.net/snesdev/65816-opcodes.html#mvn-block-move-next | ||
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.6 | |||
=== References === | |||
# https://github.com/InsaneFirebat/sm_practice_hack/blob/master/src/custompresets.asm#L260 | |||
[[Category:ASM]] | [[Category:ASM]] | ||
[[Category:65c816 additions]] | [[Category:65c816 additions]] | ||
[[Category:Block Move Instructions]] | |||
[[Category:Single Admode Mnemonics]] |
Latest revision as of 20:27, 6 August 2024
Basic Info | |||||||
---|---|---|---|---|---|---|---|
Addressing Mode | Opcode | Length | Speed | ||||
Block Move | 54 | 3 bytes | 7 cycles per byte moved |
Flags Affected | ||||||||
---|---|---|---|---|---|---|---|---|
N | V | M | X | D | I | Z | C | |
. | . | . | . | . | . | . | . |
MVN (Block Move Negative) is a 65c816 instruction that copies a contiguous block of memory. It is intended to copy a block from a higher address to a lower address (moving it in the negative direction). No flags are affected.
In Eyes & Lichty, the "N" in the mnemonic stands for "Next" not "Negative."
MVN works even in emulation mode, but the blocks must be in the zeropage.
Parameters
- the X index register specifies the starting (lowest) source address of the block
- the Y index register specifies the starting (lowest) destination address of the block
- the C double accumulator specifies the length of the block in bytes minus one
- the first operand byte specifies the destination bank the block will be in
- the second operand byte specifies the source bank the block starts out in
Execution Sequence
The following loop is repeated until the value in the C double accumulator is $FFFF:
- one byte is copied from the address in X to the address in Y
- both X and Y are incremented
- C is decremented
If interrupted, the current byte finishes copying before servicing the interrupt. The destination bank is written to DBR.
Assembler Syntax
Asar:
MVN srds
where "sr" is the source bank, and "ds" is the destination bank, with nothing in between them.[1]
See Also
External Links
- Eyes & Lichty, page 466 on MVN
- Labiak, page 153 on MVN
- snes9x implementation of MVN: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3011
- undisbeliever on MVN: https://undisbeliever.net/snesdev/65816-opcodes.html#mvn-block-move-next
- Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.6