The 24 character error code is a failure of the short Disk Self Test ( DST ) and would indicate that the Hard Drive is failing and needs to be replaced. This is also consistent with the start-up issues you describe.
If your notebook is still under warranty, contact HP and arrange to have the drive replaced - you can check your warranty status Here.
If you are in another part of the world, start Here.
If you are out of warranty and would like a guide on replacing the Hard Drive yourself, please let me know - include the full Model No. and Product No. of yourg4 series notebook - see Here for a further explanation.