0

Hi. I am a little new to mixing C and ASM and I was wondering how one could pass a value from one asm function to another ASM function that then pushes the same value to a C function.

What I have is this:

01. ASM 01 loads ASM 2 into memory, pushes dword value into EAX, and then calls the ASM 2 function.
02. ASM 02 function sets up the stack and then calls the C function.

So, how do I pass this value from ASM to ASM to C? I hope this makes sense.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Salem
0

I think the EAX register is getting overwritten in ASM 02. When I push the value onto the stack and call ASM 02, as soon as ASM 02 gets control I pop the EAX register and mov it to EBP which I then push on the stack and call the C program. The value I get is two small as it is supposed to be the linear frame buffer address and it appears to be the &end of my entire program as ASM 02 and C program are linked, but ASM 01 is not.

0

Dunno, maybe post some code.

> ASM 01 loads ASM 2 into memory,
Is this some kind of DLL or overlay?

Which 'assembler' are you using (masm, tasm, nasm, ....)
Which memory model(s) are you using?
Which C compiler at the end of the chain?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.