summaryrefslogtreecommitdiff
path: root/test_asm
diff options
context:
space:
mode:
authorKai Stevenson <kai@kaistevenson.com>2024-07-06 19:00:44 -0700
committerKai Stevenson <kai@kaistevenson.com>2024-07-06 19:00:44 -0700
commit8ba7e4819c9a40d95f0739e984a19cedd71f1620 (patch)
treedc6bad9aaebcf6d07f05966b460c5f89bd138522 /test_asm
parent0b1e955e3a69b6a02c69778adea4f123acfc8369 (diff)
compiler working with print functionHEADmaster
Diffstat (limited to 'test_asm')
-rw-r--r--test_asm22
1 files changed, 22 insertions, 0 deletions
diff --git a/test_asm b/test_asm
new file mode 100644
index 0000000..02c5b31
--- /dev/null
+++ b/test_asm
@@ -0,0 +1,22 @@
+.global _start
+.text
+_start: mov $AAA, %rax
+mov %rax, %rsi
+mov %rsi, %rdi
+call strlen
+mov %rax, %rdx
+mov $1, %rax
+mov $1, %rdi
+syscall
+mov $60, %rax
+mov $0, %rdi
+syscall
+strlen: mov $0, %rax
+dec %rax
+strlen_count: inc %rax
+cmpb $0x0, (%rdi,%rax,1)
+jne strlen_count
+ret
+.data
+AAA: .asciz "balalala\n"
+