title: How do I input a string into the text segment instead of the data segment in assembly (MIPS)
body: <p>I have an assignment in which I am asked to change each lowercase letter of a given string to an uppercase letter.</p>
  
  <p>My problem is that the professor has asked us to input the string into the text segment and not the data segment.</p>
  
  <p>I have tried using <code>lw</code> and <code>sw</code> but it doesn't work.
  Is there any other way?
  (My program works when the string is in the data segment)</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>        .data    
  str:    .space 100
  
  textlow:    .asciiz "This is a sample text!"
  
          .text
  
  main:
          li $t0, 0
  
  loop:
  
  lb $t1, textlow($t0)    
          beq $t1, 0, exit       
          blt $t1, 'a', diff  
          bgt $t1, 'z', diff
  
  sub $t1, $t1, 32  
          sb $t1, textlow($t0)  
  
  
  diff: 
          addi $t0, $t0, 1
  
  j loop
  
  exit:
          li $v0, 10      
          syscall
  </code></pre>