Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add the following macro in this cs47_macro.asm lwi ($reg, $ui, $li) : This macro takes two 16-bit immediate values $ui and $li and put them

Add the following macro in this cs47_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 pa03.asm. This should create following sample output

Register S1 contains integer number 1515890085

pa03.asm:

.include "./cs47_macro.asm"

.data msg1: .asciiz "Register S1 contains integer number " newline: .asciiz " "

.text .globl main main: # lui overrides the lower word li $s1, 0xa5a5 lui $s1, 0x5a5a # Macro to load complete word lwi ($s1, 0x5a5a, 0xa5a5) # print the value print_str(msg1) print_reg_int($s1) print_str(newline) exit

cs47_macro.asm:

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

) .macro print_str($arg) li $v0, 4 # System call code for print_str la $a0, $arg # Address of the string to print syscall # Print the string .end_macro # Macro : print_int # Usage: print_int() .macro print_int($arg) li $v0, 1 li $a0, $arg syscall .end_macro #read .macro read_int($reg) li $v0, 5 syscall move $reg, $v0 .end_macro #print .macro print_reg_int($reg) li $v0, 1 move $a0, $reg syscall .end_macro

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

2. What, according to Sergey, was strange at this meeting?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago