0% found this document useful (0 votes)
41 views

Programming in 8085

The document describes 4 programs for performing 8-bit arithmetic operations on the 8085 microprocessor: addition, subtraction, multiplication, and division. The addition program loads operands from memory addresses 4000H and 4001H, adds them, and stores the result at 4002H. The subtraction program performs the same functions with subtraction instead of addition. The multiplication program loads the first number at 2200H, initializes a counter, and repeatedly adds the first number to a result register until the counter reaches 0. The division program initializes the quotient to 0, loads the dividend and divisor, repeatedly shifts the dividend left and increments the quotient if the divisor is smaller, and stores the final quotient and remainder.

Uploaded by

Rushabh Modi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Programming in 8085

The document describes 4 programs for performing 8-bit arithmetic operations on the 8085 microprocessor: addition, subtraction, multiplication, and division. The addition program loads operands from memory addresses 4000H and 4001H, adds them, and stores the result at 4002H. The subtraction program performs the same functions with subtraction instead of addition. The multiplication program loads the first number at 2200H, initializes a counter, and repeatedly adds the first number to a result register until the counter reaches 0. The division program initializes the quotient to 0, loads the dividend and divisor, repeatedly shifts the dividend left and increments the quotient if the divisor is smaller, and stores the final quotient and remainder.

Uploaded by

Rushabh Modi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

programming in 8085

8 Bit Addition:

LXI H 4000H : HL points 4000H


MOV A, M : Get first operand
INX H : HL points 4001H
ADD M : Add second operand
INX H : HL points 4002H
MOV M, A : Store result at 4002H
HLT : Terminate program execution

Flowchart

8 Bit Subtraction:
Source program:
LXI H, 4000H : HL points 4000H
MOV A, M : Get first operand
INX H : HL points 4001H
SUB M : Subtract second operand
INX H : HL points 4002H
MOV M, A : Store result at 4002H.
HLT : Terminate program execution

Flowchart

8Bit Multiplication

Source program :
LDA 2200H
MOV E, A
MVI D, 00 : Get the first number in DE
register pair
LDA 2201H
MOV C, A : Initialize counter
LX I H, 0000 H : Result = 0
BACK: DAD D : Result = result + first
number
DCR C : Decrement count
JNZ BACK : If count 0 repeat
SHLD 2300H : Store result
HLT : Terminate program execution

8 BIT DIVISION
MVI E, 00
LHLD

: Quotient = 0
2200H
: Get dividend

Flowchart for program

LDA 2300
MOV B, A
MVI C, 08
NEXT: DAD H
MOV A, E
RLC
MOV E, A
MOV A, H
SUB B
JC SKIP
MOV H, A
INR E
SKIP:DCR C
JNZ NEXT
MOV A, E
STA 2401H
Mov A, H
STA 2410H
HLT

: Get divisor
: Store
divisor
: Count = 8
: Dividend = Dividend x 2

: Quotient = Quotient x 2
: Is most significant byte of Dividend > divisor
: No, go to Next step
: Yes, subtract divisor
: and Quotient = Quotient + 1
: Count = Count - 1
: Is count =0 repeat
: Store Quotient
: Store remainder
: End of program.

Source : http://nprcet.org/e%20content/Misc/e-Learning/IT/IV%20Sem/CS%202252-Microprocessors%20and%
20Microcontrollers.pdf

You might also like