Skip to content

Instantly share code, notes, and snippets.

@jacobmischka
Created February 2, 2015 18:11
Show Gist options
  • Save jacobmischka/10f0658cd8863650d125 to your computer and use it in GitHub Desktop.
Save jacobmischka/10f0658cd8863650d125 to your computer and use it in GitHub Desktop.
interrupt
/* Interrupt functions */
/* TODO: Interrupt hijacking */
void interrupt_IRQ() {
CLEAR_FLAG(FLAG_B);
cpu.PC++;
pushw(cpu.PC);
pushb(cpu.S);
SET_FLAG(FLAG_I);
cpu.PC = Memory_ReadWord(0xFFFE);
}
void interrupt_NMI() {
CLEAR_FLAG(FLAG_B);
cpu.PC++;
pushw(cpu.PC);
pushb(cpu.S);
SET_FLAG(FLAG_I);
cpu.PC = Memory_ReadWord(0xFFFA);
}
void interrupt_RESET(){
cpu.PC = Memory_ReadWord(0xFFFC);
cpu.SP;
cpu.S |= 0x24;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment