CS401 VU Midterm Papers Spring May 2012

Total there were 6 questions
Q:1 page no 99 Explain the following instructions (solved)
mov ax, 80
; load chars per row in ax
mul byte [bp+4]
; calculate source position
mov si, ax
; load source position in si
push si
; save position for later use
shl si, 1
; convert to byte offset

Q:2 How many bites will be moved by each of the following bloc of codes.

Mov cx, 384
REP movsb
Mov cx, 384
REP movsw

Write codes in assembly language of the following pseudo codes.

If al>Cl AND bl>al
Q:4 How Ip changes and updated when call instruction is executed.

When Call instruction is executed the stack pointer (SP) is decremented by 2 and value of IP is pushed onto
Q:5 Write Procedure to clear selective bits. 

The source operand is loaded with a mask containing one at positions which are retain their old value and zero
at positions which are to be zeroed. The effect of applying this operation on the destination with mask in the
source is to clear the desired bits. This operation is called masking.
Q:6 Which single instruction can be used at the place of

dec 5

jnz label