title: Descending bubblesort with 68k
body: <p>i'm learning Assembly on Motorola 68k,
  i was able to do BubbleSort in ascending order but not descending, i don't know why the program goes into infinite loop; Thx!; The code:</p>
  <pre><code>  ORG  $2000
    START LEA  ARRAY,A0
    CLR  D0 *Flag di scambio      
    MOVE.B #L-1,D1 *contatore      
    LOOP  MOVE.B (A0),D2
    MOVE.B 1(A0),D3
    CMP    D2,D3
    BLE    ELSE
    MOVE.B D2,1(A0)
    MOVE.B D3,(A0)
    MOVE.B #1,D0      
    ELSE  ADD  #1,A0
    DBRA D1,LOOP      
    TST D0
    BNE START
    SIMHALT
    ORG  $1000
    ARRAY DC.B 1,5,2,4,3
    L     EQU  5           
    END  START  
  </code></pre>