summaryrefslogtreecommitdiff
path: root/nasm/helloworld.asm
diff options
context:
space:
mode:
authorgarhve <git@garhve.com>2022-12-05 19:50:08 +0800
committergarhve <git@garhve.com>2022-12-05 19:50:08 +0800
commit37decc99a7b164ca3b573749af612ff88f4c1a5b (patch)
tree0420223d6d82e540c78513c7f021c18e2cd49530 /nasm/helloworld.asm
parentc6bc541ab58363d783e60a007e80e9bf9e231fda (diff)
initialize
Diffstat (limited to 'nasm/helloworld.asm')
-rwxr-xr-xnasm/helloworld.asm17
1 files changed, 17 insertions, 0 deletions
diff --git a/nasm/helloworld.asm b/nasm/helloworld.asm
new file mode 100755
index 0000000..3016f58
--- /dev/null
+++ b/nasm/helloworld.asm
@@ -0,0 +1,17 @@
+SECTION .data
+msg db "Hello World!", 0Ah ;
+
+SECTION .text
+global _start
+
+_start:
+
+ mov edx, 13 ; number of bytes to write
+ mov ecx, msg ; move memory address of 'msg' to ecx
+ mov ebx, 1 ; write to the file STDOUT
+ mov eax, 4 ; invoke SYS_WRITE (kernel opcode 4)
+ int 80h
+
+ mov ebx, 0 ;
+ mov eax, 1 ;
+ int 80h