header

Week 9 Homework

Due Mar 18

Machine Language Programs

Problem 1

Write a machine language program to implement the following Java-like instruction:

y = ax + b;

where a = 3, b = 5, and x = 10. Since we can't do multiplication, you'll have to figure out another way to find 3x. To initialize the variables, just type their values directly into the LV section of memory. Submit your solution as follows:

  1. A table showing the offset (from LV) for each of the four variables.
  2. Your program as a comma-delimited list of byte values (in decimal).

Problem 2

Repeat problem 1 but make your program a stand-alone program that initializes its own variables:

a = 3;
b = 5;
x = 10;
y = ax + b;

Submit your program in the same format as problem 1.