CSE 2312 - Assignments

Not Graded Practice for Assignment 7


Practice Question 1

(This is Problem 25 from Chapter 5 of the textbook).

Compute the Boolean bitwise expression (A AND B) OR C for:

        A = 1101 0000 1010 0011
        B = 1111 1111 0000 1111
        C = 0000 0000 0010 0000
AND and OR must be performed in a bitwise manner.


Practice Question 2

(This is Problem 26 from Chapter 5 of the textbook).

Devise a way to interchange two variables A and B without using a third variable or register. Hint: Think about the EXCLUSIVE OR instruction.


Practice Question 3

(This is Problem 27 from Chapter 5 of the textbook).

On a certain computer it is possible to move a number from one register to another, shift each of them left by different amounts, and add the results in less time than a multiplication takes. Under what condition is this instruction sequence useful for computing "constant * variable"?


Practice Question 4

For the previous question (textbook problem 5.27), would that instruction sequence be equally useful for computing "variable * variable"? Justify your answer.


Practice Question 5

Write assembly code that: For example, when your code is placed at the indicated position, the program below should print "r1".
.globl _start
_start:
        mov r1, #15
        mov r2, #20

        @@@ Place your code here.


Practice Question 6

Write assembly code that: assuming that r1 holds a value between 0 and 19, prints out that value in decimal. If r1 holds a value less than 0 or greater than 19, your program should print "no". For example, when your code is placed at the indicated position, the program below should print 17.
.globl _start
_start:
        mov r1, #17

        @@@ Place your code here.


Back to the list of assignments.