flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 03 May 2005, 15:07
1) You forgot to return from your procedure, it should be done with the "return" macro.
2) When you restore registers from stack, you have to pop them in the reverse order, since you first get the register that is on the top of the stack and this is the last one you pushed there. So the correct procedure should look like: Code: proc Aff_Element, numElement push ebx esi edi mov edi,[numElement] shl edi,2 invoke MessageBox,0,[_pointer2array+edi],_caption,0 pop edi esi ebx return endp BTW, because of your problem I have realized it would be not bad thing to make "endp" macro generate return code on the end of procedure automatically when you forget to do it. I will think about it. |
|||
![]() |
|
flaith 03 May 2005, 15:55
thank you SO much
![]() |
|||
![]() |
|
Reverend 03 May 2005, 20:28
Quote:
Actually it could be done like this: Code: mov edi,[numElement] invoke MessageBox,0,[_pointer2array+edi*4],_caption,0 If you multiply by 2,4,8,16,... you can do like this |
|||
![]() |
|
flaith 03 May 2005, 21:12
thank you
![]() |
|||
![]() |
|
mike.dld 04 May 2005, 22:06
Reverend wrote: If you multiply by 2,4,8,16,... you can do like this ![]() Code: [eax*1] = [eax] [eax*2] = [eax*2] = [eax+eax] [eax*3] = [eax*2+eax] [eax*4] = [eax*4] [eax*5] = [eax*4+eax] [eax*8] = [eax*8] [eax*9] = [eax*8+eax] |
|||
![]() |
|
madmatt 05 May 2005, 07:23
shouldn't you have an "enter" before the "proc" because of the parameter? Also someone made the "return" macro except a return-value, I can post the new macro if you like.
madmatt |
|||
![]() |
|
mike.dld 05 May 2005, 07:53
ENTER as macro should be used only if you have some local variables, otherwise it doesn't generate any code.
|
|||
![]() |
|
Reverend 05 May 2005, 20:20
mike.dld wrote:
![]() |
|||
![]() |
|
madmatt 05 May 2005, 20:58
mike.dld: Didn't know you could do that. Tried it in a simple test and it seemed to work.
MadMatt |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.