
Microprocessors
1
st
semester exam
2015-2016
Time: (2) hrs
Note: answer only (3) questions
Q\1 [5 marks]
A)
given the following instructions with the machine instructions. what is the offset address
location (IP) for each instruction if the first one started at the location (0100 h). (3 marks)
1774:0100 B83412
MOV AX,1234
1774:
89C3
MOV BX,AX
1774:
895E00
MOV [BP+00],BX
1774:
89817856
MOV [BX+DI+5678],AX
Answer:
1774:0100
1774:
0100 + 3 = 0103
1774:
0103 + 2 = 0105
1774:
0105 + 3 = 0108
B)
1-draw the block diagram of the computer system. (1 mark)
Answer:
2-draw the block diagram of the components of the processor. (1 mark)
Answer:

Q\2
[5 marks]
write a sequence of instructions to replace the locations of the lower 6 bytes in the opposite
order in the stack. (3 marks)
Answer:
POP BX
POP AX
POP CX
XCHG BH,BL
XCHG AH,AL
XCHG CH,CL
PUSH BX
PUSH AX
PUSH CX
B)
given the following instruction as shown below. if (SI=0004 h), (BX=0002 h) and the
(offset=0230 h). calculate the physical address.
AND AX,[SI][BX][0230h] (2 marks)
Answer:
PA = offset + SI + BX + (DS expanded to 00000) = 00236 h
Q\3 [5 marks]
A)
write a program to move a block of data in the data segment with size of (15 bytes) . if
(SI=0010h), (DI=0F00h), (DS=0000h). (3 marks)
Answer:
MOV AX,0000H
MOV DS,AX
MOV SI,0010H
MOV DI,0F00H
MOV CX,0EH
NEXT: MOV AH,[SI]
MOV [DI],AH
INC SI
INC DI
DEC CX
JNZ NEXT
NOP

B)
describe what happens as the following sequence of instructions is executed. (2 marks)
MOV DX,00H
MOV AX,00H
MOV ES,AX
MOV DI,00F0H
MOV CX,2FFH
MOV AL,FFH
CLD
CONT: REPNE
SCASB
CMP CX,00H
JZ DONE
INC DX
JMP CONT
DONE: HLT
Answer:
Scan about the value stored in AL (ffh) and calculate the number of iteration of this value in the
block of memory then store it in the register DX.
Q\4 [5 marks]
A) write a program that count the number of iterations of the first byte in the data segment
in block of memory of (1 K byte) started at the location (SI=0100H), (DS=0000H). note that
1k=2ffh. (3 marks)
Answer:
MOV BX,00H
MOV CX,2FFH
MOV AX,00H
MOV DS,AX
MOV SI,100H
MOV DH,[SI]
AGAIN: MOV AL,[SI]
INC SI
DEC CX
JZ END
CMP AL,DH
JZ AA
JMP AGAIN
AA: INC BX
JMP AGAIN
END: NOP
B)
1- clear the memory location (FFCBH) using debug commands. (1 mark)
2- clear the memory location (FFCBH) using data transfer instructions. (1 mark)
Answer:
1-
E FFCB h 00h
2-
Mov [FFCB],00h