Skip to content

Commit

Permalink
nes_apu, dmc mode for arcade
Browse files Browse the repository at this point in the history
  • Loading branch information
dinkc64 committed Aug 17, 2024
1 parent bc41bfd commit 3bd9f6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/burn/snd/nes_apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,17 @@ struct nesapu_info
static nesapu_info nesapu_chips[CHIP_NUM];

static INT32 cycles_per_frame;
static UINT32 arcade_mode = 0; // not cycle accurate dpcm/dmc (needed for arcade)

#if 0
INT32 nes_scanline();
#endif

void nesapuSetArcade(INT32 mode)
{
arcade_mode = mode;
}

static UINT32 nes_nesapu_sync(INT32 samples_rate)
{
return (samples_rate * M6502TotalCycles()) / cycles_per_frame; /* ntsc: (341*262 / 3) + 0.5 pal: (341*312 / 3.2) + 0.5*/
Expand Down Expand Up @@ -848,6 +854,8 @@ static void apu_update(struct nesapu_info *info)
INT32 dmc = dmc_buffer[dmcoffs];
INT32 ext = nes_ext_buffer[dmcoffs];

if (arcade_mode) dmc = apu_dpcm(info, &info->APU.dpcm);

INT32 out = (INT32)(((float)info->tnd_table[3*triangle + 2*noise + dmc] +
info->square_table[square1 + square2] + info->square_table[square3 + square4]) * 0x3fff);

Expand Down
1 change: 1 addition & 0 deletions src/burn/snd/nes_apu.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extern INT32 nesapu_mixermode;
void nesapuInitPal(INT32 chip, INT32 clock, INT32 bAdd); // pal nes
void nesapuInit(INT32 chip, INT32 clock, INT32 bAdd); // ntsc nes
void nesapuInit(INT32 chip, INT32 clock, INT32 is_pal, UINT32 (*pSyncCallback)(INT32 samples_per_frame), INT32 nAdd);
void nesapuSetArcade(INT32 mode);
void nesapuUpdate(INT32 chip, INT16 *buffer, INT32 samples);
void nesapuSetRoute(INT32 chip, INT32 nIndex, double nVolume, INT32 nRouteDir);
void nesapuSetDMCBitDirection(INT32 reversed);
Expand Down

0 comments on commit 3bd9f6f

Please sign in to comment.