|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
.globl main |
|
|
|
|
|
|
|
|
|
.text |
|
|
|
|
.text |
|
|
|
|
|
|
|
|
|
main: |
|
|
|
|
# print user input |
|
|
|
@ -13,9 +13,9 @@ main:
|
|
|
|
|
syscall |
|
|
|
|
move $a1, $v0 |
|
|
|
|
|
|
|
|
|
la $a0, arr # $a0 based address of array |
|
|
|
|
#li $a1, 1 # $a1 number to be found (checked) - change the value (7) to test |
|
|
|
|
li $a2, 6 # $a2 max array index to be checked - change the value (3) to test |
|
|
|
|
la $a0, arr # $a0 based address of array |
|
|
|
|
#li $a1, 1 # $a1 number to be found (checked) - change the value (7) to test |
|
|
|
|
li $a2, 6 # $a2 max array index to be checked - change the value (3) to test |
|
|
|
|
li $s0, 0 # set counter to 0 |
|
|
|
|
jal lookup # hop to lookup function |
|
|
|
|
|
|
|
|
@ -57,7 +57,7 @@ lookup:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.data |
|
|
|
|
arr: .word 5, 2, 1, 4, 6, 3 # change array to test |
|
|
|
|
arr: .word 5, 2, 1, 4, 6, 3 |
|
|
|
|
enter_num: .asciiz "Enter number to be found: " |
|
|
|
|
newline: .asciiz "\n" |
|
|
|
|
str_found: .asciiz "found" |
|
|
|
|