Question: Templates: PA01: .include ./macro.asm ## ## .data msg1: .asciiz Please enter a number? msg2: .asciiz You have entered # newline: .asciiz

 Templates: PA01: .include "./macro.asm" ## ## .data msg1: .asciiz "Please enter

Templates:

PA01:

.include "./macro.asm"

## ## .data msg1: .asciiz "Please enter a number? " msg2: .asciiz "You have entered # " newline: .asciiz " " ## .text .globl main main: print_str(msg1) read_int($t1) print_str(msg2) print_reg_int($t1) print_str(newline) exit

macro.asm:

## # 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 # System call code for print_int li $a0, $arg # Integer to print syscall # Print the integer .end_macro # Macro : exit # Usage: exit .macro exit li $v0, 10 syscall .end_macro Instructions: . Download pa01.asm and macro.asm in same directory. Extend macro.asm to include following two macros: o 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. o 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 macro.asm) and execute. The main program should create output on STDIO as following. Please enter a number? 56 You have entered # 56 Upload updated macro.asm (do not change the file name). Do not upload pa01.asm. Instructions: . Download pa01.asm and macro.asm in same directory. Extend macro.asm to include following two macros: o 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. o 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 macro.asm) and execute. The main program should create output on STDIO as following. Please enter a number? 56 You have entered # 56 Upload updated macro.asm (do not change the file name). Do not upload pa01.asm

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!