I am new to assembly and really to programming in general. I have completely 1 MIPS assignment in my course so far, and it was merely to display a string. This 2nd one that I am working on is much more complex. I am to take up to five integers from a user and store them directly in memory, basicly an array. I am fairly sure I know how to get the input from the user and put it in a loop so that it refernces the array once I have it, I simply just have no idea how to code an array in MIPS.

Any help would be appreciated, Ive been trying things to no avail for some time.


9 Years
Discussion Span
Last Post by Salem

Something along the lines of (you'll have to look up the exact MIPS syntax, I haven't used it in ages) .array: db(100) ; reserve a block of 100 bytes If you want to sythesise say char array[5][20]; it would be something like

move %r0,@array ; the start of the memory
move %r1,index  ; your subscript
mul r1,20,r1    ; the number of bytes in the minor dimension
add r0,r1,r0

r0 is now the start of array[index], which gives you 20 bytes to play with.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.