flat assembler
Message board for the users of flat assembler.
Index
> Main > invoking functions |
Author |
|
LocoDelAssembly 30 Jun 2007, 14:24
cinvoke is to call a procedure throught a pointer. Since you provided a label which holds directly the offset you must use ccall instead.
|
|||
30 Jun 2007, 14:24 |
|
realcr 30 Jun 2007, 15:31
Thanks for your help Loco , it works now when I use ccall.
However I still don't understand what you said about function pointer.. How should I construct a function that can be called using invoke? realcr. |
|||
30 Jun 2007, 15:31 |
|
LocoDelAssembly 30 Jun 2007, 15:49
I took the liberty of rewriting your procedure, I hope I didn't make any mistake.
Code: include 'win32axp.inc' .code start: cinvoke p_get_bits, 3453445d, 7, 20 int3 ; Trap for debugging p_get_bits dd get_bits ; Pointer to get_bits proc get_bits: ; a <= b condition isn't checked so be careful label .x at esp+4 label .a at esp+8 label .b at esp+12 ; Calculate mask to start from a or eax, -1 mov cl, byte [.a] shl eax, cl ; Calculate mask to finish on b or edx, -1 mov cl, 31 sub cl, byte [.b] shr edx, cl ; Combine masks and edx, eax ; Return bits mov eax, [.x] and eax, edx ret .end start I used cinvoke to show you when it could be used but in this particular case a pointer is not needed at all and ccall should be used instead. |
|||
30 Jun 2007, 15:49 |
|
realcr 30 Jun 2007, 16:06
Cool , I understand it now.
Great thanks for your help [and also making my function more efficient lol..] realcr. |
|||
30 Jun 2007, 16:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.