Skip to content

Instantly share code, notes, and snippets.

@jarodl
Created April 1, 2009 04:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarodl/88549 to your computer and use it in GitHub Desktop.
Save jarodl/88549 to your computer and use it in GitHub Desktop.
findblob:
la $t3, image # address of image
or $t0, $zero, $zero # i = 0
mult $a1, $a2
mflo $t1 # max = w * h
loop: beq $t0, $t1, exit
sll $t2, $t0, 2 # mult by 4
add $t2, $t2, $t3 # t3 = i + address
lw $t4, 0($t2)
andi $t5, $t4, 65535
srl $t4, $t4, 16
beq $a0, $t4, found
beq $a0, $t5, found
addi $t0, $t0, 1 # i++
j loop
found: add $v0, $t2, $zero
exit: jr $ra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment