8085 Microprocessor ALP Programs (PR 3 and 4)
8085 Microprocessor ALP Programs (PR 3 and 4)
Solution:
AIM: To write a program that subtract two 8- bit numbers.
Requirements: i) 8085 Microprocessor kit / 8085 Simulator
ii) (0 –5v) DC Battery
Algorithm:
Step1: Start the microprocessor.
Step2: Load the first 8-bit data into accumulator.
Step3: Load the second 8-bit data into register B
Step4: Subtract the two 8-bit data.
Step5: Store the result from accumulator to the specified memory location.
Step6: Stop the program execution.
Flow Chart:
STRAT
Subtract B from A
END
Main Program:
MVI A, 04
MVI B, 03
SUB B
STA 8050
HLT
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
Flow-Chart
STRAT
Subtract B from A
Check
for carry
No
Yes
Increment carry by 1
STORE the result from
accumulator to memory location
END
Main Program:
MVI C,00
LDA 8050
MOV B,A
LDA 8051
SUB B
JNC LOOP
CMA
INR A
INR C
LOOP: STA 8052
MOV A,C
STA 8053
HLT
Result after Assembling:
Address OP Code
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
800A
800B
800C
800D
800E
800F
8010
8011
8012
8013
8014
8015
8016
8017
8050
8051
8052
8053