If you had consulted an instruction set reference, you would have seen that sw
needs a memory operand. Thus, from a purely syntactical standpoint sw $v0, ($t0)
would be correct, but it wouldn't do what you want, which is simply transferring between registers. That can be done with the move
pseudoinstruction as follows: move $t0, $v0
. This will probably be translated by the assembler to addu $t0, $v0, $0
which you can of course write out yourself if you are so inclined. Similarly, to transfer it into $a0
you should use another move
and not la
.
You are also using the read_string
system call wrong. For one thing, you should load the arguments before you perform the syscall
, which should be an address of a buffer in $a0
and its length in $a1
. If you need to print the length of the string entered, you will need to calculate it yourself, by counting the bytes until the terminating zero.