Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Step: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

How does your message use nonverbal communication?

Answered: 1 week ago

Question

4. EMC Corporation

Answered: 1 week ago

Question

6. Vanguard

Answered: 1 week ago