Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ARC Assembly Language...BubbleSORT

Status
Not open for further replies.

xsparkx

Technical User
Joined
Nov 21, 2002
Messages
1
Location
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top