Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Dear Chegg tutors, Many students are struggling with this exercice and many of y

ID: 3765860 • Letter: D

Question

Dear Chegg tutors, Many students are struggling with this exercice and many of you post random answers just to fill up the gap. Can anyone please take the time and energy to work on this? It has to assemble and compile correctly on MARS. I do not mind paying extra:

Write and submit a MIPS Assembly Language program which: 1) reads the year of interest from user input, 2) displays the dates and time of all full moons for the year, and 3) identifies the monthly and seasonal blue moons which occur during that year. The program must make use of subprograms (functions, methods, subroutines, etc.). The program must be properly documented which includes in file comments.

Again, if I have to, I would pay extra.

Explanation / Answer

.data

prompt2:
.asciiz "Enter day you wish to Display: "
prompt:
.asciiz "Enter the year you wish to Display: "
Year:
.word 0
Yes_LY:
.asciiz " This year is a Leap Year "
Not_Ly:
.asciiz " This year is an Not a Leap year "
normYear:
.word 1 32 60 91 121 152 182 213 244 274 305 335
leapYear:
.word 1 32 61 92 122 153 183 214 245 275 306 336
January: .asciiz " Jan "
Febuary: .asciiz " Feb "
March: .asciiz " Mar "
April: .asciiz " Apl "
May: .asciiz " may "
June: .asciiz " Jun "
July: .asciiz " Jly "
August: .asciiz " Aug "
September: .asciiz " Sep "
October: .asciiz " Oct "
November: .asciiz " Nov "
December: .asciiz " Dec "

.text # all routines
main:
li $v0, 4
la $a0, prompt2
syscall
li $v0, 5
syscall
move $s1,$v0

li $v0,4
la $a0, prompt
syscall
li $v0, 5
syscall
move $s4,$v0
Leap_Year: li $v0, 4


get the integer (year)
used for system input
calls for entering year
store the result


add $t0, $zero, $s4
li $t1, 4
div $t0, $t1
mfhi $t1
bne $t1, $0, Not_LY
greater than 0 go to Not_LY
li $t1, 100
a leap year
div $t0, $t1
mfhi $t1
bne $t1, $0, Leap
or equal to 0 go to Leap


li $t1, 400
not a leap year
div $t0, $t1
mfhi $t1
bne $t1, $0, Not_LY
greater than or equal to 0 go to Not_LY

# if year is divisible by 400 is

# t0 = t1
# t1 = t0
# if t1 less than or greater than

# t0 = t1
# t1 = t0
# if t1 less than or

Leap:
li $v0, 4
la $a0, Yes_LY
syscall
j leapYear1
Not_LY:

li $v0, 4
la $a0, Not_Ly
syscall

to LeapYear1

# Print " It's not a leap year

"
normYear1:
addi $t0, $0, 0
addi $t1, $0, 0
addiding and assigning all
the values from $1-$t6 to 0
addi $t2, $0, 0
addi $t3, $0, 0
addi $t4, $0, 0
addi $t5, $0, 0
addi $t6, $0, 0

la $s0, normYear
addi $t0, $0,0
addi $t1,$0,1

normYearLoop:
sll $t3, $t1, 2
$t3
sll $t2, $t0, 2

add $t2, $t2, $s0
add $t3, $t3, $s0
lw $t4, ($t2)
lw $t5, ($t3)
bgt $s1, $t5, incrementNorm
sub $s2, $s1, $t4
addi $s2, $s2, 1
j display


incrementNorm:
addi $t0, $t0, 1
addi , $t1 $t1, 1

# incrementing

j normYearLoop

# jumpt to normYearloop

display:
li $v0, 1
add $a0, $s2, $0
syscall

# display

Jan:
addi $t4, $0, 0
bne $t0, $t4, Feb
go to next month
li $v0,4
la $a0, January
syscall
j Exit

Feb:
addi $t4, $0, 1
bne $t0, $t4, Mar
li $v0,4
la $a0, Febuary
syscall
j Exit


