8085 Assembly Language Programs

MVI A, 32H
STA 8040H
MVI A, 10H
STA 8041H
MVI A, 45H
STA 8042H
MVI A, C3H
STA 8043H
MVI A, A4H
STA 8044H

MVI C, 05H       : Initialize Counter
MVI A, 00H   
STA 8050H       : Store 00H in 8050H

LDA 8040H       : Load the contents of 8040H to Accumulator
LXI H, 8040H    : Store 8040H in H-L Register Pair

LOOP:
CPI 55H           : Compare the contents of Accumulator with 55H
INX H              : Increase Memory
MOV A, M        : Copy the contents of Memory to Accumulator
JZ LOOP1        : If Zero Flag is 1, Jump to Loop1
DCR C             : Decrease Counter
JNZ LOOP        : If Zero Flag is 0, Jump to Loop
HLT                : Halt the Program

LOOP1:
MVI A, FFH      : Sotre FFH into Accumulator
STA 8050H      : Copy the contents of Accuulator to 8050H
HLT                 : Halt the Program

Program to EX-OR two 1 byte numbers stored in 8000h & 8001h and store result in 8002h (without using EX-OR instruction)

Posted by Psycho Programer On Saturday, December 18, 2010 0 comments

MVI A, C3H
STA 8000H
MVI A, 5AH
STA 8001H
LDA 8000H
CMA
MOV B, A
LDA 8001H
CMA
MOV C, A
LDA 8000H
ANA C
MOV C, A
LDA 8001H
ANA B
MOV B, A
MOV A, C
ORA B
STA 8002H
HLT

Program to genereate Fibonacci Sequence

Posted by Psycho Programer On 18 comments

MVI A, 00H
STA 8000H
MVI A, 01H
STA 8001H
MVI B, 08H
LXI H, 8000H
BACK:
MOV A, M
INX H
ADD M
INX H
MOV M, A
DCR B
DCX H
JNZ BACK
HLT

Program to reverse the order of the bit in a 16 bit number.

Posted by Psycho Programer On 0 comments

LXI B, 4F3CH
MOV A, B
RRC
RRC
RRC
RRC
MOV B, A
MOV A, C
RRC
RRC
RRC
RRC
MOV C, A
MOV D, B
MOV B, C
MOV C, D
HLT

Program to find the factorial of a number

Posted by Psycho Programer On 15 comments


MVI B, 03H
MOV C, B
DCR C
LOOP1:
MOV E, C
SUB A
LOOP2:
ADD B
DCR E
JNZ LOOP2
MOV B, A
DCR C
JNZ LOOP1
STA 8000H
HLT

Program to multiply 2 Number (4 * 2)

Posted by Psycho Programer On 0 comments

MVI A, 04H
STA 8000H
MVI A, 02H
STA 8001H
LDA 8000H
MOV C, A
LDA 8001H
MOV D, A
SUB A
LOOP:
ADD C
DCR D
JNZ LOOP
STA 8002H
HLT

Program to add numbers from 1 to 10

Posted by Psycho Programer On 3 comments

MVI A, AH
MOV C, A
SUB A
MVI D, 01H
LOOP:
ADD D
INR D
DCR C
JNZ LOOP
STA 8000H
HLT