I am trying to write a function to copy words from source memory to destination memory.
I have written the function but I am having difficulty executing the code.
It is giving me execption 4
as an error
.data
.text
main:
.setnoreorder
top: beq $a2,0,done
lw $t1,($a0)
sw $t1,($a1)
add $a0,$a0,4
add $a1,$a1,4
j top
sub $a2,$a2,1
done:
jr $ra #return to the main program
add $0, $0, $0 #nop
I want to write a main program which calls this function to copy 800 words from address 0x50000 to 0x90000 in memory. But when I add the values in $a0-$a2 and run the code it doesnt work. Does anyone know how to fix it. (I am converting C code to MIPS which is why I have included a C tag
Cheers