Uploaded by Arshaq Waseem

Coal Assignment 1

advertisement
COAL Assignment#1
Total 60 Marks
Section: BSR (3A), BDS (3A, 3B)
Deadline: 20 September 5PM
Submit hardcopy in class and soft copy in google classroom.
Q1: Write instructions to perform the following operations. (5)
a. Copy BL into CL
b. Copy DX into AX
c. Store 0x12 into AL
d. Store 0x1234 into AX
e. Store 0xFFFF into AX
Q2: Write a program to calculate the area of a rectangle whose sides are stored in the first two parts of the
memory variable param and store the result in the third part of param. (10)
param: dw 2, 10 ,0
Q3: What is the effective address generated by the following combinations if they are valid. If not give
reason. Initially BX=0x0301, SI=0x00AD, DI=0x0002, BP=0x0300, and SP=0xFFFF. (5)
a. bx-si
b. bx-bp
c. bx+10
d. bx-10
e. bx+sp
Q4: Write instructions to do the following. (5)
a. Copy contents of memory location with offset 0F25 in the current data segment into AX.
b. Move contents of memory location with offset 0C10 to memory location with offset 00FF in the
current data segment.
c. Consider a memory variable with three numbers. Add the values of 2nd and 3rd numbers and store
their result in the first index.
Q5: Write a program to multiply two 32bit numbers and store the answer in a 64bit location. (10)
Q6: If AX=8FFF and BX=0FFF and “cmp ax, bx” is executed, which of the following jumps will be taken? Each
part is independent of others. Also give the value of Zero, Sign, and Carry flags. (5)
a. jg greater
b. jl smaller
c. ja above
d. jb below
Q7: Write a code to find the second largest value from the array arr. (10)
arr: dw 34, 23, 42, 63, 89, 91, 2, 21, 3, 43
Q8: Write a code to rotate the any value stored in register ax to the number of times mentioned in a memory
variable RotateNum. The direction of rotation i.e clockwise or anticlockwise will be mentioned in a variable
named Direction. 0 will refer to direction clockwise and 1 will refer to direction anticlockwise. For any other
values go to the end. (10)
RotateNum dw: 0 (use any value here)
Direction: db 0 (use any value here)
Download