uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

lab5_ex3.asm (403B)


      1 .eqv SYS_EXIT 10
      2 
      3 .data
      4         arr:    .byte 1, 15, 0, -3, 99, 48, -17, -9, 20, 15
      5 
      6 .text
      7 .globl main
      8 
      9 main:
     10         # init loop $t0, sum $t1 counters
     11         li      $t0, 0
     12         li      $t1, 0
     13 
     14 calcsum:
     15         beq     $t0, 10, exit
     16         lb      $t3, arr($t0)
     17         add     $t1, $t1, $t3
     18         addi    $t0, $t0, 1
     19         j       calcsum
     20 
     21 exit:
     22         li      $v0, SYS_EXIT
     23         syscall