×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help to debuging my assembly Please.

Help to debuging my assembly Please.

Help to debuging my assembly Please.

(OP)
Could anyone help me to check what wrong to with my assembly code. For this assembly code that write is to sort the 200 random number in order. And i got error with my sorting part that i coundn't fix it because it didn't print out the output.
Your help is very helpful to me THANK YOU

--------------------------------------------------------
--------------------------------------------------------        
.data

array:    .space    800

initstr:
    .asciiz "Initial Array: "

finalstr:
    .asciiz "Final Array: "

spacestr:
    .asciiz " "

newlinestr:    
    .asciiz "\n"

###########################################################
    
.text

main:    
    la    $a0, array
    addi    $a1, $a0, 800
    li    $s0, 11
    li    $s1, 106
    li    $s2, 6075
    
FillLoop:    
    mul    $s0, $s1, $s0
    addi    $s0, $s0, 1283
    rem    $s0, $s0, $s2
    sw    $s0, 0($a0)
    addi    $a0, $a0, 4
    bne    $a0, $a1, FillLoop

###########################################################    la    $a1, array
    addi    $a2, $a1, 800

    li    $v0, 4
    la    $a0, initstr
    syscall
    
###########################################################
PrintLoop1:
    lw    $a0, 0($a1)
    li    $v0, 1
    syscall

    la    $a0, spacestr
    li    $v0, 4
    syscall

    addi    $a1, $a1, 4
    bne    $a1, $a2, PrintLoop1

    la    $a0, newlinestr
    syscall
    
###########################################################    
bubbleSort:

    la $a0, array
    move $a2, $a1             
        li $t0, 0         
for1:
    beq $a2, $t0, exit1     

    addi $a1, $t0, -1     
for2:
    bltz $a1, exit2        
    sll $a3, $a1, 2        
    add $a3, $a0, $a3     
    lw $t2, 0($a3)             
        lw $t3, 4($a3)         
    ble $t3, $t2, else     
    jal swap
else:
    addi $a1, $a1, -1     
    j for2
exit2:
    addi $t0, $t0, 1     
    j for1
exit1:
    jr $ra

###########################################################    
    la    $a1, array
    addi    $a2, $a1, 800

    li    $v0, 4
    la    $a0, finalstr
    syscall
    
    
PrintLoop2:
    lw    $a0, 0($a1)
    li    $v0, 1
    syscall

    la    $a0, spacestr
    li    $v0, 4
    syscall

    addi    $a1, $a1, 4
    bne    $a1, $a2, PrintLoop2

    la    $a0, newlinestr
    syscall
    

# End of file.                                                      

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close