flat assembler
Message board for the users of flat assembler.
Index
> Windows > [Win32:VB6] Strings |
Author |
|
Nikolay Petrov 02 Dec 2004, 20:31
It's a easy
example: VB: Code: .... Dim Name As String first As String Name = "Blah Bla" first = Left(Name,4) .... returned - Blah Assemler Code: .... mov esi,Name mov edi,first cld;-> read symbols left -> right. if you write std (not cld) - exchange the directon, and symbols read right -> left mov ecx,4 repe movsb; -->returned in first - Blah ..... in data section Name db "Blah Bla",0 first rb 32 but sometimes, you must "safe" registers like this Asm str proc examples Code: proc str_len,string ;it's proc - like WinAPI proc lstrlenA push edi esi;safe registers xor eax,eax mov edi [string] mov ecx,-1 @@: inc ecx scasb jne @r mov eax,ecx pop esi edi;restore registers return endp ;returned lenght "string" in eax and ecx proc copy_strn,dest,source,len ;copied "len" symbols from "source" in "dest" push esi edi mov ecx,[len] mov esi,[source] mov edi [dest] rep movsb dec edi mov byte [edi],0 pop edi esi return endp In Windows you may use lstrcpy, lstrcat, lstrlen and other dll functions - look at SDK documentations; Or strcpy strlen... from msvcrt.dll JohnFound is created a good str proc library - look at fasm IDE project But i think that you must read more literature for basic assempler programe, if you wish. |
|||
02 Dec 2004, 20:31 |
|
cod3b453 02 Dec 2004, 21:35
I forgot about lstrlen & lstrcat! Thanks for the quick reply and source code Nickolay - it was very helpful!
|
|||
02 Dec 2004, 21:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.