Bit Operation Practice Problems
Suppose we have the following defined in storage:
BYTE1 DC C'4'
BYTE2 DC X'B9'
MUMBLE DS 5C
- Write one instruction to set the 4th bit of BYTE1
(counting from the left) to 0. Make no other changes to BYTE1.
- Write one instruction to set the 6th and 11th bits
of register 7 to 1. Make no other changes to the register.
- Write one instruction to set all of MUMBLE to binary 0s. Do
not use a literal.
- Suppose register 6 contains the value X'E4B3079A.
- Suppose we execute the following instruction:
SLL 6,3
What value is now in register 6? Write it in hex.
- Instead, suppose we execute this instruction:
SRL 6,7
What value is now in register 6? Write it in hex.
- Suppose register 9 contains the value X'FF5B4D39'.
- Suppose we execute the following instruction:
SLA 9,2
What value is now in register 9? Write it in hex.
- Instead, suppose we execute this instruction:
SRA 9,5
What value is now in register 9? Write it in hex.
- Suppose we execute the following instruction:
TM BYTE2,B'00101001'
What is now the value of the condition code?
- Suppose register 5 contains the value X'FEDB1234' and
register 11 contains the value X'5678A90F'.
Suppose we execute the following instruction:
XR 5,11
What value is now in register 5? Write it in hex.
Answers
Here are what are believed to be correct answers. Please point out
any that are not correct.
- One way to do this is: NI BYTE1,B'11101111'
- One way to try to do this is: O 7,=XL4'042000000'.
This will not work, as we need a value on a fullword boundary.
I think this would be: O 7, =F'69206016'.
- One way to do this is: XC MUMBLE(5),MUMBLE
- The new value will be: X'25983CD0'.
- The new value will be: X'01C9660F'.
- The new value will be: X'FD6D34E4'.
- The new value will be: X'FFFDAD69'
- The condition will be: 3 (all ones).
- The new value will be: X'C8C3BB3B'.