-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.asm
More file actions
21 lines (17 loc) · 734 Bytes
/
hello.asm
File metadata and controls
21 lines (17 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
;
; Assemble using NASM
;
SECTION .data ; Data section
msg: db "Hello, world", 10 ; The string to print.
len: equ $-msg
SECTION .text ; Code section.
global _start
_start: nop ; Entry point.
mov rdx, len ; Arg 3: length of string.
mov rsi, msg ; Arg 2: pointer to string.
mov rdi, 1 ; Arg 1: file descriptor.
mov rax, 1 ; Write.
syscall
mov rdi, 0 ; exit code, 0=normal
mov rax, 60 ; Exit.
syscall ; Call kernel.