Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

MIPS problem with storing integer in an array

I’m writing a program in MIPS language, which takes a number from the user to allocate an array with that number. Then, the user is asked to enter that many numbers to fill the array.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • Looks like you’re using the user’s byte count found in $s0, for the add before sw where you mean to use $s1, the allocated pointer.  You should be able to find that using single step debugging, and seeing the wrong value being added there.

  • You’re using $t1 both as a counter, and as a temporary register during the array indexing store, so that counter is getting wiped out.  Also can be seen by inspecting expected values during single step debugging.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading