I am trying to store a integer that i am reading from the user into a array, however when i try to store it into my array my data becomes unaligned.
This first block of code is where i initialize all the data. (Under the 1. is where i am trying to store the integer )
'#Constants P_INT = 1 #Syscall to print integer(value) P_STRING = 4 #Syscall to print a string(addr) P_CHAR = 11 #Syscall to print a char(char) R_INT = 5 #Syscall to read a integer(none) EXIT = 10 #Exit program(none) '#Data .data newline: .asciiz "\n" '#Space for the bored. 1. board_rep: .space 578 '#The current node to be read in cur_node: .word 0 '#Size of the bored size: .space 4 '#Plus sign plus: .asciiz "+" '#dash dash: .asciiz "-"Right here is where it becomes unaligned (the sw right after 2.) . The strange thing is that i am doing the exact same thing later (in the third code block) except that i am storing it in the size array.
'#Grabs user input for the bored and stores it get_board_rep: li $v0,R_INT '#Read next node and store it syscall 2. sw $v0,0($s1) addi $s1,$s1,4 ' #Increment next node addr lw $a0,0($s1) j prnt_nodeAt the store word (under the 3. ) it stores the read in integer fine.
la $s0, size ' #Store the variable addr's la $s1, board_rep li $v0,R_INT ' #Get user input(size of bored) syscall 3. sw $v0,0($s0) ' #Store the size of bored jal get_board_repI thought maybe the array was too large but i changed it to 4 (the same size that the other array that worked). But it still was unaligned.
Thanks in advance . This is a project and i know some people don't like helping with stuff like this. But i have done my homework and i cannot find a answer anywhere.
That doesn’t look aligned to me, and if i’m wrong try explicitly aligning it anyway.