Class material

A more conveniently reachable (for some) copy of some of the class slides and notes.

  1. Slides for week 1 lectures (architecture, SPLAB), course introduction (pdf), basic principles (pdf).
  2. Slides for week 2-3-4 lectures (architecture):
    Introduction to computer architecture (pdf), and assembly language (example assembly code, and listing file).
    Instruction formats and addressing modes (postscript, pdf).
    Instruction categories (postscript, pdf).
  3. Slides for week 5-6, 8 lectures (architecture), misc low-level prgramming issues (postscript, pdf).
    Example assembly code with macros, and resulting listing file.
  4. Slides for 2nd (week 7) talks for SP lab (Shell (pdf))
  5. Lecture (week 8) on co-routines (threads)(pdf)
    Example co-routine code main.c and co.s.
  6. Week 9: Files used in class on position-independent code.
  7. Slides for 3rd (week 10) talk for SP lab (Data files, linking and loading) (pdf)
  8. Week 11: Introduction to hacking (slides not on-line for legal reasons).
  9. Slides for week 12: (chapter 2 only) from Patterson and Henessy on performance. See also Performance
  10. Slides for week 13: class on codes and communication, (pdf). More on Hamming codes.
  11. Week 14: Specs for lecture on IO programming: Example spec of UART, DMA controller, Disk controller.

Warning: these slides contain some errors, that were left in delibarately, to liven things up a bit in class.

Other material

  1. C examples
  2. function call
  3. Array code example: arr.s, main.c
  4. performance: lecture question solution performance_solutions.pdf
  5. For documentation on the x86 architecture, I (Mayer) catenated Intel's 3 volume set into this huge file. This is free, legally-distributed material, created and put out by Intel. I catenated their documents because I prefer one, large file. If you want to get the original 3 volume set (or smaller, 9 volumes), check out their website.
  6. Sample code in x86 assembly:
    1. factorial
    2. Fibonacci
    3. Ackermann's function with optimized tail-calls
    4. A safe readline procedure that allocates memory dynamically
    5. A brief demonstration of how to use the XLATB instruction
    6. A brief demostration of how to use the MOVSB instruction
    7. A brief demonstration of how to use the STOSB instruction
    8. Converting hex to decimal
    9. A brief demonstration of the LOOP instruction: Factorial, iteratively
    10. A brief demonstration of how to access command-line arguments from assembly
    11. Read two-letter hex values in source string and output the corresponding ASCII string
    12. stdin-stdout-stderr.asm
    13. stdin, stdout, stderr are just variables that can be accessed via extern!
    14. A brief demonstration of counting in binary
    15. A brief demonstration of the gcd function
    16. A brief demonstration of self-modifying code in assembly
    17. The new Intel processors (Atom & later) support conversion between Big-Endian and Little-Endian with a single instruction! Check out the examples of using the cool new movbe and bswap instructions!
    18. An toy-version of printf implemented in assembly language.
  7. Some C code:
    1. A simple example of using fork(), exec(), signals… Note that I'm not using the deprecated signal() function, but the more up-to-date and portable sigaction(). This is NOT what you are asked to use in your lab, but the idea is the same and the code is very similar.
    2. A simple example of using fork(), pipe(), dup2(), exec() to create a subprocess running the "bc" calculator (do "man bc" to read about it), and give it some math problems. For the code to work, you MUST have bc installed!