flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
BoR0
I tried all, even googling.
I just cant sort it out. ![]() Please give me some example of how to use it and all the needed include files. |
|||
![]() |
|
gumletis
mov eax,string
call getsize ; Get size of eax and overwrite it to eax RET getsize: push esi mov esi,0 @@: inc esi cmp byte[eax+esi],0 jne @B mov eax,esi pop esi RET |
|||
![]() |
|
Vasilev Vjacheslav
or this:
Code: proc _strlen, string mov edi,[string] cld xor eax,eax or ecx,-1 repne scasb not ecx dec ecx xchg ecx,eax return endp eax - length of string |
|||
![]() |
|
gumletis
hmm vasilev v nice code :-s donno how to use not... :-s
|
|||
![]() |
|
BoR0
decard, you got it right! that is my point!
Sorry guys, I already know of the string length algo, that was not my point though. BTW, why does sizeof works for structures only? I tried Code: section '.code' code readable executable mov eax, sizeof.my_structure invoke ExitProcess, 0 section '.data' data readable writeable my_structure dd ? and it didn't assemble ![]() |
|||
![]() |
|
decard
sizeof is defined by struct macro (it is a macro, not a built-in keyword; built-in is named "struc"). That's why it isn't defined by "dd" directive. You have just to remember that it has 4 bytes
![]() ![]() |
|||
![]() |
|
BoR0
Well I personally think that it is a good idea to make SIZEOF work for all types of variables.. I mean, its an option that almost EVERY assembler supports it.
Thanks for all your help and kindness ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.