Solution program: solution.asm
Input data file: hamming.txt
Zip archive containing all required files
Strategy: This program requires reading through Chapter 7 in the book. They may need some help with opening and reading files. Other than that, the tutorial is fairly self-explanatory. The program can easily be completed in two weeks.
Evaluation: Very favorable response from students.
Write a program that does the following:
| 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.
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)
The Parity flag only evaluates byte values. But you can get the parity of a 16-bit number by exclusive-ORing its two bytes together. For example, parity(AX) = AH XOR AL.