Question
1. (5 pts) The Venus simulator has environment calls that allow for printing of data to the console at the bottom of the simulator. For
1. (5 pts) The Venus simulator has environment calls that allow for printing of data to the console at the bottom of the simulator. For more information see this link. We will need to print strings later in this lab using environment calls, to print a string the following steps are used: Load the string's location in memory into register a1. Signal ecall of print_string by placing 0x4 into register a0. Print to terminal by using ecall command with no operands.
a. (2 pts) Write a RISC-V procedure called prints that prints a string from memory to the Venus terminal using environment calls.
i. The procedure should take the string address as an argument.
ii. Include your code along with helpful comments in your report.
b. (3 pts) Test the procedure written above.
i. Store the strings hello \" and \"world \" in the static data segment. Null terminated strings may be placed in the static data segment with the. asciiz directive as shown in the figure below: .data string_arr: .asciiz \"String\" .asciiz \"String 2\" Code Block 1 RISC-V Static String
ii. Load the argument register used by the printst procedure with the first string's label and call the procedure.
iii. Upon return increment the string pointer to point to the next string and call printst again.
iv. Run the code.
v. Include in your report a capture of the terminal output.
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