COP3402, Assignment 4
Due 11/16 at the start of class
Write a program that calculates the even parity, hamming code word for a
8-bit word. The result will be stored in a 16-bit code word, with the last
4 bits of the code word always be equal to 0. For example, if the data is
11001010, then the code word will be
0011100010100000.
Guidelines
-
Only the main procedure may use global variables.
-
All procedures may use global constants. Strings that are used to explain
the output may be used globally. Strings that are being changed may not be
used globally.
-
All procedues must be less than 24 lines (excluding initial pushes and terminal
pops).
-
Procedures must restore all registers that they change. AX may be changed
for procedures that return a value.
-
There must be a procedure that changes a 8-bit data word into a 16-bit Hamming
code word using even parity. This can be done quite succinctly by using nested
loops. First create the code word with all parity bits set to 0, then calculate
the correct parity bits. Extra credit (1 point): change a 16-bit data word
into a 2-word Hamming code word.
-
There must be a procedure that reads a string of up to 8 binary digits from
the user and calculates the equivalent unsigned binary number. If a non-binary
digit is entered, then warn the user and request a new string. The user may
enter less than 8 binary digits, in which case the number is padded with
extra zeros. The user may also correct mistakes before pressing the ENTER
key.
-
There must be a procedure that displays a 16-bit word as a string of 16 binary
digits.
-
You may create and use local variables if you run out of registers.
-
The program should continue reading and calculating until the user enters
a value of 0.