# Ivan Novick # x86 Hello World # # as -o sum.o sum.s # ld -dynamic-linker /lib/ld-linux.so.2 -o sum -lc sum.o ############################################# .section .data x: .long 0 y: .long 0 z: .long 0 ############################################# ############################################# .section .text fmtstring: .asciz "%d" sumstr: .asciz "The sum is: %ld.\n" prompt: .asciz "enter integer: " ############################################# .globl _start _start: ############## get val ###################### pushl $prompt call printf addl $4, %esp pushl $x pushl $fmtstring call scanf addl $8, %esp ############################################# ############## get val ###################### pushl $prompt call printf addl $4, %esp pushl $y pushl $fmtstring call scanf addl $8, %esp ############################################# movl x, %eax addl y, %eax pushl %eax pushl $sumstr call printf addl $8, %esp # exit system call movl $1, %eax movl $0, %ebx int $0x80