LAB EXPERIMENTS
PART A(8085)
1. FAMILIARISATION OF 8085 MICROPROCESSOR TRAINER KIT.
2. ADDITION OF TWO 8-BIT NUMBERS.
3. SUBTRACTION OF TWO 8 BIT NUMBERS.
4. MULTIPLICATION OF TWO 8-BIT NUMBERS
5. DIVISION OF TWO 8-BIT NUMBERS
6. LARGEST NUMBER IN AN ARRAY OF DATA.
7. SMALLEST NUMBER IN AN ARRAY OF DATA
8. BCD ADDITION
9. BCD SUBTRACTION
10.SUM OF N NUMBERS
11.ARRANGE AN ARRAY OF DATA IN ASCENDING ORDER
12.ARRANGE AN ARRAY OF DATA IN DESCENDING ORDER
13. HEX TO ASCII CONVERSION
14. ASCII TO HEX CONVERSION
15. SQUARE OF A NUMBER USING LOOK UP TABLE
16. BLOCK OF DATA TRANSFER
17. BLOCK INTERCHANGE
18. BLOCK INVERSION
16.STEPPER MOTOR INTERFACE
17. DISPLAY INTERFACE
PART B
1.FAMILIARISATION OF 8086-MASM
PART A
1. ADDITION OF TWO 8 BIT NUMBERS
ALGORITHM:
1) Start the program by loading the first data into Accumulator.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Store the value of sum and carry in memory location.
7) Terminate the program.
PROGRAM:
MVI
LDA
MOV
LDA
ADD
JNC
INR
LOOP: STA
MOV
STA
HLT
C, 00
8150
B, A
8151
B
LOOP
C
8152
A, C
8153
; Initialize C register to 00
; Load the value to Accumulator.
; Move the content of Accumulator to B register.
; Load the value to Accumulator.
; Add the value of register B to A
; Jump on no carry.
; Increment value of register C
; Store the value of Accumulator (SUM).
; Move content of register C to Acc.
; Store the value of Accumulator (CARRY)
; Halt the program.
OBSERVATION:
Input:
80 (8150)
80 (8251)
Output:
00 (8152)
01 (8153)
C, 00
8150
B, A
8151
B
LOOP
Initialize C to 00
Load the value to Acc.
Move the content of Acc to B register.
Load the value to Acc.
Jump on no carry.
Complement Accumulator contents.
A
Increment value in Accumulator.
C
Increment value in register C
8152 Store the value of A-reg to memory address.
A, C
Move contents of register C to Accumulator.
8153 Store the value of Accumulator memory address.
Terminate the program.
OBSERVATION:
Input: 06 (8150)
02 (8251)
Output: 04 (8152)
01 (8153)
D, 00
Initialize register D to 00
A, 00
Initialize Accumulator content to 00
H, 8200
B, M
Get the first number in B - reg
H
C, M
Get the second number in C- reg.
B
Add content of A - reg to register B.
NEXT
Jump on no carry to NEXT.
D
Increment content of register D
C
Decrement content of register C.
LOOP
Jump on no zero to address
8252
Store the result in Memory
A, D
8253
Store the MSB of result in Memory
Terminate the program.
OBSERVATION:
Input:
FF (8200)
FF (8251)
Output:
01 (8252)
FE (8253)
4.
ALGORITHM:
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register(B register).
3) Get the second data and load into Accumulator.
4) Compare the two numbers to check for carry.
5) Subtract the two numbers.
6) Increment the value of carry .
7) Check whether repeated subtraction is over and store the value of product and
carry in memory location.
8) Terminate the program.
PROGRAM:
LXI
H, 8300
MOV
B, M
MVI
C, 00
INX
H
MOV
A, M
NEXT: CMP
B
JC
LOOP
SUB
B
INR
C
JMP NEXT
LOOP: STA 8400
MOV
A, C
STA 8401
HLT
OBSERVATION:
Input:
Output:
FF (8300)
FF (8301)
01 (8400) ---- Remainder
FE (8401) ---- Quotient
H,8200
B,M
H
MOV
A,M
DCR
LOOP: INX
CMP
JNC
AHEAD
MOV
A,M
AHEAD:DCR
JNZ
LOOP
STA
8300
HLT
OBSERVATION:
Input:
Output:
FE (8300)
H,8200
Set pointer for array
B,M
Load the Count
H
Set 1st element as largest data
A,M
B
Decrement the count
H
M
If A- reg < M go to AHEAD
AHEAD
A,M
Set the new value as smallest
B
LOOP
Repeat comparisons till count = 0
8300
Store the largest value at 4300
OBSERVATION:
Input:
Output:
0A (8300)
ALGORITHM:
1.
Initialize HL pair as memory pointer
2. Get the count at 4200 into C register
3.
Copy it in D register (for bubble sort (N-1) times required)
4. Get the first value in A register
5. Compare it with the value at next location.
6. If they are out of order, exchange the contents of A register and Memory
7. Decrement D register content by 1
8. Repeat steps 5 and 7 till the value in D- register become zero
9. Decrement C register content by 1
10. Repeat steps 3 to 9 till the value in C register becomes zero
PROGRAM:
LXI
H,8200
MOV
C,M
DCR
SKIP:
H,8201
MOV A,M
INX
CMP
JC
SKIP
MOV
B,M
MOV
M,A
DCX
MOV
M,B
INX
DCR
JNZ
LOOP
DCR
JNZ
REPEAT
HLT
OBSERVATION:
Input:
8200 --05 (Array Size)
8201-- 05
8202-- 04
8203-- 03
8204-- 02
8205-- 01
Output:8201--01
8202--02
8203--03
8204--04
820505
H,4200
MOV C,M
DCR
H,4201
MOV A,M
INX
CMP
JNC
SKIP
MOV B,M
MOV M,A
DCX
MOV M,B
SKIP:
INX
DCR
JNZ
LOOP
DCR
JNZ
REPEAT
HLT
ALGORITHM:
1. Load the given data in A- register and move to B register
2. Mask the upper nibble of the Hexa decimal number in A register
3. Call subroutine to get ASCII of lower nibble
4.
Store it in memory
PROGRAM:
LDA
8200
MOV
B,A
ANI
0F
CALL SUB1
STA
8201
MOV A,B
ANI F0
RLC
RLC
RLC
RLC
CALL
STA
HLT
SUB1:
CPI 0A
SKIP:
JC
SKIP
ADI
07
ADI
30
RET
OBSERVATION:
Input:
8200---E4(Hexa data)
Output:
8201---34(ASCII Code for 4)
8202---45(ASCII Code for E)
ALGORITHM:
1. Load the given data in A- register
.
PROGRAM:
LDA 8500
SUI 30
CPI 0A
JC
SKIP
SUI 07
SKIP:
STA 8501
HLT
OBSERVATION:
Input:
8500---31
Output:
8501---0B
11.
ALGORITHM:
1. Initialize HL pair to point Look up table
2. Get the data .
3. Check whether the given input is less than 9.
4.
H,8125
LDA
8150
CPI
0A
JC
AFTER
MVI
A,FF
STA
8151
if yes error
Error Indication
HLT
AFTER: MOV
C,A
MVI
B,00
DAD
MOV
A,M
STA
HLT
4151
LOOKUP TABLE:
4125
01
4126
04
4127
09
4128
16
4129
25
4130
36
4131
49
4132
64
4133
81
OBSERVATION:
Input:
8125 : 05
Output:
4151 25 (Square)
Input : 4150: 11
Output:
4151: FF (Error Indication)