CSE 378 Winter 2006
Lecture 3 Examples (1/9/2006)

In the code samples below, lines beginning with '#' are comments. The comment section at the top of each indicates what the code is trying to compute.

The bottom of each file shows the machine instructions generated for the code. The first hex number is the PC, the second the instruction encoding.

  1. straightline.s No branching.
  2. ifStatement1.s An if statement testing inequality with 0.
  3. ifStatement2.s An if statement doing a relative comparison of two register values.
  4. forLoop.s A simple for loop.