Lab Tasks In Lab 6, you modified the for-loop macro presented in the above tutorial to include an interval. If you missed lab 6 or forgot about that, here is what you needed to do there: Lab 6 starts here: The for loop in the above tutorial prints a range of consecutive numbers. Copy the code from the tutorial to Mars and make it execute. The macro call: for ($t0, 1, 10, body) will lead to printing numbers from 1 to 10, one each in a new line. Your task is to modify the code to pass another argument (an interval) to the macro so that the numbers are printed with the given interval in the same line where a space separates the numbers. Your program will also print a string (“Here is the output: ”) before the series of numbers using the print_str macro. For example,  Macro call: for ($t0, 1, 20, 3, body) will produce the following output:   Here is the output: 1 4 7 10 13 16 19 Lab 6 ends here. Now, in this lab (Lab 7), you will make further modification to the same macro to make the for-loop more versatile. In addition to passing an interval, your macro call will be able to pass a character (‘i’ or ‘d’) indicating if you want to increment or decrement the value of the iterator. In the case of increment, the value of the to argument will be greater than the value of the from argument. Conversely, in the case of decrement, the value for the to argument will be less than the value of the from argument. Examples of macro calls and the output: Call: for ($t0, 1, 20, 'i', 3, body) Output: 1 4 7 10 13 16 19 Call: for ($t0, 20, 1, 'd', 3, body) Output: 20 17 14 11 8 5 2 Hints: In the macro, you may need to load 'i' and 'd' to two registers before comparing it to the increment/decrement type argument-register. You can use li instruction for this purpose. Based on the comparison results, your code will branch to two different labels where the iterator register will either be incremented or decremented. Loop termination conditions need to be appropriately set.              Submission Instructions Submit the complete program (.asm file), and screenshots of the execution of the program that show the output for the following two macro calls: for ($t0, 15, 450, 'i', 5, body) for ($t0, 100, 0, 'd', 10, body)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Introduction to Macros in Mars
Read about macros here:
https://courses.missouristate.edu/kenvollmar/mars/help/MacrosHelp.html
Lab Tasks
In Lab 6, you modified the for-loop macro presented in the above tutorial to include an interval. If you missed lab 6 or forgot about that, here is what you needed to do there:

Lab 6 starts here:
The for loop in the above tutorial prints a range of consecutive numbers. Copy the code from the tutorial to Mars and make it execute. The macro call: for ($t0, 1, 10, body) will lead to printing numbers from 1 to 10, one each in a new line. Your task is to modify the code to pass another argument (an interval) to the macro so that the numbers are printed with the given interval in the same line where a space separates the numbers. Your program will also print a string (“Here is the output: ”) before the series of numbers using the print_str macro. For example, 

Macro call: for ($t0, 1, 20, 3, body) will produce the following output:  

Here is the output: 1 4 7 10 13 16 19
Lab 6 ends here.

Now, in this lab (Lab 7), you will make further modification to the same macro to make the for-loop more versatile. In addition to passing an interval, your macro call will be able to pass a character (‘i’ or ‘d’) indicating if you want to increment or decrement the value of the iterator. In the case of increment, the value of the to argument will be greater than the value of the from argument. Conversely, in the case of decrement, the value for the to argument will be less than the value of the from argument. Examples of macro calls and the output:

Call: for ($t0, 1, 20, 'i', 3, body)
Output: 1 4 7 10 13 16 19

Call: for ($t0, 20, 1, 'd', 3, body)
Output: 20 17 14 11 8 5 2

Hints: In the macro, you may need to load 'i' and 'd' to two registers before comparing it to the increment/decrement type argument-register. You can use li instruction for this purpose. Based on the comparison results, your code will branch to two different labels where the iterator register will either be incremented or decremented. Loop termination conditions need to be appropriately set.             
Submission Instructions

Submit the complete program (.asm file), and screenshots of the execution of the program that show the output for the following two macro calls:

for ($t0, 15, 450, 'i', 5, body)

for ($t0, 100, 0, 'd', 10, body)

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

sorry but the code compiled with errors and not outputing anything

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
JQuery and Javascript
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education