0% found this document useful (0 votes)
93 views3 pages

8085 Programs

The document describes an ALP program that: 1) Reads data from memory locations D000H to D00AH and stores it in reverse order in locations D100H to D10AH. 2) Exchanges the contents of two blocks of memory, where the length of each block is stored in locations D000H and D100H respectively.

Uploaded by

riyazsalema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views3 pages

8085 Programs

The document describes an ALP program that: 1) Reads data from memory locations D000H to D00AH and stores it in reverse order in locations D100H to D10AH. 2) Exchanges the contents of two blocks of memory, where the length of each block is stored in locations D000H and D100H respectively.

Uploaded by

riyazsalema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Reverse Order

Aim: A block of data is stored in memory location D000H to D00AH write a


program in ALP to display the content of block in reverse order starting from
memory location D100H.
Program:
Memory Hex Label Instruction Comment
location Code
C000 21 LXI H, D00AH Set up H-L as pointer source
C001 0A
C002 D0
C003 21 LXI H,D100H Set up D-E as pointer to
C004 00 destination
C005 D1
C006 06 MVI B, 0AH Get data at destination
C007 0A
C008 7E LOOP: MOV A,M Get data by the memory
C009 12 STAX D Store data type at destination
C00A 2B DCR H Decrement source point
C00B 13 INX D Increment destination pointer
C00C 05 DCR B Decrement counter
C00D C2 JNZ LOOP If not Zero go back
C00E 08
C00F C0
C010 CF RST 1 Stop

Source Memory Data in Hex Destination Memory Data in Hex


location in Hex Before location in Hex After execution
execution
D000H 09 D101H
D001H 02 D102H
D002H 03 D103H
D003H 04 D104H
D004H 05 D105H
D005H 06 D106H
D006H 07 D107H
D007H 08 D108H
D008H 09 D109H
D009H 0A
Register Content:

A
B
C
D
E
F
I
H
L
SPH
SPL
PCH
PCL

Flags:

D7 D6 D5 D4 D3 D2 D1 D0
S Z --- AC --- P --- CY
0 1 0 1 0 1 0 0
Exchange of Data
Aim: A block of data is stored in the memory location from D001H. The
length of the block is stored in D000H. The second block length is stored from
D100H. Write ALP to exchange the contained of this two block.
Program:
Memory Hex Label Instruction Comment
location Code
C000 21 LXI H, D00AH Set up H-L as pointer source
C001 00
C002 D0
C003 21 LXI H,D100H Set up D-E as pointer to destination
C004 01
C005 D1
C006 46 MOV B,M Set up B to Count=D000H
C007 23 Next: INX H Pointer to next source location
C008 4E MOV C,M Get data from source memory
C009 1A LDAX D Load data from destination to ACC
C00A 77 MOV M,A Store [A] in first block
C00B 79 MOV A,C Copy [C] into [A]
C00C 12 STAX D Store [A] into second block
C00D 13 INX D Point to next destination
C00E 05 DCR B Decrement counter
C00F C2 JNZ Next Repeat loop unit counter 00
C010 07
C011 C0
C012 CF HLT Stop

Source Memory Data in Hex Destination Memory Data in Hex


location in Hex Before location in Hex After execution
execution
D000H 01 D100H
D001H 02 D101H
D002H 03 D102H
D003H 04 D103H
D004H 05 D104H
D005H 06 D105H
D006H 07 D106H
D007H 08 D107H
D008H 09 D108H
D009H 0A D109H

You might also like