MOVC

VAX11

 

MOVC  MOVE CHARACTER

 

Purpose

to move character string or block of memory

Format

3 operands:

opcode len.rw srcaddr.ab, dstaddr.ab                     

 

5 operands:

opcode srclen.rw, srcaddr.ab, fill.rb, dstlen.rw, dstaddr.ab

Operation

Copy len bytes from srcaddr to dstaddr                        MOVC3

 

Copy min(srclen, dstlen) bytes from srcaddr to  MOVC5

dstaddr

If  dstlen > srclen then fill the rest of dstaddr with fill

Condition codes

N ß srclen LSS dstlen;

Z ß srclen EQL dstlen;

V ß 0;

C  ß srclen LSSU dstlen;

Exceptions

None

Opcodes

28        MOVC3                                  Move Character 3 Operand

2C       MOVC5                                  Move Character 5 Operand

Description

In 3 operand format, the destination string specified by the length and destination address operands is replaced by the source string specified by the length and source address operands. In 5 operand format, the destination string specified by the destination length and 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 highest address bytes of the destination are replaced by the fill operand. If the destination string is shorter that the source string, the highest addressed bytes of the source string are not moved. 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 source       string. R0 is non-zero only if source string is longer than          destination string

            R1 address of one byte beyond the last byte in source   string that was moved

            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. On MOVC3, or if the MOVC5 and the strings are of equal length, then Z is set and N, V, and C are cleared.

 

 

Example 1

 

.text

main: .word 0

      movc3 $13, strHello, strBuffer

 

      pushal strBuffer

      calls $1, .puts

 

      pushl $0

      calls $1, .exit

 

.data

strHello:   .asciz "Hello, World"

strBuffer: .space 80

 

 

Example 2

 

.text

main: .word 0

      movc5 $0, strBuffer, $'a, $79, strBuffer

 

      pushal strBuffer

      calls $1, .puts

 

      pushl $0

      calls $1, .exit

 

.data

strBuffer: .space 80