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,973 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,819 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: 884 | Replies: 5
Reply
Join Date: Nov 2007
Posts: 5
Reputation: art vandelay is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
art vandelay art vandelay is offline Offline
Newbie Poster

Help Simple Assembly Question on Strings

  #1  
Nov 25th, 2007
Hey people.

I'm trying to build a loop to move from Arthur Vandelay to Tim Pennypacker, to Bob Sacamano. I know how to move from 54 to 21 to -2 and so on but I can't get the code right to move from Arthur Vandelay to Tim Pennypacker. I know it's something simple that I'm missing but the online documentation is scarce.

Emp1	db	'Arthur Vandelay',13,10,'$'
Num1	dw	54,21,-2,25
	db	'Tim Pennypacker',13,10,'$'
	dw	24,81,-14,22
	db	'Bob Sacamano',13,10,'$'
	dw	72,-9,-51,-22

Much appreciated.
Last edited by art vandelay : Nov 25th, 2007 at 11:39 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Posts: 5
Reputation: art vandelay is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
art vandelay art vandelay is offline Offline
Newbie Poster

Re: Simple Assembly Question on Strings

  #2  
Nov 26th, 2007
I'm now trying mov bx,Offset Emp1+17 (or whatever the size of the previous string is.)
Last edited by art vandelay : Nov 26th, 2007 at 12:23 am.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

Re: Simple Assembly Question on Strings

  #3  
Nov 26th, 2007
why don't you make it easy on yourself and give each one a name like you did Emp1 == use Emp2, Emp3, etc. Then I think you can create a jump table
table  dw Emp1, Emp2, Emp3 
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Feb 2005
Location: 55 26'N 118 46'W
Posts: 184
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 13
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: Simple Assembly Question on Strings

  #4  
Nov 26th, 2007
Based on your example and because you have variable length records SCASB is your best option

  1. mov edi, Emp1
  2. mov al, '$'
  3. xor ecx, ecx
  4. dec ecx
  5. repnz scasb

Now you are pointing to the numeric values and you just have to add 8 to edi to point to the next employee.

Although this does work, it is very problematic. Fixed record lengths or pointers via a table as Ancient Dragon has pointed out are the best way s to go.
Reply With Quote  
Join Date: Nov 2007
Posts: 5
Reputation: art vandelay is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
art vandelay art vandelay is offline Offline
Newbie Poster

Re: Simple Assembly Question on Strings

  #5  
Dec 3rd, 2007
I ended up storing the offsets for each employee, but I'm switching to your solution for obvious reasons.

Now I'm trying to sort the data by last name, first name. Any tips?

Thanks.
Last edited by art vandelay : Dec 3rd, 2007 at 1:00 am.
Reply With Quote  
Join Date: Feb 2005
Location: 55 26'N 118 46'W
Posts: 184
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 13
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: Simple Assembly Question on Strings

  #6  
Dec 3rd, 2007
Post your code please so we can see exactly what it is you have done
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:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC