Difference between revisions of "CSC231 HelloWorld.asm"
(Created page with "--~~~~ ---- <source lang="asm"> ;;; helloWorld.asm ;;; D...") |
|||
Line 2: | Line 2: | ||
---- | ---- | ||
<source lang="asm"> | <source lang="asm"> | ||
− | ;;; helloWorld.asm | + | ;;; helloWorld.asm |
− | ;;; D. Thiebaut | + | ;;; D. Thiebaut |
− | ;;; | + | ;;; |
− | ;;; Display "Hello there!" on the screen | + | ;;; Display "Hello there!" on the screen |
− | ;;; | + | ;;; |
− | ;;; To assemble, link, and run: | + | ;;; To assemble, link, and run: |
− | ;;; nasm -f elf -F stabs helloWorld.asm | + | ;;; nasm -f elf -F stabs helloWorld.asm |
− | ;;; ld -melf_i386 -o helloWorld helloWorld.o | + | ;;; ld -melf_i386 -o helloWorld helloWorld.o |
− | ;;; ./helloWorld | + | ;;; ./helloWorld |
− | ;;; | + | ;;; |
section .data | section .data |
Revision as of 17:57, 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 -F stabs 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