12
Compiler Translates high-level language into object code Assembly code may be intermediate step Programmer DOES NOT have full control of object code Compiler decides what instructions go into machine code Compiler decides the order of instructions in machine code E.g., code snippet “ x = 4; “ could be compiled into 4 or 5 instructions 11

15
Assembler Translates assembly language into machine language Programmer has FULL CONTROL of object code Must define every instruction to be executed “Long journey in very small steps” Each “step” is instruction for CPU (many lines of code) 14

17
Mnemonic Assembler sees at least one line of assembly source code for every machine instruction it generates Assembly language has a mnemonic for each machine instruction available for that architecture Example mnemonics for x86 architecture: mov add push … 16

18
Mnemonic Example line of assembly: mov eax,4; place 4 in general 32-bit register eax 17

20
Mnemonic Example line of assembly: mov eax,4; place 4 in general 32-bit register eax 19 operands note: some instructions have zero operands other instructions have 1 operand other instructions have 2 operands

21
Mnemonic Example line of assembly: mov eax,4; place 4 in general 32-bit register eax 20 comment: starts at ; ends at EOL best practice: comment EVERY line of assembly code!!

22
Mnemonic Example line of assembly: mov eax,4; place 4 in general 32-bit register eax 21 instruction: mnemonic and operand(s)

25
Mnemonic You will become familiar with x86 mnemonics Practice, practice, practice writing x86 assembly code Same idea for MIPS and ARM assembly.. Slightly different mnemonics and operands Flip through Appendix A in the book… Taste of x86 mnemonics Don’t worry about details, yet 24

51
Debugging We are going to use KDbg Easy to use View register contents, output, etc. GUI front-end to gdb Book uses insight (Chapter 6+) It would not install on VMs!! Other options out there e.g., ddd 50

55
Debugging Using a debugger will save you time and frustration!!! Use breakpoints to check flow of execution Register contents Output etc. KDbg is a visual debugger, easier than command line only gdb command-line debugger is clunky and hard to learn 54