| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| 0.current/ | 24-Jan-2012 10:43 | - | ||
| 110/ | 06-Dec-2011 15:42 | - | ||
| 240/ | 06-Dec-2011 17:32 | - | ||
| 330/ | 26-Jan-2012 06:38 | - | ||
| 375/ | 09-Dec-2011 06:53 | - | ||
| 476/ | 26-Jan-2012 09:20 | - | ||
| 491/ | 25-Jan-2012 11:24 | - | ||
| ACM/ | 24-Mar-2010 12:08 | - | ||
| BloomU/ | 24-Mar-2010 12:07 | - | ||
| Code/ | 30-Dec-2011 21:48 | - | ||
| Computer-Organization/ | 06-Feb-2011 15:46 | - | ||
| Download/ | 28-Jan-2011 22:02 | - | ||
| Graphics/ | 12-Jan-2012 06:22 | - | ||
| Humor/ | 24-Mar-2010 12:08 | - | ||
| Index/ | 27-Sep-2010 15:44 | - | ||
| Information/ | 05-Dec-2011 16:22 | - | ||
| Linux-distros/ | 13-May-2010 12:48 | - | ||
| Maps/ | 23-May-2007 14:32 | - | ||
| Multimedia/ | 13-May-2010 12:34 | - | ||
| Nasm-Win32/ | 06-Nov-2008 16:02 | - | ||
| Networking/ | 26-Jan-2012 14:05 | - | ||
| Ophcrack Tables/ | 04-Aug-2009 13:17 | - | ||
| PACISE-board.zip | 18-Sep-2009 08:02 | 706K | ||
| PACISE/ | 24-Mar-2010 12:08 | - | ||
| Pacise-Old.zip | 28-Sep-2006 22:50 | 39M | ||
| PalmOS/ | 24-Mar-2010 12:07 | - | ||
| Personal/ | 02-Feb-2011 20:38 | - | ||
| Presentations/ | 05-Dec-2011 14:02 | - | ||
| README.html | 24-Mar-2010 12:08 | 8.8K | ||
| Readings/ | 24-Mar-2010 12:08 | - | ||
| Reference/ | 10-Sep-2011 15:44 | - | ||
| Screenshots/ | 29-Sep-2009 08:41 | - | ||
| Semesters/ | 12-Jan-2012 14:34 | - | ||
| Software/ | 24-Jan-2012 08:00 | - | ||
| Webpages/ | 26-Oct-2010 21:34 | - | ||
| apache2conf.man | 27-Sep-2010 18:24 | 12K | ||
| cgi-bin/ | 11-Oct-2011 09:54 | - | ||
| css/ | 07-Jan-2012 06:47 | - | ||
| includes/ | 20-Aug-2011 07:25 | - | ||
| js/ | 26-Jan-2012 08:37 | - | ||
| professional/ | 28-Oct-2008 15:25 | - | ||
| sched-Semester.html | 24-Mar-2010 12:08 | 2.1K | ||
This is a basic introduction to using Assembly language on a Linux system. It assumes at least a little general programming and Linux experience. Some references to further information are provided at the end.
i386 Linux and x86-64 Linux are treated differently, because i386 (IA-32) processors are different from x86-64 (AMD64/Intel 64) processors. IA-64 processors, e.g. Itanium, are are even more different, and are not considered here.
This program depends on a Linux system call, int 0x80.
(An equivalent DOS/Windows version would use the DOS call, int 0x21.)
The call is the same in both i386 and x86-64 versions of Linux, so this program works in either (when assembled and linked appropriately).
; hello.asm complete program ; ; from <http://www.csee.umbc.edu/help/nasm/nasm.shtml> ; 2009-11-18 ; ; The nasm source code is hello.asm ; This demonstrates basic text output to a screen. ; ; hello.asm a first program for nasm for Linux, Intel, gcc ; ; 32-bit (i386) --- ; assemble: nasm -f elf32 -l hello.lst hello.asm ; link: ld -m elf_i386 -o hello hello.o ; or: gcc -o hello hello.o (only on 32-bit installations) ; ; 64-bit (x86-64/amd64) --- ; assemble: nasm -f elf64 -l hello.lst hello.asm ; link: ld -m elf_x86_64 -o hello hello.o ; or: gcc -o hello hello.o (only on 64-bit installations) ; ; run: hello ; output is: Hello World ; SECTION .data ; data section msg: db "Hello World",10 ; the string to print, 10=cr len: equ $-msg ; "$" means "here" ; len is a value, not an address SECTION .text ; code section global main ; make label available to linker as invoked by gcc global _start ; make label available to linker w/ default entry main: ; standard gcc entry point _start: mov edx,len ; arg3, length of string to print mov ecx,msg ; arg2, pointer to string mov ebx,1 ; arg1, where to write, screen mov eax,4 ; write command to int 80 hex int 0x80 ; interrupt 80 hex, call kernel mov ebx,0 ; exit code, 0=normal mov eax,1 ; exit command to kernel int 0x80 ; interrupt 80 hex, call kernel