I am working on a bigger project and need a small part to help me work faster.
I need someone to write an assembly code to just to do the following....
convert a single byte in memory into two ASCII hexadecimal digits, and
reverse the process in the same program. The input should be in
location 1000H. At that new location, take the byte and create two
ASCII hex digits in the two bytes which follow it, and then the
reconverted number in the byte which follows those two (ASCII) bytes.
Thus if the input is:
--------------------------------------------
7F ? ? ?
1000H 1001H 1002H 1003H
--------------------------------------------
The output should look like:
--------------------------------------------
7F 37 46 7F
1000H 1001H 1002H 1003H
--------------------------------------------
Note that converting the digits 0-9 may be done in the same manner as
the decimal conversion, but that the digits A-F do NOT follow
immediately afterward in the ASCII table. Of course, the final output
byte (Byte 1003H) should be computed by looking at the preceeding two
bytes, NOT by inspecting the original input byte!
For output, your program should not only leave the three bytes in
memory, it should also print the two output ASCII bytes to the screen,
using INT 10H, subfunction 0EH, as described in class. It should print
the two hex digits, followed by two spaces to separate one run of your
program from the next.
So, the printed output for the above example would be:
7F
=========================================================================
=========================================================================
Here is the 2nd part of the question.
I need a program to input a series of characters until you reach an
exclamation mark ("!"). Then print on the screen the count of each
letter which has occurred, sorted in descending order by occurrence.
The maximum count will be 255.
Thus, if input is:
Wow, I just Loooooooooooooooove Assembler!
output would be:
The Letter Count of Message is:
O 17
E 3
S 3
L 2
W 2
A 1
B 1
J 1
I 1
M 1
T 1
U 1
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 'E'
... etc.
Then, sort the array by the count, keep the letter and the count
together, like this:
'O' 17 'E' 3 'S' 3 'L' 2 'W'
... etc.
Use INT 16H (which we demonstrated in class) for input. Echo print
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. |