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.
CodePudding user response:
Looks like you're using the user's byte count found in
$s0
, for the add beforesw
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.