1991 Honda Civic

Engine Mechanical problem
1991 Honda Civic 4 cyl Two Wheel Drive Automatic 105000 miles

My sons 1991 Civic DX has starting issues. It was running fine, and then one day recently, would not start. I went through a series of repairs and checks and finally got it to start, but it still does not run well.
I am getting an ECU code # 8 (top dead center code).
Do I need to replace the distributor? Is there a potential cheaper fix?

Here is what I have done to the car the past few days:

replaced distributor cap, rotor, ignition coil, and plugs.
(wires are only one year old)

checked fuel pump operation and fuel injector resistance all good

replaced valve cover gasket

replaced PCV valve
December 29, 2008.

For 1.5 liter engine

Code no. 8 TDC Position Sensor-Problem in TDC sensor circuit

Dec 30, 2008.