Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

8086 program that will reverse the order in which bytes are stored in the memory

Status
Not open for further replies.

sachingupta

Newbie level 6
Newbie level 6
Joined
May 13, 2009
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,384
Hi
I am trying this program for a long time but i am unable to find a solution. Kindly suggest me some solution.

128 bytes are stored in memory in a contiguous fashion. Write a program to reverse the order in which they are stored in the memory.

Regards
Sachin
 

some 8086 programs

Hello,

Setup two pointers using 8 bit registers.
Initialize the first one to the last address of your list
Initialize the second pointer to the address following the last of your original list
Copy the content of the address pointed by first pointer to the address pointed by the second
Decrement first pointer and decrement second pointer.
Loop copy/increment/decrement steps 127 times.

If you understood what I have write, and you need the data in the original area, you must be able to modify the given algorithm to do it.

Homework to compensate what you have not do: Repeat exercise using just one memory address, and not a 128 byte area, as in the solution given.

Regards!
 

8086 simple program

Thanks for the algorithm.
But the source and the destination memory locations is the same. Also the restriction is that we cannot use jump instructions. In this case, your algorithm will not work as after every copy the pointers are to be decremented.
Regards
 

rep + 8086 + how to use

Its easy. Follow these steps
1. Initialze two pointers, one pointing to beginning of memory block, other point to the end.
2. Copy data pointed by both the pointers in two registers say A and B.
3. Swap A & B
4. Store A & B back
5. Increment pointer which is pointing to the beginning of memory block and decrement other pointing to the end of memory
6. Repeat 2 to 5 till you reach half way through (64 iterations for 128 bytes)

Use LOOPE / LOOPNE instructions since you are not allowed to use jump.
 
8086 programes

Thanks a lot.
But can I do this by using REP?
Can I have multiple instructions repeated using single REP?
 

8086 decrement

sachingupta said:
Thanks a lot.
But can I do this by using REP?
Can I have multiple instructions repeated using single REP?
I am not sure about this. Its been a long time I learned 8086. But whats the problem in using LOOP?
 

8086 swap program

the Idea of CMOs is est and simplest way for you...
 

sample programs using 8086 microprocessors

Can I have multiple instructions repeated using single REP?
No, it's an instruction prefix.
By the way, how do you program 8086 assembler without a reference that clearly answers this kind of simple questions? Do you goggle each single instruction?
 

8086 program reference

No actually my prof. is teaching the instruction set of 8086. He has finished only basic data transfer and string instructions till now. He then gave this problem and told us to use only the instructions he has taught till date. Hence it was not possible for me to use any kind of jump instructions. Hence I faced this much problem.:|
 

Re: 8086 program

now if your having troubles when you know what instructions can be used, how do think we can help when we don't know what instructions can be used???
 

8086 program

I sincerely apologize for not providing the complete information at once.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top