Difference between revisions of "CSC231 HelloWorld.asm"
Line 22: | Line 22: | ||
;;; print message | ;;; print message | ||
− | mov eax, 4 ; write | + | mov eax, 4 ; write |
− | mov ebx, 1 ; stdout | + | mov ebx, 1 ; stdout |
− | mov ecx, Hello ; address of message to print | + | mov ecx, Hello ; address of message to print |
− | mov edx, HelloLen ; # of chars to print | + | mov edx, HelloLen ; # of chars to print |
int 0x80 | int 0x80 | ||
Latest revision as of 17:58, 12 September 2015
--D. Thiebaut 08:46, 7 September 2012 (EDT)
;;; helloWorld.asm
;;; D. Thiebaut
;;;
;;; Display "Hello there!" on the screen
;;;
;;; To assemble, link, and run:
;;; nasm -f elf helloWorld.asm
;;; ld -melf_i386 -o helloWorld helloWorld.o
;;; ./helloWorld
;;;
section .data
Hello db "Hello there!"
HelloLen equ $-Hello
section .text
global _start
_start:
;;; print message
mov eax, 4 ; write
mov ebx, 1 ; stdout
mov ecx, Hello ; address of message to print
mov edx, HelloLen ; # of chars to print
int 0x80
;;; exit
mov ebx, 0
mov eax, 1
int 0x80