You are on page 1of 3

WWW.VUTUBE.EDU.

PK

CS 401 Computer Architecture and Assembly Language


Assignment #01
Deadline
Your assignment must be uploaded / submitted before or on October 15, 2007.
Upload Instructions
Please view the assignment submission process document provided to you by the Virtual
University to upload the assignment.
Rules for Marking
Please note that your assignment will not be graded if:
 It is submitted after due date
 The file you uploaded does not open
 The file you uploaded is copied from some one else
 It is in some format other than .doc
Objective

The assignment has been designed to enable you:

 To know about different addressing modes


 To calculate effective address and physical address
 To know about the comparisons and conditions

Answer the following questions

Q#1.

Identify the problems in the following instructions and correct them by replacing
them with one or two instruction having the same effect.

i. mov [05], [ 24]


; Memory to memory move is illegal in Intel architecture. The correct
instructions for this operation could be
mov ax, [24]
mov [24],ax

ii. mov [label1], 501


; Constant to memory move is illegal in Intel architecture. The correct
instruction could be
mov ax,501
mov [label1] ,ax

iii. mov bx, al


; Size mismatch i.e. bx is 16 bit register and al is 8 bit register. The correct
statement could be
mov bx, ax
or
mov bl, al

iv. mov ax, [si+di+100]


; Addition of two index register in one memory access is disallowed. We
can do this operation by addition of index and base register.
mov ax,[si+ bx+100]

v. mov bx,[bs+bp+200]
; Addition of two based register in one memory access is disallowed. We
can do this operation by addition of index and base register.
mov ax,[bp+ si+100]

Q#2.

Write a program to calculate the square of 10 by using a loop that adds 10 to the
accumulator 10 times.

Solution:

[org 0x0100]

mov bx,10
mov cx,10
mov ax,0

l1:
add ax, bx
sub cx, 1
jnz l1

mov [total], ax
mov ax,0x4c00
int 0x21
total: dw 0
Q#3.

b. 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 Z, S, and C flags.
i. jg greater
ii. jl smaller
iii. ja above
iv. jb below

Instructions Jump ZF SF CF
Jg greater Not taken 0 1 0
Jl smaller Taken 0 1 0
Ja above Taken 0 1 0
Jb below Not taken 0 1 0

You might also like