psxbios: rewrite event handling