Question: INSTRUCTIONS: Add to this MIPSym program with MIPS Assembly Language to display the CURRENT ( and UPDATED ) date and time. 1 . Use syscall
INSTRUCTIONS: Add to this MIPSym program with MIPS Assembly Language to display the CURRENTand UPDATED date and time.
Use "syscall $datetime" to acquire the information, unpack it into global variables declared like:
extern year,
extern month,
etc.
Print the output like this example: April :: PM This is an example and program will give updated current time when ran.# Description of syscall $datetime:
# Returns local datetime, spanned across $v$v
# Bits from high$v to low$v: bitsyear, month, day, hour, min, secmil, local timezone offset from UTC
# Description of syscall $datetime:
# Returns local datetime, spanned across $v$v
# Bits from high$v to low$v: bitsyear, month, day, hour, min, secmil, local timezone offset from UTC
data
#extern month,
monthNames: word
asciiz "January"
asciiz "February"
asciiz "March"
asciiz "April"
asciiz "May"
asciiz "June"
asciiz "July"
asciiz "August"
asciiz "September"
asciiz "October"
asciiz "November"
asciiz "December"
word
code
globl
comma: asciiz
space: asciiz
hour: word
day: word
month: word
year: word
temp: word
code
globl main
#find bits per char, word, reg, etc
main:
#jal printhr
jal printmonth
#jal printday
#la $acomma
#syscall $printstring # Print a separator if needed
#syscall $printchar
#jal printyear
syscall $exit
printday:
mov $a$
syscall $datetime
andi $t$vxF #
andi $t$tb # BITS
#srl $v$v
#sw $tday
mov $a$t
syscall $printint
jr $ra
printmonth: # bits
mov $a$
syscall $datetime
#move $a$a
#w $ahour
#andi $t$vxA
andi $t$vxFFFFFFFF
andi $t$vb
andi $t$tb
#sll $t$v
sw $tmonth
move $a$t
#srl $t$v
#srl $v$v
#
#andi $t$tb # BITS
#sw $tmonth
#mov $a$t
syscall $printint
jr $ra
printyear:
mov $a$
syscall $datetime
andi $t$vxFFFFFFFF #
andi $t$tb # BITS
srl $v$v
sw $tyear
mov $a$v
#mov $a$t
syscall $printint
jr $ra
printhr:
mov $a$
sw $ahour
syscall $datetime
andi $t$vxC
andi $t$tb # BITS
srl $v$v
sw $thour
move $a$t
syscall $printint
jr $ra
#print min
#print sec
#print ms
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
