Fixed nested NMIs on wc90b.c, improves msm sound.

This commit is contained in:
Angelo Salese 2009-05-18 22:41:06 +00:00
parent 809ac1895b
commit 0232d3ac16

View File

@ -108,36 +108,22 @@ VIDEO_UPDATE( wc90b );
static int msm5205next;
static UINT8 *wc90b_shared;
static READ8_HANDLER( wc90b_shared_r )
{
return wc90b_shared[offset];
}
static WRITE8_HANDLER( wc90b_shared_w )
{
wc90b_shared[offset] = data;
}
static WRITE8_HANDLER( wc90b_bankswitch_w )
{
int bankaddress;
UINT8 *RAM = memory_region(space->machine, "maincpu");
UINT8 *ROM = memory_region(space->machine, "maincpu");
bankaddress = 0x10000 + ((data & 0xf8) << 8);
memory_set_bankptr(space->machine, 1,&RAM[bankaddress]);
memory_set_bankptr(space->machine, 1,&ROM[bankaddress]);
}
static WRITE8_HANDLER( wc90b_bankswitch1_w )
{
int bankaddress;
UINT8 *RAM = memory_region(space->machine, "sub");
UINT8 *ROM = memory_region(space->machine, "sub");
bankaddress = 0x10000 + ((data & 0xf8) << 8);
memory_set_bankptr(space->machine, 2,&RAM[bankaddress]);
memory_set_bankptr(space->machine, 2,&ROM[bankaddress]);
}
static WRITE8_HANDLER( wc90b_sound_command_w )
@ -149,11 +135,11 @@ static WRITE8_HANDLER( wc90b_sound_command_w )
static WRITE8_DEVICE_HANDLER( adpcm_control_w )
{
int bankaddress;
UINT8 *RAM = memory_region(device->machine, "audiocpu");
UINT8 *ROM = memory_region(device->machine, "audiocpu");
/* the code writes either 2 or 3 in the bottom two bits */
bankaddress = 0x10000 + (data & 0x01) * 0x4000;
memory_set_bankptr(device->machine, 3,&RAM[bankaddress]);
memory_set_bankptr(device->machine, 3,&ROM[bankaddress]);
msm5205_reset_w(device,data & 0x08);
}
@ -171,7 +157,7 @@ static ADDRESS_MAP_START( wc90b_map1, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xc000, 0xcfff) AM_RAM_WRITE(wc90b_bgvideoram_w) AM_BASE(&wc90b_bgvideoram)
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(wc90b_txvideoram_w) AM_BASE(&wc90b_txvideoram)
AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK(1)
AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90b_shared_r, wc90b_shared_w) AM_BASE(&wc90b_shared)
AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE(1)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90b_bankswitch_w)
AM_RANGE(0xfd00, 0xfd00) AM_WRITE(wc90b_sound_command_w)
AM_RANGE(0xfd04, 0xfd04) AM_WRITEONLY AM_BASE(&wc90b_scroll1y)
@ -193,7 +179,7 @@ static ADDRESS_MAP_START( wc90b_map2, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_be_w) AM_BASE(&paletteram)
AM_RANGE(0xe800, 0xefff) AM_ROM
AM_RANGE(0xf000, 0xf7ff) AM_ROMBANK(2)
AM_RANGE(0xf800, 0xfbff) AM_READWRITE(wc90b_shared_r, wc90b_shared_w)
AM_RANGE(0xf800, 0xfbff) AM_RAM AM_SHARE(1)
AM_RANGE(0xfc00, 0xfc00) AM_WRITE(wc90b_bankswitch1_w)
ADDRESS_MAP_END
@ -351,7 +337,8 @@ GFXDECODE_END
/* handler called by the 2203 emulator when the internal timers cause an IRQ */
static void irqhandler(const device_config *device, int irq)
{
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
/* NMI writes to MSM ports *only*! -AS */
//cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, irq ? ASSERT_LINE : CLEAR_LINE);
}
static const ym2203_interface ym2203_config =
@ -368,18 +355,20 @@ static void adpcm_int(const device_config *device)
{
static int toggle = 0;
msm5205_data_w(device, msm5205next);
msm5205next >>= 4;
toggle ^= 1;
if(toggle)
{
msm5205_data_w(device, (msm5205next & 0xf0) >> 4);
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
}
else
msm5205_data_w(device, (msm5205next & 0x0f) >> 0);
}
static const msm5205_interface msm5205_config =
{
adpcm_int, /* interrupt function */
MSM5205_S96_4B /* 4KHz 4-bit */
adpcm_int, /* interrupt function */
MSM5205_S96_4B /* 4KHz 4-bit */
};
static MACHINE_DRIVER_START( wc90b )