summaryrefslogtreecommitdiffhomepage
path: root/example/example_03_masm_sysv_linux/example.asm
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-23 19:46:09 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-23 19:47:41 +0100
commit7f17278493da389ea25a627ea993a35f122671ef (patch)
tree7aaf84f0af5ee7ed447d843c1c553cc2cabe185b /example/example_03_masm_sysv_linux/example.asm
parentbaa456251dc978b3bdb33c77a5c02c2e53fb2d3e (diff)
chore: GenericsLibrary: Library tweaks and additions, more examples for
Nectar and Assembly. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'example/example_03_masm_sysv_linux/example.asm')
-rw-r--r--example/example_03_masm_sysv_linux/example.asm30
1 files changed, 30 insertions, 0 deletions
diff --git a/example/example_03_masm_sysv_linux/example.asm b/example/example_03_masm_sysv_linux/example.asm
new file mode 100644
index 0000000..c001e6c
--- /dev/null
+++ b/example/example_03_masm_sysv_linux/example.asm
@@ -0,0 +1,30 @@
+%bits 64
+public_segment .code64 main
+
+; This example shows how to write "Hello World" to stdout using
+; Linux syscall interface in x86-64 assembly (NeKernel syntax).
+
+mov [rsp+0], 0x48
+mov [rsp+1], 0x65
+mov [rsp+2], 0x6C
+mov [rsp+3], 0x6C
+mov [rsp+4], 0x6F
+mov [rsp+5], 0x20
+mov [rsp+6], 0x57
+mov [rsp+7], 0x6F
+mov [rsp+8], 0x72
+mov [rsp+9], 0x6C
+mov [rsp+10], 0x64
+mov [rsp+11], 0x0A
+
+mov rax, 1
+mov rdi, 0x01
+lea rsi, [rsp]
+mov rdx, 0x0C
+syscall
+
+mov rax, 60
+xor rdi, rdi
+syscall
+
+ret \ No newline at end of file