What would the code below end up doing Provide comments for
Solution
.data
a: .word 3,4,5 ; word is assembler directive used to allocate and initialize space for a variable
.word 0
.text ; read-only while data is not
main: ; start of code
la $sb, a ; copy RAM address of \'a\' into register $sb initialize the a ( int a; )
lw $s3, i ; load word at RAM address contained in i into $s3 s3 = i
;lp is loop started
lp: sll $t1, $s3, 2 ; $t1 gets the bits in $s3 shifted left logical by 2 positions while(a[i] == k){
add $t1, $t1, $sb ; add content of $t1 and $sb and store result into $t1 i = i+a
sw $zero, 0($t1) ; store word in register $zero into RAM at address contained in $t1+0 i = 0
; $zero is a register that always equals zero
addi $s3, $s3, 1 ; add immediate content of $s3 and 1 ,result store into s3 i++
slti $ta, $s3, 3 ; Set on l. t. immediate
bne $ta, zero, lp ; branch jump to loop lp , if( i != 0 ) }
