Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

so far i was able to get it mostly complete but I'm stuck on the day and mod my code is below. please help.. coding

image text in transcribed

so far i was able to get it mostly complete but I'm stuck on the day and mod

my code is below. please help.. coding is in MIPS

.data

year: .word 2021 month: .word 3 day: .word 17

.text

main: a: li $t0, 14 # sets register t0 = 14 lw $t1, month #loads word data sub $t0,$t0,$t1 #subtracs month from t1-t0 move $a0,$t0 #moves t0 into t5. div $a0,$a0,12 # divide 11/12 move $t4,$a0 #move $a0 value into $t4 (a value)

y:

lw $t2,year #loads year value into $t1 sub $a0,$t2,$t4 # $t2(2021)-$a0 (11/12) move $t5,$a0 #move $a0 value into $t5 (year value)

m:

lw $t1,month #load month value into $t1 mul $a0,$t4,12 add $a0,$a0,$t1 sub $a0,$a0,2 # subtract $t2 move $t6,$a0 #move $a0 into $t6 (m value) d:

lw $t3, day li $t2, 31 add $a0,$t3,$t5 #add day(17)+$t5(year 2021) li $v0, 1 #print code syscall div $a0,$t5,4 li $v0, 1 #print code syscall div $a0, $t5,100 li $v0, 1 #print code syscall div $a0,$t5,400 li $v0, 1 #print code syscall mul $a0,$t1,31 div $a0,$a0,12

li $v0, 1 #print code syscall

li $v0, 10 #end syscall

.end main

Description: Write the code to compute the day of the week for a given date in the Gregorian calendar using the following method: 14-month 12 y = year- in = month +12a - 2 31m mod 7 For Gregorian calendar: d = (day+y+1 - 1 + 8 + 31m) The value of d is 0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc. 1. Declare the variables day, month, year and initialize them with March 15, 2021. 2. Compute and output the day of the week value(d) for day, month, year. 3. Declare and store the result(d) in the variable dow. 4. Output the value of the variable dow

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

In what industries operating costing is used?

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago