flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
BoR0 09 Feb 2005, 13:34
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. |
|||
![]() |
|
decard 09 Feb 2005, 15:50
sizeof is declared by structure macros when you define a new structure:
Code: struct my_structure
field_1 dd ?
field_2 rb 128
ends after this definition you can use sizeof.my_structure to obtain number of bytes that structure occupies. |
|||
![]() |
|
Vasilev Vjacheslav 09 Feb 2005, 15:54
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 10 Feb 2005, 18:27
hmm vasilev v nice code :-s donno how to use not... :-s
|
|||
![]() |
|
BoR0 10 Feb 2005, 19:00
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 10 Feb 2005, 19:22
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 10 Feb 2005, 21:15
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-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.