title: ARM Assembly String read and output subroutine
body: <p>so I created two subroutines called read_character and output_character which just basically outputs whatever you type on screen on PuTTy through the uART. These two subroutines go on looping continuously to show on screen whatever you type. Basically input and output.</p>
  
  <p>I need help creating two more subroutines called read_string and output_string , which would make use of the above two functions (read_character and output_character), to display a string after a user types it. As in once the user types the string and hits ENTER, my display should return the string back to the user. </p>
  
  <p>The following are the subroutines I created:</p>
  
  <pre><code>U0LSR EQU 0x14          ; UART0 Line Status Register
  register EQU 0xE000C000
  
  read_character
          LDR r0, =0xE000C014                            ;load the flag register to r0
          LDRB r1, [r0]                                  ;load byte from r0 to r1
          BIC r1, r1, #0xFFFFFFFE                        ; bit clear and keep the first bit to check RDR
          CMP r1, #0                                     ;compare to 0
          BEQ read_character                             ;if 0 go back to read_character
          LDR r6, =register                              ;if not 0, then continue and save what is in 0xE000C000 in r6
          LDR r2, [r6]
  
          ;if 1 =&gt; read the byte from recieve register
          ;stop
  
      output_character
          LDR r0, =0xE000C014                             ;load the flag register to r0
          LDRB r1, [r0]                                   ;load the byte
          BIC r1, r1, #0xFFFFFFDF                         ;bit clear and keep the 5th bit, which is the THRE bit
          MOV r1, r1, LSR #4                              ;right shift to set the fifth bit as first
          CMP r1, #0                                      ;compare to 0
          BEQ output_character
          LDR r6, =register
          STR r2, [r6]
          B read_character                                 ;branch back to read_character to read and transmit next character
  
          LDMFD sp!, {lr}
          BX lr
  </code></pre>