360 Assembly/360 Instructions/MVC
MVC - SS - Opcode D2 - Move Character
The MVC instruction allows the movement of 1 to 256 characters from one location in memory to another. It is a six byte, SS (storage-to-storage) instruction. As with the 360 series, movement is right to left, thus the first argument is the target to move to (with optional length specification), the right argument is the source to move from. For movement of more than 256 bytes in one instruction, the MVCL instruction should be used.
MVC TARGET,SOURCE MOVE SOURCE TO TARGET MVC TARGET(40),SOURCE MOVE 40 BYTES FROM SOURCE TO TARGET MVC TARGET+10(20),SOURCE+3 MOVE 20 BYTES STARTING AT SOURCE+3 TO TARGET+10 MVC 5(3,14),SOURCE MOVE 3 BYTES FROM SOURCE TO THE ADDRESS BEGINNING AT * REGISTER 14 PLUS 5
The following example is commonly used to clear out a print line:
MVI TARGET,C' ' PUT A BLANK AT THE BEGINNING OF THE LINE MVC TARGET+1(132),TARGET MOVES THE FIRST BLANK TO CHARACTER 2, WHICH MOVES TO CHAR. 3, THEN 4 AND SO ON
- MVC D1(L,B1),D2(B2)
- D1 is the displacement from base register B1, and is the target address
- D2 is the displacement from base register B2, and is the source address
- L is the number of bytes to move from source to target, valid values of 1 to 256.
|SS Instruction (6 bytes) in Hex|
|Byte 1||Byte 2||Byte 3||Byte 4||Byte 5||Byte 6|
|(8 bits)||(8 bits)||(First 4 Bits of Byte 3)||(Second 4 Bits of Byte 3)||(8 bits)||(First 4 Bits of Byte 5)||(Second 4 Bits of Byte 5)||(8 bits)|
|L-1||B1||D1 (12 Bits)||B2||D2 (12 Bits)|
The MVC instruction is not intended as a NOP, therefore at least one byte must be moved. Because the 1 byte length value can only hold the values 0 to 255, the length to be moved that is inserted into the instruction is one less than the actual L value in the source code, or, the actual length to move is one higher than the length field stored in the instruction.
The MVC instruction is available on all models.
Purpose of Instruction
The MVC instruction can be used to move from 1 to 256 bytes of data. The MVCL instruction is available on 370 and above machines for moving larger volumes of data.
When a program needs to move a string from one location to another. If the length is not specified, the assembler uses the specified length of the target field. The assembler will flag an error if the target length is over 256 bytes. The minimum length that can be moved is one byte.
The string of characters in the address noted in the right operand is moved, for the specified length, to the address noted in the left operand. Bytes are moved one at a time.
Exceptions and Faults
- Protection Exception - the source or the target is outside of the legal address range assigned to this task
|360 Assembly Instructions||Next Instruction|
|360 Assembly Language|
|360 Family||Introduction · Basic FAQ · 360 Family · 360 Architecture|
|360 Instruction Set||360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions|
|Syntaxes and Assemblers||360 Assemblers· Pseudo Instructions|
|Instruction Extensions||Floating Point · High-Level Languages|