The Programming Project: microprocessor
Showing posts with label microprocessor. Show all posts
Showing posts with label microprocessor. Show all posts

Saturday, May 25, 2013

One's Compliment

To find 1's compliment without complimenting the accumulator or using XOR in 8085 Assembly Language

LDA 0000H
MVI B,09H
LOOP: RAR
CMC
DCR B
JNZ LOOP
STA 0001H
HLT

Tuesday, April 30, 2013

Program to add 16 bit numbers in 8085


Two 16 bits number 2498H and 54A1H is to added the lower 8-bit sum stored at 0000H, higher 8-bit sum at 0001H and the carry at 0002H

LXI H,2498H
LXI D,54A1H
XRA A
MOV B,A
MOV A,E
ADD L
STA 0000H
MOV A,D
ADC H
JNC SKIP
INR B
SKIP: STA 0001H
MOV A,B
STA 0002H
HLT


Thursday, March 28, 2013

M#1


Two 8-bits numbers (say x,y) are stored in memory location 0000H and 0001H.This program finds the value of 2(x*y) and stores the result at 0002H and 0003H.
First we add x with itself y times to get x*y, the sum is stored in register D and carry in register E(if any). Then the byte is register D is added twice and if any carry is generated is stored in register C, finally the carry in register E is added twice withe itself and then with C to get the result
LXI H,0000H
MOV B,M
INX H
MOV C,M
XRA A
MOV D,A
MOV E,A
LOOP: ADD B
JNC SKIP
INR E
SKIP: DCR C
JNZ LOOP
MOV D,A
XRA A
MOV C,A
MVI B,02H
LOOP1: ADD D
JNC SKIP1
INR C
SKIP1: DCR B
JNZ LOOP1
STA 0002H
MVI B,02H
XRA A
LOOP2: ADD E
DCR B
JNZ LOOP2
ADD C
STA 0003H
HLT