Assembly.md (820B)
1 +++ 2 title = 'Assembly' 3 +++ 4 symbolic notation for machine language, improves readability 5 two syntaxes — Intel and AT&T 6 7 - Intel: 8 - order 9 - operation destination source 10 - e.g. mov rax, 5 11 - just like a=5 12 - no decorations 13 - AT&T: 14 - extra decorations like % in front of registers and $ in front of literal values 15 - not very readable 16 - order such as: mov 5, %rax 17 18 First four arguments: %rax, %rdi, %rsi, %rdx 19 20 When you write a subroutine, push the base pointer. Then set the base pointer to the stack pointer. 21 22 At the end of the subroutine, set the stack pointer to the base pointer. Then pop the base pointer. Then ret. 23 24 Syscall 60 is exit, 1 is write, 0 is read. 25 1 is stdout, 0 is stdin, 2 is stderr. 26 27 Registers store addresses. Parentheses are used to access value at address.