Ihr erstes Assemblerprogramm
Richten Sie Ihre Entwicklungsumgebung ein und schreiben, assemblieren, linken und führen Sie ein einfaches „Hello, World!“-Programm in x86-Assembler aus.
Ihr erstes Assemblerprogramm ist eine kostenlose Assembly Language & x86 Low-Level Systems Programming-Lektion auf CoddyKit. Dies ist Lektion 3 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Assembly Language & x86 Low-Level Systems Programming-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Assembly Language & x86 Low-Level Systems Programming-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Your First Assembly Program
Time to go hands-on: you will set up the tools, write a "Hello, World!" in assembly, and turn it into a runnable executable. This is the fun part.
Get Ready: Assembler & Linker
You need two tools: an assembler (we use NASM) to make an object file, and a linker (LD) to turn that into a runnable program.
Anatomy of an Assembly Program
An assembly program splits into sections. .data holds initialized data like strings; .text holds your instructions, starting at _start.
Storing "Hello, World!"
Store the message in .data. The db directive defines bytes; we add a newline (0xA) and compute the length right after.
section .data
msg db 'Hello, World!', 0xA
len equ $ - msgSystem Calls: Printing Text
To print, ask the OS via a system call. On Linux that is sys_write (number 1): you pass the output, the address, and the byte count.
section .text
global _start
_start:
; sys_write (syscall number 1)
mov rax, 1 ; syscall number for sys_write
mov rdi, 1 ; file descriptor 1 (stdout)
mov rsi, msg ; address of the string to write
mov rdx, len ; number of bytes to write
syscall ; execute the system callEnding Our Program (Syscall)
When done, the program must tell the OS to stop with a second syscall: sys_exit (number 60), passing an exit status — 0 means success.
; sys_exit (syscall number 60)
mov rax, 60 ; syscall number for sys_exit
mov rdi, 0 ; exit status 0 (success)
syscall ; execute the system callYour First Full Program!
Here is the full "Hello, World!" — save it as hello.asm. The .data section holds the message, .text prints it and exits.
section .data
msg db 'Hello, World!', 0xA
len equ $ - msg
section .text
global _start
_start:
; sys_write (syscall number 1)
mov rax, 1 ; syscall number for sys_write
mov rdi, 1 ; file descriptor 1 (stdout)
mov rsi, msg ; address of the string to write
mov rdx, len ; number of bytes to write
syscall ; execute the system call
; sys_exit (syscall number 60)
mov rax, 60 ; syscall number for sys_exit
mov rdi, 0 ; exit status 0 (success)
syscall ; execute the system callFrom Assembly to Object File
First, assemble: nasm -f elf64 turns hello.asm into the object file hello.o — machine code, but not yet an executable.
nasm -f elf64 hello.asm -o hello.oCreating the Executable
The object file isn't runnable yet. The linker (ld) wires up the _start entry point and produces the final executable.
ld hello.o -o helloExecute and See the Output!
Now run it with ./hello. "Hello, World!" prints to your console — congratulations, you just ran your first x86 assembly program!
./helloQuick Check: Process Steps
You've seen the full process to create an executable from assembly code. What is the correct order of steps?
Recap: Your First Assembly Program
You ran the full workflow: define data, call sys_write and sys_exit, then assemble, link, and execute. Next: registers and data types.
Häufig gestellte Fragen
Ist die Lektion „Ihr erstes Assemblerprogramm“ kostenlos?
Ja — der vollständige Text von „Ihr erstes Assemblerprogramm“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Assembly Language & x86 Low-Level Systems Programming-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Assembly Language & x86 Low-Level Systems Programming-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Ihr erstes Assemblerprogramm“?
Richten Sie Ihre Entwicklungsumgebung ein und schreiben, assemblieren, linken und führen Sie ein einfaches „Hello, World!“-Programm in x86-Assembler aus. Du übst Assembly Language & x86 Low-Level Systems Programming mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Assembly Language & x86 Low-Level Systems Programming zu starten?
Keine Vorkenntnisse erforderlich. Assembly Language & x86 Low-Level Systems Programming auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 3 von 4.
Wie lange dauert die Lektion „Ihr erstes Assemblerprogramm“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Assembly Language & x86 Low-Level Systems Programming-Lektion Code schreiben und ausführen?
Ja. Jede Assembly Language & x86 Low-Level Systems Programming-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Was ist Assemblersprache?
- Grundlagen der x86-Architektur
- Ihr erstes Assemblerprogramm
- Die Toolchain aus Assemblieren, Linken und Ausführen