| | |
descending bucket sort in 68000
![]() |
•
•
Join Date: Apr 2008
Posts: 34
Reputation:
Solved Threads: 0
Assembly Syntax (Toggle Plain Text)
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.
![]() |
Other Threads in the Assembly Forum
- Previous Thread: Belgian keyboard in SoftIce
- Next Thread: Help Assembly matrix multiplication
| Thread Tools | Search this Thread |





