flat assembler
Message board for the users of flat assembler.
Index
> Windows > split function? |
Author |
|
pelaillo 26 Apr 2004, 04:43
This function expects:
esi points to a szString ecx length of szString [edit] Returns a number of splitted words in edx and pointers to each word in an array. Code: ; This program is demonstrative only (workless) ; It is intended to be used with a debugger ; as for example OllyDbg format PE GUI 4.0 section '.code' code readable executable Start: mov esi,TheString mov ecx,TheLength mov edi,TheWords call Tokenizer int3 Tokenizer: xor edx,edx .skipWhitespace: cmp byte [esi],' ' je .skip cmp byte [esi],09h je .skip cmp byte [esi],0Dh je .skip cmp byte [esi],0Ah jne .doneWhitespace .skip: inc esi loop .skipWhitespace .doneWhitespace: mov [edi+edx*4],esi inc edx .seek: lodsb or al,al je .end cmp al,' ' je .done cmp al,09h je .done cmp al,0Ah je .done cmp al,0Dh je .done cmp al,ah je .done loop .seek jmp .end .done: mov byte [esi-1],0 loop .skipWhitespace .end: ret section '.data' data readable writeable TheWords rd 100h ; Space reserved for 256 words TheString db 'This is our string, the string we are going to use',0 TheLength = $ - TheString [/edit] Last edited by pelaillo on 26 Apr 2004, 13:32; edited 1 time in total |
|||
26 Apr 2004, 04:43 |
|
Dr.X 26 Apr 2004, 12:21
I will have to study more. I think this one is too complex. I'm still a beginer. Perhaps I was asking if I can run before I can walk.
Thanks Pelaillo. Dr.X |
|||
26 Apr 2004, 12:21 |
|
pelaillo 26 Apr 2004, 13:42
Dr X,
Please let me show it is not as complex as it seems at first sight. I've changed my previous post in order to have a demonstrative view over it. - Compile it with fasm - Download (if you have not downloaded yet) OllyDbg from http://home.t-online.de/home/Ollydbg/ - Open the exe with OllyDbg and press F5 to show the processor screen. Then press F7 for a step debugging and look what happens on each step. You will be changing this function to fit your own needs very soon |
|||
26 Apr 2004, 13:42 |
|
Dr.X 26 Apr 2004, 15:05
Ok Pelaillo. I will try this when I get home (i'm at work right now)
When I said that it was complex, I only meant for me. I'm sure it is a good solution. I just have to study more. I'm new to asm (not just new to fasm but to the whole assembler thing in general). I'm still studying Vid's tutorials and reading Intro to Assembler by Draeden/VLA. I will still try your suggestion. Thank you for the help. Dr.X |
|||
26 Apr 2004, 15:05 |
|
JohnFound 26 Apr 2004, 18:04
Dr.X wrote: When I said that it was complex, I only meant for me. Well, you will learn assembler more easy if you try not to think this way. That was that pelaillo wanted to say. Assembler is actually more easy than it looks at first sight. Regards. |
|||
26 Apr 2004, 18:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.