I have new problem. I'm working with strings in assembly language and I want to ask: Is there any function in assembly language for "splitting" strings like Split in JavaScript, .NET and explode in PHP?
-
Do you want someone to write a function for you? Why don't you try first? There's no opcode to split strings if that's what you're thinkingJBernardo– JBernardo2011-07-25 18:15:48 +00:00Commented Jul 25, 2011 at 18:15
-
No I don't write it. My problem is that I don't know how to code it and here I'm asking how to code it.AlbatrosDocsCoder– AlbatrosDocsCoder2011-07-25 18:21:51 +00:00Commented Jul 25, 2011 at 18:21
Add a comment
|
1 Answer
Pure assembly? No. There is no such thing as a string on a cpu, just bytes. You'll have to either use a library like the c library, link it and use the usual c functions, or code it yourself in assembly.
4 Comments
AlbatrosDocsCoder
And can I make it like that i will go character by character and I will compare it with delimiter? than if character will be delimiter, next characters (without another delimiters) will be written to another db?
Femaref
I think you really need to think on a lower level than you are currently. What db? Assembly is moving bytes and adresses around, not characters or a even bigger, a database. The general concept is okay though. The function gets a pointer to an input array plus a single byte used as the delimiter and returns (by putting it into eax) a pointer to an output array.
AlbatrosDocsCoder
sorry, instruction. String db "splitted string here".
Necrolis
Assembly (atleast x86) has a concept of strings, as there are specific string manip opcodes, like stos & movs (which got abused as generic memory op), scas, lods etc (etfos.hr/~jbognar/pozadine/temp/asembly%20tutorial/x86asm/…), you are right about there being no splitting op though