Modernized nmk112 device. [Osso]

This commit is contained in:
Alex W. Jackson 2013-06-07 19:50:09 +00:00
parent d6f0880504
commit 0e79cea0cd
12 changed files with 144 additions and 176 deletions

View File

@ -86,7 +86,6 @@ Versions known to exist but not dumped:
#include "cpu/m68000/m68000.h"
#include "machine/eeprom.h"
#include "machine/nvram.h"
#include "machine/nmk112.h"
#include "cpu/z80/z80.h"
#include "includes/cave.h"
#include "sound/2203intf.h"
@ -510,7 +509,7 @@ static ADDRESS_MAP_START( donpachi_map, AS_PROGRAM, 16, cave_state )
/**/AM_RANGE(0xa08000, 0xa08fff) AM_RAM AM_SHARE("paletteram") // Palette
AM_RANGE(0xb00000, 0xb00003) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff) // M6295
AM_RANGE(0xb00010, 0xb00013) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff) //
AM_RANGE(0xb00020, 0xb0002f) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w) //
AM_RANGE(0xb00020, 0xb0002f) AM_DEVWRITE("nmk112", nmk112_device, okibank_lsb_w) //
AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") // Inputs
AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1") // Inputs + EEPROM
AM_RANGE(0xd00000, 0xd00001) AM_WRITE(cave_eeprom_msb_w) // EEPROM
@ -1164,7 +1163,7 @@ static ADDRESS_MAP_START( pwrinst2_sound_portmap, AS_IO, 8, cave_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("oki1", okim6295_device, read, write) // M6295
AM_RANGE(0x08, 0x08) AM_DEVREADWRITE("oki2", okim6295_device, read, write) //
AM_RANGE(0x10, 0x17) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w) // Samples bank
AM_RANGE(0x10, 0x17) AM_DEVWRITE("nmk112", nmk112_device, okibank_w) // Samples bank
AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write) //
AM_RANGE(0x50, 0x50) AM_WRITE(soundlatch_ack_w) // To Main CPU
// AM_RANGE(0x51, 0x51) AM_WRITENOP // ?? volume

View File

@ -148,7 +148,6 @@ Afega stands for "Art-Fiction Electronic Game"
#include "sound/okim6295.h"
#include "sound/3812intf.h"
#include "machine/nmk004.h"
#include "machine/nmk112.h"
#include "cpu/pic16c5x/pic16c5x.h"
#include "includes/nmk16.h"
@ -1080,7 +1079,7 @@ static ADDRESS_MAP_START( raphero_sound_mem_map, AS_PROGRAM, 8, nmk16_state )
AM_RANGE(0xc000, 0xc001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
AM_RANGE(0xc800, 0xc800) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
AM_RANGE(0xc808, 0xc808) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
AM_RANGE(0xc810, 0xc817) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w)
AM_RANGE(0xc810, 0xc817) AM_DEVWRITE("nmk112", nmk112_device, okibank_w)
// AM_RANGE(0xc810, 0xc817) AM_WRITE(okibank_w)
AM_RANGE(0xd000, 0xd000) AM_WRITE(raphero_sound_rombank_w)
AM_RANGE(0xd800, 0xd800) AM_READWRITE(soundlatch_byte_r, soundlatch2_byte_w) // main cpu
@ -1101,7 +1100,7 @@ static ADDRESS_MAP_START( macross2_sound_io_map, AS_IO, 8, nmk16_state )
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
AM_RANGE(0x88, 0x88) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
AM_RANGE(0x90, 0x97) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w)
AM_RANGE(0x90, 0x97) AM_DEVWRITE("nmk112", nmk112_device, okibank_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( bjtwin_map, AS_PROGRAM, 16, nmk16_state )
@ -1113,7 +1112,7 @@ static ADDRESS_MAP_START( bjtwin_map, AS_PROGRAM, 16, nmk16_state )
AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
AM_RANGE(0x084000, 0x084001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
AM_RANGE(0x084010, 0x084011) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
AM_RANGE(0x084020, 0x08402f) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w)
AM_RANGE(0x084020, 0x08402f) AM_DEVWRITE("nmk112", nmk112_device, okibank_lsb_w)
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0x094000, 0x094001) AM_WRITE(nmk_tilebank_w)
AM_RANGE(0x094002, 0x094003) AM_WRITENOP /* IRQ enable? */
@ -1139,7 +1138,7 @@ static ADDRESS_MAP_START( atombjt_map, AS_PROGRAM, 16, nmk16_state )
AM_RANGE(0x080014, 0x080015) AM_WRITE(nmk_flipscreen_w)
// AM_RANGE(0x084000, 0x084001) AM_DEVREADWRITE8("oki1", okim6295_device, read, write, 0x00ff)
// AM_RANGE(0x084010, 0x084011) AM_DEVREADWRITE8("oki2", okim6295_device, read, write, 0x00ff)
// AM_RANGE(0x084020, 0x08402f) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w)
// AM_RANGE(0x084020, 0x08402f) AM_DEVWRITE("nmk112", nmk112_device, okibank_lsb_w)
AM_RANGE(0x088000, 0x0887ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0x094000, 0x094001) AM_WRITE(nmk_tilebank_w)
AM_RANGE(0x094002, 0x094003) AM_WRITENOP /* IRQ enable? */

