CS208 Introduction to Computer Systems Wednesday, 31 January 2024 + Today - Assembly language intro & experiments - Quick peek at machine language - New assignment due a week from today - (Exam: I'm hoping to return it Friday) + Intel chip/instruction-set history ~1970: 4004 1970s-1980s: 8008, 8080, 8086 : 8-bit machines every instruction was some # of bytes registers were 8 bits registers were named a, b, c, etc. 1982: 80186 16-bit registers registers were named ax, bx, cx, etc. (x = "extended") 80286 1985: 80386 32-bit registers registers were named eax, ebx, ecx, etc. (e, x = "extended") much later... 64-bit registers: rax, rbx, etc. (r = register) + Compiler Explorer - Settings - Write a function int f(int a, int b) that does: return a * b What does the corresponding assembly look like? - Try some more return a + b return 5 * a + 9 * b try other formulas - Try an if-statement return the smaller of and b - Try a for-loop return a + (a+1) + ... + (b-1) + b + Notes on those experiments ... - mov vs. movl vs. movq movl -- l = long = 32 bits (I'm sorry, not the C "long") movq -- q = quad = 64 bits (still sorry) movb -- b = byte etc. eax = 32 bits (goes with l) rax = 64 bits (goes with q) - keep your eyes on eax vs. rax vs. ax etc. - Intel vs. AT&T notation - oh no, the documentation is backwards! + Look at the assignment + What's going on? - C compiles to machine language -