Showing posts with label Microprocessor. Show all posts
Showing posts with label Microprocessor. Show all posts

Friday, 28 June 2013

8085 program for 8 bit binary division

Here, dividend is of 16 bits and divisor is of 8 bits. Dividend is stored in 8DC1 (LSB) and 8DC2 (MSB), divisor is stored in 8DC3, quotient is in 8DC4 and remainder is in 8DC5.

Mnemonics:

LHLD 8DC1H
LDA 8DC3H
MOV B, A
MVI C, 08

LOOP:
   DAD H
   MOV A, H
   SUB B
   JC AHEAD
   MOV H, A
   INR L

AHEAD:
   DCR C
   JNZ LOOP
   SHLD 8DC4H
   HLT

Observation Table:
Memory Address
Content
8DC1
04H
8DC2
01H
8DC3
03H
8DC4
56H
8DC5
02H


©Dixit Bhatta 2013

Tuesday, 25 June 2013

8085 program for multi-byte decimal addition

The counter is stored in 8E00H. The first set of numbers is stored from 8E01H onward, and the second set starts from 8F01H. The sum of numbers in corresponding positions is finally placed in the address of the first set of numbers.

Mnemonics:

LXI H, 8E00H
LXI D, 8F01H
MOV C, M
INX H

LOOP:
   LDAX D
   ADD M
   MOV M, A
   DCR C
   INX H
   INX D
   JNZ LOOP
   HLT

Observation table:
Memory Address
Content Before
Content After
8E00
03H
03H
8E01
12
23
8E02
10
25
8E03
09
20
8F01
11
11
8F02
15
15
8F03
11
11

©Dixit Bhatta 2013

Sunday, 28 April 2013

8085 program to convert 8-bit binary to BCD

LXI H, 8D02
MOV A, M
MVI C, D
MVI B, 0

HUN:
SUI 64H
JC TENS
INRC
JMP HUN

TENS:
ADI 64H

LOOP:
SUI 0AH
JC UNITS
INR B
JMP LOOP

UNITS:
ADI 0AH

INX H
MOV M,C
INX H
MOV M,B
INX H
MOV M,A
HLT

Observation:

Memory
Content
Input
8D02H
8D
Output
8D21H
01
8D22H
04
8D23H
01

©Dixit Bhatta 2013