Fetch-Execute Cycle
ISA
Set of instructions understood by a CPU -
imulq $86, (%rax), %rcx
List the different kinds of registers
Orthogonality of ISAs
When ISA doesn’t distinguish between different registers. What can be done with one register can be done with any other registers. Each instruction performs a unique task that doesn’t overlap with another instruction.
ARM is orthogonal
Uses of Conventions
They help structure writing assembly code
ISA Design decisions for where arguments can be loaded and stored
Word Addressed
One address for one word and there is extra info to refer to the bytes inside the word
Byte Addressed
One address per octet ( 8 bits ) and the lowest address in a word represents the address of the word.
How does ISA allow memory access or what are the different memory addressing modes?
Immediate Mode: The value is specified in the instruction itself, used for constants.
Direct Mode: The value is stored at a fixed address. Used for global variables.
Indirect mode: The value is stored in a fixed address which is specified inside a register. Extra power(check)
Index Mode: The value is at a fixed address specified by register but is offset by an index.
Register Naming

Stackframes
The stack frame is the collection of all data on the stack associated with the function call like the arguments to the function and the return address
The steps involved in a function call with respect to the stack frame and the different pointers
What are the 2 special purpose registers?
Main addressing mode in x86 ( AT&T Syntax )
disp(%reg1, %reg2, scale)
This refers to the address, disp + (reg1) + scale * reg2
What is load effective addressing?
Stores the effective address of the source into the destination register instead of storing the value pointed to by effective address ( this is what mov does )
Lea doesn’t read from the computed address whereas Mov does.
Command for compiling a C file ( sam.c ) to an assembly file ( sam.s)
clang -S sam.c -o sam.s
Which register is used for:
Calling conventions (1) - How arguments are passed into functions.
There are 2 ways in which arguments are passed onto a function
Call and exit in ISA
callq address: pushes the address of the following instruction ( this is the return address ) onto the stack and transfers the control to the function by setting the rip to the address of the function.
retq: pops the address from the stack by incrementing the stackpointer and returns control back to the calling function by setting rip to the popped address
What are callee saved registers?
rbx, rbi, r12 - r15