January 3rd, 2006, 06:37 AM
Concenating Strings in Assembly
i got bored the other day, thought id go through some of the programs ive made and optimize them a bit .etc ive got to the the point where the only way to make the executable smaller or faster is to port my code to a lower level language, and considering i use C, assembly is a good option (and as far as i know the only one). ive literally "converted" almost all my code except 3 lines . in these 3 lines i concenate 3 strings to together. usually to find a function i would have a look through msdn for a function find out what .dll its stored in and then import it. However i cannot find one to concenate strings ive looked through user32.dll, kernel32.dll (duno why i looked there), advapi.dll and so on, i could make my own dll in C then import the strcat() into my asm application. but i want my application to be all assembly any help appreciated.
January 3rd, 2006, 01:52 PM
1. "Premature Optimization is the root of all evil" -- These are wise words indeed.
2. strcat() is a C function and is found in the standard C library (libc.lib or something like that). It is pretty trivially implemented in a few lines of C code. Here's one implementation.
3. Speaking of efficiency, strcat() is rather inefficient anyway, unless you really know how to use it. It is probably better to have a pointer to the end of the source string and append characters that way. See my point 1 about premature optimization.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
January 6th, 2006, 05:06 PM
assembly really shud have it own forum here. The only other forum i know is fasm's own and there all transfixed on OS construction to help me and my string problems . its a dieing language..... i wanna learn it b4 all learning resources go down with it.