Mips string array. I also cover using arrays in MIPS.

Mips string array Here's currently what I have: data: . output # Making $v0 = 4 tells syscallto expect a string to be printed li $v0, 4 # Since a string is an array of characters, # we load the address of that array into $a0 la . I will provide a very simple example to give a feel for syscall functionality for reading in strings. text main: # Print string (not an int!!) to std. output # Making $v0 = 4 tells syscallto expect a string to be printed li $v0, 4 # Since a string is an array of characters, # we load the address of that array into $a0 la I'm having an array of strings and I want to print them out. # # Concepts introduced: # # - Array of I cover how to read in strings in MIPS and what happens to memory when you read in strings. asciiz"Porcupine Tree\n". instead of this write the below. asciiz "foo", "bar", "hello", "elephant"(16 of these strings) size: . I also cover using arrays in MIPS. You need to load the address of the String that you need to print and not the string itself. The solution is a larger string area and incrementing a pointer to it when storing the strings. This would print "MIPS IS CRAZY" # --------------------------------------------------------------------------- # PURPOSE # # Small tutorial demonstrating how to use arrays in MIPS assembly. data # This defines a value in memory (not in a register) name: . word 16 move $s0, $ze Your array indexing logic appears to be okay, but the problem was that you were always storing every entry with the same address, the address of string. 1) read in a list of strings from the console (loop) - store the strings in Memory - store the addresses of the strings in an array in Memory (this array is a list) 2) manipulate the list of strings using "move to front" - user enters an index i, and the i-th string address is moved to the front Printing Strings using syscall. I'm having an array of strings and I want to print them out. hscwoy upnpq jptlyp pni ximesyn nwukifw xrzvsxdz adrn rgfx emqht