
MVN perfoms in a way
that is analagous to MVC. While MVC
works on entires bytes, MVN only
processes the numeric parts (rightmost 4 bits) of the bytes it references. The purpose of a move numeric instruction is
to move the numeric parts of a consecutive collection of bytes from one
location in memory to another location.
As you can see from the instruction format above, the instruction
carries with it the number of bytes to
be copied (LL1), as well as the beginning addresses of the source (B2D2D2D2)
and target (B1D1D1D1) fields. Notice that the instruction does not
specifiy the ending addresses of either field - the instruction is no respecter
of fields. MVN copies the numeric parts of LL1 + 1 consecutive
bytes from the storage location designated by B2D2D2D2
to the storage location
designated by B1D1D1D1.
The length (LL1) determines the number of
“half-bytes” which will be copied. The
length is usually determined implicitly from the length of operand 1 but the
programmer can provide an explicit length.
Consider the two example MVN’s below,
Object code Assembler code
FIELDA DS
CL8
FIELDB DS
CL5
...
D107C008C010 MVN
FIELDA,FIELDB Implicit length
D102C008C010 MVN
FIELDA(3),FIELDB Explicit length
In the first example, the
length implicitly defaults to 8, the length of FIELDA. In the second example, the length is
explicitly 3. Notice that the assembled length (LL1) is one less
than the implicit or explicit length.
This can be seen in the object code above where the assembled lengths are x’07’ and x’02’.
The copying operation is usually straightforward, but can be
more complicated by overlapping the source and target fields. Keep in mind that the copy is made one byte
at a time. Consider the following
examples,
Object code Assembler code
ONE DC C’1’ ONE = X’F1’
FIELDA DC
CL3’ABC’ FIELDA = X’C1C2C3’
FIELDB DC
XL3’123456’ FIELDB = X’123456’
...
D102C008C00B MVN
FIELDA,FIELDB After FIELDA = X’C2C4C6’
D102C00EC008 MVN
FIELDB,FIELDA After FIELDB = X’113253’
D102C008C007 MVN
FIELDA,ONE After FIELDA = X’C1C1C1’
In the first MVN above, 3 consecutive numeric
half-bytes in FIELDB are simply copied to the numeric portions of FIELDA.
The half-bytes are copied, one at a time moving left to right within
both operands. In the second example, 3
consecutive bytes are copied into FIELDB (implicit length = 3) from FIELDA. The
third MVN is complicated by the fact
that the source and target fields overlap.
We will examine the third move in some detail.

Some Unrelated MVN’s:
A DC
X’123456’
B
DC X’ABCDEF’
C
DC X’A1B2’
... Result:
MVN A,B A = X’1B3D5F’
B = X’ABCDEF’
MVN A+1,B A = X’123B5D’ B = X’AFCDEF’
MVN A+1(2),B A = X’123B5D’ B = X’ABCDEF’
MVN B,=X’D1E2’ B = X’A1C2E?’ One byte copied from
the literal pool
MVN B,B+1 B = ’ADCFE1’ Left shift
MVN B+1(2),B B = ’ABCBEB’ 1st byte is propagated
MVN C,A C = ’A2B4’ A
= X’123456’
MVN A(L’C),C A = ’113256’
Explicit Length attribute
MVN A(1000),B Assembly
Error - max length is 256 bytes
MVN A,B(20) Assembly
Error - Op-1 determines length

1. Pay attention to the lengths of the fields involved in any MVN statement. If the target field is longer than the
source field, bytes following the source may be transferred. If the target field is shorter than the
source field, bytes in the source may may be truncated.