Advertisement
Guest User

intro1.s

a guest
Feb 2nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2. .globl first
  3. first:  .word 5, 4, 3
  4.        .word 2
  5.        .word 1
  6. .globl last
  7. last:   .word 0
  8.  
  9. .text
  10. .globl main
  11. main:  
  12.         la $t1, first        #load address, $t1 = 0
  13.         lw $t2, 0($t1)       #load content from M[$t1+0] $t2 = 5
  14.         lw $t5, 4($t1)       #load content from M[$t1+4] $t5 = 4
  15.         add $t2, $t2, $t5    #add contents of $t2 & $t5, store result in $t2
  16.         lw $t5, 8($t1)       #load content from M[$t1+8], $t5=3
  17.         add $t2, $t2, $t5    #$t2 = $t2+$t5 ($t2 = 12)
  18.         lw $t5, 12($t1)      #load from M[$t1+12] $t5 = 2
  19.         add $t2, $t2, $t5    #$t2 = $t2+$t5 ($t2 = 14)
  20.         addi $t2, $t2, 1     #add immediate number (constant number) 1 to content of $t2, put result in $t2. $t2=$t2+1=15
  21.         li $v0, 10           #load system call code 10 (exit) to $v0
  22.         syscall              #Make the system call $v0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement