| | |
Simple Assembly Question on Strings
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2007
Posts: 5
Reputation:
Solved Threads: 0
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.
Much appreciated.
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.
Assembly Syntax (Toggle Plain Text)
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.
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
Assembly Syntax (Toggle Plain Text)
table dw Emp1, Emp2, Emp3
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Based on your example and because you have variable length records SCASB is your best option
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.
asm Syntax (Toggle Plain Text)
mov edi, Emp1 mov al, '$' xor ecx, ecx dec ecx 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.
![]() |
Similar Threads
- assembly simple games(Nasm) (Assembly)
- Simple array question (C++)
- Simple algorithm question/needed (Java)
- Need help with basic assembly calculator (Assembly)
- Simple Class Question (C++)
- simple msn question (Windows Software)
- C++ handling of strings in a boolean expression (C++)
- Simple (I think) Code Question (PHP)
Other Threads in the Assembly Forum
- Previous Thread: Two dimensional Arrays in MIPS
- Next Thread: Sparc Assembly Help!
| Thread Tools | Search this Thread |






