Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Description: Write a program that prompts the user for the month and year and outputs a mini monthly calendar in QtSpim with mips assembly. You
Description:
Write a program that prompts the user for the month and year and outputs a mini monthly calendar in QtSpim with mips assembly.
You can assume the input month and year will be valid, but account for leap years
Required IO:
Mini Calendar by F Last
Enter the month?
Enter the year?
March
Sun Mon Tue Wed Thu Fri Sat I
q
cdotscdotscdotscdotscdotscdotscdots
cdotscdotscdotscdotscdots
cdots I
cdotscdotscdotscdotscdots
cdots are spaces, is new line character.
This is what I have so far, but I am having trouble starting the print from the correct day as well as making the alignment resemble the examples in picture: data
text: asciiz "Mini Calendar by A Palacios
mprompt: asciiz
Enter the month?
yprompt: asciiz "Enter the year?
space: asciiz
newline: asciiz
days: word
dOfWeek: asciiz "Sun Mon Tue Wed Thu Fri Sat
daySpace: asciiz
oneSpace: asciiz
twoSpaces: asciiz
text
globl main
main:
li $v
la $a text
syscall
li $v
la $a mprompt
syscall
li $v
syscall
move $t $v
li $v
la $a yprompt
syscall
li $v
syscall
move $t $v
blt $t adjustmonth
b calculateday
adjustmonth:
addi $t $t
addi $t $t
b calculateday
calculateday:
li $t
li $t
addi $t $t
mul $t $t $t
div $t $t
mflo $t
andi $t $tx
srl $t $t
add $t $t $t
add $t $t $t
srl $t $t
add $t $t $t
srl $t $t
add $t $t $t
li $t
mul $t $t $t
sub $t $t $t
andi $t $tx
addi $t $t
rem $t $t
bnez $t notleap
rem $t $t
bnez $t leap
rem $t $t
beqz $t leap
b notleap
notleap:
li $t
b continue
leap:
li $t
continue:
addi $t $t
sll $t $t
lw $t days$t
beq $t checkleap
b printcalendar
checkleap:
beq $t febleapyear
b printcalendar
febleapyear:
addi $t $t
b printcalendar
printcalendar:
li $v
la $a dOfWeek
syscall
move $t $t
li $t
blt $t $t printinitialspaces
b printdays
printinitialspaces:
li $v
la $a daySpace
syscall
addi $t $t
blt $t $t printinitialspaces
printdays:
li $t
move $t $t
printdaysloop:
ble $t $t printdaynumber
b endprintingdays
printdaynumber:
beqz $t printnewline
li $v
move $a $t
syscall
blt $t printonespace
b updateday
printonespace:
li $v
la $a oneSpace
syscall
b updateday
printnewline:
li $v
la $a newline
syscall
li $t
li $v
move $a $t
syscall
blt $t printonespace
b updateday
updateday:
addi $t $t
addi $t $t
rem $t $t
b printdaysloop
endprintingdays:
li $v
syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started