-
Notifications
You must be signed in to change notification settings - Fork 111
Description
HERE ME OUT. Asymbly is a cool tool, but more importantly, it can be used as a way to teach how cpus actualy work. In the concurency go lesson, I saw it say this is an oversymplification, but lets say we have 3 instructions here, which made me think, it would be really cool to make a x86-64 ASM course, to teach how instructions work. because i know that that 3 line program !3 instructions (x := 3
x ++
fmt.Println(x)
would be a LOT of instructions. first putting 0000000000000011 into whatever register, then saving that register to memory, then increinting that register,
here is linux x86-32 version(imbad at 86-64)
.global _start
.intel_syntax
.section .text
_start:
#increment eax
mov %eax, 1
add %eax, x
#print
mov %eax, 4
mov %ebx, 1
lea %ecx, [x]
mov %edx, 1
int 0x80
#exit program
mov %eax, 1
mov %ebx, 0
int 0x80
.section .data
x: .long 0x04