Вот пример сообщения «Hello, World!» программа на ассемблере для архитектуры x86:
Метод 1: синтаксис NASM (Linux)
section .data
hello db 'Hello, World!', 0
section .text
global _start
_start:
; write the string to stdout
mov eax, 4
mov ebx, 1
mov ecx, hello
mov edx, 13
int 0x80
; exit the program
mov eax, 1
xor ebx, ebx
int 0x80
Метод 2: синтаксис MASM (Windows)
.data
hello db 'Hello, World!', 0
.code
main PROC
; write the string to stdout
mov edx, OFFSET hello
mov ecx, SIZEOF hello
mov ebx, 1
mov eax, 4
int 0x80
; exit the program
mov eax, 1
xor ebx, ebx
int 0x80
main ENDP
end
Метод 3: синтаксис TASM (DOS)
.model tiny
.code
org 100h
start:
; write the string to stdout
mov dx, OFFSET hello
mov ah, 9
int 21h
; exit the program
mov ah, 4Ch
int 21h
.data
hello db 'Hello, World!', 0