Review for the Midterm Exam
CS 301 Lecture, Dr. Lawlor
Super-compressed version of things to know:
- Bits, hex, bytes. What bitwise operators do. How many bits & bytes in a byte, word, dword, qword.
- Machine code: concept of bytes representing instructions. (exact bytes used for x86 are not important for the test)
- Registers: rax, eax, etc. Saved/preserved vs temporary/scratch registers.
- Arithmetic: how to use "add", "sub", "imul", and the bitwise instructions. Overflow.
- Pointers: how to allocate space on the stack, the heap (with
malloc), or statically (with section .data); how to access memory with
DWORD[ptr] or QWORD[ptr]. Pointer arithmetic.
- Stack: how to allocate space, what functions expect, how to save
& restore registers, how to clean up stack. How "push" and
"pop" instructions work.
- Branches: how to convert "if", "for", "while", etc into assembly. How "call" and "ret" instructions work.