This post is for IFW if he is still looking at this tread.
I have tried to use your FdcShiftBit() routine in my program. I never had problem with my previous decoder routine for many years until I found the specific case used in the Jupiter
master drive game: a 0x5224 MFM pattern followed by a 0x4489 pattern that should be decoded as a 0xC2 address mark byte followed by a 0x0B byte. So I have tried to use an adapted version of your routine in Aufit.
The result is that now I can read the “Jupiter
master drive” "special" sequence correctly but now the normal A1 sync sequence at the head of every records is not read correctly.
The reason is the following: a normal sync sequence is composed of a set of several 0x00 (encoded as 0xAAAA) bytes followed by 3 A1 sync mark (encoded as 0x4489).
So we have a sequence of bit like this:
Code: Select all
0xAAAA 0x4489 = 1010 1010 1010 1010 0100 0100 1000 1001
0x5224 0 1010 0100 0100 100
As shown this can be interpreted as a 0x5224 sequence followed few bits later by a 0x4489 sequence. In your program the first 0x5224 sync (returned as 0x14) is detected but the second A1 sync is rejected because placed at less than 16 bits apart.
The good news is that despite the fact that the A1 sync is not returned as a sync mark the synchronization is done correctly and therefore all subsequent bytes are decoded correctly.
So my question is: does your routine needs a “post-processing” action from the calling routine to put back an A1 to replace the first returned sync or am I missing something else?