CS208, Monday 24 Jan 2022
Questions
- Let's talk about 0xFFFFFFC3 vs. 0x000000C3
- typecasting
- automatic typecasting / "promotion" (Yikes!)
- %x, %d
- Other questions?
Learning about assembly language
- Backwards compatibility has made a giant mess of related terminology
- Reading is slow and weird as you build up vocabulary
- Gotta use those liberal arts critical thinking skills to
evaluate credibility and bad writing
- Keep a list of questions
- Experiment (gcc -S and
Compiler Explorer can help a lot)
Architecture
- Registers
- Memory
- Status register FLAGS: note the bits CF, ZF, and SF
- Some registers are special: SP and BP, but also SI, DI
Watch out
- The "Aside" on p.172 of your textbook ("The ever-changing forms of generated code") is important
- Textbook + Wikipedia + Wikibooks + miscellaneous boring blogs as references
- Watch out: operand order varies; names vary across the decades (and linger in software)
- Code Explorer vs. gcc -S
Some instructions
- Easy: MOV, ADD, SUB, MUL, NEG
- Weird but easy: LEA
- Conditionals: CMP, TEST
- Jumps: JLE, JS
- Functions: CALL, RET
- Stack: PUSH, POP (and registers SP, BP)
New assignment
- Walk-through puzzle 0
- Wednesday: work on assignment; more x86
- Friday: what's the exam going to be like? short lab on gdb