Question: Use tool 'MARS' to Solve the problem: Download third.asm and macro.asm in a same directory. Add the following macro in this macro.asm : lwi ($reg,

Use tool 'MARS' to Solve the problem:

Download third.asm and macro.asm in a same directory.

Add the following macro in this macro.asm:

lwi ($reg, $ui, $li) : This macro takes two 16-bit immediate values $ui and $li and put them into higher bits and lower bits of $reg. For example lwi($s1, 0x5a5a, 0xa5a5) will place a value 0x5a5aa5a5 into $s1 register.

Assemble and execute third.asm. This should create following sample output Register S1 contains integer number 1515890085

============================================================

The given .asm document is as follow: macro.asm:

Use tool 'MARS' to Solve the problem: Download third.asm and macro.asm in

a same directory. Add the following macro in this macro.asm: lwi ($reg,

third.asm:

$ui, $li) : This macro takes two 16-bit immediate values $ui and

=================================================================

All the information are already shown above, just need help with the macro in macro.asm.

Please help, thank you!

-- MACRO DEFINITIONS ------ -----------> # Macro : print_str # Usage: print_str(

) .macro print_str($arg) $v0, 4 # System call code for print str Sal, $arg # Address of the string to print syscall # Print the string .end_macro li la # Macro : print_int # Usage: print_int () .macro print_int($arg) $v0, 1 # System call code for print int Sal, Sarg # Integer to print syscall # Print the integer .end_macro .macro read_int($reg) li $v0, 5 #system call code to read int syscall move $reg, $v0 .end_macro .macro print_reg_int($reg) li $v0, 1 move $al, $reg syscall .end_macro .macro swap_hi_lo($templ, $temp2) mtlo $a0 mflo $templ mthi $a0 mfhi Stemp2 .macro print_hi_lo($strHi, $strEqual, $str Comma, stro) li $v0, 4 la $ab, $strHi #Address of the string to print syscall li $v0, 4 $al, $strEqual #Address of the string to print syscall $v0, 4 la $al, $strComma #Address of the string to print syscall # Macro : exit # Usage: exit .macro exit li $v0, 10 syscall .end_macro . include "./macro. asm" WN .data msgl: .asciiz "Register sl contains integer number" newline: .asciiz "n" 6 .text .globl main 9main: 10 # lui overrides the lower word li $sl, Oxa5a5 lui $sl, Ox5a5a # Macro to load complete word lwi ($sl, Ox5a5a, Oxa5a5) # print the value print_str(msgl) print_reg_int($sl) print_str(newline) exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!