Machine Organization I

V22.0201 - Fall 1998

Nathan Hull

Assignment 2

Due: Thursday, October 15

In class, we solved two problems, one of which converts a single binary byte in memory into three ASCII decimal digits, and the other which reverses the process. Your assignment is to convert a single binary byte in memory into two ASCII hexadecimal digits, and reverse the process in the same program. The input should be in location 1000H, the two ASCII hex digits in 1001H and 1002H, and the reconverted binary number in 1003H. As a check, put a 1 in location 1004H if 1000H equals 10003H at the conclusion of the program, otherwise put a 0FFH in that location.

Thus if the input is:

7F

?

?

?

?

1000H

1001H

1002H

1003H

1004H

The output should look like:

7F

37

46

7F

1

1000H

1001H

1002H

1003H

1004H

('7')

('F')

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, location 1003H should be computed by looking at positions 1001H and 1002H, NOT 1000h!

Although your program should accept the input from location 1000H, it should also print the output as follows, using INT 10H, subfuction 0EH, as described in class. It should print the two hex digits, followed by a space, and then followed by the word 'OK' or the word 'BAD' depending upon whether byte 1000H matches byte 1004H or not. Finally, it should print out two more spaces to separate one run of your program from the next.

Email your E-Tutor the ASM file.