[go: up one dir, main page]

100% found this document useful (1 vote)
1K views3 pages

Assembly x86 Practice Questions

This document contains an assignment on computer organization and assembly language. It is divided into 4 sections and contains multiple choice and short answer questions about assembly language instructions, variables, data types, registers, and memory addressing modes. Students are asked to determine the validity of instructions, the result of executing sequences of instructions, implement mathematical expressions in assembly language, and fill in register values after instruction sequences. All questions must be handwritten and printed assignments will not be accepted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views3 pages

Assembly x86 Practice Questions

This document contains an assignment on computer organization and assembly language. It is divided into 4 sections and contains multiple choice and short answer questions about assembly language instructions, variables, data types, registers, and memory addressing modes. Students are asked to determine the validity of instructions, the result of executing sequences of instructions, implement mathematical expressions in assembly language, and fill in register values after instruction sequences. All questions must be handwritten and printed assignments will not be accepted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment# 2

Computer Organization and Assembly Language


Due Data: Tuesday 24th Sep,2019 Before16:00 Sections: C,D&E
Instructor: Asra Ashraf

 All the questions must be written with hand on paper. Printed assignments will be
not accepted at all.

1ST SECTION
Use the following variable definitions for the first three questions. Keep in mind that these
variables are stored in exactly this sequence in memory. This program is used in a x86
architecture.

.data
var1 DB -4, -2, 3, 1
var2 DW 1000h, 2000h, 3000h, 4000h
var3 DW -16, -42
var4 DW 1, 2, 3, 4, 5
1. For each of the following statements, state whether or not the instruction is valid. Also
state the reason.
a. MOV AX, var1
b. MOV AX, var2
c. MOV EAX, VAR3
d. MOV var2, var3
e. MOVZX var2, al
f. MOVZX AX, var2
g. MOV DS, AX
h. MOV DS, 1000H
2. What will be the hexadecimal value of the destination operand after each of the following
instructions execute in sequence:
a. MOV AL, var1
b. MOV AH, [var1+3]
3. What will be value of the destination operand after each of the following instructions
execute in sequence?
a. MOV AX, var2
b. MOV AX, [var2+4]
c. MOV AX, var3
d. MOV AX, [var3-2]
e. MOV AX, [var2-2]
f. MOV EDX, var4
g. MOVZX EDX, var2

1
Assignment# 2

h. MOV EDX, [var4+4]


i. MOVSX EDX, var1
j. MOV EDX, [var4-5]

2ND SECTION
Use the following data for next five questions.

.data
val1 DB 10h
val2 DW 8000h
val3 DW 0FFFFh
val4 DW 7FFFh
1. Write instruction/s that increment/s val2
2. Write instruction/s that subtract/s val2 from val3
3. If val2 is incremented by 1 using ADD instruction, what will be the values of CF and
SF?
4. Write down the values of indicated flags after each instruction is executed whereas all
these flags are clear before the start of first instruction. i.e.
CF=0 SF=0 ZF=0 OF=0
a. MOV AX, 7FF0h ;CF= SF= ZF= OF=
b. ADD AL, 10h ;CF= SF= ZF= OF=
c. ADD AH, 1 ;CF= SF= ZF= OF=
d. ADD AX, 2 ;CF= SF= ZF= OF=
5. Implement the following expression in assembly language AX = (-val2+BX)-val4

3RD SECTION
Use the following data definitions for next questions.

.data
myBytes DB 10h, 20h, 30h, 40h
myWords DW 3 DUP (?), 2000h
myString DB “ABCDE”
1. What will be the value of EAX after each of the following instructions execute?
a. MOV EAX, TYPE myBytes
b. MOV EAX, LENGTHOF myBytes
c. MOV EAX, SIZEOF myBytes
d. MOV EAX, TYPE myWords
e. MOV EAX, LENGTHOF myWords
f. MOV EAX, SIZEOF myWords
g. MOV EAX, SIZEOF myString
2. Write a single instruction that moves the first two bytes in myBytes to the DX register.
The resulting value will be 2010h.

2
Assignment# 2

3. Write an instruction that moves the second byte in myWords to the AL register.
4. Write an instruction that moves all four bytes in myBytes to the EAX register.

4TH SECTION
Use the following data definitions for the next questions.

.data
myBytes DB 10h, 20h, 30h, 40h
myWords DW 8Ah, 3Bh, 72h, 44h, 66h
myDoubles DD 1, 2, 3, 4, 5
myPointer DD myDouble
1. Fill in the requested register values on the right side of the following instruction
sequence.
a. MOV ESI, OFFSET myBytes
b. MOV AL, [ESI] ; AL =
c. MOV AL, [ESI+3] ; AL =
d. MOV ESI, OFFSET myWords+2
e. MOV AX, [ESI] ; AX =
f. MOV EDI, 8
g. MOV EDX, [myDoubles+EDI] ; EDX =
h. MOV EDX, myDoubles[EDI] ; EDX =
i. MOV EBX, myPointer
j. MOV EAX, [EBX+4] ; EAX =
k. MOV EXI, OFFSET myBytes
l. MOV AX, [ESI] ; AX =
m. MOV EAX, DW PTR myWords ; EAX =
n. MOV ESI, myPointer
o. MOV AX, [ESI+2] ; AX =
p. MOV AX, [ESI+4] ; AX =
q. MOV AX, [ESI+6] ; AX =

You might also like