Is this XP 32 or 64 bit? Is it a home made Pc or name brand? How much ram, make and type. 533,667?
Reason I ask is that sometimes hardware compatibility, failure of ram module, placement and bios update or bios settings could be part of the problem. Many name brand computers will have bios updates and fixes for things like this. It may be worth checking their sites just in case. If you would like just provide the make and model of the Pc and I can look it up for you if time is an issue.
Did the computer do this after being on for a while, or did this start when you first turned the PC on?
If this occurred after being on for a while I would check the cooling fan for the processor. Maybe it's clogged with dust or the power pin has come out, or its just died.
The other thing is that right now a few nasty boot directory viruses are causing XP issues so if you can get into safe mode I would run a full scan with Malwarebytes or try Combofix. Just be aware that some of these viruses can do irreparable damage to the boot directory and sometimes do require a full reinstall to fix. If the issue doesn't allow you to install these programs, use another Pc (if possible) and install the programs on a USB and run them from that on your pc.
www.malwarebytes.org
Is the computer fully up to date with all current win updates?
Out of curiosity have you added any new hardware to the computer recently like a new video card, hard drive?
Depending on how powerful the power supply is, it may be overtaxed or in need of replacement, or sometimes dusty as [censored] and needing cleaning. Dust in a computer is one of the worst things on electrical contacts. I have seen many Pc's acting like yours and after a total cleaning no further problems. Not always the case, just something to be aware of.
Did the issue start after a new program was added or has it been going on for a while?
Try hitting F8 during startup and selecting Repair. See if after this the issue is resolved.
If no luck then hit F8 again during startup and select Safe mode. Go through any new programs installed and remove them one by one, restarting each time to see if the issue resolves. I know it's timely but its necessary.
Sorry for all the questions and mass of info, just trying to cover the bases for you.
Okay last thing I promise.
If you are sure that it has no viruses and a new piece of hardware isn't the issue then try this.
With the PC off and unplugged, pull the ram modules out of the PC. (MAKE SURE YOU GROUND YOURSELF TO THE CASE OF THE PC FIRST!) To do this touch the inner steel case once the side is open. If you don't you could fry the board and everything attached to it with a static discharge.
Clean the contacts and the inserts where they plug in to the PC. To clean them just use an old dry toothbrush. I know it sounds funny but it works. Once clean Reinsert them and lock them in. Start PC and see if problem resolves.
Good luck.