Bit Operation Practice Problems

Suppose we have the following defined in storage:

BYTE1    DC    C'4'
BYTE2    DC    X'B9'
MUMBLE   DS    5C
  1. Write one instruction to set the 4th bit of BYTE1 (counting from the left) to 0. Make no other changes to BYTE1.

  2. Write one instruction to set the 6th and 11th bits of register 7 to 1. Make no other changes to the register.

  3. Write one instruction to set all of MUMBLE to binary 0s. Do not use a literal.

  4. Suppose register 6 contains the value X'E4B3079A.

    1. Suppose we execute the following instruction:
              SLL   6,3

      What value is now in register 6? Write it in hex.

    2. Instead, suppose we execute this instruction:
              SRL   6,7

      What value is now in register 6? Write it in hex.

  5. Suppose register 9 contains the value X'FF5B4D39'.

    1. Suppose we execute the following instruction:
              SLA   9,2

      What value is now in register 9? Write it in hex.

    2. Instead, suppose we execute this instruction:
              SRA   9,5

      What value is now in register 9? Write it in hex.

  6. Suppose we execute the following instruction:
                 TM    BYTE2,B'00101001'

    What is now the value of the condition code?

  7. 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.

  1. One way to do this is: NI BYTE1,B'11101111'

  2. 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'.

  3. One way to do this is: XC MUMBLE(5),MUMBLE
    1. The new value will be: X'25983CD0'.

    2. The new value will be: X'01C9660F'.
    1. The new value will be: X'FD6D34E4'.

    2. The new value will be: X'FFFDAD69'

  4. The condition will be: 3 (all ones).

  5. The new value will be: X'C8C3BB3B'.