Introduction to 8085 & it's description(includes basic lab experiments)
1. INTRODUCTION TO 8085
INTEL 8085 is one of the most popular 8-bit microprocessor capable of addressing 64
KB of memory and its architecture is simple. The device has 40 pins, requires +5 V power
supply and can operate with 3MHz single phase clock.
8085 MICROPROCESSOR FUNCTIONAL BLOCK DIAGRAM
Architecture of 8085 Microprocessor
a) General purpose register
It is an 8 bit register i.e. B,C,D,E,H,L. The combination of 8 bit register is known as
register pair, which can hold 16 bit data. The HL pair is used to act as memory pointer is
accessible to program.
b) Accumulator
It is an 8 bit register which hold one of the data to be processed by ALU and stored
the result of the operation.
c) Program counter (PC)
It is a 16 bit pointer which maintain the address of a byte entered to line stack.
d) Stack pointer (Sp)
It is a 16 bit special purpose register which is used to hold line memory address for
line next instruction to be executed.
e) Arithmetic and logical unit
It carries out arithmetic and logical operation by 8 bit address it uses the accumulator
content as input the ALU result is stored back into accumulator.
2. f) Temporary register
It is an 8 bit register associated with ALU hold data, entering an operation, used by
the microprocessor and not accessible to programs.
g) Flags
Flag register is a group of fire, individual flip flops line content of line flag register
will change after execution of arithmetic and logic operation. The line states flags are
i) Carry flag (C)
ii) Parity flag (P)
iii) Zero flag (Z)
iv) Auxiliary carry flag (AC)
v) Sign flag (S)
Carry flag:
If an arithmetic operation results in a carry, the carry flag is set. The carry flag also
serves as a borrow flag for subtraction.
Parity flag:
After arithmetic – logic operation, if the result has an even number of 1’s the flag is
set. If it has odd number of 1’s it is reset.
Zero flag:
The zero flag is set if the ALU operation results in zero. This flag is modified by the
result in the accumulator as well as in other registers.
Auxiliary carry flag:
In an arithmetic operation when a carry is generated by digit D3 and passed on to D4,
the auxiliary flag is set.
Sign flag:
After the execution of the arithmetic - logic operation if the bit D7 of the result is 1,
the sign flag is set. This flag is used with signed numbers. If it is 1, it is a negative number
and if it is 0, it is a positive number.
h) Timing and control unit
Synchronous all microprocessor, operation with the clock and generator and control
signal from it necessary to communicate between controller and peripherals.
i) Instruction register and decoder
Instruction is fetched from line memory and stored in line instruction register decoder
the stored information.
j) Register Array
These are used to store 8 bit data during execution of some instruction.
PIN Description
Address Bus
1. The pins Ao – A15 denote the address bus.
2. They are used for most significant bit
Address / Data Bus
1. AD0 – AD7 constitutes the address / Data bus
2. These pins are used for least significant bit
3. ALE (Address Latch Enable)
1. The signal goes high during the first clock cycle and enables the lower order
address bits.
IO / M
1. This distinguishes whether the address is for memory or input.
2. When this pins go high, the address is for an I/O device.
S0 – S1
S0 and S1 are status signal which provides different status and functions.
RD
1. This is an active low signal
2. This signal is used to control READ operation of the microprocessor.
WR
1. WR is also an active low signal
2. Controls the write operation of the microprocessor.
HOLD
1. This indicates if any other device is requesting the use of address and data bus.
2. It indicates whether the hold signal is received or not.
HLDA
1. HLDA is the acknowledgement signal for HOLD
2. It indicates whether the hold signal is received or not.
INTR
1. INTE is an interrupt request signal
2. IT can be enabled or disabled by using software
INTA
1. Whenever the microprocessor receives interrupt signal
2. It has to be acknowledged.
RST 5.5, 6.5, 7.5
1. These are nothing but the restart interrupts
2. They insert an internal restart junction automatically.
4. 8 BIT ADDITION
AIM:
To write a assembly language program for Addition two (8) bit numbers by
using-8085 micro processor kit.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. keyboard
ALGORITHM (ADDITION)
Step1 : Start the microprocessor
Step2 : Initialize the carry as ‘Zero’
Step3 : Load the first 8 bit data into the accumulator
Step4 : Copy the contents of accumulator into the register ‘B’
Step5 : Load the second 8 bit data into the accumulator.
Step6 : Add the 2 - 8 bit datas and check for carry.
Step7 : Jump on if no carry
Step8 : Increment carry if there is
Step9 : Store the added request in accumulator
Step10 : More the carry value to accumulator
Step11 : Store the carry value in accumulator
Step12 : Stop the program execution.
5. Flow chart
NO
YES
Intialise the carry as zero
Load the 1st
8 bit number
Transfer the 1st
number to register ‘B’
Load the 2nd
8 bit number
Transfer and Add the contents of A and B
Increment carry by one
Store the added value in accumulator
Store the value of carry in accumulator
Move the contents of carry into accumulator
END
Check for
carry
START
6. PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,00 0E,00 Clear the content of C Register.
4102 LDA 4300 3A,00,43
Load the content of the
accumulator in 4300
4105 MOV B, A 47
Move the content from
accumulator to B register
4106 LDA 4301 3A,01,43
Load the content of the
accumulator in 4301
4109 ADD B 80
Add the content from accumulator
to B register
410A JNC 410E ( LOOP 1) D2,0E,41
Jump on no carry to the label
(LOOP 1)
410D INR C 0C Increment the C register content
410E LOOP 1 STA 4302 32,02,43
Store the sum at accumulator at in
location 4300
4111 MOV A,C 79
Move the carry content from C
Register to accumulator
4112 STA 4303 32,03,43
Store carry content in
accumulator at the location 4303
4115 HLT 76 End the program
Input
Without carry
Input Address Value
4300 04
4301 02
Output
Output Address Value
4302 06
4303 00 (carry)
With carry
Input Address Value
4300 FF
4301 FF
Output Address Value
Output 4302 FE
4303 01 (carry)
Calculation 1111 1111 0000 0100
1111 1111 0000 0010
---------------
(1) 1111 1110 0000 0110
=========
F E
7. 8 BIT SUBTRACTION
Aim:
To write a assembly language program for subtracting two (8) bit numbers by using-
8085 micro processor kit.
Apparatus required:
1. 8085 microprocessor kit
2. Keyboard
ALGORITHM
Step1 : Start the microprocessor
Step2 : Intialize the carry as ‘Zero’
Step3 : Load the first 8 bit data into the accumulator
Step4 : Copy the contents of accumulator into the register ‘B’
Step5 : Load the second 8 bit data into the accumulator.
Step6 : Add the 2 - 8 bit datas and check for carry.
Step7 : Jump on if no carry
Step8 : Increment carry if there is
Step9 : Store the added request in accumulator
Step10 : More the carry value to accumulator
Step11 : Store the carry value in accumulator
Step12 : Stop the program execution.
8. Flow chart
NO
YES
Intialise the carry as zero
Load the 1st
8 bit number
Transfer the 1st
number to register ‘B’
Load the 2nd
8 bit number
Subtract the two values
Increment carry by one
1’s compliment of 2nd
value
Add 1 to 1’s compliment for 2’s compliment
END
Check for
carry
START
Store the value of result in accumulator
Move the carry into the accumulator
Store the value of carry in accumulator
9. PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,00 0E,00 Clear the content of C Register.
4102 LDA 4300 3A,00,43
Load the content of the accumulator in
4300
4105 MOV B, A 47
Move the content from accumulator to
B register
4106 LDA 4301 3A,01,43
Load the content of the accumulator in
4301
4109 SUB B 90
Sub the content from accumulator to B
register
410A JNC 410E ( LOOP 1) D2,0E,41 Jump on no carry to the label (LOOP 1)
410D INR C 0C Increment the C register content
410E LOOP 1 STA 4302 32,02,43
Store the content of accumulator at in
location 4302
4111 MOV A,C 79
Move the carry content from C Register
to accumulator
4112 STA 4303 32,03,43
Store carry content in accumulator at
the location 4303
4115 HLT 76 End the program
Input
Without borrow
Input Address Value
4300 05
4301 07
Output
Output Address Value
4302 02
4303 00 (borrow)
With carry borrow
Input Address Value
4300 07
4301 05
Output Address Value
4302 02
4303 01 (borrow)
Calculation 05 – 07
07 – 0111
1000
0001
------
1001
05 - 0101
------
1110 (-2)
10. ADDITION OF TWO 16 – BIT NUMBERS
AIM:
To write an assembly language program for adding two 16 bit numbers using 8085
micro processor kit.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. Key board
ALGORITHM (ADDITION):
Step1 : Get the 1st
8 bit in ‘C’ register (LSB) and 2nd
8 bit in ‘H’
Register (MSB) of 16 bit number.
Step2 : Save the 1st
16 bit in ‘DE’ register pair
Step3 : Similarly get the 2nd
16 bit number and store it in ‘HL’ register
Pair.
Step3 : Get the lower byte of 1st
number into ‘L’ register
Step4 : Add it with lower byte of 2nd
number
Step5 : tore the result in ‘L’ register
Step6 : Get the higher byte of 1st
number into accumulator
Step7 : Add it with higher byte of 2nd
number and carry of the lower bit
Addition.
Step8 : Store the result in ‘H’ register
Step9 : Store 16 bit addition value in ‘HL’ register pair
Step10 : Stop program execution
11. Flow chart
NO
YES
C = 00H
Load ‘HL’ with 1st
Data
Transfer HL - DE
Load ‘HL’ with 2nd
Data
DE + HL = HL
C = C + 01
Store ‘HL’ in memory (SUM)
Transfer C - A
END
Check for
carry
START
Store ‘A’ in memory (Cy)
13. With carry
Input Address Value
4800 FF (addend)
4801 DE (addend)
4802 96 (augend)
4803 DF (augend)
Output Address Value
4804 95 (sum)
4805 BE (sum)
4806 01 (carry)
Calculation
1101 1110 1111 1111
1101 1111 1001 0101
---------------------------------
1011 1110 1001 0101
B E 9 5
14. SUBTRACTION OF TWO 16 – BIT NUMBERS
Aim:
To write an assembly language program for subtracting two 16 bit numbers using
8085 microprocessor kit.
Apparatus required:
1. 8085 microprocessor kit
2. Keyboard
ALGORITHM
Step1 : Start the microprocessor
Step2 : Get the 1st
16 bit in ‘HL’ register pair
Step3 : Save the 1st
16 bit in ‘DE’ register pair
Step4 : Get the 2nd
16 bit number in ‘HL’ register pair
Step5 : Get the lower byte of 1st
number
Step6 : Get the subtracted value of 2nd
number of lower byte by
subtracting it with lower byte of 1st
number
Step7 : Store the result in ‘L’ register
Step8 : Get the higher byte of 2nd
number
Step9 : Subtract the higher byte of 1st
number from 2nd
number with
borrow
Step10 : Store the result in ‘HL’ register
Step11 : Stop the program execution
15. Flow chart
C = 00H
Load ‘HL’ with 1st
Data
Transfer HL - DE
Load ‘HL’ with 2nd
Data
Transfer E – A (LSB)
END
START
A = A – L (LSB)
Store ‘A’ in memory (LSB)
Transfer D – A (MSB)
A – A – H – Borrow (MSB)
Store ‘A’ in memory (MSB)
16. PROGRAM:
Address Label Mnemonics Hex Code Comments
4500 MVI C,00 0E C = 00H
4501 00
4502 LHLD 4800 2A L – 1st
No.
4503 00
4504 48
4505 XLHG EB HL – DE
4506 LHLD 4802 2A HL – 2nd
No.
4507 02
4508 48
4509 MOV A,E 7B LSB of ‘1’ to ‘A’
450A SUB L 95 A – A – L
450B STA 4804 32 A – memory
450C 04
450D 48
450E MOV A,D 7A MSB of 1 to A
450F SBB H 9C A- A – H
4510 STA 4805 32 A – memory
4511 05
4512 48
4513 HLT 76 Stop execution
Input
Without borrow
Input Address Value
4800 07
4801 08
4802 05
4803 06
Output
Output Address Value
4804 02
4805 02
4807 00
18. 8 BIT MULTIPLICATION & DIVISION
AIM:
To perform 8085 assembly language program for 8 bit multiplication .
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. keyboard
ALGORITHM (MULTIPLICATION):
Algorithm:
Step1 : Start the microprocessor
Step2 : Get the 1st
8 bit numbers
Step3 : Move the 1st
8it number to register ‘B’
Step4 : Get the 2nd
8 bit number
Step5 : Move the 2nd
8 bit number to register ‘C’
Step6 : Intialise the accumulator as zero
Step7 : Intialise the carry as zero
Step8 : Add both register ‘B’ value as accumulator
Step9 : Jump on if no carry
Step10 : Increment carry by 1 if there is
Step11 : Decrement the 2nd
value and repeat from step 8, till the 2nd
value becomes zero.
Step12 : Store the multiplied value in accumulator
Step13 : Move the carry value to accumulator
Step14 : Store the carry value in accumulator
19. Flowchart
NO
YES
No
YES
Get the 1st
8 bit number
Move it to register ‘B’
Get the 2nd
8 bit number
Intialize the accumulator as zero & carry as zero
Add the accumulator with 1st
number
Increment carry
Decrement 2nd
number
Store the value f carry in accumulator
END
Check for
carry
start
2nd
Number
20. PROGRAM:
Address Label Mnemonics Hex Code Comments
4100 LDA 4500 3A, 00, 45 Load the first 8 bit number
4103 MOV B,A 47 Move the 1st
8 bit data to
register ‘B’
4104 LDA 4501 3A, 01, 45 Load the 2nd
16 it number
4107 MOV C,A 4F Move the 2nd
8 bit data to
register ‘C’
4108 MVI A, 00 3E, 00 Intialise the accumulator as
zero
410A MVI D, 00 16, 00 Intialise the carry as zero
410C ADD B 80 Add the contents of ‘B’ and
accumulator
410D INC D2 11, 41 Jump if no carry
4110 INR D 14 Increment carry if there is
4111 DCR C OD Decrement the value ‘C’
4112 JNZ C2 0C, 41 Jump if number zero
4115 STA 4502 32 02, 45 Store the result in
accumulator
4118 MOV A,D 7A Move the carry into
accumulator
4119 STA 4503 32,03,45 Store the result in
accumulator
411C HLT 76 Stop the program execution
Input
Input Address Value
4500 04
4501 02
Output
Output Address Value
4502 08
4503 00
21. DIVISION OF TWO 8 – BIT NUMBERS
Aim:
To write an assembly language program for dividing two 8 bit numbers using
microprocessor kit.
Apparatus required:
8085 microprocessor kit
Key board
Algorithm:
Step1 : Start the microprocessor
Step2 : Intialise the Quotient as zero
Step3 : Load the 1st
8 bit data
Step4 : Copy the contents of accumulator into register ‘B’
Step5 : Load the 2nd
8 bit data
Step6 : Compare both the values
Step7 : Jump if divisor is greater than dividend
Step8 : Subtract the dividend value by divisor value
Step9 : Increment Quotient
Step10 : Jump to step 7, till the dividend becomes zero
Step11 : Store the result (Quotient) value in accumulator
Step12 : Move the remainder value to accumulator
Step13 : Store the result in accumulator
Step14 : Stop the program execution
22. Flow chart
NO
YES
YES
START
Get the divided
Intialise the Quotient as zero
Get the divisor
Compare the dividend & divisor
Add the accumulator with 1st
number
Check for
carry
Increment carry
Decrement 2nd
number
Dividend
Move the remainder to accumulator
Store the Quotient in accumulator
END
Store the remainder in accumulator
23. PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI B,00 0E,00 Clear the content of B Register.
4102 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair.
4105 MOV A,M 7E
Move the content of memory location
to A Register.
4106 INX H 23 Increment memory location.
4107 LOOP 1 SUB M 96
Subtract the content of memory
location with accumulator.
4108 INR B 04 Increment the B register.
4109 JNC 4107 (LOOP 1) D2,07,41 If carry = 0, jump to address 4107.
410C DCR B 05 Decrement the B register.
410D ADD M 86
Add the content of memory location
with accumulator.
411E STA 4301 32,01,43 Store the remainder in address 4301.
4111 MOV A,B 78
Move the B Register content to the
accumulator.
4112 STA 4302 32,02,43 Store the quotient in address 4302.
4115 HLT 76 End the program
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 4300
4201 4301
RESULT:
Thus the ALP for 8 bit multiplication and division were performed and output was
verified
24. EXPT .NO:
BLOCK TRANSFER OPERATION
AIM:
To perform a forward block transfer and reverse block transfer operation using 8085
microprocessor.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. keyboard
ALGORITHM (Forward block transfer):
1. Initialize the source address in HL register pair.
2. Initialize the destination address in DE register pair
3. Move the memory content pointed by HL pair to accumulator.
4. Move accumulator content to memory location pointed by storing DE register.
5. Increment the HL pair
6. Increment the DE registers pair
7. Decrement C register
8. If there is no zero jump to step 4
9. Stop the Program.
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,05 0E,05
Clear the content of C registers.(Count
5)
4102 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4105 LXID 4300 21,00,43
The content of data 4300 transfer to DE
pair
4108
LOOP 1
MOV A,M 7E
Move the content of memory to
accumulator
4109 STAX D 12
Store the accumulator content at D
register.
410A INX H 23 Increment the H register
410B INX D 13 Increment the D register
410C DCR C 0D Decrement the C register
410D JNZ 4108 (LOOP 1) C2,08,41 If carry = 0, jump to address 4108.
4110 HLT 76 End the program
25. Flow chart
No
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 4300
4201 4301
4202 4302
4203 4303
4204 4304
Clear the content of C registers. (Count value)
Load the content to H reg
Load the content to D reg
Store the Accumulator content D register
INR H Reg
END
Check for
carry
START
INX D Reg
Move the content of memory to accumulator
26. ALGORITHM (Reverse transfer):
1. Initialize the source address in HL register pair.
2. Initialize the destination address in DE register pair
3. Move the memory content pointed by HL pair to C register
4. Move the content of C register to E register
5. Increment the HL pair
6. Move the content of memory to accumulator
7. Store the accumulator content at D register
8. Decrement the D register
9. Decrement the C register
10. If carry = 0, jump to address 4107
11. End the program
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4103 LXID 4300 21,00,43
The content of data 4200 transfer to DE
pair
4106 MOV C,M 4E
Move the content of memory to C
register
4107 LOOP 1 MOV E,C 59
Move the content of C register to E
register.
4108 INX H 23 Increment the H register
4109 MOV A,M 7E
Move the content of memory to
accumulator
410A STAX D 12
Store the accumulator content at D
register.
410B DCX D 1B Decrement the D register
410C DCR C 0D Decrement the C register
410D JNZ 4107 (LOOP 1) C2,07,41 If carry = 0, jump to address 4107.
4110 HLT 76 End the program
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 (Count 4) 4300
4201 4301
4202 4302
4203 4303
4204
27. Flow Chart
No
RESULT:
Thus the forward block transfer and reverse block transfer operation were performed and
output was verified.
Load the content to HL Pair (Count value)
Transfer content HL to DE Pair
Transfer the content of C register to E register.
INR H Reg
END
Check for
carry
START
DCR C Reg
Transfer the content of memory to C Reg
Transfer the content of memory to accumulator
Store the accumulator content at D register.
DCX D Reg
28. EXPT .NO:
ARRAY OPERATION
AIM:
To perform a smallest and largest of numbers using 8085 microprocessor.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. Keyboard
ALGORITHM (LARGEST NUMBER):
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
Element).
7. If the accumulator content is smaller, then move the memory content
(Largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,00 0E,00 Clear the content of C Register
4102 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4105 MOV C,M 4E
Move the content of memory to C
register
4106 INX H 23 Increment the H register
4107 MOV A,M 7E
Move the content of memory to
accumulator
4108 DCR C 0D Decrement the C register
4109 LOOP 1 INX H 23 Increment the C register
410A CMP M BE
Compare the content of memory with
accumulator
410B JNC 410F (Loop 2) D2,0F,41 If carry = 0, jump to address 410F
410E MOV A,M 7E
Move the content of memory to
accumulator
410F Loop 2 DCR C 0D Decrement the C register
4110 JNZ 4109 (LOOP 1) C2,09,41 If carry = 0, jump to address 4109
4113 STA 4300 32,00,43
Store the largest number in the
memory location
4116 HLT 76 End the program.
29. OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 03 (Count) 4300
4201
4202
4203
ALGORITHM (SMALLEST NUMBER):
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next
Element).
7. If the accumulator content is smaller, then move the memory content
(Largest element) to the accumulator. Else continue.
8. The counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,00 0E,00 Clear the content of C Register.
4102 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4105 MOV C,M 4E
Move the content of memory to C
register
4106 INX H 23 Increment the H register
4107 MOV A,M 7E
Move the content of memory to
accumulator
4108 DCR C 0D Decrement the C register
4109 LOOP 1 INX H 23 Increment the C register
410A CMP M BE
Compare the content of memory with
accumulator
410B JC 410F (Loop 2) DA,0F,41 If carry = 1, jump to address 410F
410E MOV A,M 7E
Move the content of memory to
accumulator
410F LOOP 2 DCR C 0D Decrement the C register
4110 JNZ 4109 (LOOP 1) C2,09,41 If carry = 0, jump to address 4109
4113 STA 4300 32,00,43
Store the Smallest number in the
memory location
4116 HLT 76 End the program
30. OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 03(Count) 4300
4201
4202
4203
RESULT:
Thus the largest and smallest number operation were performed and output was verified.
31. EXPT .NO:
SORTING
AIM:
To perform a ascending and descending order of using 8085 microprocessor.
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. Keyboard
ALGORITHM (ascending order):
1. Get the numbers to be sorted from the memory locations.
2. Compare the first two numbers and if the first number is larger than second then
Interchange the number.
3. If the first number is smaller, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4103 MOV B,M 46
Move the content of memory to B
register
4104 DCR B 05 Decrement the B register
4105 LOOP 1 MOV C,B 48
Move the content of B register to C
register.
4106 LXIH 4201 21,01,42
The content of data 4201 transfer to HL
pair
4109 LOOP 2 MOV A,M 7E
Move the content of memory to
accumulator
410A INX H 23 Increment the H register
410B MOV D,M 56
Move the content of memory to D
register
410C CMP D BA
Compare the content of D register with
accumulator
410D JC 4114 (LOOP 3) DA,14,41 If carry = 1, jump to address 4114
4110 MOV M,A 77
Move the content of memory to
accumulator
4111 DCX H 2B Decrement the H register
4112 MOV M,D 72
Move the content of D register to
memory
4113 INX H 23 Increment the H register
4114 LOOP 3 DCR C 0D Decrement the C register
4115 JNZ 4109 (LOOP 2) C2,09,41 If zero flag = 0, jump to address 4109
4118 DCR B 05 Decrement the B register
4119 JNZ 4105 (LOOP 1) C2,05,41 If zero flag = 0, jump to address 4105
411C HLT 76 End the program
32. OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 (Count 05) 4201
4201 4202
4202 4203
4203 4204
4204 4205
4205
ALGORITHM (Descending order):
1. Get the numbers to be sorted from the memory locations.
2. Compare the first two numbers and if the first number is smaller than second then I
Interchange the number.
3. If the first number is larger, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 LXIH 4200 21,00,42
The content of data 4200 transfer to HL
pair
4103 MOV B,M 46
Move the content of memory to B
register
4104 DCR B 05 Decrement the B register
4105 LOOP 1 MOV C,B 48
Move the content of B register to C
register.
4106 LXIH 4201 21,01,42
The content of data 4201 transfer to HL
pair
4109 LOOP 2 MOV A,M 7E
Move the content of memory to
accumulator
410A INX H 23 Increment the H register
410B MOV D,M 56
Move the content of memory to D
register
410C CMP D BA
Compare the content of D register with
accumulator
410D JNC 4114 (LOOP 3) DA,14,41 If carry = 0, jump to address 4114
4110 MOV M,A 77
Move the content of memory to
accumulator
4111 DCX H 2B Decrement the H register
4112 MOV M,D 72
Move the content of D register to
memory
4113 INX H 23 Increment the H register
4114 LOOP 3 DCR C 0D Decrement the C register
4115 JNZ 4109 (LOOP 2) C2,09,41 If zero flag = 0, jump to address 4109
4118 DCR B 05 Decrement the B register
4119 JNZ 4105 (LOOP 1) C2,05,41 If zero flag = 0, jump to address 4105
411C HLT 76 End the program
33. OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
4200 (Count 05) 4201
4201 4202
4202 4203
4203 4204
4204 4205
4205
RESULT:
Thus the Ascending and Descending operation were performed and output was verified.
34. EXPT .NO:
CODECONVERSION
AIM:
To perform a code conversion for Following
1.HEXA DECIMAL TO ASCII
2.ASCII TO HEXA DECIMAL
3
APPARATUS REQUIRED:
1. 8085 microprocessor kit
2. Keyboard
PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 MVI C,00 0E,00 Clear the content of C Register.
4102 LHLD 4200 2A,00,42
Load the augend in DE pair through HL
pair
4105 XCHG EB
Transfer the content of HL pair to DE
pair
4106 LHLD 4202 2A,02,42 Load the addend in HL pair
4109 MOV A,E 7B
Move the content of E register to A
register
410A SUB L 95
Subtract the content of L register with
accumulator
410B STA 4204 32,04,42 Store the LSB in address location 4204
410E MOV A,D 7A
Move the Content of D register to
register A
410F SBB H 9C
Subtract the content of H register and
carry flag with accumulator
4110 STA 4205 32,05,42 Store the MSB in address location 4205
4113 JNC 4117 ( LOOP 1) D2,17,41 If there is no carry go to label (LOOP 1)
4116 INR C 0C Increment the C register
4117 LOOP 1 MOV A,C 79
Move the content of C Register to A
register
4118 STA 4206 32,06,42
Store the carry in 4206 through
accumulator ( MSB of sum )
411B HLT 76 End the program