the following program is trying to copy words from the address in register $a0 to the address in register $a1, counting the number of words copied in register $v0. It will then stop copying when it finds a word equal to 0. i wasnt tring to preserve the contents of register $v1,$a0,$a1. the terminating word should be copied but not counted.
this is what i have so far can anyone show me the buggs
this is what i have so far can anyone show me the buggs
Code:
addi $v0, $zero, 0 #initialize count
loop: lw $v1, 0($a0) #read next word from source
sw $v1, 0($a1) #write to destination
addi $a0, $a0, 4 #advance pointer to next source
addi $a1, $a1, 4 #advance pointer to next destination
beq $v1, $zero, loop #loop if word copied != zero
Comment