Someone has modified the utils.asm file to insert a PrintTab subprogram immediately after the PrintNewLine subprogram as shown below (changes are highlighted in yellow). The programmer complains that the PrintTab command cannot be called using the "jal PrintTab" instruction. What is wrong, and how can this be fixed? Explain all the problems in the code this programmer has written. # subprogram: PrintNewLine # author: Charles Kann # purpose: to output a new line to the user console # input: None # output: None # side effects: A new line character is printed to the # user's console .text PrintNewLine: li $v0, 4 la $a0, __PNL_newline syscall jr $ra .data __PNL_newline: .asciiz "\n" PrintTab: li $v0, 4 la $a0, tab syscall jr $ra .data tab: .asciiz "\t"
Someone has modified the utils.asm file to insert a PrintTab subprogram immediately
after the PrintNewLine subprogram as shown below (changes are highlighted in yellow).
The programmer complains that the PrintTab command cannot be called using the "jal
PrintTab" instruction. What is wrong, and how can this be fixed? Explain all the
problems in the code this programmer has written.
# subprogram: PrintNewLine
# author: Charles Kann
# purpose: to output a new line to the user console
# input: None
# output: None
# side effects: A new line character is printed to the
# user's console
.text
PrintNewLine:
li $v0, 4
la $a0, __PNL_newline
syscall
jr $ra
.data
__PNL_newline: .asciiz "\n"
PrintTab:
li $v0, 4
la $a0, tab
syscall
jr $ra
.data
tab: .asciiz "\t"
Step by step
Solved in 3 steps