The Programming Project: opcode
Showing posts with label opcode. Show all posts
Showing posts with label opcode. 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

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