Académique Documents
Professionnel Documents
Culture Documents
Aim: Write a program to add two 8-bit hex numbers which are stored at memory locations
2500H and 2501H and store the answer at 2502H. Store 00 if no carry and 01 otherwise at
memory location 2053.
Flow Chart:
Start
A
Load H-L pair with address
Of first operands memory
No If
Increment H-L pair to point CarrY
To next memory location.
Yes
Stop
A
Program:
With carry:
Input:
Address Value
2500 BC 1st
2501 DE 2nd
Output:
Output Value
2502 9A Result
2503 01 Carry
Without Carry
Input:
Address Value
2500 01 1st value
2501 02 2nd value
Output:
Address Value
2503 03 Result
2504 00 carry
Result: We are able to add two 8-bit hex numbers using 8085 microprocessor using the
ADD operation and we also are able to store carry using JNC.
Experiment No.:2(b)
Aim : Write a program to add two 16-bit hex numbers which are stored at memory
locations 2500 and 2502 and store the result at 2504.Store 00 if carry otherwise 01 at memory
location 2506.
Flowchart:
Start
Initialize register B with 00H
Increment register B
A
Store the carry at location
2506H
Stop
Program:
With Carry:
Input:
Address Value
2050 FF 1st
2051 FF
2052 FF 2nd
2053 FF
Output:
Address Value
2054 FE Result
2055 FF
2056 01 Carry
Without carry:
Input:
Address Value
2500 22 1st
2501 11
2502 44 2nd
2503 33
Output:
Address Value
2503 66 Result
2504 44
2505 00 Carry
Result: We are able to add two 16-bit hex numbers using 8085 microprocessor directly by
using pair of registers at a time and also store the carry if generated.
Aim: Write a program to subtract two 8-bit hex numbers which are stored at memory
locations 2500 and 2501 and store the answer at 2502. Store 00 if no borrow and 01
otherwise at memory location 2503.
Flowchart:
Start A
Program:
With Borrow:
Input:
Address Value
2500 01H 1st
2501 02H 2nd
Output:
Output Value
2502 EEH Result
2503 01H Borrow
Without Borrow:
Input:
Address Value
2501 03 1st
2502 01 2nd
Output:
Address Value
2503 02 Result
2504 00 Borrow
Result : We are able to subtract two 8-bit hex numbers using 8085 microprocessor using the
SUB operation and we also are able to store borrow using JNC.
Aim: Write a program to subtract two 16-bit hex numbers which are stored at memory
locations 2500 and 2502 and store the answer at 2504. Store 00 if no borrow and 01
otherwise at memory location 2506.
Start
A
Load H-L pair with data Subtract the higher order of second
from 2500H number from higher order of first
number with borrow from previous
subtraction
Exchange H-L pair
With D-E pair
Move the result from
Accumulator to Register H
No If
Borrow?
Move the lower side from
register E to Accumulator
Yes
Increment register B
Subtract the lower order of
second number from lower
order of first number
Store the result from H-L pair
to memory
Stop
Program:
Memory Location Mnemonics Operand
2000 LHLD 2500
2003 XCHG
2004 LHLD 2502
2007 MOV A,E
2008 SUB L
2009 MOV L,A
200A MOV A,D
200B SBB H
200C MOV H,A
200D MVI B,00
200F JNC 2013
2012 INR B
2013 SHLD 2504
2016 MOV A,B
2017 STA 2506
201A RST 5
Without Borrow
Input:
Address Value
2050 08H 1st
2051 02H
2052 03H 2nd
2053 00H
Output:
Address Value
2054 05H Result
2055 02H
2056 00H Borrow
With Borrow
Input:
Address Value
2050 03 H 1st
2051 01H
2052 05 H 2nd
2053 02 H
Output:
Address Value
2054 FDH Result
2055 FEH
2056 01H Borrow
Result :We are able to subtract two 16-bit hex numbers using 8085 microprocessor directly
by using pair of registers at a time and also store the borrow if generated.