SHARE
TWEET

Untitled

a guest Aug 20th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #5.1
  2.     .data
  3.     .text
  4.     .globl main
  5. main:  
  6.     li $s0,12
  7.     li $t1,1
  8.     li $t2,100
  9.     li $s1,0
  10.     beq $s0,$zero,l1
  11.     beq $s0,$t1,l2
  12.     move $s1,$t2
  13.     move $a0,$s1
  14.     li $v0,1
  15.     syscall
  16.     li $v0,10
  17.     syscall
  18. l1:
  19.     add $s1,$s1,1
  20.     move $a0,$s1
  21.     li $v0,1
  22.     syscall
  23.     li $v0,10
  24.     syscall
  25. l2:
  26.     addi $s1,$s1,-1
  27.     move $a0,$s1
  28.     li $v0,1
  29.     syscall
  30.     li $v0,10
  31.     syscall
  32. # ---------------------------------------
  33. # 5.2
  34.     .data
  35.     .text
  36.     .globl main
  37. main:
  38.     li $t1,2
  39.     li $s0,10
  40.     li $t2,0
  41. loop:  
  42.     ble $t1,$zero,l1
  43.     add $t2,$t2,$s0
  44.     addi $t1,$t1,-1
  45.     j loop
  46.    
  47. l1:
  48.     move $a0,$t2
  49.     li $v0,1
  50.     syscall
  51.     li $v0,10
  52.     syscall
  53.  
  54. # -------------------------------------
  55. # 5.3
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top