summary refs log tree commit diff
path: root/exit-code.S
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2025-10-05 14:36:54 -0700
committerIrene Knapp <ireneista@irenes.space>2025-10-05 14:36:54 -0700
commit8f94834e451cf7ae7cccb5522562b3dea3754039 (patch)
tree2d0be73cde7abfb1767c8720226d9ccc072de57d /exit-code.S
parent95ef9dbac33a46432b4ae4b5028d2538e9c4bfa9 (diff)
yay the earliest examples are in a solid state
Force-Push: yes
Change-Id: I7111b9a9ed3cb5c5cf162af336b2278cf5850b76
Diffstat (limited to 'exit-code.S')
-rw-r--r--exit-code.S27
1 files changed, 27 insertions, 0 deletions
diff --git a/exit-code.S b/exit-code.S
new file mode 100644
index 0000000..4c723e8
--- /dev/null
+++ b/exit-code.S
@@ -0,0 +1,27 @@
+/*
+ * This file was a very early example, written by consulting [1]. It was
+ * useful primarily to see how the GNU assembler handles these opcodes, to
+ * better understand the encoding.
+ *
+ * [1] https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
+ *
+ *
+ * gcc -o quine -nostartfiles -nostdlib quine.S && ./quine ; echo $?
+ *
+ * or
+ *
+ * as -o quine.o quine.S && ld -s -o quine quine.o && ./quine; echo $?
+ *
+ * Can't use nasm, nasm is 32-bit only.
+ */
+.text
+
+.global _start
+
+_start:
+        //mov $60, %rax
+        //mov $42, %rdi
+        mov $60, %eax
+        mov $42, %edi
+        syscall
+