Tell me more ×  Is there a way to call C input/output functions
from a nasm assembly file?  share|improve this question (top
google hit for "call printf from nasm") –  NPE Dec 15 '11 at
17:10 add comment  1 Answer  The following code is copied
verbatim from Sample nasm programs:  printf1.asm basic calling
printf:    The nasm source code is printf1.asm   The result of
the assembly is printf1.lst   The equivalent "C" program is
printf1.c   Running the program produces output printf1.out
This program demonstrates basic use of "C" library function
printf.   The equivalent "C" code is shown as comments in the
assembly language.  ; printf1.asm   print an integer from
storage and from a register ; Assemble:     nasm -f elf -l
printf.lst  printf1.asm ; Link:         gcc -o printf1
printf1.o ; Run:          printf1 ; Output:       a=5, eax=7  ;
Equivalent C code ; /* printf1.c  print an int and an expression
*/ ; #include <stdio.h> ; int main() ; { ;   int a=5; ;
printf("a=%d, eax=%d\n", a, a+2); ;   return 0;