6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 15, 2024 6:51 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Reverse order string
PostPosted: Sun Apr 03, 2005 3:16 pm 
Offline

Joined: Sun Apr 03, 2005 2:37 pm
Posts: 1
I'm trying to output a string in reverse order.
Example: The Philadelphia Eagles lost again.

again.
lost
Eagles
Philadelphia
The

Any help would be greatly appreciated.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 03, 2005 10:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8541
Location: Southern California
You won't get much of an answer without providing more details about what you're working on, but I'll give it a try.

It would not be so unusual to feed the display in backwards fashion, right-to-left, such that the order of the characters fed to it would be:

.-n-i-a-g-a-<space>-t-s-o-l-<space>-s-e-l-g-a-E-<space>-a-i-h-p-l-e-d-a-l-i-h-P-<space>-e-h-T

It will normally go much to fast for the eye to see that the display got filled from right to left, and the sentence will still appear in the normal forward order. However, I can't think of any usefulness in doing:

again. lost Eagles Philadelphia The

But if that's really what you wanted, just scan the string for a space, starting from the end and stopping when you get to the first space, then output the word following it. Then truncate the sting (by reducing the value of the length byte) to get rid of the word just sent out, and repeat the process until the string length is 0.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 06, 2005 6:35 am 
Offline

Joined: Sun Sep 15, 2002 10:42 pm
Posts: 214
This sounds suspiciously like a homework assignment.

Don't do this guy's homework for him :)

Toshi


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: