The code that handles power on is accessed by the reset vector (0FFFFh:0000h). This is invoked when the ON key is pressed (and other deep sleep wakeup sources) while the machine is off.