Hello. I have a simply programs that sums two numbers in assembler. I also have a c program with a .h file that must use that program.
But I always got as a result a 0.
This is my asm code
Code:
This is my .h codeCode:MyProc proc var1:REAL4, var2:REAL4 LOCAL retval:REAL4 PUBLIC MyProc finit fld var1 fld var2 fadd fstp retval fwait ;<- is this really needed? mov eax, retval ret MyProc endp
Code:
Code:#ifndef _FLOTANTE_H #define _FLOTANTE_H extern "C" unsigned long __stdcall __MyProc(float, float); float MyProc(float f1, float f2); #endif
and this is my C code
Code:
Code:void sum(void) { int ch; float f1; float f2; printf("Enter first number\n\n"); scanf("%d",&f1); printf("Enter second number\n\n"); scanf("%d",&f2); float total2; total2 = MyProc(f1, f2); printf("Total is: %d", total2); while ( (ch = getchar()) != '\n' && ch != EOF) ; printf("\n\nPress ENTER to continue."); while ( (ch = getchar()) != '\n' && ch != EOF) ; if(ch=='\n' || ch==EOF) { printmenu(); } }



LinkBack URL
About LinkBacks


