Hello world!
My “Hello world!” in assembler language:section .text ; program section
global _start ; ld is reported about _start
_start: ; from this label program starts
mov eax, 4 ; 4 - write command
mov ebx, 1 ; 1 - stdout
mov ecx, hello ; hello - our text
mov edx, size ; size - text size
int 0x80 ; 0x80 - system call
mov eax, 1 ; 1 - exit command
mov ebx, 0 ; 0 - program exit state
int 0x80 ; 0x80 - system call
section .data ; data section
hello db 'Hello, world!', 0x0a ; our text
size equ $ - hello ; text size ([current address] - [text address])
I may write something more interesting soon.Moje “Hello world!” w assemblerze:
section .text ; sekcja programu
global _start ; informuje ld o _start
_start: ; etykieta wykonywana na starcie programu
mov eax, 4 ; 4 - polecenie write
mov ebx, 1 ; 1 - stdout
mov ecx, hello ; hello - nasz tekst
mov edx, size ; size - dlugość tekstu
int 0x80 ; 0x80 - wywołanie przerywania systemowego
mov eax, 1 ; 1 - polecenie exit
mov ebx, 0 ; 0 - status poprawnego zakończenia programu
int 0x80 ; 0x80 - wywołanie przerywania systemowego
section .data ; sekcja danych
hello db 'Hello, world!', 0x0a ; nasz napis
size equ $ - hello ; długość napisu ([aktualny adres] - [adres napisu])
Niedługo postaram się umieścić coś ciekawszego.