1 |
|
/* |
2 |
|
* CPUC64_SC.cpp - Single-cycle 6510 (C64) emulation |
3 |
|
* |
4 |
< |
* Frodo (C) 1994-1997,2002-2009 Christian Bauer |
4 |
> |
* Frodo Copyright (C) Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
103 |
|
dfff_byte = 0x55; |
104 |
|
BALow = false; |
105 |
|
first_irq_cycle = first_nmi_cycle = 0; |
106 |
+ |
opflags = 0; |
107 |
|
} |
108 |
|
|
109 |
|
|
301 |
|
* $dfa0-$dfff: Emulator identification |
302 |
|
*/ |
303 |
|
|
304 |
< |
const char frodo_id[0x5c] = "FRODO\r(C) 1994-1997 CHRISTIAN BAUER"; |
304 |
> |
const char frodo_id[0x5c] = "FRODO\r(C) CHRISTIAN BAUER"; |
305 |
|
|
306 |
|
uint8 MOS6510::read_emulator_id(uint16 adr) |
307 |
|
{ |
559 |
|
// Clear all interrupt lines |
560 |
|
interrupt.intr_any = 0; |
561 |
|
nmi_state = false; |
562 |
+ |
opflags = 0; |
563 |
|
|
564 |
|
// Read reset vector |
565 |
|
pc = read_word(0xfffc); |
604 |
|
|
605 |
|
// Any pending interrupts in state 0 (opcode fetch)? |
606 |
|
if (!state && interrupt.intr_any) { |
607 |
< |
if (interrupt.intr[INT_RESET]) |
607 |
> |
if (interrupt.intr[INT_RESET]) { |
608 |
|
Reset(); |
609 |
< |
else if (interrupt.intr[INT_NMI] && (the_c64->CycleCounter-first_nmi_cycle >= 2)) { |
610 |
< |
interrupt.intr[INT_NMI] = false; // Simulate an edge-triggered input |
611 |
< |
state = 0x0010; |
612 |
< |
} else if ((interrupt.intr[INT_VICIRQ] || interrupt.intr[INT_CIAIRQ]) && (the_c64->CycleCounter-first_irq_cycle >= 2) && !i_flag) |
613 |
< |
state = 0x0008; |
609 |
> |
} else if (interrupt.intr[INT_NMI]) { |
610 |
> |
uint32 int_delay = (opflags & OPFLAG_INT_DELAYED) ? 1 : 0; // Taken branches to the same page delay the NMI |
611 |
> |
if (the_c64->CycleCounter - first_nmi_cycle - int_delay >= 2) { |
612 |
> |
interrupt.intr[INT_NMI] = false; // Simulate an edge-triggered input |
613 |
> |
state = 0x0010; |
614 |
> |
opflags = 0; |
615 |
> |
} |
616 |
> |
} else if ((interrupt.intr[INT_VICIRQ] || interrupt.intr[INT_CIAIRQ]) && |
617 |
> |
(!i_flag || (opflags & OPFLAG_IRQ_DISABLED)) && !(opflags & OPFLAG_IRQ_ENABLED)) { |
618 |
> |
uint32 int_delay = (opflags & OPFLAG_INT_DELAYED) ? 1 : 0; // Taken branches to the same page delay the IRQ |
619 |
> |
if (the_c64->CycleCounter - first_irq_cycle - int_delay >= 2) { |
620 |
> |
state = 0x0008; |
621 |
> |
opflags = 0; |
622 |
> |
} |
623 |
> |
} |
624 |
|
} |
625 |
|
|
626 |
|
#include "CPU_emulcycle.h" |