Description
In our fifth lab, you and your partner will build a simple ARM program as outlined below. Once finished, you can use the remaining time to ask your TA questions about the current assignment.
Steps
Find your lab partner. Then:
- Login to a Systems Lab machine using your MSCSnet username and password. The west side of the Lab has Linux machines, while the opposite side has Windows machines.
That said, if you are on a Linux box, you can open a terminal prompt and run commands accordingly. If you are on a Windows machine,
you will have to ssh into an appropriate Lab machine (such as morbius) using PuTTY.
- Using the mkdir command, create a directory that will hold your programming labs. Creating subdirectories within this directory will help keep your labs organized, but this is optional.
- Once you've created the lab directory, lock it down with chmod go-rwx name-of-labdir.
- If you chose to create a subdirectory (e.g. lab5), make sure to change into it with cd lab5.
- Grab a fresh ARM Playground tarball by running this command: tar xvzf ~pmcgee6/cosc2200/pi3Playground.tgz View the README.txt file if you'd like.
- Write your program in your preferred text editor (I recommend vim) according to the specification below.
- Once finished, show a demo of your program to the present TA.
- Like in the past labs, you can continue to improve your program and show demos to the TA until you receive full points.
- If you finish early, you can use the remaining time to ask your TA questions about the current assignment.
Using the divide function
The divide function takes a dividend in r0 and a divisor in r1; upon return, the integer quotient is stored in r0 and any remainder in r1.
The Program: Even/Odd Checker
Write an assembler program that reads in integers from the user until a zero is entered. After each integer is entered, the program will output 1 if the integer is even, and 0 if the integer is odd.
Example:
? 1
0
? 2
1
? 4
1
? 8
1
? 9
0
? 45
0
? 101
0
? 102
1
? 0
All user process have completed.