check engine light flashing fast on 1997 Subaru Legacy Outback

The car will not turn over, but, the lights, radio and power windows still work. The fan will even run. I replaced the rear o2 sensor. no help.

Asked by for the 1997 Subaru Legacy Outback
Start with a new battery a battery with one bad cell will power the lights radio etc but wont have the amps to engage the starter or power the ignition