Question
Use 'MARS' to Solve the problem: Extend macro.asm to include following two macros: 1. read_int($reg) : To read an integer value from STDIO into given
Use 'MARS' to Solve the problem:
Extend macro.asm to include following two macros:
1. read_int($reg) : To read an integer value from STDIO into given register. For example read_int($t2) will wait for user input for an integer and will store it in register $t2.
2. print_reg_int($reg): To print integer value in given register on STDIO. For example print_reg_int($t2) will print integer value stored in $t2 register on STDIO.
Assemble first.asm (which includes macro.asm) and execute.
The main program should create output on STDIO as following. Please enter a number? 32 You have entered # 32
==============================================================
The given .asm document is as follow:
macro.asm:
first.asm:
=================================================================
The final answer should be only one .asm file. Please help, thank you!
------- MACRO DEFINITIONS # Macro : print_str # Usage: print_str() .macro print_str($arg) $v0, 4 # System call code for print_str la $al, $arg # Address of the string to print syscall # Print the string .end_macro # Macro : print_int # Usage: print int (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