Skip to content

Commit

Permalink
FDS: IRQs are affected by enable disk io register
Browse files Browse the repository at this point in the history
  • Loading branch information
negativeExponent committed Jun 2, 2022
1 parent 971d721 commit d623a93
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/fds.cpp
Expand Up @@ -223,8 +223,8 @@ void FCEU_FDSSelect(void)
FCEU_DispMessage("Disk %d Side %c Selected", 0, SelectDisk >> 1, (SelectDisk & 1) ? 'B' : 'A');
}

#define IRQ_Repeat (IRQa & 0x01)
#define IRQ_Enabled (IRQa & 0x02)
#define IRQ_Repeat 0x01
#define IRQ_Enabled 0x02

static void FDSFix(int a) {
if ((IRQa & IRQ_Enabled) && IRQCount) {
Expand Down Expand Up @@ -574,21 +574,29 @@ void FDSSoundReset(void) {
static DECLFW(FDSWrite) {
switch (A) {
case 0x4020:
X6502_IRQEnd(FCEU_IQEXT);
IRQLatch &= 0xFF00;
IRQLatch |= V;
break;
case 0x4021:
X6502_IRQEnd(FCEU_IQEXT);
IRQLatch &= 0xFF;
IRQLatch |= V << 8;
break;
case 0x4022:
X6502_IRQEnd(FCEU_IQEXT);
IRQCount = IRQLatch;
IRQa = V & 3;
IRQa &= ~1;
IRQa |= (V & 1);
if ((V & 2) && (FDSRegs[3] & 1)) {
IRQa |= 2;
IRQCount = IRQLatch;
} else
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0x4023:
if (!(V & 1)) {
IRQa &= 2;
X6502_IRQEnd(FCEU_IQEXT);
X6502_IRQEnd(FCEU_IQEXT2);
}
break;
case 0x4023: break;
case 0x4024:
if (mapperFDS_diskinsert && ~mapperFDS_control & 0x04) {

Expand Down

0 comments on commit d623a93

Please sign in to comment.