title: How to get specified number of character from a string in MIPS?
body: <pre><code>00111100000000010001000000000001
  00110100001001000000000000000000
  00100100000000100000000000000100
  00000000000000000000000000001100
  00100100000000100000000000001010
  00000000000000000000000000001100
  </code></pre>
  
  <p>Given this machine code, I need to just get the first line (32) characters, so that I can convert it back into MIPS instructions. I am having trouble figuring out how to get the first line of code and store it into a register. Does anyone have any ideas on how to get the first line, and the next lines after that? I was given a hint to try using the sll or srl instructions, but when I do that, i do not see any change in the code. </p>
  
  <pre><code>#File to be read from
  file: .asciiz "bincode1.txt"
  #place to store contents of file
  buffer: .space 1024
  
      .text
  
  #Open the file
  li $v0, 13  #system call to open the file
  la $a0, file    #load address of the file and store in a0
  li $a1, 0   #a1 is reserved for a line in the text file
  li $a2, 0
  syscall     #opens the file
  move $s0, $v0   #save file descriptor 
  
  #Read the file
  li $v0, 14  #system call to read from the file
  move $a0, $s0   #put the file name into a0
  la $a1, buffer  #address of the buffer to read
  li $a2, 1024
  syscall
  
  #Close the file
  li $v0, 16  #system call to close the file
  move $a0, $s0   #file name to close
  syscall
  
  #print contents of buffer to verify it copied correctly 
  li $v0, 4
  la $a0, buffer
  syscall
  
  #la $t1, buffer
  srl $t2, $a0, 32
  
  li $v0, 4
  la $a1, ($t2)
  syscall
  </code></pre>
  
  <p>The file bincode1.txt has the previous 6 lines of machine code. I get an error if I try to shift it by 32, and I know this is incorrect, but I am not sure what to do from here. Any suggestions would be helpful.</p>