title: how does movia, movi, ldw, addi, stw, ldw, ret statements work?
body: <p>I thought it will be easy to explain on specific example, i understood beq works like if r9==r10 that statement gives a call for the label which is shown on the same line but i didn't understand others exactly.    </p>
  
  <p>START:
          .word 0
          .word INSTR1
      INSTR1:
          .word 1
          .word 77
          .word INSTR2
      INSTR2:
          .word 2
          .word 15
          .word FIN
      FIN:
          .word 3</p>
  
  <pre><code>acc:
      .word 0
  
  
  .text
  
  .global main
  
  main:   movia r8, START
      movia r9, acc
  
  myloop: movi r10, 1
      ldw r11, 0x0(r8)
      beq r11, r0, clear
      beq r11, r10, add
      addi r10, r10, 1
      beq r11, r10, sub
      addi r10, r10, 1
      beq r11, r10, exit
      br fail
  
  clear:  stw r0, 0x0(r9)
      ldw r8, 0x4(r8)
      br myloop
  
  add:    ldw r12, 0x0(r9)
      ldw r13, 0x4(r9)
      addi r12, r12, r13
      stw r12, 0x0(r9)
      ldw r8, 0x8(r8)
      br myloop
  
  sub:    ldw r12, 0x0(r9)
      ldw r13, 0x4(r9)
      sub r12, r12, r13
      stw r12, 0x0(r9)
      ldw r8, 0x8(r8)
      br myloop
  
  exit:   ret
  
  fail:   movia r12, 0xFFFFFFFF
      stw r12, 0x0(r9)
      ret
  </code></pre>