Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ADD1: add $v0, $a0, $a1
- jr $ra
- SUB1: sub $v0, $a0, $a1
- jr $ra
- PRO1: mul $v0, $a0, $a1
- jr $ra
- DIV1: div $v0, $a0, $a1
- jr $ra
- .data
- Addn: .asciiz "1. Addizione\n"
- Subn: .asciiz "2. Sottrazione\n"
- Prot: .asciiz "3. Moltiplicazione\n"
- Divn: .asciiz "4. Divisione\n"
- null: .asciiz "Valore non valido\n"
- numeri: .word 1, 2, 3, 4
- .text
- .globl main
- main:
- li $v0, 4
- la $a0, Addn
- syscall
- li $v0, 4
- la $a0, Subn
- syscall
- li $v0, 4
- la $a0, Prot
- syscall
- li $v0, 4
- la $a0, Divn
- syscall
- la $s0, numeri
- lw $s1, 0($s0)
- lw $s2, 4($s0)
- lw $s3, 8($s0)
- lw $s4, 12($s0)
- j LOAD
- LOAD:
- li $v0, 5
- syscall
- move $t4, $v0
- move $s5, $t4
- li $v0, 5
- syscall
- move $t5, $v0
- move $s5, $t5
- li $v0, 5
- syscall
- move $t6, $v0
- move $s6, $t6
- j ADD
- ADD: beq $s5, $s1, SUB
- jal ADD1
- SUB: beq $s5, $s2, PRO
- jal SUB1
- PRO: beq $s5, $s3, DIV
- jal PRO1
- DIV: beq $s5, $s4, END
- jal DIV1
- END: li $v0, 4
- la $a0, null
- j LOAD
- move $t1, $v0
- move $a0, $t1
- li $v0, 1
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement