8085 MICROPROCESSOR PROGRAMMING Rev. 1.0 Page #1 This ...

220 downloads 8483 Views 574KB Size Report
8085 MICROPROCESSOR PROGRAMMING. Rev. 1.0. Page #1. This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 ...
8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Page #1

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

BCD ADDITION

AIM

To write an assembly language program to add two BCD numbers

ASSEMBLY LANGUAGE PROGRAM C000 C001 C002 C003 C004 C005 C006 C007 C008 C009 C00A

LDA

C300

C00B C00C C00D C00E C00F C010 C011 C012 C013 C014 C015 C016

JNC C00F

MOV B A LDA C301 MVI C 00 ADD B DAA

INR C STA C302 MOV A C STA C303 HLT

3A 00 C3 47 3A 01 C3 0E 00 80 27 D2 0F C0 0C 32 02 C3 79 32 03 C3 76

; ; ; ; ; ; ; ; ; ; ;

Load the accumulator with addend Move the accumulator content to B register Load the accumulator with augend Move immediately 00H to C register

Add the B register content with accumulator The 8 bit number in the accumulator is adjusted to form two 4 bit BCD digit by Decimal adjust accumulator instruction ; Jump if no carry to C00FH ; ; ; Increment the C register content ; Store the accumulator content(sum) at C302H ; ; ; Move the C register content to accumulator ; Store the accumulator content(carry) at C303H ; ; ; Halt the execution

EXECUTION - 1 C300 C301 C302 C303

55 58 13 01

; ; ; ;

Addend(Input data) Augend(Input data) Sum(Output data) Carry(Output data)

Page #2

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

PROGRAM TRACE

FLAG WORD

EXECUTION - 2 C300 C301 C302 C303

25 56 81 00

; ; ; ;

Addend(Input data) Augend(Input data) Sum(Output data) Carry(Output data)

PROGRAM TRACE

FLAG WORD

Page #3

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

EXECUTION - 3 C300 C301 C302 C303

AB 23 34 01

; ; ; ;

Addend(Input data) Augend(Input data) Sum(Output data) Carry(Output data)

PROGRAM TRACE

FLAG WORD

EXECUTION – 4 C300 C301 C302 C303

FF FF 64 00

; ; ; ;

Addend(Input data) Augend(Input data) Sum(Output data) Carry(Output data)

PROGRAM TRACE

Page #4

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

FLAG WORD

EXECUTION - 5 C300 C301 C302 C303

DE 34 18 00

; ; ; ;

Addend(Input data) Augend(Input data) Sum(Output data) Carry(Output data)

PROGRAM TRACE

FLAG WORD

REFERENCE 1. Ramesh S.Gaonkar, “Microprocessor Architecture, Programming, and Applications”, Fourth Edition, Penram International Publishing (India), 2000. 2. S.Subathra, “Microprocessor Adhiparashakthi Engineering 2001

Laboratory”, Record College, Melmaruvathur,

work, March

3. S.Subathra, “Programming in 8085 Microprocessor and its applications – An Innovative Analysis”, Technical Report,

Page #5

8085 MICROPROCESSOR PROGRAMMING

Adhiparashakthi 2003

Engineering

Rev. 1.0

College,

Melmaruvathur,

March

4. Micro-85 EB, User Manual, Version – 3.0, CAT #M85 EB-002, VI Microsystems Pvt. Ltd., Chennai. 5. Micro85 simulation software, Infotech Solutions, Calcutta.

Page #6