Add x86-assembly

This commit is contained in:
dwrz
2026-10-27 12:41:06 +00:00
parent 42c2105b16
commit dcacadffc0
11 changed files with 632 additions and 0 deletions
@@ -0,0 +1,23 @@
.data
stop:
.int 3
.text
.global _start
_start:
mov $0, %rcx
loop:
cmp stop, %rcx
# If equal, change RIP to exit.
je exit
inc %rcx
# Unconditionally change RIP to loop.
jmp loop
exit:
# Try this: comment out the following three instructions.
# What happens if you assemble and link? Why?
# Think about RIP and the Fetch-Decode-Execute cycle.
mov $231, %rax
mov %rcx, %rdi # Exit code -- let's see the value of %rcx.
syscall