Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using MIPS SPIM Simulator Instructions: Download pa01.asm and cs47_macro.asm in same directory. Extend cs47_macro.asm to include following two macros: read_int($reg) : To read an integer
Using MIPS SPIM Simulator
Instructions:
- Download pa01.asm and cs47_macro.asm in same directory.
- Extend cs47_macro.asm to include following two macros:
- read_int($reg) : To read an integer value from STDIO into given register. For example read_int($t1) will wait for user input for an integer and will store it in register $t1.
- print_reg_int($reg): To print integer value in given register on STDIO. For example print_reg_int($t1) will print integer value stored in $t1 register on STDIO.
- Assemble pa01.asm (which includes cs47_macro.asm) and execute.
- The main program should create output on STDIO as following.
Please enter a number? 56 You have entered # 56
File: cs47_macro.asm
File pa01.asm
cs47_macro (1).asm mips1.asmpa01.asm MACRO DEFINITIONS # Macro : print-str # Usage: print-str (address of the string) macro print str ($arg) $v0, 4 # System call code for print-str a0, $arg # Address of the string to print syscall # Print the string end macro # Macro : print-int # Usage: print-int(val) macro print int ($arg) 10 12 $v0, 1 # System call code for print-Int $a0, $arg # Integer to print 14 15 16 syscall # Print the integer end macro 18 19 20 21 # Macro : exit # Usage: exit macro exit vO 10 syscall end macro 24 25 cs47 macro (1).asm mips1.asmpa01.asm 1 include ./es47 macro. asm APPLICATION P DATA SEGMENT DEFINITIO 5 data 6 msgl sciiz Please enter a number? as c11z "You have entered # " asciiz n 8 newline 10 text 11 elobl main 12 main print str msgl) read int ($t1) print str (msg2) print reg int ($t1) print str(newline) exit 14 16 17 18 cs47_macro (1).asm mips1.asmpa01.asm MACRO DEFINITIONS # Macro : print-str # Usage: print-str (address of the string) macro print str ($arg) $v0, 4 # System call code for print-str a0, $arg # Address of the string to print syscall # Print the string end macro # Macro : print-int # Usage: print-int(val) macro print int ($arg) 10 12 $v0, 1 # System call code for print-Int $a0, $arg # Integer to print 14 15 16 syscall # Print the integer end macro 18 19 20 21 # Macro : exit # Usage: exit macro exit vO 10 syscall end macro 24 25 cs47 macro (1).asm mips1.asmpa01.asm 1 include ./es47 macro. asm APPLICATION P DATA SEGMENT DEFINITIO 5 data 6 msgl sciiz Please enter a number? as c11z "You have entered # " asciiz n 8 newline 10 text 11 elobl main 12 main print str msgl) read int ($t1) print str (msg2) print reg int ($t1) print str(newline) exit 14 16 17 18Step 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