Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- txt: .asciiz "Enter the number: "
- result: .asciiz "Subtraction result: "
- .text
- main:
- #initializes register $ t1, include 9
- li $t1, 9
- #display txt
- li $v0, 4
- la $a0, txt
- syscall
- #download number from user, and save it in $t2
- li $v0,5
- syscall
- move $t2,$v0
- #perform subtraction and write the differences in the $ s1 register
- sub $s1, $t1, $t2
- #display result
- li $v0, 4
- la $a0, result
- syscall
- #display value from $s1
- li $v0,1
- la $a0, ($s1)
- syscall
- #end
- li $v0,10
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement