Create a new article
Write your page title here:
We currently have 3,185 articles on s23. Type your article name above or create one of the articles listed here!



    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
    ;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!

    tataaaa! you wrote your first assembler program.

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.