Bryn Mawr College
CS 240: Computer Organization
Due in class on Thursday, December 8, 2011
This exercise describes two LC-3 assembly language programs. For this assignment you can choose to do either one. For extra credit (equivalent to a full assignment credit) you may do both. The deadline is firm. There will be no extensions.
Description#1: Write an LC-3 assembly language program to compute the day of the year, given a date. For example, Feb 1, 2011 is the 32nd day of the year.
You can place the date in pre-assigned registers. I.e. R0/R1/R2 = (mm/dd/yyyy).
It should output the date and the result on the console.
Description#2: Write an LC-3 assembly language program to play a simple guessing the number game. Assume that the program has stored a number between 0-9 (inclusive). The program gives the user at most 5 chances to guess the number. The user will enter her guesses from the keyboard when prompted (use the TRAP instructions).
If a user's guess is larger than the selected number, the program should output:
if smaller, it should output:
If correct, it should output:
Correct! You took # guesses.
where # is the number of guesses. If after 5 guesses the user has not guessed the number, the program should output:
Game over. Correct answer is #.
where # is the number selected. If the user enters a character other than 0-9, the program should output:
And count that as a guess, and go on.
Back to CS240 Home Page