Question: Please help my out put should be this is what I have so far # Author: # Date: # Description: .globl main, user_info, mult_table #
Please help my out put should be

this is what I have so far
# Author: # Date: # Description:
.globl main, user_info, mult_table # Do not remove this line
# Data for the program goes here .data #string constants info: .ascii "CS2810 MIPS Program 3 " .asciiz "Welcome to the multiplication table program " prompt0: .asciiz "Please enter your name: " prompt1: .asciiz "Up to what multiplication table you want? " message: .asciiz " Hello: " bye: .asciiz " Bye." tab: .asciiz "\t" nl: .asciiz " " num: .word 0 name: .space 80
# Code goes here .text
########## main: # Task 1: Call user_info procedure jal user_info # Task 2: Capture integer input li $v0, 4 # print prompt1 la $a0, prompt1 syscall
li $v0, 5 # read integer from console syscall sw $v0, num # save integer to memory
# Task 3: Call mult_table procedure jal mult_table
exit_main: li $v0, 4 # print bye la $a0, bye syscall li $v0, 10 # 10 is the exit program syscall syscall # execute call
## end of ca.asm
############################################################### # Display User information # # $a0 - input, None # $v0 - output, None user_info: li $v0, 4 # print info la $a0, info syscall
li $v0, 4 # print prompt0 la $a0, prompt0 syscall
li $v0, 8 # read string from console la $a0, name li $a1, 80 syscall
li $v0, 4 # print message + name la $a0, message syscall la $a0, name syscall jr $ra
mult_table: addi $t0, $zero, 1 # initialize i to 1 addi $t1, $zero, 1 # initialize j to 1
outer_loop: beq $t0, $a0, exit # exit outer loop when i = num addi $t1, $zero, 1 # reset j to 1 for each iteration of outer loop
inner_loop: beq $t1, $a0, new_line # move to next row when j = num mul $t2, $t0, $t1 # multiply i and j, result in $t2 li $v0, 1 # load system call code for print integer into $v0 move $a0, $t2 # move the result to $a0 syscall # print the result li $v0, 4 # load system call code for print string into $v0 la $a0, tab # load address of tab space into $a0 syscall # print a tab space addi $t1, $t1, 1 # increment j j inner_loop # jump back to inner loop new_line: li $v0, 4 # load system call code for print string into $v0 la $a0, nl # load address of newline character into $a0 syscall # print a newline addi $t0, $t0, 1 # increment i j outer_loop # jump back to outer loop exit: jr $ra # return to calling function
Bye. -- program is finished running
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