Mar:
addi $t4, $0, 2
bne $t0, $t4, Apl
li $v0,4
la $a0, March
syscall
j Exit

Apl:
addi $t4, $0, 3
bne $t0, $t4, may
li $v0,4
la $a0, April
syscall
j Exit

may:
addi $t4, $0, 4
bne $t0, $t4, Jun
li $v0,4
la $a0, May
syscall
j Exit

Jun:
addiding value to $t4
If not equal to asked value
addi $t4, $0, 5
bne $t0, $t4, Jly
li $v0,4
la $a0, June
syscall
j Exit

July:
addi $t4, $0, 6
bne $t0, $t4, Aug
li $v0,4
la $a0, July
syscall
j Exit

Aug:
addi $t4, $0, 7
bne $t0, $t4, Sep
li $v0,4
la $a0, August
syscall
j Exit

Sep:
addi $t4, $0, 8
bne $t0, $t4, Oct
li $v0,4
la $a0, September
syscall
j Exit

Oct:
addi $t4, $0, 9
bne $t0, $t4, Nov
li $v0,4
la $a0, October
syscall
j Exit

Nov:
addi $t4, $0, 10
bne $t0, $t4, Dec
li $v0,4
la $a0, November
syscall
j Exit

Dec:
addi $t4, $0, 11
bne $t0, $t4, Exit
li $v0,4
la $a0, December
syscall
j Exit

leapYear1:
addi $t0, $0, 0
addi $t1, $0, 0
addi $t2, $0, 0
addi $t3, $0, 0

Assigning $t0-$t6 register to 0

addi $t4, $0, 0
addi $t5, $0, 0
addi $t6, $0, 0
addi $t0, $0, 0
addi $t1,$0,1

leapYearLoop:
la $s0, leapYear
sll $t3, $t1, 2
sll $t2, $t0, 2
add $t2, $t2, $s0
add $t3, $t3, $s0
lw $t4, ($t2)
lw $t5, ($t3)
bgt $s1, $t5, incrementLeap
increment leap

sub $s2, $s1, $t4
addi $s2, $s2, 1
j display2
incrementLeap:
addi $t0, $t0, 1
addi , $t1 $t1, 1


display2:
li $v0, 1
add $a0, $s2, $0
syscall

Jan1:
add $t4, $0, $0
bne $t0, $t4, Feb1
month
li $v0,4
la $a0, January
syscall
j Exit

Feb1:
addi $t4, $0, 1
bne $t0, $t4, Mar1
month
li $v0,4
la $a0, Febuary
syscall
j Exit

Mar1:
addi $t4, $0, 2
bne $t0, $t4, Apl1
li $v0,4
la $a0, March
syscall

j Exit

Apl1:
addi $t4, $0, 3
bne $t0, $t4, may1
li $v0,4
la $a0, April
syscall
j Exit

may1:
addi $t4, $0, 4
bne $t0, $t4, Jun1
li $v0,4
la $a0, May
syscall
j Exit

Jun1:
addi $t4, $0, 5
bne $t0, $t4, Jly1
li $v0,4
la $a0, June
syscall
j Exit

July1:
addi $t4, $0, 6
bne $t0, $t4, Aug1
li $v0,4
la $a0, July
syscall
j Exit

Aug1:
addi $t4, $0, 7
bne $t0, $t4, Sep1
li $v0,4
la $a0, August
syscall
j Exit

Sep1:
addi $t4, $0, 8
bne $t0, $t4, Oct1
li $v0,4
la $a0, September
syscall
j Exit

Oct1:
addi $t4, $0, 9
bne $t0, $t4, Nov1
li $v0,4
la $a0, October
syscall
j Exit

Nov1:
addi $t4, $0, 10
bne $t0, $t4, Dec1
li $v0,4
la $a0, November
syscall
j Exit

Dec1:
addi $t4, $0, 11
bne $t0, $t4, Exit
li $v0,4
la $a0, December
syscall
j Exit

Exit:
li $v0, 1
add $a0, $s4, $0
syscall
li $v0 10
syscall

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote