Education In Pakistan

Papers, Notes, Books & Help For Students

UPDATED EDUCATIONAL NEWS INTERVIEW HELP FOR ALL JOBS ONLINE BOOKS SCHOLARSHIPS AVAILABLE INTERNSHIP JOBS

Tag: VU. CS401 .Assembly. Language. Mid Term .Examination – Spring .2006

VU CS401 Assembly Language Mid Term Examination – Spring 2006

.

CS401 Assembly Language

Mid Term Examination – Spring 2006

Time Allowed: 90 Minutes

Please read the following instructions carefully before attempting any

question:

1. This examination is open books, open handouts and quiet

neighbors.

2. Answer all questions.

a. There is no choice.

b. You will have to answer correctly all questions in this

examination to get the maximum possible marks.

3. Do not ask any questions about the contents of this examination

from anyone.

a. If you think that there is something wrong with any of the

questions, attempt it to the best of your understanding.

b. If you believe that some essential piece of information is

missing, make an appropriate assumption and use it to solve

the problem.

4. You have been provided with all assembly tools so you can use

assembly tools also.

5. Your paper contains 4 questions.

All Coding questions should be answered using the Assembly language

syntax.

Question No. 1

What is wrong with each of the following instructions?

Marks : 10

i.

ii.

iii.

iv.

MOV BL, CX

MOV ES, SS

MOV [BX], [DI]

MOV [BYTEVAR], 20

v. MOV [02], [ 92]

Question No. 2

Marks : 10

Find errors in the code given below and write error description against each erroneous

instruction.

[org 0x0100]

jmp start

var1 dw 34, 21, 25, 20, 23, 21, 29, 14, 42, 10

var2 dw 0

var3 dw 0

start:

mov 5, 0

mov bx, 0

label1:

cmp ax, 20

je end

mov bh, ax

mov [var2], bx

mov cx, [var1+ bx]

add ax, [bx-si]

label2:

add bx, 2

cmp bx, [bx+bp]

je here

cmp [si+di], cx

jc swap

jmp label2

swap:

mov [var2+bx], [var1+bx]

mov [var3 ], cx

mov bx, [index1]

jmp label2

end:

mov ax, 0x4d00

int 0x21

Question No. 3

Marks : 10

Answer the following Questions.

a.

b.

c.

d.

e.

Which registers are changed by the CMP instructions?

Write a instruction to change the sign bit of AX.

What is the difference between a TEST and AND instruction?

What is the difference between little endian and big endian formats?

What is the function of segment override prefix and what changes it brings to the

opcode?

Question No. 4

a) Consider

MSG: db ‘this is a message’

Write code to replace each lowercase letter in the following string by its upper case

equivalent. Use index address mode.

b) Write valid instruction(s) to perform each function specified below.

Marks : 20

i.

ii.

iii.

iv.

Provide instruction to read a value from port number 0x312

Provide instruction to move the value at the top of the stack in IP register

Provide instruction to move value of flag register in AX.

Provide instruction to divide value of AX by 8.

Education In Pakistan © 2016