Question: Required I / O: F . Last is your first initial and last name. Hints: The format argument will be passed to printf in $

Required I/O:
F. Last is your first initial and last name.
Hints:
The format argument will be passed to printf in $a0, preserve $a0?
The variable arguments will be passed to printf in the reverse order. For example:
format cstring", p1, p2, p3
$a0-> "format cstring"
stack:
high [ p3]8
[ p2]4
low [p1]0
Set pointer to the first parameter: t9-sp
Retrieve first parameter: ($t9)
Get ready for the next parameter: t9=t9+4
Retrieve second parameter: ($t9)
Get ready for the next parameter: t9=t9+4
...
The caller is responsible for creating and removing the variable arguments on the stack.
MUST BE IN MIPS ASSEMBLY LANGUAGE :
1. Implement the procedure printf:
void printf(cstring format, parameters...)
format:
%%- output %
%d output the next parameter as an integer (syscall 1)
%s output the next parameter as a cstring (syscall 4)
This procedure is similar to Java System.out.printf or C/C++ printf. For unknown %code, printf will
output ?code and terminate. For example: "hello %z there" will output:
hello ?z
2. Provide a test main that will call printf with different parameters.
Required I / O: F . Last is your first initial

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 Programming Questions!