flat assembler
Message board for the users of flat assembler.
Index
> Main > proc macro problem |
Author |
|
IronFelix 19 Jan 2005, 13:50
Snifit, let me tell what i know about it. It is not a good idea to put 1 byte to stack because it becomes unaligned.
About your words "This does not work either because (my guess) the proc macro doesn't know that it should pop a byte...". Proc macro doesn't do any pop. You can try this: myownproc: byteparam equ ebp+8 push ebp mov ebp,esp mov al,[byteparam] ; read passed parameter ; ... mov esp,ebp pop ebp retn 1 When you can call it in this way: xor eax,eax or al,[byteparam] stdcall myownproc,eax Stdcall is invoke analog, but it make 'call myownproc'. Regards. |
|||
19 Jan 2005, 13:50 |
|
IronFelix 19 Jan 2005, 14:12
Sorry, small mistake: i used 'retn 1' to return from function and had to pass only one byte ('push byte byteparam' instead of using eax)! For my stdcall example at the end of the function must be 'retn 4'.
_________________ Flat Assembler is the best! |
|||
19 Jan 2005, 14:12 |
|
JohnFound 19 Jan 2005, 14:15
AFAIK, you never can push one byte using the instruction "push". You can push word or dword only. The only way to push only one byte is to store it in the stack with "mov" instruction and to decrement esp by 1.
|
|||
19 Jan 2005, 14:15 |
|
snifit 19 Jan 2005, 14:37
Big thanks guys!
I didn't realize it was such a problem with a single byte at the stack, and if I knew I'd used word or dword instead Anyways, I fixed it by using a dword value instead and by using the stdcall macro. Thanks again. |
|||
19 Jan 2005, 14:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.