//---------------------------------------------------------------- // greeting.s // // This is an example of an application program which does // not use any external references, and therefore does not // need to be linked to any other object-files or separate // libraries of standard C functions. // // compile using: $ as greeting.s -o greeting.o // link using: $ ld greeting.o -o greeting // execute using: $ ./greeting // // programmer: ALLAN CRUSE // written on: 15 MAY 2003 //---------------------------------------------------------------- .section .data msg: .string " Hello \n" # text of the message string .section .text _start: movl $4, %eax # system-call number for sys_write movl $1, %ebx # device-file id-number for stdout movl $msg, %ecx # address of the message string movl $8, %edx # length of the message string int $0x80 # trap-instruction for system-call movl $1, %eax # system-call number for sys_exit movl $0, %ebx # value for the exit-code int $0x80 # trap-instruction for system-call .globl _start # makes entry-point visible (can omit this)