1. If 8085 addresses 87H and 79H, specify the content of accumulator and status S, Z and CY flags.
87H contents of accumulator=00H
79H S=0, Z=1, CY=1, AC=1, P=0
100H
2. Write ALP in 8086 to find factorial of the number.
MOV AX, 0005H
MOV CX, AX
DEC CX
l1: MUL CX
LOOP l1
MOV [0200], AX
HLT
3. Write ALP in 8086 to print a message "8086 microprocessor".
DATA SEGMENT; start of data segment.
MSG DB '8086 microprocessor' $
DATA ENDS; end of data segment.
CODE SEGMENT; start of code segment.
Start: MOV AX, DATA; initialize data segment register.
MOV DS, AX
MOV AH, 09H; display string on DOS prompt.
(09 for entire string, 02 for single char)
MOV DX, OFFSET MSG; character one by one read.
INT 21H;interrupt when CPU busy.
MOV AH, 4CH; exit for DOS.
INT 21H
CODE ENDS; end of code segment
END START
4. Write ALP in 8086 to reverse the given string DATA SEGMENT.
STRING DB 'ASSEMBLY LANGAUGE', $
Length DW $-string
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
MOV SI, OFFSET String
MOV CX, length
ADD SI, CX
Back: MOV DL, [SI]
MOV AH, 02H; Output char from DL
INT 21H
DEC SI
Loop Back
MOV AH, 4CH; exit from DOS
INT 21H
CODE ENDS
END START
5. Assume that all segment register are initialized at 1200H. The instruction register IP holds the address 0000H,
which is the beginning of the instruction code (program). The stack is initialized at FFFFH, and SI register is
initialized at 8000H to indicate where data bytes are stored. Calculate the beginning physical address of the
instruction code, data and stack. Explain what the physical address, logical address and offset address are.
Code Address Stack address Data address
CS: 1 2 0 0 SS: 1 2 0 0 DS: 1 2 0 0
IP: + 0 0 0 0 SP: + F F F F SI: + 8 0 0 0
PA: 1 2 0 0 0 PA: 2 1 F F F PA: 1 A 0 0 0
Physical address is 20-bit address that the processor places on the address bus. It ranges from 00000 to
FFFFFH.
Logical addresses are: Code-1200:0000
Stack-1200:FFFF
Data-1200:8000
Offset addresses are: Code-0000H
Stack-FFFFH
Data-8000H
6. Write a program to add two hexadecimal numbers stored at the memory location 2050H and 2051H and store
the result at 2052H.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV A, M
INX H
ADD M
INX H
MOV M, A
HLT
7. Write ALP to multiply two numbers stored in location 2050H and 2051H and store the result at 2052H.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV C, M
XRA A
INX H
L1: ADD M
DCR C
JNZ l1
INX H
MOV M, A
HLT
8. Write alp to divide two numbers stored in memory locations 2050H and 2051H and store the remainder at
2070H and quotient at 2071H.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV A, M
MVI D, 00H
INX H
label 1: SUB M
INR D
CMP M
JNC label 1
STA 2070H
MOV A, D
STA 2071H
HLT
[Link] ALP to disassemble the byte stored at memory location 2040H and store the result at memory location
2041H and 2042H.
Program: Label mnemonics operand comment
LXI H, 2040H
MOV A, M
MOV B, A
ANI 0FH
INX H
MOV M, A
MOV A, B
RRC
RRC
RRC
RRC
ANI 0FH
INX H
MOV M, A
HLT
10. ALP to find 1's and 2's complement of data stored at memory location 2050H and store the result at 2051H
and 2052H.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV A, M
CMA
INX H
MOV M, A
ADI 01H
INX H
MOV M, A
HLT
11. Program to EX-OR two data without using EX-OR instructions.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV A, M
MOV B, A
CMA
INX H
ANA M
MOV C, A
MOV A, M
CMA
ANA B
ORA C
INX H
MOV M, A
HLT
12. Program to find largest number in a given series of data. The length is given in memory location 203FH and
the series itself starts from 2040H. Store the result at 2060H.
Program: Label mnemonics operand comment
LXI H, 203FH
MOV C, M
DCR C
INX H
MOV A, M
l2: INX H
CMP M
JNC l1
MOV A, M
l1: DCR C
JNZ l2
STA 2060H
HLT
13. Program to distinguish even number from given set of data stored from memory location 2050H and to store
the even number from 2070H.
Program: Label mnemonics operand comment
LXI H, 204FH
LXI D, 2070H
MOV B,M
INX H
l2 MOV A,M
RRC
JC l1
RLC
STAX D
INX D
l1: INX H
DCR B
JNZ l2
HLT
14. Program to convert BCD number stored at 2050H into binary code and to store it at 2051H.
Program: Label mnemonics operand comment
LXI H, 2050H
MOV A, M
ANI 0FH
MOV C, A
MOV A, M
RRC
RRC
RRC
RRC
ANI OFH
MOV D, A
XRA A
l1: ADI 0AH
DCR D
JNZ l1
ADD C
INX H
MOV M, A
HLT
INPUT: OUTPUT:
ADDRESS DATA ADDRESS DATA
2050H (86)10 2051H (56)10
[Link] a program to arrange six bytes of data stored from location D000H in descending order.
Data(H): 02 ,0A, 01, 11, 05, 06
Program: Label mnemonics operand comment
LXI H, D000H
MVI B, 06H
MOV C, B
DCR C
MOV E, C
label2: MOV A, M
INX H
CMP M
JNC label1
MOV D, M
MOV M, A
DCX H
MOV M, D
INX H
label1: DCX C
JNZ label2
LXI H,D000H
MOV C,E
DCR B
JNZ l2
HLT
16. Exchange the contents of memory location 2000H and 4004H.
Program: Label mnemonics operand comment
LDA 2000H
MOV B, A
LDA 4000H
STA 2000H
MOV A, B
STA 4000H
HLT
17. Addition of two 16-bit nembers.
Program: Label mnemonics operand comment
LHLD 2040H
XCHG
LHLD 2042H
DAD D
SHLD 2044H
HLT
18. Program to make output port high and low for the same interval.
START: MVI A, 01H
OUT PORT #
CALL DELAY
XRA A
OUT PORT#
CALL DELAY
JMP START
DELAY: MVI B, FFH
l1: DCR B
JNZ l1
RET
19.