Course Review for Midterm
CS 301 Lecture, Dr. Lawlor
Well, in two months we've covered most of assembly language in this class! Thanks for sticking with it!
Here's generally what we've covered:
- Thinking in bytes
- Bits, hex digits, bytes
- Numeric representation of bit values
- Arithmetic on binary, hex numbers.
- Converting between binary, hex, and decimal.
- Low-level C code:
- Bitwise operators: & (AND) |
(OR) ^ (XOR) ~
(NOT) << (left shift) >> (right shift)
- "goto" and jump labels in C/C++. Converting "for",
"while", "if", and "switch" into simple statements of the form "if (x)
goto Y".
- pointers and memory layout in C/C++. malloc/free and
new/delete. How to fake an array with pointers. How the
compiler lays out structures and classes in memory. Alignment
padding. What to expect from stack and heap memory leaks (forget
to deallocate) and memory corruption (invalid array index,
use-after-delete, etc.).
- The linker and link errors. "extern "C"". Fortran and C++ "name mangling".
- Assembly Language:
- Registers
- Arithmetic and bitwise instructions in assembly
- Branches in assembly ("cmp" and "jle" type stuff). Converting "for", "while", "if", and "switch" into assembly. Overflow detection.
- Memory access in assembly
- Stack manipulation
- Array indexing
- Arrays of structs
- Calling function in assembly
- Pushing and popping parameters
- Operation of "call" and "return"
The midterm is in class on Wednesday, October 24. I recommend looking over the lecture notes, homeworks, and Chapters 1-3 of the Bryant book (up to page 210 or so).