Bryn Mawr College
CS 240: Principles of Computer Organization
Due before start of class on Friday, April 30. Extra Credit Due on Friday, May 7, 2021.
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 deadlines are 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, 2020 is the 32nd day of the year.
You can place the date in pre-assigned registers. For example: R0/R1/R2 = (mm/dd/yyyy).
It should output the date and the result on the console: The date is: 02/01/2020 It is day 32 of the year.
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