Question: Write the code in MIPS assemby to compute the day of the week for a given date in the Gregorian calendar using the following method:
Qtspim 5 X . FP Regs Int Regs (16) Data Text int Regs (16) Text PC User Text Segment [00400000][00440000] IPC 1004000001 8240000 lw $4, ($29) 183: I Sao Sap) arge Cause 0 1004000041 2750004 addu $s. $25,4 184: addiu al Sap 4. argy Badvaddr- 1004000081 24a60004 addiu $6, $5,4 ; 185: addiu a2 sal envp Status - 3000410 1004000001 00041080 all $2, $4, 2 186: 31290 Sab 2 1004000101 00023021 addu $6, 96, 92 187: addu $a2 Sa 2 Svo HI 1004000141 00000000 Jal Ox00000000 (main) 188: ja main LO 400 4000131 000 0 0 0 0 0 10p 189 net 10040001el 3402000a ori $2,$o, 10 192: 14 SVO 10 B tr01 1004000201 00000000 syscall 192: syscall syscall 10 (exit) R1 [at] - 0 R2 (VO) - 0 Kernel Text Segment [80000000]..[80010000] R3 [vi] = 0 180000180 00010821 addu $27, $o, $1 ; 90: move ski sat. Save $at R4 (0) - 1800001841 30019000 10 $1, -28672 92: s sv s. Not re-entrant and we can't RS (al] -0 trust sap R6 (2) - 11:44 1800001881 ac220200 SW 52, 512 (51) R7 (a3) - 1800001861 30039000 lui $1, -28672 : 93: sw $a s2 + But we need to use these R8 [t0) = 0 registers R9 [1] = 0 180000290) ac240204 w $4, 516($1) R10 [t2) - 1800001941 40126800 mfc $26, $13 95: mfco Sko 513 . Cause register R1 [t3) - 0 [800001981 001a2082 srl $4, $26, 2 96: srl Sao Sko 2. Extract ExcCode Field R12 [te) - 180000191 30840015 andt $4, $4, 31 ;97: andi Sad Sa Oxf R13 [t5) - 180000100! 34020004 ori $2,$0,4 101: 11 svo syscall (print_str) R14 [t6] -0 180000124 30049000 lui $4, -28672 01 : 102: la ng0 m. R15 (17) - 1800001a81 0000000c syscall ; 103: syscall RIG (50] -0 1800001acl 34020001 or $2. $0,1 105: 1 Svo 1 syscall i (print_int) R17 (81) - 0 1800001b01 c01a2082 srl $4, $26, 2 ; 106: srl Sad Sko 2. Extract ExeCode Field RIS (521 180000154) 30840015 andi $4, $4, 31 107: andi $a0 $a Oxit R19 (83) - 180000108 0000000c syscall ; 108: syscall R20 [84] -0 1800001bcl 34020004 ori $2. $0.4 110: 11 svo 4 i syscall 4 (printstr) R21 (85) 180000100i 3344003candi $4, $26, 60 i 111: andi Sao Sko Ox3c R22 (56) - 180000104 3c019000 lui $1. -28672 - 112: lw $a0 _exep (Sa) R23 (7) - 1800001c8! 00240821 addu $1. $1, $4 R24 [18] -0 1800001cel 8e240180 lw $4, 384($1) R25 [t? 4800001d01 0000 0000 np 1. TOP R26 (ko) - 0 (800001041 0000000e syscall 114: xysea11 R27 [ki] -0 1800001081 34010018 or $1. $0, 24 ; 116: One Sko 9x18 okupe i Bad PC exception Copyright 1990-2012, James R. Larus. All Rights Reserved SPIM is distributed under a BSD license. See the file README for a full copyright notice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
