User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 455,976 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,797 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 823 | Replies: 4
Reply
Join Date: Nov 2007
Posts: 3
Reputation: boosh is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boosh boosh is offline Offline
Newbie Poster

arrays

  #1  
Nov 28th, 2007
Hi,
I have an array of two string elements. Is it possible to store these two elements as one element in a register?

Thanks.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: arrays

  #2  
Nov 28th, 2007
Sure, if you have enough room. For example, you can store two 8-bit values in a single 16-bit register. (By "string elements" do you mean "characters"?)

A better question, though, is why do you want to do this? It doesn't sound safe.
Reply With Quote  
Join Date: Nov 2007
Posts: 3
Reputation: boosh is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boosh boosh is offline Offline
Newbie Poster

Re: arrays

  #3  
Nov 28th, 2007
Originally Posted by Duoas View Post
Sure, if you have enough room. For example, you can store two 8-bit values in a single 16-bit register. (By "string elements" do you mean "characters"?)

A better question, though, is why do you want to do this? It doesn't sound safe.



Thanks for your reply. I am concatenating strings, I have only being using mips these past few days so maybe it is not the best way of going about it.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: arrays

  #4  
Nov 28th, 2007
A string is way too large to hold in a single register.

Remember, a register holds the address of a string somewhere else in memory. So to concatenate two strings you need two addresses. Find the end of the target string (by modifying the address to point to the end), then copy the characters from the source addresses to the target addresses.

Hope this helps.
Reply With Quote  
Join Date: Nov 2007
Posts: 3
Reputation: boosh is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
boosh boosh is offline Offline
Newbie Poster

Re: arrays

  #5  
Nov 28th, 2007
Originally Posted by Duoas View Post
A string is way too large to hold in a single register.

Remember, a register holds the address of a string somewhere else in memory. So to concatenate two strings you need two addresses. Find the end of the target string (by modifying the address to point to the end), then copy the characters from the source addresses to the target addresses.

Hope this helps.


Thanks for your help, I'll give it a go!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Assembly Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Assembly Forum

All times are GMT -4. The time now is 9:20 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC