Advertisement
karol_dziachan

task1_exam_PWR_ASK

May 27th, 2020
2,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2. txt: .asciiz "Enter the number: "
  3. result: .asciiz "Subtraction result: "
  4. .text
  5. main:
  6.     #initializes register $ t1, include 9
  7.     li $t1, 9
  8.     #display txt
  9.     li $v0, 4
  10.     la $a0, txt
  11.     syscall
  12.    
  13.     #download number from user, and save it in $t2
  14.     li $v0,5
  15.     syscall
  16.     move $t2,$v0
  17.    
  18.     #perform subtraction and write the differences in the $ s1 register
  19.     sub $s1, $t1, $t2
  20.    
  21.     #display result
  22.     li $v0, 4
  23.     la $a0, result
  24.     syscall
  25.    
  26.     #display value from $s1
  27.     li $v0,1
  28.         la $a0, ($s1)
  29.         syscall
  30.        
  31.         #end
  32.         li $v0,10
  33.     syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement