Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 24

LABORATORY RECORD NOTE BOOK

Submitted in partial fulfilment of requirement of


Bachelor of Technology in Computer Science & Engineering (B. Tech CSE)

B. Tech CSE (Semester - V)


Batch 2019 – 2023
AMITY UNIVERSITY CHHATTISGARH

AMITY UNIVERSITY CHHATTISGARH


BATCH 2018-2022

Enrolment Number: A80105219015

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.

University Exam Held on __________________

Faculty In-Charge Director (ASET)

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:

Write a Program Using 8085 & verify for :


a.Addition of Two 8-Bit Numbers.
b.Addition of Two 16-Bit Numbers.(With Carry).

a.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 C, 00 Initialize C register to 00


LDA 4150 Load the value to Accumulator.
MOV B, A Move the content of Accumulator to B
register.
LDA 4151 Load the value to Accumulator.
ADD B Add the value of register B to A
JNC LOOP Jump on no carry.
INR C Increment value of register C
LOOP: STA 4152 Store the value of Accumulator (SUM).
MOV A, C Move content of register C to Acc.
STA 4153 Store the value of Accumulator (CARRY)
HLT Halt the 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 –

Load the lower part of first number in B register


Load the lower part of second number in A (accumulator)
Add both the numbers and store
Load the higher part of first number in B register
Load the higher part of second number in A (accumulator)
Add both the numbers with carry from the lower bytes (if any) and store at the next
location

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:

The program to add two 16-bit numbers was executed.


AIM :
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)

a.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. Subtract the two register contents.
5. Check for carry.
6. If carry is present take 2’s complement of Accumulator.
7. Store the value of borrow in memory location.
8. Store the difference value (present in Accumulator) to a memory
9. location and terminate the program.

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:

Thus, the program to subtract two 8-bit numbers was executed.

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

2000 LHLD 2050 Load H-L pair with address 2050

EXCHANGE H-L PAIR WITH D-E


2003 XCHG PAIR

2004 LHLD 2052 Load H-L pair with address 2052

2007 MVI C, 00 C<-00H

2009 MOV A, E A<-E

200A SUB L A<-A-L

200B STA 2054 2054<-A


MEMORY
ADDRESS MNEMONICS COMMENTS

200E MOV A, D A<-D

200F SBB H SUBTRACT WITH BORROW

2010 STA 2055 2055<-A

2013 HLT TERMINATES THE PROGRAM

OBSERVATION:

INPUT:
(2050H) = 19H
(2051H) = 6AH
(2052H) = 15H
(2053H) = 5CH

OUTPUT:
(2054H) = 04H
(2055H) = OEH

RESULT:

Thus, the program to subtract two 16-bit numbers was executed.


AIM:
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

a.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) Add the two register contents.
5) Check for carry.
6) Increment the value of carry.
7) Check whether repeated addition is over and store the value of product and
carry in memory location.
8) Terminate the program.

PROGRAM:

MVI D, 00 Initialize register D to 00


MVI A, 00 Initialize Accumulator content to 00
LXI H, 4150
MOV B, M Get the first number in B - reg
INX H
MOV C, M Get the second number in C- reg.
LOOP: ADD B Add content of A - reg to register
B.
JNC NEXT Jump on no carry to NEXT.
INR D Increment content of register D
NEXT: DCR C Decrement content of register C.
JNZ LOOP Jump on no zero to address
STA 4152 Store the result in Memory
MOV A, D
STA 4153 Store the MSB of result in Memory
HLT Terminate the program.

OBSERVATION:

Input: FF (4150)
FF (4151)
Output: 01 (4152)
FE (4153)

RESULT:

Thus the program to multiply two 8-bit numbers was executed.

b.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, 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:

Thus the program to divide two 8-bit numbers was executed.


AIM:
Write a Program Using 8085 for Finding Square-Root of a Number & Verify.

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 –

MEMORY ADDRESS MNEMONICS COMMENT

2000 MVI D, 01 D <- 01

2002 MVI E, 01 E <- 01

2004 LDA 2050 A <- M[2050]

2007 SUB D A <- A – D

2008 JZ 2011 Jump if ZF = 0 to memory location 2011

200B INR D D <- D + 1

200C INR D D <- D + 1

200D INR E E <- E + 1

200E JMP 2007 Jump to memory location 2007

2011 MOV A, E A <- E

2012 STA 3050 A -> M[3050]


2015 HLT END

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 –

Memory Mnemonics Operands Comment


2000 MVI C, 05 [C] <- 05
2002 LXI H, 2500 [H-L] <- 2500
2005 LXI D, 2600 [D-E] <- 2600
2008 MOV A, M [A] <- [[H-L]]
2009 STAX D [A] -> [[D-E]]
200A INX H [H-L] <- [H-L] + 1
200B INX D [D-E] <- [D-E] + 1
200C DCR C [C] <- [C] – 1
200D JNZ 2008 Jump if not zero to 2008
2010 HLT Stop

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:

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,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:

Input 4200 05 (Array


: Size)
4201 05
4202 04
4203 03
4204 02
4205 01

Output: 4200 05(Array


Size)
4201 01
4202 02
4203 03
4204 04
4205 05

RESULT:

The program to Arrange Number in Ascending Order was successfully


executed.
AIM:
Write a Program to Check Number of 1's and 0's in Given Number Using 8085 &
Verify.

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

Input: A-FO H, C-00 H, D-00 H


Output: C-04 H, D-04 H

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

Input: A-09 H, B-07 H


Output: A- 01 H, F200-01 H

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

# ORG F100H       // Store inputs at the address


# DB 05H ,03 H       // Store two bytes in successive location

Input: F100-05 H, F101-03 H


Output: A- 0F H, F200- 0F H

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

# ORG F100H        // Store inputs at the address


# DB 04,43,77,55,55       // Store bytes in successive locations

Input: F100-04 H, F101-43 H, F102- 77 H, F103- 55 H, F104- 55 H


Output: D-02 H, A-30 H

RESULT:

The Program to Add 'N' Two Digit BCD Numbers was executed successfully.

You might also like