Computer Architecture and Assembly Language Programming - CS401 Fall 2006 Assignment 02 Solution
Computer Architecture and Assembly Language Programming - CS401 Fall 2006 Assignment 02 Solution
Programming
Assignment #02
Deadline
Your assignment must be uploaded / submitted before or on October 29, 2006.
Upload Instructions
Please view the assignment submission process document provided to you by the Virtual
University to upload the assignment.
Objective
The assignment has been designed to enable you:
start:
;---------------for finding minimum number
mov bx, 0
; initialize array index to zero
mov ax, 0
; initialize min to zero
top1:
; minimum number to ax
end1:
add bx, 2
loop top1
mov [min], ax
end2:
add bx, 2
loop top2
mov [max], ax
mov ax, 0x4c00
int 0x21
Q#2
Suppose AL contains 10011011b and CF= 0. Give the new contents of AL after each of
the following instructions is executed. Assume the preceding initial conditions for each
part of this question.
a. SHL AL,1
b. SHR AL, CL if CL contains 3
c. ROL AL ,1
d. SAR AL, CL if CL contains 3
e. RCR AL,CL if CL contains 2
Solution:
a.
b.
c.
d.
e.
AL=00110110
AL=00010011
AL=00110111
AL=11110011
AL=10100110
CF=1
CF=0
CF=1
CF=0
CF=1