title: read system call in ARM assembly
body: <p>I want to read an integer and write if it is negative or positive . The problem is that the output is always positive even if I enter negative numbers. Furthermore the number is maximum 4 digits and I want it to be 4 bytes. Please note that I am a complete begginer in ARM assembly . Here is the code </p>
  
  <pre><code>.text
  .global main
  
  
  main:   
      mov r0, #0 /* read system call */
      ldr r1, =inp_str
      mov r2, #4
      mov r7, #3
      swi 0
  
      cmp r1,#0   
      blt w2
      bge w1
  
  w1:
      mov r0, #1 /* write system call */
      ldr r1, =string1
      mov r2, #len1
      mov r7, #4
      swi 0
      b e
  
  w2:
      mov r0, #1 /* write system call */
      ldr r1, =string2
      mov r2, #len2
      mov r7, #4
      swi 0
  
  e:
      mov r0, #0 /* exit system call */
      mov r7, #1
      swi 0
  
  .data
      string1: .ascii "positive "
  len1 = . - string1
      string2: .ascii "negative "
  len2 = . - string2
      inp_str: .asciz "%d"
  </code></pre>