Supplementary procedures:
| For this problem, bits are numbered from left to right, starting with 1 and ending at 16. |
Each record of the test data file contains exactly 18 bytes (16 bytes of digits, plus hidden CR, LF characters) Here are the contents of hamming.txt:
0110100011110000
1110100011110000
0110110011110000
0110100011100000
0110010111010000
0100010111010000
0110110111010000
0110010110010000
It contains two different code words, with examples of errors in different positions. Your program should work with any valid Hamming code words. Download and run my demo program. The ZIP file also contains hamming.txt, which you should use to test your own program. My solution program generates about 30 lines of output, so you might want to set your DOS window properties to enough lines to avoid losing scrolled text. Also, un-check the "Close Window on Exit" option in the window properties dialog.
When I test your program, I will use a a new version of hamming.txt. Important:
your program must open a file named hamming.txt in the current directory.
Your grade will be based on how early you turn in a perfectly working program. In the following table, the grade you can earn goes down with each successive submission date. Immediately after each submission date, I will publish on my web site, the source code for the code samples shown in the right column. For example, on Nov 16, I will publish the contents of my EvenParity and ReadCodeWord procedures:
| Submit Date | Max Grade | Published Code Samples |
| Nov 8 | 110 | none |
| Nov 15 | 100 | none |
| Nov 27 | 80 | EvenParity, ReadCodeWord |
| Nov 29 | 60 | FixCodeWord, TestCodeWord |
The AND, OR, NOT, XOR, and TEST instructions all affect the parity flag. For example, if you do the following, it will set the parity flat to PE (even) or PO (odd), depending on the bits in the lowest byte of the destination operand:
mov al,10101110b or al,al ; Parity = odd (five bits are set)
What about 16-bit numbers? Bummer, the Parity flag only works for byte values. To evaluate the parity of a 16-bit register such as AX, you can check the parity of AH and AL separately, and then combine the two results. Here's an interesting property of integer addition that will help you:
even + even --> even odd + odd --> even odd + even --> odd even + odd --> oddIn my own solution program, I have a function named EvenParity that sets the Zero flag if the word in AX has even parity.