# 1. Assignment 4¶

CS240, Fall 2015, Professor Blank

Student 1:

Student 2:

Write machine code for each of the following problems, assemble them, and run them. Point out how to tell that you got the answer. Explain how your code works.

## 1.1 Problem¶

Add up the numbers 1 through 10 (use a branch).

## 1.2 Problem¶

Add up the numbers 10 through 20 (use a branch).

## 1.3 Problem¶

Subtract 5 from 7.

## 1.4 Problem¶

Subtract 7 from 5.

## 1.5 Problem¶

Multiply 2 times 7. Multiplying by two could be called "shift left".... why?

## 1.6 Problem¶

Multiply 5 times 7 in a generic way. Make your code so that you could change either 7 or 5 and the code would still work.

## 1.7 Problem¶

How many times will 3 go into 11? Make your code so that you could change either 3 or 11 and the code would still work.

## 1.8 Problem¶

How many times will 4 go into 33? Make your code so that you could change the data and it would still work.

## 1.9 Problem¶

Is the number 5 in the range of numbers 1 through 10? Make your code so that you could change 10 or 5 and it would still work.

## 1.10 Problem¶

Put a number in R0. If the number in R0 is even, put the number xFF in R1, otherwise put x00 in R1.