Content added Content deleted
imported>port-212-202-57-136.reverse.qsc.de mNo edit summary |
imported>mutante mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
This is an example of "Hello Fnord" in Assembler: |
This is an example of "Hello Fnord" in [[Assembler]]: |
||
vi hello.asm |
vi hello.asm |
||
Line 30: | Line 30: | ||
--- |
--- |
||
put this into hello.asm then compile it with [[nasm]] |
put this into hello.asm then [[compiler|compile]] it with [[nasm]] |
||
$ nasm -f elf hello.asm |
$ nasm -f elf hello.asm |
||
Line 42: | Line 42: | ||
$ ./a.out |
$ ./a.out |
||
Hello, fnord! |
Hello, [[fnord]]! |
||
tataaaa! you wrote your first assembler program. |
tataaaa! you wrote your first [[assembler]] [[program]]. |
||
[[Category:Programming]] |
|||
[[Category:Computer]] |
Latest revision as of 16:51, 19 March 2005
This is an example of "Hello Fnord" in Assembler:
vi hello.asm
---
section .data ;section declaration msg db "Hello, fnord!" ;der String section .text ;section declaration global _start ;default Eingangspunkt fuer ELF-Link _start: ;write() call mov eax, 4 ;4 in eax, weil write syscall #4 ist mov ebx, 1 ;stdout in ebx, weil die richtige fd 1 ist mov ecx, msg ;die Adresse des Strings in ecx mov edx, 13 ;13 in edx, weil der String 13 Bytes enthaelt int 0x80 ;Kernelaufruf, um den System-Call auszuloesen ; exit() call mov eax,1 ;1 in eax, weil exit syscall #1 ist mov ebx,0 ;0 in ebx int 0x80 ;Kernelaufruf, um den System-Call auszuloesen
---
put this into hello.asm then compile it with nasm
$ nasm -f elf hello.asm
link it
$ ld hello.o
run it
$ ./a.out
Hello, fnord!