Honors 201
Assignment 2
RADIX SORT

Write an assembly language program which uses the radix sort method to
sort the following list of 40 unsigned decimal numbers in the range 0-255
into ascending order:

DATA  DB   012, 021, 160, 024, 004, 053, 176, 197, 181, 024
      DB   032, 044, 032, 032, 084, 208, 212, 192, 189, 128
      DB   004, 001, 065, 252, 008, 017, 072, 076, 029, 052
      DB   160, 157, 117, 125, 104, 153, 077, 096, 081, 125


You input the data by including the above lines in your program. You can
generate the output simply by giving a screen shot from DDB, or alternatively
you can output the data as a series of decimal values to the screen.

The radix sort method works as follows:

The bits in a byte are numbered 

   7 6 5 4 3 2 1 0

where 7 is the most significant, 0 is the least significant.

Radix sorting works by looking at specific bits in the data, and dividing
up the data into two piles, the zeroes pile and the ones pile, then the
data is reassembled by putting the zeroes pile first, then the ones pile.

To do a complete radix sort on 8-bit bytes, first divide up the data on
bit 0 (the least significant bit), then recombine the zeroes and ones,
then repeat this for bit 1, bit 2, bit 3, ... and finally bit 7, and
the data will be sorted.

Let's illustrate the method with an example using three bit values

  010 011 100 001 010 101

First divide on the last bit:

  zeroes: 010 100 010 101
  ones:   011 001

Recombine:
 
  010 100 010 101 011 001

Now divide on the middle bit:

  zeroes: 100 001 101
  ones;   010 010 011

Recombine:

  100 001 101 010 010 011

Now divide on the first bit:

  zeroes: 001 010 010 011
  ones:   100 101 

Recombine:

  001 010 010 011 100 101

And the list is now sorted in ascending order.


THIS IS DUE TWO WEEKS FROM THIS COMING THURSDAY. I AM MAKING THIS
THE DUE DATE, SINCE THAT IS THE MIDTERM DATE, AND YOU SHOULD REALLY
HAVE THIS DONE BEFORE THE MID-TERM!