EX.
NO: 8-BIT SUBTRACTION USING 8085
DATE:
AIM:
To write an assembly language program for subtracting two eight bit numbers using 8085
processor.
APPARATUS REQUIRED:
8085 Microprocessor kit,
Power supply
ALGORITHM:
Get data in Accumulator at specified memory location
Store the data in B register
Get next data in Accumulator register
6.Add the contents of A register with B register
Store the result
Terminate the program
FLOW CHART:
Start
Get first data
in B reg
Get second data
in A reg
Subtract the
values
Store result
Stop
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
4100 3A START: LDA, 4150H Load the contents of
4150H to HL register
4101 50
4102 41
4103 47 MOV B,A Transfer the data from
accumulator to B register
4104 3A LDA 4151 Load the contents of
4151H to the accumlator
4105 51
4106 41
4107 90 SUB B Subtract the contents of R
from the accumulator.
4108 32 STA 4152 Store the contents of
accumulator in 4152H
4109 52
410A 41
410B 76 STOP: HLT Terminate the program
MANUAL CALCULATION:
(A) : 70H = 0111 0000
(B) : 20H = 0010 0000 (-)
(A) : 50H = 0101 0000
ADDRESS DATA
Input:
4150H 70H
4151H 20H
Output:
4152H 50H
RESULT:
Subtraction of two 8-bit numbers using 8085 is performed and the output is verified.