how to call printf from assembly nasm x86 linux 8086 -


i'm trying, unsuccessfully, call printf assembly program follows:

section .rodata preffix: db "calc >",0 preffix_length: equ $-preffix  section .text align 16 global main   extern printf  main:   push preffix   push preffix_length   call printf   ret 

but keep getting segmentation fault.

i'm writing in linux (ubuntu) nasm assembly 80x86.

you don't want push length - strings in c address of text 0 byte mark end.

you can use gdb figure out crashes.


Comments