I got around to porting the BCH-21,31 forward-error-correction routines I have to the NES.
Included is a trivial demonstration of both generation and correction working.
FEC let you detect when data corruption has happened, and to a limited extent lets you repair that damage. BCH-21,31 is specifically used in a wide variety of radio protocols (including POCSAG, FLEX, and the GameCube's WaveBird). In the NES, this might be useful in passwords, or perhaps for storage on audio cassette.
Because calculating BCH involves a lot of work on just one bit at a time, I've stored all the numbers in "transposed" manner, one bit per byte, big-endian. However, my routines correctly let you pack multiple bits into those 31 bytes. Note that because this FEC can correct at most two bits, you'll want to plan based on the specific kind of data corruption you anticipate; in RF contexts this transposed layout is beneficial because it distributes single bits of noise over multiple protected words.
Hopefully someone finds this useful.
Included is a trivial demonstration of both generation and correction working.
FEC let you detect when data corruption has happened, and to a limited extent lets you repair that damage. BCH-21,31 is specifically used in a wide variety of radio protocols (including POCSAG, FLEX, and the GameCube's WaveBird). In the NES, this might be useful in passwords, or perhaps for storage on audio cassette.
Because calculating BCH involves a lot of work on just one bit at a time, I've stored all the numbers in "transposed" manner, one bit per byte, big-endian. However, my routines correctly let you pack multiple bits into those 31 bytes. Note that because this FEC can correct at most two bits, you'll want to plan based on the specific kind of data corruption you anticipate; in RF contexts this transposed layout is beneficial because it distributes single bits of noise over multiple protected words.
Hopefully someone finds this useful.