MOVC Instruction

Purpose:To copy a character string or block of memory
Format:opcode srclen.rw, srcadr.ab, dstadr.ab
opcode srclen.rw, srcadr.ab, fill.rb, dstlen.rw, dstadr.ab
Operation: MOVC3
MOVC5 if srclen = dstlen
{copy srclen bytes from the src address to the dst address};
{C <- 0; Z <- 1}

MOVC5 if srclen > dstlen
{copy dstlen bytes from the src address to the dst address};
{C <- 0; Z <- 0}

MOVC5 if srclen > dstlen
{copy srclen bytes from the src address to the dst address};
{fill (dstlen - srclen) bytes from
(dst address + srclen) to (dst address + dstlen - 1)};
{C <- 1; Z <- 0}

Condition
Codes:
N <- srclen LSS dstlen;
Z <- srclen EQL dstlen;
V <- 0;
C <- srclen LSSU dstlen;
Exceptions:None
Opcodes:
28MOVC3Move Character 3 Operand
2CMOVC5Move Character 5 Operand
Description: In the 3 operand format, the destination string specified by the length an destination address operands is replaced by the source string specified by the length and the source address operands.

In the 5 operand format, the destination string specified by the destination length and the destination address operands is replaced by the source string specified by the source length and source address operands. If the destination string is longer than the source string, the remaining bytes are replaced by the fill operand. If the destination string is shorter than the source string, only the number of bytes specified by the destination string length operand are copied.

The operation of the instruction is such that overlap of the source and destination strings does not affect the result.

Notes:
1.
After execution of MOVC3;
R0 = 0
R1 = address of one byte beyond the source string.
R2 = 0
R3 = address of one byte beyond the destination string.
R4 = 0
R5 = 0
2.
After execution of MOVC5;
R0 = Number of unmoved bytes remaining in the source (if any)
R1 = address of one byte beyond the last moved byte of the source string.
R2 = 0
R3 = address of one byte beyond the destination string.
R4 = 0
R5 = 0
3.
MOVC3 is the preferred way to copy one block of memory to another.
4.
MOVC5 with a 0 source length operand is the preferred way to fill a block of memory with the fill character.
5.
Both MOVC3 and MOVC5 are interruptable. If interrupted, the first part done flag in the PSL will be set and the registers R0 through R5 will hold working values that must be restored so that the instruction can be continued. The instruction will continue on REI.