954,479 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help needed

Please help me to write the following program in 8085 assembly language. Only guidelines required.
5 numbers are stored at consecutive memory location. Arrange them in ascending order and store them in another location.

nehasfun
Newbie Poster
3 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

Wow. I learnt the 8085 assembly language a long time ago while I was still in school. Unfortunately, I don't remember much :(

alpha2006
Junior Poster
116 posts since Apr 2006
Reputation Points: 10
Solved Threads: 5
 

>Unfortunately, I don't remember much
While interesting (well, not really), your post has no meaningful content relevant to this thread. If you're incapable of helping, there's no point in posting to inform everyone of it.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Ya, well said. The reply isn't appropriate in any sense.

nehasfun
Newbie Poster
3 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

So it doesn't seem as if I'm just posting to complain, how have you tried to solve the problem so far? If there are always five numbers, you can brute force it without too much code, or you can write a more general sorting solution. Because you're moving the data to a different memory location, you would probably be best off using an insertion sort.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

I have given a lot of thought to the problem. Actually the problem is arranging the numbers in ascending order. You see I can easily find the largest of the numbers by using loops or something sort of that.
I have an idea to solve this one too but the code is becoming too large. Another problem Iam facing is that the program has to be coded in 8085 Assembly Language. The program is easy to be made in other languages but not in 8085.

nehasfun
Newbie Poster
3 posts since May 2006
Reputation Points: 10
Solved Threads: 0
 

>The program is easy to be made in other languages but not in 8085.
How so? 8085 supports the necessary instructions to write a sorting algorithm.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

Thatz it !!!!! Sorting 6 numbers in memory starting from 0060H hex address (Selection sort algo) -------------------------
LXI H, 0060H
MVI B, 05H
LOOP1: MOV C, B
MOV D, H
MOV E, L
INR E
LOOP2: LDAX D
CMP M
JNC NO_SWP
SWAP: MOV D, M
MOV M, A
MOV A, D
MOV D, H
STAX D
NO_SWP: INR E
DCR C
JNZ LOOP2
INX H
DCR B
JNZ LOOP1
HLT

mahul000
Newbie Poster
8 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 
lxi h, 0060h
mvi b, 05h
loop1: Mov c, b
mov d, h
mov e, l
inr e
loop2: Ldax d
cmp m
jnc no_swp
swap: Mov d, m
mov m, a
mov a, d
mov d, h
stax d
no_swp: Inr e
dcr c
jnz loop2
inx h
dcr b
jnz loop1
hlt
mahul000
Newbie Poster
8 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You