CS255 Syllabus & Progress

CS255 Syllabus & Progress


Material covered are displayed in blue.


    Search the lecture notes:

  1. Review of Computer Architecture and Intro to Program Organization
    • Logical View of a Computer System: click here
    • Structure of computer main memory: click here
    • Accessing the computer memory: click here

    • Program organization (where different parts of the program is put in memory): click here -- will be explained in Section 4 in detail
    • The program translation process: click here -- will be explained in Section 5 in detail


    Before we can explain how the computer works - i.e., how it manipulates data, we must understand how information are stored inside the computer...

  2. How information are stored in the computer
    • Fundamental data used in the computer (these values need to be stored)
      • Numbers (int, float, double)
      • Text (char)
      • Computer instructions
      • (Boolean values "true" is represented as the number 1 and "false" as number 0)

    • Storing numeric values inside the computer:

    • Other number systems:

    • Representing Signed integers: click here

    • Fixed point numbers: click here

    • Floating point numbers
      Homework 1 re-enforces number system concepts: click here

    • A binary number information sheet: click here

  3. Representing alphanumerical (textual) data inside the computer:




  4. Making communication possible between humans and computers:

    • Introduction: click here

    • Communicating non-textual information to a computer:
      • Communicating Boolean values between humans and computers: click here

      • Communicating numerical values between humans and computers:
        Homework 2 re-enforces string <-> binary conversion: click here




  5. Storing computer instructions inside the computer:
    • Instruction categories:
      • 0 operand
      • 1 operand (unary operation, e.g., negate)
      • 2 operands (binary operation, e.g., add)
    • Instruction formats:
      • Variable length (Intel, Motorola M68000)
      • Fixed length (SPARC, MIPS)
    • M68000 Instruction encoding: click here
    • SPARC Instruction encoding: click here






  6. Intro to computer programming: anatomy of computer programs and how to make a computer program

    • What's in a computer program (instructions + variables in memory cells): click here
    • The general CPU architecture (= machinery to execute computer instructions): click here
    • The instruction execution cycle (how the CPU works): click here

    • Evolution of the art of "programming a computer": click here
    • Example of translating high level language program: click here





  7. Intro to M68000 assembler programming

    • Why assembler programming ? click here
    • M68000 CPU architecture: click here

    • Structure of an (M68000) assembler program (assembler directives and assembler instructions): click here





  8. Assembler directives: defining constants and variables in a program

    • Defining (symbolic) constants in a computer program: click here

    • Defining variables in a computer program:
      • Review: kinds of variables in Java: click here
      • Intro to memory organization: click here
      • How the different kinds of variables are stored in memory: click here

      • Defining (uninitialized) class variables of Java in assembler programming: click here
      • Defining initialized class variables of Java in assembler programming: click here
      • Memory alignment requirement for variables: click here

    • Ending an M68000 assembler program: click here





  9. Operands used in assembler instructions

    • M68000 Assembler Instruction: click here

    • Operands in M68000 assembler programming:
    • Big and little endian storage format: click here





  10. The Assignment Statement:
    • A simple example: C = A + B click here

    • Accessing variables: M68000 addressing modes (tough topic...)
      • Immediate: click here
      • Absolute or Direct: click here
        Homework 3 introduces the Egtapi programming environment, and re-enforces defining and using simple variables with Assembler Directives and the Immediate & Direct Modes: click here

        This project is very easy to do, but make sure you assemble and run the program to get familiar with Egtapi, or else, you will have major headaches with later projects


      • Address register indirect (with displacement): click here

      • Accessing data structures using the indirect modes:

      • Address register indirect with index and displacement: click here



    • M68000 instruction nmenomic codes and the allowed addressing modes: click here
    • M68000 instruction nmenomic codes and their meaning: click here
    • All M68000 instructions discussed in CS255 (work in progress): click here




  11. Arithmetic operations (+, -, * and /):
    • The data type in an operation: click here

    • Important property of computer (= machine) instructions: click here

    • Arithmetic operations on the operands of the same data type:
      • The add (and adda) instruction: click here
      • The default type of a M68000 instruction and case sensitivity: click here
      • Note on how "a + b" is translated into assembler code: click here

      • The subtract (sub) instruction: click here
      • The negate (neg) instruction: click here
      • The muls and divs instructions (integer multiply and divide): click here

    • Operations on array variables of various data types: click here



  12. Computations using different types of variables:
    • Mixing int, short, byte operands:
      • Assembler instructions to convert between different data types : click here

      • Assignment statement using different sizes: click here
      • Arithmetic expression using different sizes: click here
      • Mixed type operations with array variables: click here

      • Using the ext instruction on the results of the muls and divs instructions:

      • A large example accessing data structures (includes linked list): click here

  13. "Complicated" functions - like sin(x): click here


    Homework 4 re-enforces using array variables and size conversion with M68000 assembler instructions: click here

    Now you know what the computer actually does when it executes an assignment statement: how it evaluates an expression and assigns the result to a variable in a high level programming language

  14. The Selection (if, if-else) Statements:

  15. Repetition statements in assembler:


    Homework 5 re-enforces the use of compare and branching in writing your first assembler program containing a while loop and an if-statements: click here

    The midterm test will cover the material upto this point


    Now you know what the computer actually does when it runs a program. The only thing that you still do not know is what happens in a function call (there is still a lot to learn...).


    Programming project hw6 re-enforces loop and if-statements further with a sorting algorithm... click here

  16. Subroutines (a.k.a. methods, procedures, functions):
    • Prelude to subroutines: try to use BRA to implement subroutines: click here
    • Prelude to subroutines: implementing a stack click here

    • M68000 instructions for subroutine invocation and return click here

    • Passing parameters and return values: click here

    • Different ways to pass parameters to a function/subroutine:

    • Local variables (and parameter variables):
      • Intro to Subroutine with local variables: click here

      • Review: Lifetime of parameter variables and local variables: click here

      • How modern programming languages store parameter and local variables:
        • Modern languages: click here
        • using the stack to pass parameters and store local variables: click here
        • using a frame pointer to access parameters and local variables: click here

    • Recursion:
      • Reminder on parameter variables and local variable:
        • parameter variables and local variables are created when a function is invoked
        • parameter variables and local variables are destroyed when a function returns
        • We have learned how to implement this behavior using the system stack

      • Writing recursive functions in assembler code:
        1. always pass parameters on the stack
        2. always use the stack to store local variables

      • First recursion in assembler, the classical factorial: click here
      • Another classic recursive problem -- Fibonacci numbers: click here



        I have some material here to help you understand how to write a recursive method --- these material are not part of CS255 curriculum:
        • Review CS170: recursion is a divide and conquer technique to solve problems: click here
        • Review CS170: Tower of Hanoi click here
        • A tougher example of divide and conquer using recursion: click here (Not part of CS255 material)


      • Tower of Hanoi in M68000 assembler code: click here (skipped for brevity - read through it yourself)


      Programming project hw7 re-enforces recursion: click here

    • Working with linked lists:
      • Remember how linked lists are stored inside the computer: click here

      • Insert at start of the linked list: click here
      • Insert a new element at the tail of the list:
        • Iterative algorithm to insert at tail of a list: click here --- skipped (just loop and if, you can read it)
        • Recursive algorithm to insert at tail of a list:

      • Insert into an ordered list: as hw8

      Programming project hw8 re-enforces linked lists: click here

      If you understand everything so far, you now know exactly what is going on when a computer executes a program. You can apply what you learn and write assembler programs in any assembler language, e.g., Intel Pentium, IBM PowerChip, DEC Alpha, SunMicrosystem SPARC... To program with a new chip, all you need to learn are:

      • its architecture (registers),
      • the addressing modes
      • the instruction mnemonic codes and what they do.
      I have SPARC and Intel material after the C lecture notes to demonstrate this process.





  17. Introduction to the (System Programming Language) C for Java programmers



  18. Functions (methods):
    Hand out C Project 1: click here



  19. Intermediate topics: things that look similar in C and Java but work differently



  20. Advanced datatypes



  21. Miscellaneous topics in C


    Hand out Homework 7 to re-inforce C++ programming click here


    That's all, Folks !





  22. Additional Enrichment Material: Intel 80x86 programming (not covered in CS255)


    Rough notes on Intel Assemler programming:

    Other resources:

    • Matloff GNU assembler programming tutorial: click here
    • Sourceforge GNU assembler programming tutorial: click here

    • Free Intel Macro Assembler (if you want to write assembler on your PC): RIGHT click here and SAVE AS
    • Intel Assembler Programming book - this book is like the CS255 course using Intel Assembler code: click here
    • Step by step Windows programming tutorial shows you how to write window programs, menus, call backs, etc: click here
    • The Art of Assembly Programming (a very good online book, but the 32 bit version uses a non-standard assembler called "HLA" - High Level Assemble language) click here