Question: In this same assignment you will find a MIPS assembly language program that could be used to balance your checkbook (Prog1toModify). Negative transaction values correspond

In this same assignment you will find a MIPS assembly language program that could be used to balance your checkbook (Prog1toModify). Negative transaction values correspond to checks drawn on the checking account and positive transactions values correspond to deposits into the checking account. The program terminates when a value of zero is read in. After each transaction the new calculated balance is displayed.

1. Save your program as a .asm file. Run your program. Use the single step feature to observe the contents of the registers as the program executes. Set a few breakpoints in the program and observe the results. Notice that this program only works for integer values.

2. The program includes a heading with a place to insert your name. This program provides an example of how all of your programs should be documented in this course. The syscall instructions are calls to system services to perform input\output functions.

3. Run this program and input five deposits in the amount of 9876543. You will notice that this program does not contain any instructions to detect when overflow occurs so it produces an erroneous balance when overflow does occur. Your job for this programming assignment is to make improvements to this program so that whenever an overflow does occur in either the positive or negative domain the following specific announcement will be displayed: An Overflow had Occurred This transaction has been ignored

4. Next the correct previous balance should be displayed on the following line in the Balance column. Then the program should prompt the user for the next transaction.

No message other than the one specified above is acceptable!

Be sure to place in-line comments within the program everywhere you have made changes to the initial program. Each of your comments should be preceded by #### to make it easy to find your modifications to the initial program.

All comments to the right of the .asm statements should be lined up.

Please follow all the steps please.

The following is the code in .asm file

#####################################################################

# Functional Description:

# This program can be used to balance your check book.

#

#####################################################################

# Pseudocode:

# Print Header;

# s0 = 0;

# loop: Prompt user for transaction;

# v0 << transaction amount;

# if (v0 = 0) done;

# s0 = s0 + v0;

#

# cout << s0

# go to loop

# done:

# cout << "Adios Amigo"

#

######################################################################

# Register Usage:

# $v0: Transaction Amount

# $s0: Current Bank Balance

#

######################################################################

.data # Data declaration section

Head: .ascii " \tThis program, written by ,"

.ascii " can be used to balance your check book."

.asciiz " \t\t\t\t\t\t\t\t\t Balance"

tabs: .asciiz "\t\t\t\t\t\t\t\t\t"

tran: .asciiz " Transaction:"

bye: .asciiz " **** Adios Amigo **** "

.text # Executable code follows

main:

li $v0, 4 # system call code for print_string

la $a0, Head # load address of Header message into $a0

syscall # print the Header

move $s0, $zero # Set Bank Balance to zero

loop:

li $v0, 4 # system call code for print_string

la $a0, tran # load address of prompt into $a0

syscall # print the prompt message

li $v0, 5 # system call code for read_integer

syscall # reads the amount of Transaction into $v0

beqz $v0, done # If $v0 equals zero, branch to done

addu $s0, $s0, $v0 # add transaction amount to the Balance

li $v0, 4 # system call code for print_string

la $a0, tabs # load address of tabs into $a0

syscall # used to space over to the Balance column

li $v0, 1 # system call code for print_integer

move $a0, $s0 # move Bank Balance value to $a0

syscall # print Bank Balance

b loop # branch to loop

done: li $v0, 4 # system call code for print_string

la $a0, bye # load address of msg. into $a0

syscall # print the string

li $v0, 10 # terminate program run and

syscall # return control to system

# END OF PROGRAM

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