MOV
Purpose |
move a scalar quantity |
Format |
opcode src.rx, dst.wx |
Operation |
dst ß src |
Condition codes |
N ß dst LSS 0 Z ß dst EQL 0 V ß 0 C ß C |
Exceptions |
None (integer); Reserved operand (floating point) |
Operation codes |
90 MOVB Move Byte BO MOVW Move Word DO MOVL Move Long 7D MOVQ Mode Quad 50 MOVF Move Floating 70 MOVD Move Double |
Description |
The destination operand is replaced by the source operand. The source operand is unaffected. |
Notes |
1. On a floating reserved operand fault, the destination operand is unaffected and the condition codes are unpredictable. 2. Unlike the POP-11, but like the other VAX-11 instructions, MOVB and MOVW do not modify the high order bytes of a register destination. Refer to the MOVZxL and CVTxL instructions to update the full register contents. |
Example 1
In the following program we put 0 in r0, and then printing it, and printing the PSW.
Then we put -1 in r0 and print the PSW again. PSW will be 4 and then 8 (On the beginning the third bit will be 1, and on the end the fourth bit will be set).
.text
main: .word 0
# put 0 in r0. Zero flag will raised
movl $0, r0
movpsl r1 # r1 will contains the PSL
movw r1, r2 # save only the PSW to r2
pushl r0
pushl r2
pushal format
calls $3, .printf
# put negative number in r0. Neg flag should rised
movl $-1, r0
movpsl r1 # r1 will contains the PSL
movw r1, r2 # save only the PSW to r2
pushl r0
pushl r2
pushal format
calls $3, .printf
pushl $0
calls $1, .exit
format: .asciz "PSW is %d. R0 is %d\n"
Example 2
The programs test the different types of mov commands: movl, movw and movb.
It will print 12345678, then 5678 and then 78.
.text
main: .word 0
movl $0x12345678, r1
movw r1, r2
movb r2, r3
pushl r3
pushl r2
pushl r1
pushal format
calls $4, .printf
pushl $0
calls $1, .exit
format: .asciz "R1 is %X, R2 is %X, R3 is %X\n"
Example 3
The following program demonstrates the using of the movq opcode:
.text
main: .word 0
movl $1000, r0
movl $1004, r1
movl $0x12345678, (r0)
movl $0x54321234, (r1)
movq (r0), r4 # R4 contains 0x12345678, R5 contains 0x54321234
halt