Machine Organization I
V22.0201 - Spring 2009

Assignment 3
Due: Wednesday, March 11th


Simple Bubble or Exchange Sort

In this program, you are to input a series of characters until you reach two exclamation marks in a row ("!!"). You will then print on the screen the count of each letter which has occurred, sorted in ascending order by occurrence. The maximum count will be 255.

Thus, if your input is:

Wow! I just Loooooooooooooooove Assembler!!

Your output would be:

The Letter Count of Your Message is:

A   1
B   1
J   1
I   1
M   1
T   1
U   1

L   2
W   2
E   3
S   3
O  17

Notes: One solution is to keep an array which has both the letters and the counts in it, such as this:

'A'
0
'B'
0
'C'
0
'D'
0
...etc

Then, when you sort the array by the count, keep the letter and the count together, like this:

'C'
0
...etc
'E'
3
'S'
3
'O'
17

Use INT 16H (which we demonstrated in class) for input. Echo print your input character by character.

The code for converting the count into decimal ascii is exactly that found in Chapter 2, with the exception that leading zeroes should be converted into spaces.

All variables should be now be written using db's or dw's.