View File

@ -31,7 +31,6 @@ TODO:
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "machine/nmk112.h"
#include "sound/okim6295.h"
#include "sound/2203intf.h"
#include "includes/powerins.h"
@ -124,7 +123,7 @@ static ADDRESS_MAP_START( powerins_sound_io_map, AS_IO, 8, powerins_state )
AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("ym2203", ym2203_device, read, write)
AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
AM_RANGE(0x88, 0x88) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
AM_RANGE(0x90, 0x97) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w)
AM_RANGE(0x90, 0x97) AM_DEVWRITE("nmk112", nmk112_device, okibank_w)
ADDRESS_MAP_END
static ADDRESS_MAP_START( powerinb_sound_io_map, AS_IO, 8, powerins_state )
@ -133,7 +132,7 @@ static ADDRESS_MAP_START( powerinb_sound_io_map, AS_IO, 8, powerins_state )
AM_RANGE(0x01, 0x01) AM_NOP
AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("oki1", okim6295_device, read, write)
AM_RANGE(0x88, 0x88) AM_DEVREADWRITE("oki2", okim6295_device, read, write)
AM_RANGE(0x90, 0x97) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_w)
AM_RANGE(0x90, 0x97) AM_DEVWRITE("nmk112", nmk112_device, okibank_w)
ADDRESS_MAP_END

View File

