section .data
msg: db "hello!", 10, 0 ;my message
section .text
extern printf ;C printf function
global main
main:
push ebp
mov ebp, esp
call print_string
mov esp, ebp
pop ebp
ret ;end of program
print_string:
pusha
push msg
call printf ;should print "Hello"
popa
ret ;return back to main
Когато стартирам този код, получавам:
здравей!
Грешка в сегментирането (ядрото е изхвърлено)
Какво не е наред с кода?
msg
указател там, така чеret
ще се провали. - person Weather Vane   schedule 29.07.2015