MIPS problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

MIPS problem

Hello forum,

I am a mips newbie and have a problem with a small mips program, that should read in 5 integers in a loop and save them in an array like so:

[color=Green]loop:
jal pread1 # read in integer
move $t2, $v0 # save it in t2



# TODO: save integers as array "elements"



addi $t0, $t0, 4 # increment loop counter by 4
blt $t0, 20, loop # If ($t0 < 20)

.....
.....

ar: .space 16 # 16 Byte for 4 integers[/color]

The problem is that I don't know how to increment the array element positions and save the t2 values there. I think I have to increment the array's base address somehow....
Hope that at least my approach is right.
Thanks in advance for any help.
Sign In or Register to comment.