what's the problem with this MIPS code?

This is really weird.. when I try to run ths code using PC Spim and execute it directly using F5, it complaints that a bad data address occured and ignored.. however when I run this step by step at a time, when it reaches the end of the process.. it doesn't give me that error.. so I am confused why this error could happen?? Can someone help me to point it out..
.text
	.globl _ifsGalore
	_ifsGalore:
			# Function Entry
	sw $ra,-72($sp)
	sw $fp,-76($sp)
	add  $fp, $zero, $sp
	subu $sp, $sp, 76
	 # MOVE 
	add $t0,$zero,5
	sw  $t0,-48($fp)
	 # MOVE 
	add $t0,$zero,6
	lw  $t1,-48($fp)
	mul $t1,$t1,4
	add  $t2,$zero,-44
	add $t1,$t2,$t1
	add $t1,$fp,$t1
	sw  $t0,($t1)
	 # MOVE 
	add $t0,$zero,5
	sw  $t0,-56($fp)
	 # MOVE 
	lw  $t0,-56($fp)
	mul $t0,$t0,4
	add  $t1,$zero,-44
	add $t0,$t0,$t1
	add $t0,$fp,$t0
	lw  $t1,($t0)
	sw $t1,-52($fp)
	 # MOVE 
	add $t0,$zero,7
	lw  $t1,-52($fp)
	mul $t1,$t1,4
	add  $t2,$zero,-44
	add $t1,$t2,$t1
	add $t1,$fp,$t1
	sw  $t0,($t1)
	 # MOVE 
	add $t0,$zero,6
	sw  $t0,-68($fp)
	 # MOVE 
	lw  $t0,-68($fp)
	mul $t0,$t0,4
	add  $t1,$zero,-44
	add $t0,$t0,$t1
	add $t0,$fp,$t0
	lw  $t1,($t0)
	sw $t1,-64($fp)
	 # MOVE 
	lw  $t0,-64($fp)
	mul $t0,$t0,4
	add  $t1,$zero,-44
	add $t0,$t0,$t1
	add $t0,$fp,$t0
	lw  $t1,($t0)
	sw $t1,-60($fp)
	 # MOVE 
	add $t0,$zero,8
	lw  $t1,-60($fp)
	mul $t1,$t1,4
	add  $t2,$zero,-44
	add $t1,$t2,$t1
	add $t1,$fp,$t1
	sw  $t0,($t1)
			# Function Ends
	LABEL1:
			# Exit Sequence
	lw $ra,-72($fp)
	add  $sp, $zero, $fp
	lw $fp,-76($fp)
	jal $ra
	.globl main
	main:
			# Function Entry
	sw $ra,-4($sp)
	sw $fp,-8($sp)
	add  $fp, $zero, $sp
	subu $sp, $sp, 8
			# Function call
	jal _ifsGalore
	add $sp,$sp,0
			# Function Ends
	LABEL2:
			# Exit Sequence
	lw $ra,-4($fp)
	add  $sp, $zero, $fp
	lw $fp,-8($fp)
	jal $ra

Open in new window

kuntilanakAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mc7400Commented:
Line 89 should be jr $ra
jal is used to call, jr is used to return
0
kuntilanakAuthor Commented:
changed that as well and doesn't work still...
0
Mc7400Commented:
Run it with step by step and make sure the registers have the same values when return as the entry point, I don't have any tool here to check it.
Please provide the error message.
0
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

kuntilanakAuthor Commented:
yes they do have the same values at entry and return I guess.... when I run it step by step in SPIM it doesn't complain however when run at once, it complaints: as I said the error was:

bad data address occured and ignored.
0
Mc7400Commented:
If you are trying to return at line 72 then it should be jr as well.
you may have to select delayed branches and delayed load in settings.
0
kuntilanakAuthor Commented:
trust me changing the jal to jr doesn't have any effects of resolving the error, I tried...
0
Mc7400Commented:
Have you selected delayed branches and delayed load in settings?
One more thing that there is no need to save $ra register, delete all the lines which save or retrieve the $ra.
I've just downloaded PCSpim and the code worked perfectly after the mentioned changes.
0
Mc7400Commented:
See you tomorrow
0
Infinity08Commented:
>> Line 89 should be jr $ra
>> jal is used to call, jr is used to return

Maybe now, you believe me, kuntilanak ;)

        http://www.experts-exchange.com/Programming/Languages/Assembly/Q-23900622-what's-wrong-with-this-MIPS-code.html#22948199
0
kuntilanakAuthor Commented:
>>One more thing that there is no need to save $ra register, delete all the lines which save or retrieve the >>$ra.

which part is it? I can only see I save and retrieve $ra when I do a function call and return back again from it...
0
kuntilanakAuthor Commented:
>>Maybe now, you believe me, kuntilanak ;)

I always believed you since the beginning, :D
0
Infinity08Commented:
>> I always believed you since the beginning, :D

j/k ;)
0
kuntilanakAuthor Commented:
>>j/k ;)

Infinity maybe you could help me out here....
0
Infinity08Commented:
The 'add' on line 64 overflows. Make sure that the calculations you do are correct. The $t1 value is too big to add to the frame pointer.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kuntilanakAuthor Commented:
yes, that's why! thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.