Professional Documents
Culture Documents
Solution of Micro Process Sheet2
Solution of Micro Process Sheet2
1. Write an 8086 assembly program to save the HEX numbers 01H, 02H, 03H, 04H,
and 05H to memory locations 7101H, 7102H, 7103H, 7104H, and 7105H
respectively.
Solution:
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
2. Write an 8086 assembly program to add the value 05H to the contents of each of
the registers BL, CL, DL. Assuming BL=11H, CL=22H, DL=33H.
Solution:
Solution - a:
Using Direct Addressing
MOV AL, 01H
MOV [0100H], AL
INC AL
MOV [0101H], AL
INC AL
MOV [0102H], AL
HLT
Solution - b:
Using Indirect Addressing
MOV BX, 0100H
MOV AL, 01H
MOV [BX], AL
INC BX
INC AL
MOV [BX], AL
INC BX
INC AL
MOV [BX], AL
HLT
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
Solution - c:
Using Relative Addressing
4. Write an 8086 assembly program to add the two numbers 23F9H and 9A35H,
and save the result at memory locations 7100H, 7101H, and 7102H.
Solution:
5. Write an 8086 assembly program to add the two numbers F3A56BH and
78B6A9H, and save the result at memory locations 7100H, 7101H, 7102H, and
7103H.
Solution:
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
6. Write an 8086 assembly program to calculate the summation of the contents of
each memory location from 7101H to 7105H, with its corresponding contents in
memory locations 710AH to 710EH, then save the results in memory locations
7110H to 7114H, respectively.
Solution:
Solution:
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
8. Write an 8086 assembly program to perform a cyclic displacement on the
contents of registers AL, BL, and CL.
Solution:
MOV DL, CL
MOV CL, BL
MOV BL, AL
MOV AL, DL
HLT
Solution - a:
Using Direct Addressing
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
10. Write an 8086 assembly program to multiply the contents of register BL by the
contents of register BH, and save the result in AL. Don’t use the “MUL”
instruction.
Solution:
11. Write an 8086 assembly program to divide the contents of register BL by the
contents of register BH, save the result in AL, and the remainder in AH.
Don’t use the “DIV” instruction.
(Assume that BL > BH, BH0)
Solution:
12. Write an 8086 assembly program to calculate the factorial of an integer in the
accumulator, assuming that the result can reside in one byte register. Send the
result to register BX.
Solution:
MOV CX, AX
MOV AX, 0001H
L: MUL CL
LOOP L
MOV BX, AX
HLT
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
13. Within the address range 1900H → 191FH. Determine the content of BL, BH,
and DL registers in which:
BL = Number of Positive values.
BH = Number of Negative values.
DL = Number of Zero values.
Solution:
14. Write an 8086 assembly program to always check the content of the input port
35H. If the content is positive, put it in memory location 7200H. While if negative,
put it on output port 03H.
Solution:
L: IN AL, [35H]
CMP AL, 00H
JG POS
JS NEG
JMP L
POS: MOV [7200H], AL
JMP L
NEG: OUT [03H], AL
JMP L
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
15. Write an 8086 assembly program to always check the content of the input port
03H. If the content is even, put it in memory location A200h, otherwise put the
content on output port 0Ah.
Solution:
L: IN AL, [03H]
MOV BL, AL
AND BL, 01H
JZ EVEN
OUT [0AH], AL
JMP L
16. Write an 8086 assembly program to always check the 4th bit of the content of the
input port A3H. If the 4th bit of the content is one, put the data in memory location
E100h, otherwise put the content on output port 0Ah.
Solution:
L: IN AL, [A3H]
MOV BL, AL
AND BL, 08H
JZ ZERO
MOV [E100H], AL
JMP L
ZERO:OUT [0AH], AL
JMP L
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
17. Write an 8086 assembly program to calculate the equation 2*AL + 4*BL using the
appropriate shift or rotate instructions then store the result in memory location
BA07h (Assume that the result will reside in one byte).
Solution:
This study source was downloaded by 100000885594941 from CourseHero.com on 05-09-2024 22:34:29 GMT -05:00
https://www.coursehero.com/file/99536014/Solution-of-Microprocessor-Sheet-2-2pdf/
Powered by TCPDF (www.tcpdf.org)