1. A method for program debugging, the method comprising: setting a plurality of breakpoints corresponding to a plurality of events in a Basic Input/Output System (BIOS) program code, each event being a test executed by the BIOS program code to a peripheral device and taking a general processing path when the peripheral device is working well or an error processing path when the peripheral device is in an error state; executing the BIOS program code for outputting a diagnosis code of one of the plurality of breakpoints; setting a parameter to simulate the peripheral device is working well throughout execution of the event corresponding to the diagnosis code by a branch command of a script file via an emulator; executing the event corresponding to the diagnosis code according to the parameter for making the event undergo the general processing path; resetting the parameter to simulate the peripheral device being in the error state throughout execution of the event corresponding to the diagnosis code by the branch command of the script file via the emulator; and executing the event corresponding to the diagnosis code according to the reset parameter for making the event undergo the error processing path; wherein the breakpoints are software interrupt, using a trap to stop the execution of the emulator; wherein the breakpoint can be set ahead or after program codes of the corresponding event; if the breakpoints are set ahead of the corresponding events, the parameters are reset after the breakpoints; if the breakpoints are set after the corresponding events, the script file should spontaneously jump ahead of the branch command of the event and reset the parameter of the event.