when i am trying to compile a c program with asm code as follows
tcc -emasm.exe stop.c
it is not compiling.
how should i do it?
when i am trying to compile a c program with asm code as follows
tcc -emasm.exe stop.c
it is not compiling.
how should i do it?
Mr. GOOGLE knows it all:
part 3: sprites, linking C & assembler
Do you really need to add "-emasm.exe"? I don't know how your compiler handles inline assembly, but some compilers can do it without an external assembler.
if u use djgpp u maybe capable of using the preprocessor #asm
#asm
mov ax,5
#endasm
Ünicode¬>world = 10.0£
He used TCC, which is the Turbo C Compiler if I am correct. How did you use the inline assembly? Can you post the code where you use it?
i think it is used the same way as the other preprocessor directives like:
NOTE THAT #ASM ~ #ENDASM IS NOT PART OF STANDARD C WAS ACORDINGLY WITH C9X ; MUCH MORE OF COMPILER IMPLEMETATION
#include <conio.h>
#include <stdio.h>
#include <ctype.h>
int main(int argc,char *argv[])
{
char do;
int cat=1,dog=2,hold;
int *pnt_cat = &cat;
int *pnt_dog = &dog;
int *pnt_hold = &hold;
printf("Enter your choice(y/n): ");
scanf("%c", &do);
if(tolower(do) == 'y'){
#asm
mov pnt_hold,dog //here i'm supposed to swap values
mov pnt_dog,cat //suppost to do some swaping: my head
mov pnt_cat,hold //is start hurting.
#endasm
printf("\ndone~\n");
}else{
printf("\ano swaping was exec~\n");
}
getch();
return 0;
}
for what i know we're not supposed to pass memory addresses to memory address so we just swap the values from one address to another(that's will explain why i'm not sure about the pointers and my head really hurts now.
In Borland C one can do
The C standard says:Code:_asm { mov ax,bx blabla }
The asm keyword may be used to insert assembly language directly into the translator output (6.8). The most common implementation is via a statement of the form:
asm ( character-string-literal );
So I think you could also do:
Code:asm mov ax,bx; asm sub cx;
Last edited by Shiro; 04-19-2002 at 01:57 PM.