RSS Forums RSS

descending bucket sort in 68000

Please support our Assembly advertiser: Programming Forums
Reply
Posts: 34
Reputation: Seamus McCarthy is an unknown quantity at this point 
Solved Threads: 0
Seamus McCarthy Seamus McCarthy is offline Offline
Light Poster

descending bucket sort in 68000

  #1  
Apr 26th, 2008
          ORG      $8000
NUMBERS   DS.B     5               ;room for 5 input values
BUCKETS   DS.B     11              ;room for 11 buckets

          ORG      $8100

BKTSORT   LEA	BUCKETS,A0         ;init array pointer
                 MOVE.W   #10,D0          ;init loop counter
CLRBKT     CLR.B    (A0)+               ;clear bucket
                 DBRA     D0,CLRBKT       ;do this 11 times
                 LEA	    NUMBERS,A1     ;init pointer to input data
                 LEA	    BUCKETS,A0     ;init pointer to buckets
                 MOVE.W   #4,D0             ;init loop counter
SETBKT      MOVE.B   (A1)+,D1         ;read input value
                 MOVE.B   #1,(A0,D1)      ;set bucket to 1
                 DBRA     D0,SETBKT       ;do this 5 times
                 LEA	    NUMBERS,A1    ;init pointer to input array
                 LEA	    BUCKETS,A0    ;init pointer to buckets
                 CLR.L    D1                   ;clear index pointer
                 MOVE.W   #10,D0          ;init loop counter
READBKT   CMPI.B   #1,(A0,D1)      ;read bucket value
                 BNE      NOSAVE            ;branch if bucket = 0
                 MOVE.B   D1,(A1)+        ;save index value
NOSAVE     ADDI.B   #1,D1             ;advance index value
                 DBRA     D0,READBKT    ;do this 11 times
                 RTS 

I understand and got the ascending bucket sort to work but how would i edit the ascending sort to give me the numbers in descending order instead.
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Assembly Forum
Views: 986 | Replies: 0 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:30 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC