Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- save:
- .word
- 0x000000000,
- 0x000000000,
- 0x000000000,
- 0x000000000,
- 0x000000000,
- 0x000000000,
- 0x000000000,
- 0x000000001,
- 0x000000002,
- 0x000000003
- .text
- main:
- la $a0, save #Affectation de $a0 à save
- ori $a1, $zero, 1 #Affectation de $v0 à 1
- ori $a2, $zero, 9 #Affectation de $v0 à 9
- jal Recherche # goto Recherche
- or $a0, $zero, $v0 #$a0 = $zero || $v0
- ori $v0, $zero, 1 #Affectation de $v0 à 1
- syscall #Vérification de $v0: 5 - read $a0
- ori $v0, $zero, 10 #EXIT
- syscall #EXIT
- Recherche:
- or $s0, $zero, $zero #$s0 = $zero || $zero
- for:
- slt $t0, $a2, $s0 #if($a2 < $s0) $t0 = 1 else $t0 = 0
- bne $t0, $zero, exitfor #if ($t0 != $zero) goto exitfor
- sll $t0, $s0, 2 #$t0 = $s0 << 2
- add $t0, $t0, $a0 #$t0 = $t0 + $a0
- lw $t0, 0($t0) #$t0 = Mem[$t0]
- beq $t0, $a1, exitfor #if($t0 = $a1) goto exitfor
- addi $s0, $s0, 1 #$s0 = $s0 + 1
- j for #goto for
- exitfor:
- or $v0, $zero, $s0 #$v0 = $zero || $s0
- jr $ra #goto $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement