To answer your question, Code 52 indicates that the "long term" memory in the ECM has been reset. This will be the case whenever power is removed from the ECM (i.e. disconnecting battery cables, disconnecting P-1 (blue) ECM connector, etc.) This code should be "cleared" from memory after restoring the ECM's power supply.
Now what that means is battery power was lost for enough time for the ECM to lose memory. If you disconnected the battery trying to reset the light, that would have caused the code.
However, that doesn't explain why the engine stalled and the light is on. What I suggest is to scan the computer to determine what new codes are now stored. This vehicle has an OBD1 diagnostic system. It doesn't require a scanner to retrieve codes. All that will be needed is a short jumper wire or even a paper clip. Here is a link that explains how it works.
Once you do this, let me know what codes were retrieved. Also, you asked if it was safe to drive. Take a look through these links. They discuss your concerns.
Let me know if this helps or if you have other questions.
Friday, April 3rd, 2020 AT 7:29 PM