Skip to content

Commit

Permalink
Clear waiting with disabled interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
LRFLEW committed Oct 15, 2022
1 parent d01df96 commit 4adfe0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 8 additions & 6 deletions src/cpu/fake6502.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,17 @@ void nmi6502() {
push8(status);
status |= FLAG_INTERRUPT;
pc = (uint16_t)read6502(0xFFFA) | ((uint16_t)read6502(0xFFFB) << 8);
waiting = 0;
waiting = 0;
}

void irq6502() {
push16(pc);
push8(status & ~FLAG_BREAK);
status |= FLAG_INTERRUPT;
pc = (uint16_t)read6502(0xFFFE) | ((uint16_t)read6502(0xFFFF) << 8);
waiting = 0;
if (!(status & FLAG_INTERRUPT)) {
push16(pc);
push8(status & ~FLAG_BREAK);
status |= FLAG_INTERRUPT;
pc = (uint16_t)read6502(0xFFFE) | ((uint16_t)read6502(0xFFFF) << 8);
}
waiting = 0;
}

uint8_t callexternal = 0;
Expand Down
6 changes: 2 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1289,10 +1289,8 @@ emulator_loop(void *param)
}

if (video_get_irq_out() || via2_irq()) {
if (!(status & 4)) {
// printf("IRQ!\n");
irq6502();
}
// printf("IRQ!\n");
irq6502();
}

if (pc == 0xffff) {
Expand Down

0 comments on commit 4adfe0b

Please sign in to comment.