Skip to content

Commit

Permalink
Fixed mapper 342.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Jan 18, 2024
1 parent 52356fb commit 009dc37
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/core/mappers/mapper_342.c
Original file line number Diff line number Diff line change
Expand Up @@ -2335,27 +2335,19 @@ INLINE static void mapper23_cpu_every_cycle(BYTE nidx) {
INLINE static void mapper24_cpu_every_cycle(BYTE nidx) {
// Mapper #23 - VRC2/4
if (m342.vrc4.irq.control & 0x02) {
if (m342.vrc4.irq.control & 0x04) {
m342.vrc4.irq.prescaler++;
if ((!(m342.vrc4.irq.prescaler_counter & 0x02) && (m342.vrc4.irq.prescaler == 114))
|| ((m342.vrc4.irq.prescaler_counter & 0x02) && (m342.vrc4.irq.prescaler == 113))) {
m342.vrc4.irq.prescaler = 0;
m342.vrc4.irq.prescaler_counter++;
if (m342.vrc4.irq.prescaler_counter == 3) {
m342.vrc4.irq.prescaler_counter = 0;
}
m342.vrc4.irq.value++;
if (m342.vrc4.irq.value == 0) {
m342.vrc4.irq.value = m342.vrc4.irq.latch;
nes[nidx].c.irq.high |= EXT_IRQ;
}
} else {
m342.vrc4.irq.prescaler++;
if ((!(m342.vrc4.irq.prescaler_counter & 0x02) && (m342.vrc4.irq.prescaler == 114))
|| ((m342.vrc4.irq.prescaler_counter & 0x02) && (m342.vrc4.irq.prescaler == 113))) {
m342.vrc4.irq.prescaler = 0;
m342.vrc4.irq.prescaler_counter++;
if (m342.vrc4.irq.prescaler_counter == 3) {
m342.vrc4.irq.prescaler_counter = 0;
}
m342.vrc4.irq.value++;
if (m342.vrc4.irq.value == 0) {
m342.vrc4.irq.value = m342.vrc4.irq.latch;
nes[nidx].c.irq.high |= EXT_IRQ;
}
}
}
}
}
Expand Down

0 comments on commit 009dc37

Please sign in to comment.