8085 MICROPROCESSOR 2078-HSMallik
8085 MICROPROCESSOR 2078-HSMallik
Plan:
This program will add two 8-bit hex numbers
at address 8000 and 8001.
The result is stored at address 8002.
Algorithm:
Steps:
•Initialize HL register pair with address of first
number i.e. address 8000.
•Move this number into accumulator.
•Get the second number from address 8001.
•Add second number to accumulator.
•Point the address for result.
•Move the result from accumulator to address 8002.
•Go back to monitor.
• Switch ON the given trainer kit
• Enter 8000
8002 00 Result
8002 00 Result
8002 00 Result
Before Execution
8000 16 8000 AB
8001 56 8001 23
After Execution
8085 Simulator
Program (2):
Decimal addition of two 8-bit decimal numbers
(the result should not be greater than 99).
PLAN:
This program will add two 8-bit decimal numbers at address 8000 and
Before Execution
8000 16 8000 81
8001 56 8001 15
After Execution
Previously: in program 1
PLAN:
Steps:
6. Go back to monitor.
PROGRAM:
8004 35 (LSB1+
LSB2) 8004 33 (LSB1+
LSB2)
8005 61 (MSB1+
MSB2) 8005 55(MSB1+
MSB2)
XX XX
A7 CA
(a) Address Data (b) Address Data
8000 CA (LSB1) 8000 11 (LSB1)
8001 A7 (MSB1) 8001 2A (MSB1)
8002 6B (LSB2) 8002 22 (LSB2)
8003 B9 (MSB2) 8003 2B (MSB2)
8004 35 (LSB1+
LSB2) 8004 33 (LSB1+
LSB2)
8005 61 (MSB1+
MSB2) 8005 55(MSB1+
MSB2)
A7 CA
XX XX
(a) Address Data (b) Address Data
8000 CA (LSB1) 8000 11 (LSB1)
8001 A7 (MSB1) 8001 2A (MSB1)
8002 6B (LSB2) 8002 22 (LSB2)
8003 B9 (MSB2) 8003 2B (MSB2)
8004 35 (LSB1+
LSB2) 8004 33 (LSB1+
LSB2)
8005 61 (MSB1+
MSB2) 8005 55(MSB1+
MSB2)
A7 CA
B9 6B
(a) Address Data (b) Address Data
8000 CA (LSB1) 8000 11 (LSB1)
8001 A7 (MSB1) 8001 2A (MSB1)
8002 6B (LSB2) 8002 22 (LSB2)
8003 B9 (MSB2) 8003 2B (MSB2)
8004 35 (LSB1+
LSB2) 8004 33 (LSB1+
LSB2)
8005 61 (MSB1+
MSB2) 8005 55(MSB1+
MSB2)
A7 CA
B9 +A7 6B +CA
(a) Address Data (b) Address Data
8000 CA (LSB1) 8000 11 (LSB1)
8001 A7 (MSB1) 8001 2A (MSB1)
8002 6B (LSB2) 8002 22 (LSB2)
8003 B9 (MSB2) 8003 2B (MSB2)
8004 35 (LSB1+
LSB2) 8004 33 (LSB1+
LSB2)
8005 61 (MSB1+
MSB2) 8005 55(MSB1+
MSB2)
A7 CA
61 35
Program (4):
PLAN:
This program adds ‘n’ number of hexadecimal numbers from
address 8101 onwards.
OBSERVATIONS:
(a) Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 8100 04
xx 8101 02
8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 8100 04
xx 8101 02
81 00 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 8100 04
xx 8101 02
81 00 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 04 8100 04
xx 8101 02
81 00 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 04 8100 04
xx 8101 02
81 00 8102 10
XOR
8103 03
xx
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 04 8100 04
00 8101 02
81 00 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 04 8100 04
00 8101 02
81 01 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 03 8100 04
02 8101 02
81 01 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 03 8100 04
02 8101 02
81 01 8102 10
8103 03
Not zero 8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 03 8100 04
02 8101 02
81 02 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 02 8100 04
12 8101 02
81 02 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 02 8100 04
12 8101 02
81 02 8102 10
8103 03
Not zero 8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 02 8100 04
12 8101 02
81 03 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 01 8100 04
15 8101 02
81 03 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 01 8100 04
15 8101 02
81 03 8102 10
8103 03
Not zero 8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 01 8100 04
15 8101 02
81 04 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 00 8100 04
1D 8101 02
81 04 8102 10
8103 03
8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 00 8100 04
1D 8101 02
81 04 8102 10
8103 03
Zero 8104 08
.
Address Data (b) Address Data
8100 04 8100 03
8101 02 8101 02
8102 10 8102 10
8103 03 8103 03
8104 08 8104 08
8100 1D (Result) 8100 15 (Result)
Memory Add Data
Accumulator 00 8100 1D
1D 8101 02
81 04 8102 10
8103 03
8104 08
.
Program (5):
PLAN:
This program breaks the byte of data stored
at 8100 into two nibbles.
8001 00
8002 81
8004 0F
800C F0
8100 AB 8100 12
8101 00 8101 00
8102 00 8102 00
8100 AB 8100 12
8101 0B 8101 02
8102 A0 8102 10
Program (6):
PLAN:
Step 3
8004 07 RLC
8005 07 RLC
Move it to MSB
8006 07 RLC
8007 07 RLC
Step 4 Point to LS nibble
8008 23 INX H
8100 0A 8100 01
8101 0B 8101 02
8102 00 8102 00
8100 0A 8100 01
8101 0B 8101 02
8102 AB 8102 12
Program (7):
PLAN:
This program checks the hex number stored in location
8100 for odd or even parity.
Steps:
1. Initialize memory pointer with 8100 location i.e. point to
given hex number.
2. Move it into accumulator.
3. ‘OR’ the contents of accumulator with itself.
4. Check the parity register for odd or even parity and store 00
or EE in location 8101 depending upon whether it is odd or
even parity.
5. Go back to monitor.
PROGRAM:
8001 00
8002 81
Step 2
8003 7E MOV A,M Move it into
accumulator
Step 3
8004 B7 ORA A Set the flag
Step 4 If the parity is odd, jump
8005 E2 JPO ODD to ODD
8006 0C
8007 80
Point to memory
8008 2C INR L location for result
8009 36 MVI M, EE Store EE in 8101
800A EE
Point to memory
Step 4 800C 2C ODD INR L location for result
800D 36 MVI M, 00 Store 00 in 8101
800E 00
Step 5 800F EF RST 5 Go back to monitor
OBSERVATIONS:
8100 20 8100 44
PLAN:
8101.
ALGORITHM:
Steps:
1.Load the data of location 8100 in the accumulator.
2.Set the carry flag to zero.
3.Rotate the accumulator through carry.
4.Store the contents of accumulator (result) in location
8101.
5.Go back to monitor.
PROGRAM:
Address Code Label Mnemonic Operand Comments
Step 8000 3A Start LDA 8100 Get the given number
1 in accumulator
8001 00
8002 81
Step 8003 37 STC Set the carry flag to 1
2 8004 3F CMC Complement the carry
8100 1A 8100 2A
PLAN:
This program multiplies data stored in
location 8100 (multiplicand) and in
location 8101 (multiplier) and stored
the result in location 8102 (LSB) and
in location 8103 (MSB).
ALGORITHM:
Steps:
1. Load the multiplicand (D1) and multiplier (D2) in HL pair.
2. Stored it into DE pair.
3. Clear HL pair.
4. Move multiplicand into register B (as a counter)
5. Clear register D
6. Add HL and DE pair (result is in HL pair).
7. Decrease 1 from multiplicand.
8. Check whether register B is 00 or not. If not repeats from step 6.
9. Store the result at location 8102 and 8103.
10.Go back to monitor.
PROGRAM:
Address Code Label Mnemonic Operand Comments
Step 1 8000 2A Start LHLD 8100 Load HL pair with
D1 and D2
8001 00
8002 81
Step 2 8003 EB XCHG Exchange HL and
DE register pair
800E 0B
800F 80
8011 02
8012 81
Step10 8013 EF RST 5 Go back to
monitor
OBSERVATIONS: