Microprocessors Midterm Exam
Microprocessors Midterm Exam
Microprocessors Midterm Exam
MICROPROCESSORS
Midterm Exam
Instructor: Ebrahim Alssrary
QUESTIONS
-------------------------------------------------------------------------------------------------------------------------------
1. Complete the sentences :
a. CF will be set to 1 in a 16-bit ADD if there is a carry out from bit …………………….
b. The CF will be set to 1 in an 8-bit ADD if there is a carry out from bit…………………
c. The ADD instruction can effect which bits of the flag register …,…..,….,…..and……..
d. A segment is an area of memory that includes up to …………………………………….
e. A physical address is a……… bit address; an offset address is a…………… bit address
f. Every macro must start with directive ………. And end with directive …..
3. a. Find the status of the CF,PF,AF,ZF and SF for the following operations
MOV BL,9FH MOV AL,23H MOV DX,10FFH
ADD BL,61H ADD AL,97H ADD DX,1
b. How many bytes are defined by the following?
DATA_1 DB 6 DUP (4DUP(0FFH)
c. Correct the error: ADD DATA_1,DATA_2
4. Give the addressing mode for each of the following :
a. MOV AX,DX c. MOV DX,[BP+DI+4] e. MOV AL,[BX]
b. MOV [BP][SI]+12,AX d. MOV CX,[3000]
5. Show the contents of the memory locations after the execution of each instruction.
a. MOV BX,129FH b. MOV DX,8C63H
MOV[1450],BX MOV [2348],DX
DS:1450 ……… DS:2348…………
DS:1451….. …. DS:2349………….
6. State the difference between the following two instructions:
a. MOV BX,DATA1 b. ADD AX,BX
MOV BX,OFFSET DATA1 ADD AX,[BX]
7. How many bytes are set aside by each of the following directives?
a. ASC_DATA DB ‘1234’ b. HEX_DATA DW 1234H
…………………………………………………………………………………………….
8. a. If CF=1,AL=95,and BL=4F prior to the execution of ‘SBB AL,BL’,what will be the
contents of AL after the subtraction ?
b. Fill in the blanks in the following program ,which clears the screen . write comments on
each line stating the purpose of each line of code .
MOV AH,…..
MOV AL,…..
MOV BH,…..
MOV CH,…..
MOV CL,…..
MOV DH,…..
MOV DL,……
INT 10H
9. What is the total value in registers DX and AX after invoking the following macro?
WAGES MACRO SALARY,OVERTIME,BONUSES
;TOTAL WAGES=SALARY+OVERTIME+BONUSES
SUB AX,AX
MOV DX,AX
ADD AX,SALARY
ADD AX,OVERTIME
ADC DX,0
ADD AX,BONUSES
ADC DX,0
ENDM
The macro is invoked as WAGES 60000,25000,3000
MOV AL,77
MOV DX,303H