@ -47,7 +47,6 @@ Stephh's notes (based on the games M68000 code and some tests) :
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/nmk112.h"
#include "sound/okim6295.h"
#include "includes/quizpani.h"
@ -61,7 +60,7 @@ static ADDRESS_MAP_START( quizpani_map, AS_PROGRAM, 16, quizpani_state )
AM_RANGE(0x100016, 0x100017) AM_WRITENOP /* IRQ enable? */
AM_RANGE(0x100018, 0x100019) AM_WRITE(quizpani_tilesbank_w)
AM_RANGE(0x104000, 0x104001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
AM_RANGE(0x104020, 0x104027) AM_DEVWRITE_LEGACY("nmk112", nmk112_okibank_lsb_w)
AM_RANGE(0x104020, 0x104027) AM_DEVWRITE("nmk112", nmk112_device, okibank_lsb_w)
AM_RANGE(0x108000, 0x1083ff) AM_RAM_WRITE(paletteram_RRRRGGGGBBBBRGBx_word_w) AM_SHARE("paletteram")
AM_RANGE(0x108400, 0x1085ff) AM_WRITENOP
AM_RANGE(0x10c000, 0x10c007) AM_RAM AM_SHARE("scrollreg")

View File

@ -353,7 +353,6 @@ To Do / Unknowns:
#include "cpu/z80/z80.h"
#include "cpu/z180/z180.h"
#include "machine/eeprom.h"
#include "machine/nmk112.h"
#include "sound/2151intf.h"
#include "sound/3812intf.h"
#include "sound/okim6295.h"
@ -838,10 +837,8 @@ WRITE8_MEMBER(toaplan2_state::raizing_z80_bankswitch_w)
WRITE8_MEMBER(toaplan2_state::raizing_oki_bankswitch_w)
{
nmk112_device *nmk112 = machine().device<nmk112_device>("nmk112");
nmk112_okibank_w(nmk112, space, offset, data & 0x0f);
nmk112_okibank_w(nmk112, space, offset + 1, (data >> 4) & 0x0f);
m_nmk112->okibank_w(space, offset, data & 0x0f);
m_nmk112->okibank_w(space, offset + 1, (data >> 4) & 0x0f);
}

View File

@ -4,6 +4,7 @@
***************************************************************************/
#include "machine/eeprom.h"
#include "machine/nmk112.h"
struct sprite_cave
{
@ -36,6 +37,7 @@ public:
m_mirror_ram(*this, "mirror_ram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_nmk112(*this, "nmk112"),
m_int_timer(*this, "int_timer"),
m_eeprom(*this, "eeprom") { }
@ -116,6 +118,7 @@ public:
/* devices */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<nmk112_device> m_nmk112;
required_device<timer_device> m_int_timer;
int m_rasflag;
int m_old_rasflag;

View File

@ -1,3 +1,4 @@
#include "machine/nmk112.h"
#include "sound/okim6295.h"
class nmk16_state : public driver_device
@ -5,6 +6,11 @@ class nmk16_state : public driver_device
public:
nmk16_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2"),
m_nmk112(*this, "nmk112"),
m_nmk_bgvideoram0(*this, "nmk_bgvideoram0"),
m_nmk_txvideoram(*this, "nmk_txvideoram"),
m_mainram(*this, "mainram"),
@ -16,13 +22,13 @@ public:
m_nmk_bgvideoram2(*this, "nmk_bgvideoram2"),
m_nmk_bgvideoram3(*this, "nmk_bgvideoram3"),
m_afega_scroll_0(*this, "afega_scroll_0"),
m_afega_scroll_1(*this, "afega_scroll_1"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_oki1(*this, "oki1"),
m_oki2(*this, "oki2") { }
m_afega_scroll_1(*this, "afega_scroll_1") {}
int mask[4*2];
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki1;
optional_device<okim6295_device> m_oki2;
optional_device<nmk112_device> m_nmk112;
required_shared_ptr<UINT16> m_nmk_bgvideoram0;
optional_shared_ptr<UINT16> m_nmk_txvideoram;
required_shared_ptr<UINT16> m_mainram;
@ -35,6 +41,7 @@ public:
optional_shared_ptr<UINT16> m_nmk_bgvideoram3;
optional_shared_ptr<UINT16> m_afega_scroll_0;
optional_shared_ptr<UINT16> m_afega_scroll_1;
int mask[4*2];
int m_simple_scroll;
int m_redraw_bitmap;
UINT16 *m_spriteram_old;
@ -185,8 +192,5 @@ public:
void decode_tdragonb();
void decode_ssmissin();
DECLARE_WRITE_LINE_MEMBER(ym2203_irqhandler);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki1;
optional_device<okim6295_device> m_oki2;
};

View File

@ -1,16 +1,23 @@
#include "machine/nmk112.h"
class powerins_state : public driver_device
{
public:
powerins_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_nmk112(*this, "nmk112"),
m_vctrl_0(*this, "vctrl_0"),
m_vram_0(*this, "vram_0"),
m_vram_1(*this, "vram_1"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu") { }
m_spriteram(*this, "spriteram")
{ }
int m_oki_bank;
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
optional_device<nmk112_device> m_nmk112;
required_shared_ptr<UINT16> m_vctrl_0;
required_shared_ptr<UINT16> m_vram_0;
required_shared_ptr<UINT16> m_vram_1;
@ -18,6 +25,7 @@ public:
UINT16 *m_vctrl_1;
tilemap_t *m_tilemap_0;
tilemap_t *m_tilemap_1;
int m_oki_bank;
int m_tile_bank;
DECLARE_WRITE16_MEMBER(powerins_okibank_w);
DECLARE_WRITE16_MEMBER(powerins_soundlatch_w);
@ -35,6 +43,4 @@ public:
UINT32 screen_update_powerins(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_soundcpu;
};

View File

@ -1,13 +1,18 @@
#include "machine/nmk112.h"
class quizpani_state : public driver_device
{
public:
quizpani_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_nmk112(*this, "nmk112"),
m_scrollreg(*this, "scrollreg"),
m_bg_videoram(*this, "bg_videoram"),
m_txt_videoram(*this, "txt_videoram"),
m_maincpu(*this, "maincpu") { }
m_txt_videoram(*this, "txt_videoram") { }
required_device<cpu_device> m_maincpu;
required_device<nmk112_device> m_nmk112;
required_shared_ptr<UINT16> m_scrollreg;
required_shared_ptr<UINT16> m_bg_videoram;
required_shared_ptr<UINT16> m_txt_videoram;
@ -23,5 +28,4 @@ public:
TILE_GET_INFO_MEMBER(txt_tile_info);
virtual void video_start();
UINT32 screen_update_quizpani(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
};

View File

@ -1,4 +1,6 @@
#include "machine/eeprom.h"
#include "machine/nmk112.h"
/**************** Machine stuff ******************/
//#define USE_HD64x180 /* Define if CPU support is available */
//#define TRUXTON2_STEREO /* Uncomment to hear truxton2 music in stereo */
@ -29,6 +31,7 @@ public:
m_mainram16(*this, "mainram16"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_nmk112(*this, "nmk112"),
m_oki(*this, "oki"),
m_oki1(*this, "oki1"),
m_eeprom(*this, "eeprom") {
@ -147,6 +150,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(bbakraid_irqhandler);
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
optional_device<nmk112_device> m_nmk112;
optional_device<okim6295_device> m_oki;
optional_device<okim6295_device> m_oki1;
optional_device<eeprom_device> m_eeprom;

View File

@ -13,50 +13,86 @@
#define TABLESIZE 0x100
#define BANKSIZE 0x10000
struct nmk112_state
const device_type NMK112 = &device_creator<nmk112_device>;
nmk112_device::nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NMK112, "NMK 112", tag, owner, clock)
{
/* which chips have their sample address table divided into pages */
UINT8 page_mask;
UINT8 current_bank[8];
UINT8 *rom0, *rom1;
int size0, size1;
};
/*****************************************************************************
INLINE FUNCTIONS
*****************************************************************************/
INLINE nmk112_state *get_safe_token( device_t *device )
{
assert(device != NULL);
assert(device->type() == NMK112);
return (nmk112_state *)downcast<nmk112_device *>(device)->token();
}
INLINE const nmk112_interface *get_interface( device_t *device )
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void nmk112_device::device_config_complete()
{
assert(device != NULL);
assert((device->type() == NMK112));
return (const nmk112_interface *) device->static_config();
}
/*****************************************************************************
STATIC FUNCTIONS
*****************************************************************************/
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
static void do_bankswitch( nmk112_state *nmk112, int offset, int data )
void nmk112_device::device_start()
{
const nmk112_interface *intf = (const nmk112_interface *)static_config();
if (intf->rgn0 == NULL)
{
m_rom0 = NULL;
m_size0 = 0;
}
else
{
m_rom0 = machine().root_device().memregion(intf->rgn0)->base();
m_size0 = machine().root_device().memregion(intf->rgn0)->bytes() - 0x40000;
}
if (intf->rgn1 == NULL)
{
m_rom1 = NULL;
m_size1 = 0;
}
else
{
m_rom1 = machine().root_device().memregion(intf->rgn1)->base();
m_size1 = machine().root_device().memregion(intf->rgn1)->bytes() - 0x40000;
}
m_page_mask = ~intf->disable_page_mask;
save_item(NAME(m_current_bank));
machine().save().register_postload(save_prepost_delegate(FUNC(nmk112_device::postload_bankswitch), this));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void nmk112_device::device_reset()
{
for (int i = 0; i < 8; i++)
{
m_current_bank[i] = 0;
do_bankswitch(i, m_current_bank[i]);
}
}
void nmk112_device::do_bankswitch( int offset, int data )
{
int chip = (offset & 4) >> 2;
int banknum = offset & 3;
int paged = (nmk112->page_mask & (1 << chip));
int paged = (m_page_mask & (1 << chip));
UINT8 *rom = chip ? nmk112->rom1 : nmk112->rom0;
int size = chip ? nmk112->size1 : nmk112->size0;
UINT8 *rom = chip ? m_rom1 : m_rom0;
int size = chip ? m_size1 : m_size0;
nmk112->current_bank[offset] = data;
m_current_bank[offset] = data;
if (size == 0) return;
@ -80,109 +116,22 @@ static void do_bankswitch( nmk112_state *nmk112, int offset, int data )
DEVICE HANDLERS
*****************************************************************************/
WRITE8_DEVICE_HANDLER( nmk112_okibank_w )
WRITE8_MEMBER( nmk112_device::okibank_w )
{
nmk112_state *nmk112 = get_safe_token(device);
if (nmk112->current_bank[offset] != data)
do_bankswitch(nmk112, offset, data);
if (m_current_bank[offset] != data)
do_bankswitch(offset, data);
}
WRITE16_DEVICE_HANDLER( nmk112_okibank_lsb_w )
WRITE16_MEMBER( nmk112_device::okibank_lsb_w )
{
if (ACCESSING_BITS_0_7)
{
nmk112_okibank_w(device, space, offset, data & 0xff);
okibank_w(space, offset, data & 0xff);
}
}
static void nmk112_postload_bankswitch(nmk112_state *nmk112)
void nmk112_device::postload_bankswitch()
{
for (int i = 0; i < 8; i++)
do_bankswitch(nmk112, i, nmk112->current_bank[i]);
}
/*****************************************************************************
DEVICE INTERFACE
*****************************************************************************/
static DEVICE_START( nmk112 )
{
nmk112_state *nmk112 = get_safe_token(device);
const nmk112_interface *intf = get_interface(device);
if (intf->rgn0 == NULL)
{
nmk112->rom0 = NULL;
nmk112->size0 = 0;
}
else
{
nmk112->rom0 = device->machine().root_device().memregion(intf->rgn0)->base();
nmk112->size0 = device->machine().root_device().memregion(intf->rgn0)->bytes() - 0x40000;
}
if (intf->rgn1 == NULL)
{
nmk112->rom1 = NULL;
nmk112->size1 = 0;
}
else
{
nmk112->rom1 = device->machine().root_device().memregion(intf->rgn1)->base();
nmk112->size1 = device->machine().root_device().memregion(intf->rgn1)->bytes() - 0x40000;
}
nmk112->page_mask = ~intf->disable_page_mask;
device->save_item(NAME(nmk112->current_bank));
device->machine().save().register_postload(save_prepost_delegate(FUNC(nmk112_postload_bankswitch), nmk112));
}
static DEVICE_RESET( nmk112 )
{
nmk112_state *nmk112 = get_safe_token(device);
for (int i = 0; i < 8; i++)
{
nmk112->current_bank[i] = 0;
do_bankswitch(nmk112, i, nmk112->current_bank[i]);
}
}
const device_type NMK112 = &device_creator<nmk112_device>;
nmk112_device::nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NMK112, "NMK 112", tag, owner, clock)
{
m_token = global_alloc_clear(nmk112_state);
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void nmk112_device::device_config_complete()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void nmk112_device::device_start()
{
DEVICE_START_NAME( nmk112 )(this);
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void nmk112_device::device_reset()
{
DEVICE_RESET_NAME( nmk112 )(this);
do_bankswitch(i, m_current_bank[i]);
}

View File

@ -19,22 +19,35 @@ struct nmk112_interface
UINT8 disable_page_mask;
};
class nmk112_device : public device_t
class nmk112_device : public device_t,
public nmk112_interface
{
public:
nmk112_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~nmk112_device() { global_free(m_token); }
~nmk112_device() {}
DECLARE_WRITE8_MEMBER( okibank_w );
DECLARE_WRITE16_MEMBER( okibank_lsb_w );
// access to legacy token
void *token() const { assert(m_token != NULL); return m_token; }
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
void do_bankswitch( int offset, int data );
void postload_bankswitch();
// internal state
void *m_token;
/* which chips have their sample address table divided into pages */
UINT8 m_page_mask;
UINT8 m_current_bank[8];
UINT8 *m_rom0, *m_rom1;
int m_size0, m_size1;
};
extern const device_type NMK112;
@ -48,12 +61,4 @@ extern const device_type NMK112;
MCFG_DEVICE_ADD(_tag, NMK112, 0) \
MCFG_DEVICE_CONFIG(_interface)
/***************************************************************************
DEVICE I/O FUNCTIONS
***************************************************************************/
DECLARE_WRITE8_DEVICE_HANDLER( nmk112_okibank_w );
DECLARE_WRITE16_DEVICE_HANDLER( nmk112_okibank_lsb_w );
#endif /* __NMK112_H__ */