Professional Documents
Culture Documents
Ashwin Pillai M & M Lab File
Ashwin Pillai M & M Lab File
This is to certify that this is a bonafide record of the work done by Mr. Ashwin Pillai
of the year 3rd B.Tech Department of Computer Science Engineering in the
Microprocessor Laboratory in the 5th semester.
Examiner 1 Examiner 2
S.no Program Objective Remarks
1 Write a Program Using 8085 & verify for :
a.Addition of Two 8-Bit Numbers.
b.Addition of Two 16-Bit Numbers.(With Carry)
2 Write a Program Using 8085 & verify for :
a.Subtraction of Two 8-Bit Numbers. (Display Of Borrow)
b.Subtractionof Two 16-Bit Numbers.(Display Of Borrow)
3 Write a Program Using 8085 &Test for Typical Data:
a. Multiplication of Two 8-Bit Numbers by Bit Rotation
Method
b. Division of Two 8-Bit Numbers by Repeated Subtraction
Method
4 Write a Program Using 8085 for Finding Square-Root of a
Number & Verify.
5 Write a Program to Move a Block of Data Using 8085
& verify.
6 Write a Program to Arrange Number in Ascending Order
Using 8085 & verify.
7 Write a Program to Check Number of 1's and 0's in Given
Number Using 8085 & verify.
8 Write a Program to Find GCD Of Two Numbers
Using 8085 & verify.
9 Write a Program to Find LCM Of Two Numbers Using
8085 & verify.
10 Write a Program to Add 'N' Two Digit BCD Numbers
Using 8085 & verify.
AIM:
a.ALGORITHM:
PROGRAM:
OBSERVATION:
Input: 80 (4150)
80 (4251)
Output: 00 (4152)
01 (4153)
RESULT:
The program to add two 8-bit numbers was executed.
b.Algorithm –
Program –
MEMORY ADDRESS MNEMONICS
2000 LDA 2050 A ← 2050
2003 MOV B, A B←A
2004 LDA 2052 A ← 2052
2007 ADD B A ← A+B
2008 STA 3050 A → 3050
200B LDA 2051 A ← 2051
200E MOV B, A B←A
200F LDA 2053 A ← 2053
2012 ADC B A ← A+B+CY
2013 STA 3051 A → 3051
2016 HLT Stops execution
OBSERVATION:
Input: 66 (2051)
45 (2050)
33 (2053)
22(2052)
Output: 00 (3052)
99 (3051)
67(3050)
RESULT:
a.ALGORITHM:
PROGRAM:
MVI C, 00 Initialize C to 00
LDA 4150 Load the value to Acc.
MOV B, A Move the content of Acc to B register.
LDA 4151 Load the value to Acc.
SUB B
JNC LOOP Jump on no carry.
CMA Complement Accumulator contents.
INR A Increment value in Accumulator.
INR C Increment value in register C
LOOP: STA 4152 Store the value of A-reg to memory address.
MOV A, C Move contents of register C to Accumulator.
STA 4153 Store the value of Accumulator memory
address.
HLT Terminate the program.
OBSERVATION:
Input: 06 (4150)
02 (4251)
Output: 04 (4152)
01 (4153)
RESULT:
b.ALGORITHM –
1. Get the LSB in L register and MSB in H register of 16 Bit number.
2. Exchange the content of HL register with DE register.
3. Again Get the LSB in L register and MSB in H register of 16 Bit number.
4. Subtract the content of L register from the content of E register.
5. Subtract the content of H register from the content of D register and borrow from
previous step.
6. Store the result in memory location.
PROGRAM –
MEMORY
ADDRESS MNEMONICS COMMENTS
OBSERVATION:
INPUT:
(2050H) = 19H
(2051H) = 6AH
(2052H) = 15H
(2053H) = 5CH
OUTPUT:
(2054H) = 04H
(2055H) = OEH
RESULT:
a.ALGORITHM:
PROGRAM:
OBSERVATION:
Input: FF (4150)
FF (4151)
Output: 01 (4152)
FE (4153)
RESULT:
b.ALGORITHM:
PROGRAM:
LXI H, 4150
MOV B, M Get the dividend in B – reg.
MVI C, 00 Clear C – reg for qoutient
INX H
MOV A, M Get the divisor in A – reg.
NEXT: CMP B Compare A - reg with register
B.
JC LOOP Jump on carry to LOOP
SUB B Subtract A – reg from B- reg.
INR C Increment content of register C.
JMP NEXT Jump to NEXT
LOOP: STA 4152 Store the remainder in Memory
MOV A, C
STA 4153 Store the quotient in memory
HLT Terminate the program.
OBSERVATION:
Input: FF (4150)
FF (4251)
Output: 01 (4152)-----Remainder
FE (4153)----Quotient
RESULT:
ALGORITHM –
1. Assign 01 to register D and E
2. Load the value, stored at memory location 2050 in accumulator A
3. Subtract value stored at accumulator A from register D
4. Check if accumulator holds 0, if true then jump to step 8
5. Increment value of register D by 2
6. Increment value of register E by 1
7. Jump to step 3
8. Move value stored at register E in A
9. Store the value of A in memory location 3050
PROGRAM –
OBSERVATION:
Input: 09(2050)
Output:03(3050)
RESULT:
Found the Square-Root of a Number.
AIM:
Write a Program to Move a Block of Data Using 8085 & verify.
Algorithm –
1. Load register pair H-L with the address 2500H
2. Load register pair D-E with the address 2600H
3. Move the content at memory location into accumulator
4. Store the content of accumulator into memory pointed by D-E
5. Increment value of register pair H-L and D-E by 1
6. Decrements value of register C by 1
7. If zero flag not equal to 1, go to step 3
8. Stop
Program –
OBSERVATION:
Input: 05(2504)
04(2503)
03(2502)
02(2501)
01(2500)
Output: 05(2604
04(2603)
03(2602)
02(2601)
01(2600)
RESULT:
Thus the program to Move a Block of Data was executed.
AIM:
Write a Program to Arrange Number in Ascending Order Using 8085 &
verify.
ALGORITHM:
PROGRAM:
LXI H,420
MOV 0 C,M
DCR C
REPEAT: MOV D,C
LXI H,4201
LOOP: MOV A,M
INX H
CMP M
JC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
OBSERVATION:
RESULT:
ALOGORITHM:
1. ORG Addr. Directive reserves the starting address for Program Code or data in
specified memory array,.
2. MVI (MOVE IMMEDIATE DATA)moves immediate value to specified register.
3. RLC (ROTATE ACCUMULATOR LEFT) binary bit of the accumulator is rotated left
by one position.
4. INR Reg. (INCREMENT REGISTER) increments the contents of the register by one.
5. JNC Addr. instruction jump the execution to the specified Address if carry flag is reset.
6. JMP (JUMP UNCODITIONALLY) jump execution to specified location.
7. JNZ Addr. instruction jump the execution to the specified Address if zero flag is reset.
8. DCR (DECREMENT REGISTER)instruction decrement the specified register content
by 1.
9. ADD M (ADDTION) adds the contents of memory to accumulator.
10. RST 1 (RESET) finishes the execution of the current instruction and stops any further
execution.
11. DB Directive is defined to store values in specified memory array.
Program:
# ORG 2000H
MVI C,00 // Clear reg.C
MVI D,00 // Clear reg.D
MVI A,F0 // Take number into Accumulator
MVI B,08 // Counter 8 loaded in reg.B
up:RLC // Rotate left through carry
JNC down // Jump if CF=0
INR D // D+1=>D for 1’s counter
JMP shift // Unconditional Jump
down:INR C // C+1=> C for 0’s counter
shift:DCR B // B-1=> B
JNZ up // True until B=0
RST 1 // Terminate
RESULT:
The Program to Check Number of 1's and 0's in Given Number was executed
successfully.
AIM:
Write a Program to Find GCD Of Two Numbers Using 8085 & verify.
ALGORITHM:
1. ORG Addr. Directive reserves the starting address for Program Code or data in
specified memory array,
2. MOV A, M copies the data byte into accumulator from the memory specified by the
address in H-L pair.
3. MVI (MOVE IMMEDIATE DATA)moves immediate value to specified register.
4. CMP (COMPARE WITH ACCUMULATOR) compares the register/memory content
to accumulator
If (A) < (Reg/Mem) ; carry flag is set and zero flag is reset.
If (A) = (Reg/Mem) ; carry flag is reset and zero flag is set.
If (A) > (Reg/Mem) ; both carry flag and zero flag are reset.
5. JZAddr. instruction jump the execution to the specified Address if zero flag is set.
6. JNCAddr. instruction jump the execution to the specified Address if carry flag is reset.
7. SUB Reg (SUBTRACT REGISTER) subtract register content by accumulator and
result stored into accumulator.
8. DCR (DECREMENT REGISTER)instruction decrement the specified register content
by 1.
9. JMP (JUMP UNCONDITIONALLY) Jump execution to the specified address.
10. STA (Store Accumulator Direct) copy the content of accumulator to specified
address.
11. RST 1 (RESET) finishes the execution of the current instruction and stops any further
execution.
12. DB Directive is defined to store values in specified memory array.
Program:
# ORG 2000H
MVI A,09 // Load first no. in reg.A
MVI B,07 // Load second No. in reg.B
CMP B // Compare B to A
JZ down // True if A=B
JNC shift // True if A>B
MOV C,A // A → C
MOV A,B // A ← B
MOV B,C // C← B
shift:SUB B // A-B → A
CMP B // Compare B to A
JZ move // True if A=B
JNC shift // True if A>B
MOV C,A // A ← C
MOV A,B // A ← B
MOV B,C // C → A
JMP shift // Unconditional Jump
move:MOV A,B // B → A
down:STA F200 // A → [address]
RST 1 // Terminate
RESULT:
The Program to Find GCD Of Two Numbers was executed successfully.
AIM:
Write a Program to Find LCM Of Two Numbers Using 8085 & verify.
ALGORITHM:
1. ORG Addr. Directive reserves the starting address for Program Code or data in
specified memory array,
2. LXI H (LOAD REGISTER PAIR IMMEDIATELY) loads 16 bit data in register pair
designated by operand.
3. INX H (INCREMENT REGISTER PAIR) increments the contents of the register pair
by one.
4. MOV A, M copies the data byte into accumulator from the memory specified by the
address in H-L pair.
5. SUB M (SUBTRACTION) subtracts the contents of register to accumulator.
6. MVI (MOVE IMMEDIATE DATA)moves immediate value to specified register.
7. CPI (COMPARE IMMEDIATE WITH ACCUMULATOR) compares the immediate
value to accumulator
If (A) < (Reg/Mem) ; carry flag is set and zero flag is reset.
If (A) = (Reg/Mem) ; carry flag is reset and zero flag is set.
If (A) > (Reg/Mem) ; both carry flag and zero flag are reset.
8. JZ Addr. instruction jump the execution to the specified Address if zero flag is set.
9. JNC Addr. instruction jump the execution to the specified Address if carry flag is reset.
10. ADD Reg (ADDITION) add register content to accumulator and result stored into
accumulator.
11. SUB Reg (SUBTRACT REGISTER) subtract register content by accumulator and
result stored into accumulator.
12. JMP (JUMP UNCONDITIONALLY) Jump execution to the specified address.
13. STA (Store Accumulator Direct) copy the content of accumulator to specified
address.
14. RST 1 (RESET) finishes the execution of the current instruction and stops any further
execution.
15. DB Directive is defined to store values in specified memory array.
Program:
# ORG 2000H
LXI H,F100 // HL ← F100
MOV A,M // A ← [HL]
MOV C,M // C← [HL]
MOV D,M // D ← [HL]
INX H // HL+1 → HL
up:SUB M // A-M → M
JNC up // Jump if A>M
ADD M // M+A → A
CPI 00 // Compare A with 00 H
JZ down // True if A=00 H
MOV A,D // D → A
ADD C // A+C → A
MOV D,A // A → D
JMP up // Unconditional Jump
down:MOV A,D // D →A
STA F200 // A →[F200]
RST 1 // Terminate
RESULT:
The Program to Find LCM Of Two Numbers was executed successfully.
AIM:
Write a Program to Add 'N' Two Digit BCD Numbers Using 8085 & Verify.
ALGORITHM:
1. ORG Addr. Directive reserves the starting address for Program Code or data in
specified memory array,
2. LXI H (LOAD REGISTER PAIR IMMEDIATELY) loads 16 bit data in
register pair designated by operand.
3. INX H (INCREMENT REGISTER PAIR) increments the contents of the
register pair by one.
4. MOV A, M copies the data byte into accumulator from the memory specified
by the address in H-L pair.
5. MVI (MOVE IMMEDIATE DATA)moves immediate value to specified
register.
6. DCR Reg (DECREMENT REGISTER) decrement register content by one.
7. DAA (Decimal Adjust Accumulator) instruction changes the content of
accumulator from a binary value to two 4-bit BCD digits.
8. JNZ Addr. instruction jump the execution to the specified Address if zero flag
is reset.
9. ADD M (ADDITION) addmemory address content specified in HL register to
accumulator and result stored into accumulator.
10. SUB Reg (SUBTRACT REGISTER) subtract register content by
accumulator and result stored into accumulator.
11. JMP (JUMP UNCONDITIONALLY) Jump execution to the specified
address.
12. STA (Store Accumulator Direct) copy the content of accumulator to specified
address.
13. RST 1 (RESET) finishes the execution of the current instruction and stops
any further execution.
14. DB Directive is defined to store values in specified memory array.
Program:
# ORG 2000H
LXI H,F100 // HL &8592; F100
MOV C,M // C &8592;[HL]
MVI D,00 // Clear reg.D
INX H // HL+1 &8594; HL
DCR C // C-1 &8594; C
MOV A,M // M &8594; A
up:INX H // HL+1 &8594; HL
ADD M // M+A &8594;A
DAA // Decimal Adjust After Addition
JNC down // Jump if no carry
INR D // D+1 &8594;D
down:DCR C // C-1 &8594;C
JNZ up // Jump if ZF=0
STA F200 // A &8592;[F200]
RST 1 // Terminate
RESULT:
The Program to Add 'N' Two Digit BCD Numbers was executed successfully.