Re: ASM Help

new topic     » goto parent     » topic index » view thread      » older message » newer message

First of all, I see an evil typo in here. You're storing the adress to CALL 
in EDX, but you're CALLin EAX..
And you shouldn't use CALL FAR, but CALL NEAR.

This is how to call a procedure (void) with one parameter:

PUSH the_parameter
MOV EAX, proc_address
CALL NEAR EAX

That's all there is to it, no need to pop anything.
If you call a function (char, short, int), then the value of the function 
usually will be returned in EAX. E.g:

; pass the value of EBX to the function
PUSH EBX
MOV EAX, an_int_function
CALL NEAR EAX
; did the function return 0 ?
CMP EAX,0
; do something..



>com_asm = {
>     #60,                    --    0: pusha
>     #BB,#00,#00,#00,#00,    --    1: mov ebx, paramcount (2)
>     #8B,#0D,#00,#00,#00,#00,--    6: mov ecx, [params] (8)
>     #8B,#01,                --    C: start: mov eax, [ecx]
>     #50,                    --    E: push eax
>     #83,#C1,#04,            --    F: add ecx, 4
>     #4B,                    --   12: dec ebx
>     #75,#F7,                --   13: jnz start
>     #B8,#00,#00,#00,#00,    --   15: mov edx, comfunc (22)
>     #FF,#D8,                --   1A: call far eax
>     #58,                    --   1C: pop eax
>     #A3,#00,#00,#00,#00,    --   1D: mov [retpointer], eax (30)
>     #58,
>     #58,
>     #58,
>     #61,                    --   22: popa
>     #C3},                   --   23: ret
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu