MIPS Swapping Operation

Say I have an array with 10 elements and assume the $s1 register is already loaded with the base address. How would I write a simple operation that will swap A[4] and A[9]? So far i've come up with something which consists of using a temp register, but i'm not sure if its correct:

lw $t0, 4($s1) 
sw 4($s1), 9($s1)
sw 9($s1), $t0


from Recent Questions - Stack Overflow https://ift.tt/3ktjdcr
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations