Using external ASM proc's in WATCOM/C++ ???

i have made some ASM32 procedures and compiled them to an OBJ file, I want to implement them in my WatcomC code, but how do i pass the right arguments to the right REGS??? i am doing it like this but it doesn't seem to work correctly...


#PRAGMA AUX bitBlt_ PARM [EAX] [EDI] [ESI]

void bitBlt(word size,dword *dst,dword *src);

// EAX = size

// EDI = Destination (0x0a0000 in this case)

// ESI = Source (gfxPtr)




Comments

  • : i have made some ASM32 procedures and compiled them to an OBJ file, I want to implement them in my WatcomC code, but how do i pass the right arguments to the right REGS??? i am doing it like this but it doesn't seem to work correctly...


    : #PRAGMA AUX bitBlt_ PARM [EAX] [EDI] [ESI]

    : void bitBlt(word size,dword *dst,dword *src);

    : // EAX = size

    : // EDI = Destination (0x0a0000 in this case)

    : // ESI = Source (gfxPtr)


    Well, its the right idea, but there are some possible problems. If your using C++, you should add "C" before your void bitBlt syntax to make sure name mangling isn't messing with it.

    Also, you have the first param as eax, but you declare it as a word. Keep them the same size. You can add a "*_" after the function name and write the function name without the _ (just for readability).

    In all likelyhood, the problem is that you should say bitBlt_ parm caller ... which I guess is what the compiler expects. One more thing; make sure you've installed the register passing ability and are telling the compiler your using (it may be the default, but I think a -r cmnd line parameter to the compiler tells it to use register passing).


    Try this:


    extern "C" void bitBlt(dword size,dword *dst,dword *src);

    #pragma aux bitBlt "*_" parm caller [EAX] [EDI] [ESI]


    You can fool with it from there, but this should work. (Wow, I did alot of rambling there)


    Rock





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories