CS255 Syllabus & Progress

CS255 Syllabus & Progress


Material covered are displayed in blue.


    Search the lecture notes:


  1. Intro to CS255: click here

  2. Intro to Computer Architecture



  3. The Computer System (details of the memory and the CPU)



  4. The program translation (compilation) process - from high level language to machine code


    Homework 1 re-enforces computer architecture concepts:
    click here



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

  5. Storing Boolean data inside a computer



  6. Representing and storing unsigned integer (= whole) numbers inside a computer



  7. Representing and storing signed integer (whole) numbers inside a computer


    Homework 2 re-enforces number system concepts: click here




  8. Representing text data inside the computer:

    • ASCII code: click here --- slides
    • Unicode: click here --- slides

    • Human <==> Computer communication (explains the need for conversion from ASCII to other representation and vice versa):

    • Boolean input and output:
      • Pre-requisite: Java Strings click here --- slides
      • How to enter Boolean inputs - converting between ASCII String representation and Boolean representation: click here --- slides
      • How computers print out Boolean outputs - converting between Boolean representation to ASCII String representation: click here --- slides

    • Numeric input/output - Converting between ASCII String representation and int 2's complement representation:
      • Introduction: click here --- slides

      • Java pre-requisites for String <==> Integer conversion:

      • How to enter integer inputs - Conversion algorithm ASCII representation -> 2's complement representation:
      • How computers print out integer values - Conversion algorithm 2's complement representation -> ASCII representation :

        (My old notes on conversion algorithms: click here)

    Project 3 re-enforces string ⟷ 2's complement conversion: click here




  9. Representing computer instructions inside the computer (intro to hardware):




  10. Intro to assembler programming using the ARM processor




  11. The two assembler program section/segments (text segment and data segment)





  12. Assembler programming with integer constants and simple integer variables





  13. The array data structure (teach with demo/asm/3-array/demo.s)





  14. The linked list data structure (teach with demo/asm/4-linked-list/demo1.s and demo2.s)


    Project 5 re-enforces access technique to structured variables (arrays and linked lists): click here



    • My summary notes on ARM assembler programming techniques used to prepare the CS255 material: click here
    • A single sheet summary of ARM instruction nmenomic codes : click here
    • Documentation - the complete ARM Instruction set and encoding (not part of syllabus material): 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. We will discuss various program flow control structures next.





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






  16. The Loop Statements:



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

    The midterm test will cover the material upto this point and will be scheduled soon.


    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...).







  17. Subroutines (a.k.a. methods, procedures, functions)






  18. Leaf functions with parameters and local variables in CPU registers
    • Introduction: click here --- slides

    • Passing parameters to a function and passing return values using CPU registers:
      • Intro: using CPU registers to pass parameters and return values: click here --- slides
      • Sequencing of events in function call + return with parameters and return values: click here --- slides
      • sumSquares(a,b): using CPU registers to pass parameters and return values click here --- slides


    • sumRange(A, a, b): using registers as local variables: click here --- slides


    Project 7 (Bubblesort) re-enforces the use of registers for passing parameters and storing local variables: click here

  19. Non-Leaf functions with parameters and local variables in the runtime stack



  20. Recursive subroutines/methods: (are always non-leaf functions !)
    • Introduction: click here --- slides

    • First recursive method in assembler, the classic factorial function: click here --- slides

    • Second recursive method in assembler: click here --- slides


      Programming project pj8 re-enforces storing parameters and local variables on stack with a recursive function: click here



      I inserted some material here to help you understand how to write program using the recursion technique --- these material are not part of CS255 curriculum:

      But I will discuss these webpages (quicker than usual) to help you understand the next topic: use recursion to manipulate linked lists



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






  21. Recursion with linked lists:
    • Introduction: click here --- slides

    • Remember how linked lists are stored inside the computer: click here --- review slides

    • Inserting a new element at the tail of the list using a recursive algorthm:
      • My CS170 page on designing a recursive "insert at tail of list" algorithm: click here --- slides
      • Implementing the recursive "insert at tail of list" algorithm in ARM assembler code: click here --- slides



    Programming project pj9 re-enforces recursion with inserting in an ordered linked list: click here



  22. Parameter passing techniques:


    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 Intel assembler programming material after the C lecture notes to demonstrate this process. (These notes are not part of the CS255 curriculum - it's "for your eyes only")





    Abbreviated C teaching pages:

      • Introduction:

      • The C-compiler - 1-pass compilers and 2-pass compilers: slides

      • Things in C that you must be aware as a Java programmer:

      • Variable definition/declaration and variable usage in C:
        • Local variables (scoping and life time): slides
        • Global variables (scoping and life time): slides
        • Special storage variables (static local and static global): slides

      • Function definition/declaration and function usage in C:
        • Defining functions, using/calling functions and parameter passing mechanism in C: slides
        • Declaring functions: slides
        • C programming practice: use header files to hold declarations (and type definitions): slides

      • Structured variables:
        • Arrays (one-dim and 2-dim): slides
        • C struct and data type (like Java "objects"): slides

      • The reference data type:
        • Intro to the reference data type: slides
        • The operations/operators on reference data types: slides
        • Function with reference data types parameters - "DIY pass-by-reference": slides
        • Pointer to user-defined (struct) typed variables: slides
        • The (short-hand) pointer-member-access operator ->: slides

      • Linked list in C:
        • Intro to list programming in C: slides
        • Allocating memory space for list elements (i.e., "creating list objects") in C: slides
        • Inserting a new list element at the tail of a list: slides
        • Deleting element at the start of a list: slides

      • Pointer arithmetic and dynamic arrays:
        • Intro to pinter arithmetic using dynamic arrays: slides
        • Pointer arithmetic: slides
        • The short-hand operator [ ]: slides
          *** The Final will cover all the material above this line ***
        • Using the ++ operator to traverse an array: slides

      • Debug C programs: slides

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



  24. C's data types and variables:



  25. Basic input/output:



  26. Operators:



  27. Statements:



  28. Arrays: (C has static arrays, Java has dynamic arrays)



  29. Function (= method) definition:
    • Defining and calling a function in C: click here
    • Array parameters click here

    • No overloaded functions in C !!!! click here

    • The Parameter passing mechanism of C: click here

    • Automatic conversion of parameter types and return value types in function call:



  30. Function declaration:



  31. Multi-files C programs - the importance of declaring functions:


  32. The make (UNIX) utility: (Make will not be covered in the final)

    Hand out C Project 1: click here





  33. Intermediate topics: language features that are available in C and Java but work differently

    • User-defined types: (i.e.: structures)

    • Life time and scope of variables in C:
      • Review: Life time and Scope of the variables: click here

      • Kinds of variables in C: click here

      • Life time of variables in C (and when is a variable initialized ?): click here
      • Scope of variables in C:
        • Scoping rules for: (1) global, (2) static global and (3) static local variables: click here
        • Scoping rules for local and parameter variables in C: click here (pay attention !)

    • Applying the scoping rules --- how to make sure variables in a C program are accessible in multi-files C programs
      • Intro: accessing variables in a multi-files C programs: click here
      • Making global variables accessible in multi-files C programs through declaration: click here

    • Debugging a C program: (debugging will not be covered in the final)



  34. C language features that are not found in or different from Java (pointer data type !)

    • The reference data type and reference (pointer) variables (Java does NOT have this data type !!!)
      • Reference (pointer) data type and variables: click here
      • The reference (&) operator click here
      • Storing the result of reference (&) operator in reference data typed variables: click here
      • Using reference variables --- the dereference (*) operator: click here

      • First application of reference variables: pass parameters pass-by-reference: click here

    • Pointer to user-defined type:

    • Using pointers to create and maintain linked lists in C:

    • Pointer arithmetic and Arrays


    • Take a look at precedence and associativity of the new C's operators that you have learned: click here

    • Strings in C --- arrays of char: click here
    • Some Strings functions in C Standard library click here
    • Array of Strings --- command line arguments: click here





  35. Miscellaneous topics in C

    • Special kinds of variables in C:

    • Function parameters:
      • Passing a function as a parameter to a function: click here


    C documentations:


    That's all, Folks !





  36. 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