Question: LC3 Introduction : Your job is to write a program in LC-3 assembly language that provides the day of the week for any date between

LC3

Introduction: Your job is to write a program in LC-3 assembly language that provides the day of the week for any date between January 1, 1901 and the present day.

Specifics: Input : Your program will start at address x3000 and will work with other modules that will load x31F0, x31F1, x31F2 before your program computes the day of the week. You can assume that before your program executes, x31F0, x31F1, and x31F2 will contain data as follows:

x31F0: the day of the month (a number from 1 to 31). x31F1: the month (a number from 1 to 12, corresponding to Jan to Dec). x31F2: the year (a four digit number)

For example October 2, 1989 will be stored as:

x31F0 : #2 x31F1 : #10 x31F2 : #1989

You should test your program by supplying values in these three memory locations and then running your program.

Output :

(A) Store the code for the day of the week in x31F3. For example, in the case of April 10, 1901, you must store a 3 in x31F3. Use the following codes for the DAY of the WEEK:

Sunday = 0 ,Monday = 1, Tuesday = 2 , Wednesday = 3, Thursday = 4 , Friday = 5, Saturday = 6

(B) Display on the screen the message: The day is <>.

For example, in the case of 02 10 1989, the screen should display: The day is Monday.

Example:

Suppose we want to find out the day of the week that July 4, 1999 fell on. Your program must start with the three locations containing the values shown:

x31F0 : #4 x31F1 : #7 x31F2 : #1999.

Since 1999 -1901 = 98, and January 1, 1901 was a Tuesday, January 1, 1999 is a Friday. Since January 1, 1999 was a Friday, July 1 was a Thursday. Since July 1, 1999 was a Thursday, July 4 was a Sunday.

Thus, the program stores 0 in x31F3, and displays: The day is Sunday.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!