Hello,
I have to program in ARC assembly language which i'm so clueless...i know it in MIPS Language but can't seem to convert it... anyhelp?
if i had an array of 10 numbers.... stored... how would i go down the list and sort it?
move $t0, $a0
move $t1, $a1
add $t2, $zero, $zero
for1:
slt $t3, $t2, $t0
beq $t3, $zero, exit1 i == n
addi $t3, $t2, -1 # $t3 = i - 1
for2:
slti $t4, $t3, 0
bne $t4, $zero, exit2
add $t4, $t3, $t3
add $t4, $t4, $t4 # $t4 = 4 * j
add $t4, $t0, $t4 # $t4 = a[j]
lw $t5, 0($t4)
lw $t6, 4($t4)
slt $t4, $t6, $t5
beq $t4, $zero, exit2
move $a0, $t0
move $a1, $t3
jal swap
addi $t3, $t3, -1
5
j for2
exit2:
addi $t2, $t2, 1
j for1
exit1:
jr $ra
I have to program in ARC assembly language which i'm so clueless...i know it in MIPS Language but can't seem to convert it... anyhelp?
if i had an array of 10 numbers.... stored... how would i go down the list and sort it?
move $t0, $a0
move $t1, $a1
add $t2, $zero, $zero
for1:
slt $t3, $t2, $t0
beq $t3, $zero, exit1 i == n
addi $t3, $t2, -1 # $t3 = i - 1
for2:
slti $t4, $t3, 0
bne $t4, $zero, exit2
add $t4, $t3, $t3
add $t4, $t4, $t4 # $t4 = 4 * j
add $t4, $t0, $t4 # $t4 = a[j]
lw $t5, 0($t4)
lw $t6, 4($t4)
slt $t4, $t6, $t5
beq $t4, $zero, exit2
move $a0, $t0
move $a1, $t3
jal swap
addi $t3, $t3, -1
5
j for2
exit2:
addi $t2, $t2, 1
j for1
exit1:
jr $ra