Browse Source

Update exit function

Clean documentation
develop
Matthew Faltys 5 years ago
parent
commit
50b71f946c
  1. 24
      prj1.asm

24
prj1.asm

@ -1,11 +1,7 @@
# Declare main as a global function
.globl main
# All program code is placed after the
# .text assembler directive
.text
# The label 'main' represents the starting point
main:
# print user input
li $v0, 4
@ -23,16 +19,19 @@ main:
li $s0, 0 # set counter to 0
jal lookup # hop to lookup function
# print newline
#li $v0, 4
#la $a0, newline
#syscall
# print out result
li $v0, 1 # print_int syscall code = 1
move $a0, $s0 # load integer into $ao
syscall
j exit # exit out of program
# print newline
li $v0, 4
la $a0, newline
syscall
# exit
li $v0, 10
syscall
lookup:
addi $t0, $a2, 1 # store one higher value
@ -59,12 +58,7 @@ setoob:
li $s0, -1 # index is oob, set to -1
jr $ra # jump back to ra in main
exit:
# All memory structures are placed after the
# .data assembler directive
.data
arr: .word 5, 2, 1, 4, 6, 3 # change array to test
enter_num: .asciiz "Enter number to be found: "

Loading…
Cancel
Save