about summary refs log tree commit diff
path: root/historical/exit-code.gnu.asm
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-10-05 01:58:58 -0700
committerIrene Knapp <ireneista@irenes.space>2026-10-05 01:58:58 -0700
commite889b122cee2eb60cd1577c22560c8918b30d749 (patch)
tree1c45bc3869657e4f1b5b6f551bd815b07db86897 /historical/exit-code.gnu.asm
parent7acba568178af4048135a858a7ca9c6fb9c00520 (diff)
move around a bunch of the files that aren't actually in use
to better describe their status

Force-Push: yes
Change-Id: If5ef70b7872700ff36ef07f20aac1f3b991dff45
Diffstat (limited to 'historical/exit-code.gnu.asm')
-rw-r--r--historical/exit-code.gnu.asm29
1 files changed, 29 insertions, 0 deletions
diff --git a/historical/exit-code.gnu.asm b/historical/exit-code.gnu.asm
new file mode 100644
index 0000000..48b7e62
--- /dev/null
+++ b/historical/exit-code.gnu.asm
@@ -0,0 +1,29 @@
+/*
+ * 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 exit-code -nostartfiles -nostdlib exit-code.gnu.asm && ./exit-code ; echo $?
+ *
+ * or
+ *
+ * as -o exit-code.o exit-code.gnu.asm && ld -s -o exit-code exit-code.o && ./exit-code; echo $?
+ *
+ * Can't use nasm, nasm is 32-bit only.
+ *
+ * Since you get a nice clean file, you can then do:
+ *
+ * objdump --disassemble exit-code
+ */
+.text
+
+.global _start
+
+_start:
+        mov $60, %eax
+        mov $42, %edi
+        syscall
+