diff --git a/src/mess/drivers/pocketc.c b/src/mess/drivers/pocketc.c index 51344fbd3c3..e5e00c5dfdd 100644 --- a/src/mess/drivers/pocketc.c +++ b/src/mess/drivers/pocketc.c @@ -13,7 +13,6 @@ #include "includes/pc1350.h" #include "includes/pc1403.h" #include "machine/ram.h" -#include "drivlgcy.h" /* pc1430 no peek poke operations! */ @@ -708,7 +707,7 @@ static GFXDECODE_START( pc1251 ) GFXDECODE_ENTRY( "gfx1", 0x0000, pc1251_charlayout, 0, 8 ) GFXDECODE_END -static MACHINE_CONFIG_FRAGMENT( pocketc ) +static MACHINE_CONFIG_START( pocketc, pocketc_state) MCFG_QUANTUM_TIME(attotime::from_hz(60)) MCFG_NVRAM_ADD_0FILL("cpu_nvram") @@ -730,13 +729,13 @@ static MACHINE_CONFIG_FRAGMENT( pocketc ) MCFG_GFXDECODE_ADD("gfxdecode", pc1401 ) MCFG_PALETTE_ADD("palette", 8*2) MCFG_PALETTE_INDIRECT_ENTRIES(6) - MCFG_PALETTE_INIT_LEGACY( pocketc ) + MCFG_PALETTE_INIT_OWNER( pocketc_state, pocketc ) /* sound hardware */ /*MCFG_SOUND_ADD("dac", DAC, pocketc_sound_interface)*/ MACHINE_CONFIG_END -static MACHINE_CONFIG_START( pc1401, pc1401_state ) +static MACHINE_CONFIG_DERIVED_CLASS( pc1401, pocketc, pc1401_state ) MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ MCFG_CPU_PROGRAM_MAP(pc1401_mem) MCFG_SC61860_READ_RESET_HANDLER(READLINE(pc1401_state,pc1401_reset)) @@ -748,8 +747,6 @@ static MACHINE_CONFIG_START( pc1401, pc1401_state ) MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1401_state,pc1401_outb)) MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1401_state,pc1401_outc)) - MCFG_FRAGMENT_ADD(pocketc) - MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(pc1401_state, screen_update_pc1401) MACHINE_CONFIG_END @@ -759,7 +756,7 @@ static MACHINE_CONFIG_DERIVED( pc1402, pc1401 ) MCFG_CPU_PROGRAM_MAP( pc1402_mem) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( pc1250, pc1251_state ) +static MACHINE_CONFIG_DERIVED_CLASS( pc1250, pocketc, pc1251_state ) MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ MCFG_CPU_PROGRAM_MAP( pc1250_mem) MCFG_SC61860_READ_RESET_HANDLER(NULL) @@ -770,9 +767,7 @@ static MACHINE_CONFIG_START( pc1250, pc1251_state ) MCFG_SC61860_READ_B_HANDLER(READ8(pc1251_state,pc1251_inb)) MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1251_state,pc1251_outb)) MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1251_state,pc1251_outc)) - - MCFG_FRAGMENT_ADD(pocketc) - + /* video hardware */ MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_SIZE(608, 300) @@ -803,7 +798,7 @@ static MACHINE_CONFIG_DERIVED( pc1261, pc1260 ) MCFG_CPU_PROGRAM_MAP( pc1261_mem) MACHINE_CONFIG_END -static MACHINE_CONFIG_START( pc1350, pc1350_state ) +static MACHINE_CONFIG_DERIVED_CLASS( pc1350, pocketc, pc1350_state ) MCFG_CPU_ADD("maincpu", SC61860, 192000) /* 7.8336 MHz */ MCFG_CPU_PROGRAM_MAP( pc1350_mem) MCFG_SC61860_READ_RESET_HANDLER(NULL) @@ -815,8 +810,6 @@ static MACHINE_CONFIG_START( pc1350, pc1350_state ) MCFG_SC61860_WRITE_B_HANDLER(WRITE8(pc1350_state,pc1350_outb)) MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1350_state,pc1350_outc)) - MCFG_FRAGMENT_ADD( pocketc ) - /* aim: show sharp with keyboard resolution depends on the dots of the lcd @@ -833,7 +826,7 @@ static MACHINE_CONFIG_START( pc1350, pc1350_state ) MCFG_RAM_EXTRA_OPTIONS("12K,20K") MACHINE_CONFIG_END -static MACHINE_CONFIG_START( pc1403, pc1403_state ) +static MACHINE_CONFIG_DERIVED_CLASS( pc1403, pocketc, pc1403_state ) MCFG_CPU_ADD( "maincpu", SC61860, 256000 ) MCFG_CPU_PROGRAM_MAP( pc1403_mem) MCFG_SC61860_READ_RESET_HANDLER(NULL) @@ -845,8 +838,6 @@ static MACHINE_CONFIG_START( pc1403, pc1403_state ) MCFG_SC61860_WRITE_B_HANDLER(NULL) MCFG_SC61860_WRITE_C_HANDLER(WRITE8(pc1403_state,pc1403_outc)) - MCFG_FRAGMENT_ADD( pocketc ) - /* aim: show sharp with keyboard resolution depends on the dots of the lcd diff --git a/src/mess/includes/pc1251.h b/src/mess/includes/pc1251.h index 98b40714732..ddb7ae73432 100644 --- a/src/mess/includes/pc1251.h +++ b/src/mess/includes/pc1251.h @@ -9,13 +9,14 @@ #ifndef PC1251_H_ #define PC1251_H_ +#include "pocketc.h" #include "cpu/sc61860/sc61860.h" #include "machine/nvram.h" #define PC1251_CONTRAST (ioport("DSW0")->read() & 0x07) -class pc1251_state : public driver_device +class pc1251_state : public pocketc_state { public: enum @@ -24,7 +25,7 @@ public: }; pc1251_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + : pocketc_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } diff --git a/src/mess/includes/pc1350.h b/src/mess/includes/pc1350.h index 4dc418191d2..d48754f4950 100644 --- a/src/mess/includes/pc1350.h +++ b/src/mess/includes/pc1350.h @@ -9,6 +9,7 @@ #ifndef PC1350_H_ #define PC1350_H_ +#include "pocketc.h" #include "cpu/sc61860/sc61860.h" #include "machine/nvram.h" #include "machine/ram.h" @@ -16,7 +17,7 @@ #define PC1350_CONTRAST (ioport("DSW0")->read() & 0x07) -class pc1350_state : public driver_device +class pc1350_state : public pocketc_state { public: enum @@ -25,7 +26,7 @@ public: }; pc1350_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + : pocketc_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ram(*this, RAM_TAG) { } diff --git a/src/mess/includes/pc1401.h b/src/mess/includes/pc1401.h index 5950a3e3438..081f4daa5f4 100644 --- a/src/mess/includes/pc1401.h +++ b/src/mess/includes/pc1401.h @@ -9,13 +9,14 @@ #ifndef PC1401_H_ #define PC1401_H_ +#include "pocketc.h" #include "cpu/sc61860/sc61860.h" #include "machine/nvram.h" #define CONTRAST (ioport("DSW0")->read() & 0x07) -class pc1401_state : public driver_device +class pc1401_state : public pocketc_state { public: enum @@ -24,7 +25,7 @@ public: }; pc1401_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + : pocketc_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } diff --git a/src/mess/includes/pc1403.h b/src/mess/includes/pc1403.h index 46fbf35af9b..063d31a3a28 100644 --- a/src/mess/includes/pc1403.h +++ b/src/mess/includes/pc1403.h @@ -9,13 +9,14 @@ #ifndef PC1403_H_ #define PC1403_H_ +#include "pocketc.h" #include "cpu/sc61860/sc61860.h" #include "machine/nvram.h" #define CONTRAST (ioport("DSW0")->read() & 0x07) -class pc1403_state : public driver_device +class pc1403_state : public pocketc_state { public: enum @@ -24,7 +25,7 @@ public: }; pc1403_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + : pocketc_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } diff --git a/src/mess/includes/pocketc.h b/src/mess/includes/pocketc.h index 109a66f93a4..bb9193ec36e 100644 --- a/src/mess/includes/pocketc.h +++ b/src/mess/includes/pocketc.h @@ -7,16 +7,18 @@ #ifndef POCKETC_H_ #define POCKETC_H_ - -/*----------- defined in video/pocketc.c -----------*/ - -extern PALETTE_INIT( pocketc ); - -extern const unsigned short pocketc_colortable[8][2]; - typedef const char *POCKETC_FIGURE[]; -void pocketc_draw_special(bitmap_ind16 &bitmap, - int x, int y, const POCKETC_FIGURE fig, int color); +class pocketc_state : public driver_device +{ +public: + pocketc_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } + + DECLARE_PALETTE_INIT(pocketc); + + static const unsigned short pocketc_colortable[8][2]; + void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const POCKETC_FIGURE fig, int color); +}; #endif /* POCKETC_H_ */ diff --git a/src/mess/video/pocketc.c b/src/mess/video/pocketc.c index 5d59a938e24..f77441b9958 100644 --- a/src/mess/video/pocketc.c +++ b/src/mess/video/pocketc.c @@ -18,7 +18,7 @@ static const UINT8 pocketc_palette[] = 0, 0, 0 }; -const unsigned short pocketc_colortable[8][2] = { +const unsigned short pocketc_state::pocketc_colortable[8][2] = { { 5, 4 }, { 5, 0 }, { 5, 2 }, @@ -29,7 +29,7 @@ const unsigned short pocketc_colortable[8][2] = { { 3, 5 } }; -PALETTE_INIT( pocketc ) +PALETTE_INIT_MEMBER(pocketc_state, pocketc) { UINT8 i=0, r, b, g, color_count = 6; @@ -48,7 +48,7 @@ PALETTE_INIT( pocketc ) /* Draw an indicator (DEG, SHIFT, etc) */ -void pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const POCKETC_FIGURE fig, int color) +void pocketc_state::pocketc_draw_special(bitmap_ind16 &bitmap, int x, int y, const POCKETC_FIGURE fig, int color) { int i,j; for (i=0; fig[i]; i++, y++)