So after implementing my code in the previous post, if you run the hard drivin compact roms, you should be able to successfully calibrate the wheel, but you must use a mouse. Moving the mouse for ages to the right will simulate 4 wheel rotations and after completing the calibration you want to see:
NEW CNTSPTRN 1024 PATCEN 0
Which indicates one complete wheel rotation (CNTSPTRN) amounts to 1024 (0x400) encoder values and the wheel is currently in its centre position (PATCEN 0).
Note. You will want to hold the left shift key to get the encoder value spot on at the end of the calibration (When its working out the PATCEN thing).
In the game, the centre edge bit (That "result ^= 0x4000" stuff in hdc68k_port1_r()) will 'latch' each time the wheel does a full rotation (Hitting the wheel's centre point). The encoder wheel value at these centre points will be 0x000, 0x400, 0x800 or 0xC00. So say the centre edge bit is 0 between range 0x000 to 0x3FF, this means in the 0x400 to 0x7FF range the centre edge bit will be 1, in the 0x800 to 0xBFF range the centre edge bit will be 0, and in the 0xC00 to 0xFFF range the centre edge bit will be 1.
Note. I believe incorrect calibration and incorrect centre edit bit latching were the main reasons why the old code didn't work. The old code would set m_hdc68k_wheel_edge to 1 when it wanted to latch the centre edge bit. In hdc68k_port1_r(), because m_hdc68k_wheel_edge was set it would toggle the centre edge bit. The problem is, during the game, you don't always get a hdc68k_wheel_edge_reset_w() acknowledgement for changing the centre edge bit (You do in service mode, but not always during the game), and the code relied on that to set m_hdc68k_wheel_edge back to 0. The result is, during the game you can get into a state where the centre edit bit toggles repeatedly because m_hdc68k_wheel_edge it left set to 1 for ages (Until such a time when hdc68k_wheel_edge_reset_w() is called (After the car re-spawns is one of those times)).
I think that just as your car re-spawns is the moment when the game works out which one of the centre points is the most appropriate (nearest). Let say you started the game around the 0x800 position, then you crash after turning hard right (and say the encoder at that moment is 0xD50). Then once you re-spawn, the game doesn't expect you to wind back the steering all the way to the 0x800 centre point (0xD50-0x550 encoder values), you'll only be expected to wind back the steering to the 0xC00 centre point (0xD50-0x150 encoder values).
So now after you crash, when you get the car to go in a straight forwards direction and observe the encoder value (left shift), you should notice it'll always be around one of those those centre points (0x000, 0x400, 0x800, 0xC00).