summaryrefslogtreecommitdiffstats
path: root/src/mame
diff options
context:
space:
mode:
authorGravatarGravatar Miodrag Milanovic <mmicko@gmail.com>2013-02-08 12:09:50 +0000
committerGravatarGravatar Miodrag Milanovic <mmicko@gmail.com>2013-02-08 12:09:50 +0000
commitd27fc2f7507c09bbf1b295da12d56d14f7a00f56 (patch) (github)
treece061c5ecfdfe45120eda4e02c84a98f90795178 /src/mame
parent0af8c1b855e673526d09b00c42742582ca47b18b (diff)
downloadmame-d27fc2f7507c09bbf1b295da12d56d14f7a00f56.tar.bz2
mame-d27fc2f7507c09bbf1b295da12d56d14f7a00f56.zip
modernized rest of galaga (nw)
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/galaga.c42
-rw-r--r--src/mame/includes/galaga.h93
-rw-r--r--src/mame/machine/xevious.c108
-rw-r--r--src/mame/video/bosco.c31
-rw-r--r--src/mame/video/digdug.c38
-rw-r--r--src/mame/video/galaga.c10
-rw-r--r--src/mame/video/xevious.c62
7 files changed, 173 insertions, 211 deletions
diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c
index 6e71b86ee4e..6c956015e3f 100644
--- a/src/mame/drivers/galaga.c
+++ b/src/mame/drivers/galaga.c
@@ -903,7 +903,7 @@ MACHINE_RESET_MEMBER(galaga_state,galaga)
MACHINE_RESET_MEMBER(xevious_state,battles)
{
MACHINE_RESET_CALL_MEMBER(galaga);
- battles_customio_init(machine());
+ battles_customio_init();
}
@@ -917,14 +917,14 @@ static ADDRESS_MAP_START( bosco_map, AS_PROGRAM, 8, bosco_state )
AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx_0", namco_06xx_data_r, namco_06xx_data_w)
AM_RANGE(0x7100, 0x7100) AM_DEVREADWRITE_LEGACY("06xx_0", namco_06xx_ctrl_r, namco_06xx_ctrl_w)
AM_RANGE(0x7800, 0x7fff) AM_RAM AM_SHARE("share1")
- AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE_LEGACY(bosco_videoram_w) AM_SHARE("videoram")/* + sprite registers */
+ AM_RANGE(0x8000, 0x8fff) AM_RAM_WRITE(bosco_videoram_w) AM_SHARE("videoram")/* + sprite registers */
AM_RANGE(0x9000, 0x90ff) AM_DEVREADWRITE_LEGACY("06xx_1", namco_06xx_data_r, namco_06xx_data_w)
AM_RANGE(0x9100, 0x9100) AM_DEVREADWRITE_LEGACY("06xx_1", namco_06xx_ctrl_r, namco_06xx_ctrl_w)
AM_RANGE(0x9800, 0x980f) AM_WRITEONLY AM_SHARE("bosco_radarattr")
- AM_RANGE(0x9810, 0x9810) AM_WRITE_LEGACY(bosco_scrollx_w)
- AM_RANGE(0x9820, 0x9820) AM_WRITE_LEGACY(bosco_scrolly_w)
+ AM_RANGE(0x9810, 0x9810) AM_WRITE(bosco_scrollx_w)
+ AM_RANGE(0x9820, 0x9820) AM_WRITE(bosco_scrolly_w)
AM_RANGE(0x9830, 0x9830) AM_WRITEONLY AM_SHARE("starcontrol")
- AM_RANGE(0x9840, 0x9840) AM_WRITE_LEGACY(bosco_starclr_w)
+ AM_RANGE(0x9840, 0x9840) AM_WRITE(bosco_starclr_w)
AM_RANGE(0x9870, 0x9870) AM_WRITE(bosco_flip_screen_w)
AM_RANGE(0x9874, 0x9875) AM_WRITEONLY AM_SHARE("bosco_starblink")
ADDRESS_MAP_END
@@ -959,12 +959,12 @@ static ADDRESS_MAP_START( xevious_map, AS_PROGRAM, 8, xevious_state )
AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("xevious_sr1") /* work RAM + sprite registers */
AM_RANGE(0x9000, 0x97ff) AM_RAM AM_SHARE("xevious_sr2") /* work RAM + sprite registers */
AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("xevious_sr3") /* work RAM + sprite registers */
- AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE_LEGACY(xevious_fg_colorram_w) AM_SHARE("fg_colorram")
- AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE_LEGACY(xevious_bg_colorram_w) AM_SHARE("bg_colorram")
- AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE_LEGACY(xevious_fg_videoram_w) AM_SHARE("fg_videoram")
- AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE_LEGACY(xevious_bg_videoram_w) AM_SHARE("bg_videoram")
- AM_RANGE(0xd000, 0xd07f) AM_WRITE_LEGACY(xevious_vh_latch_w)
- AM_RANGE(0xf000, 0xffff) AM_READWRITE_LEGACY(xevious_bb_r, xevious_bs_w)
+ AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(xevious_fg_colorram_w) AM_SHARE("fg_colorram")
+ AM_RANGE(0xb800, 0xbfff) AM_RAM_WRITE(xevious_bg_colorram_w) AM_SHARE("bg_colorram")
+ AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(xevious_fg_videoram_w) AM_SHARE("fg_videoram")
+ AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(xevious_bg_videoram_w) AM_SHARE("bg_videoram")
+ AM_RANGE(0xd000, 0xd07f) AM_WRITE(xevious_vh_latch_w)
+ AM_RANGE(0xf000, 0xffff) AM_READWRITE(xevious_bb_r, xevious_bs_w)
ADDRESS_MAP_END
@@ -975,12 +975,12 @@ static ADDRESS_MAP_START( digdug_map, AS_PROGRAM, 8, digdug_state )
AM_RANGE(0x6830, 0x6830) AM_WRITE(watchdog_reset_w)
AM_RANGE(0x7000, 0x70ff) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_data_r, namco_06xx_data_w)
AM_RANGE(0x7100, 0x7100) AM_DEVREADWRITE_LEGACY("06xx", namco_06xx_ctrl_r, namco_06xx_ctrl_w)
- AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE_LEGACY(digdug_videoram_w) AM_SHARE("videoram") /* tilemap RAM (bottom half of RAM 0 */
+ AM_RANGE(0x8000, 0x83ff) AM_RAM_WRITE(digdug_videoram_w) AM_SHARE("videoram") /* tilemap RAM (bottom half of RAM 0 */
AM_RANGE(0x8400, 0x87ff) AM_RAM AM_SHARE("share1") /* work RAM (top half for RAM 0 */
AM_RANGE(0x8800, 0x8bff) AM_RAM AM_SHARE("digdug_objram") /* work RAM + sprite registers */
AM_RANGE(0x9000, 0x93ff) AM_RAM AM_SHARE("digdug_posram") /* work RAM + sprite registers */
AM_RANGE(0x9800, 0x9bff) AM_RAM AM_SHARE("digdug_flpram") /* work RAM + sprite registers */
- AM_RANGE(0xa000, 0xa007) AM_READNOP AM_WRITE_LEGACY(digdug_PORT_w) /* video latches (spurious reads when setting latch bits) */
+ AM_RANGE(0xa000, 0xa007) AM_READNOP AM_WRITE(digdug_PORT_w) /* video latches (spurious reads when setting latch bits) */
AM_RANGE(0xb800, 0xb83f) AM_DEVREADWRITE("earom", atari_vg_earom_device, read, write) /* non volatile memory data */
AM_RANGE(0xb840, 0xb840) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) /* non volatile memory control */
ADDRESS_MAP_END
@@ -993,13 +993,13 @@ static ADDRESS_MAP_START( galaga_mem4, AS_PROGRAM, 8, galaga_state )
AM_RANGE(0x1000, 0x107f) AM_RAM
ADDRESS_MAP_END
-static ADDRESS_MAP_START( battles_mem4, AS_PROGRAM, 8, galaga_state )
+static ADDRESS_MAP_START( battles_mem4, AS_PROGRAM, 8, xevious_state )
AM_RANGE(0x0000, 0x0fff) AM_ROM
- AM_RANGE(0x4000, 0x4003) AM_READ_LEGACY(battles_input_port_r)
- AM_RANGE(0x4001, 0x4001) AM_WRITE_LEGACY(battles_CPU4_coin_w)
- AM_RANGE(0x5000, 0x5000) AM_WRITE_LEGACY(battles_noise_sound_w)
- AM_RANGE(0x6000, 0x6000) AM_READWRITE_LEGACY(battles_customio3_r, battles_customio3_w)
- AM_RANGE(0x7000, 0x7000) AM_READWRITE_LEGACY(battles_customio_data3_r, battles_customio_data3_w)
+ AM_RANGE(0x4000, 0x4003) AM_READ(battles_input_port_r)
+ AM_RANGE(0x4001, 0x4001) AM_WRITE(battles_CPU4_coin_w)
+ AM_RANGE(0x5000, 0x5000) AM_WRITE(battles_noise_sound_w)
+ AM_RANGE(0x6000, 0x6000) AM_READWRITE(battles_customio3_r, battles_customio3_w)
+ AM_RANGE(0x7000, 0x7000) AM_READWRITE(battles_customio_data3_r, battles_customio_data3_w)
AM_RANGE(0x8000, 0x80ff) AM_RAM
ADDRESS_MAP_END
@@ -3348,8 +3348,8 @@ DRIVER_INIT_MEMBER(xevious_state,xevios)
DRIVER_INIT_MEMBER(xevious_state,battles)
{
/* replace the Namco I/O handlers with interface to the 4th CPU */
- machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) );
- machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) );
+ machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x7000, 0x700f, read8_delegate(FUNC(xevious_state::battles_customio_data0_r),this), write8_delegate(FUNC(xevious_state::battles_customio_data0_w),this) );
+ machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x7100, 0x7100, read8_delegate(FUNC(xevious_state::battles_customio0_r),this), write8_delegate(FUNC(xevious_state::battles_customio0_w),this) );
DRIVER_INIT_CALL(xevious);
}
diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h
index 9111da1b548..0b64315d2a5 100644
--- a/src/mame/includes/galaga.h
+++ b/src/mame/includes/galaga.h
@@ -64,6 +64,13 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect );
void bosco_latch_reset();
+ struct star
+ {
+ UINT16 x,y;
+ UINT8 col,set;
+ };
+
+ static struct star m_star_seed_tab[];
};
class xevious_state : public galaga_state
@@ -102,6 +109,36 @@ public:
INTERRUPT_GEN_MEMBER(battles_interrupt_4);
TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
+ DECLARE_WRITE8_MEMBER( xevious_fg_videoram_w );
+ DECLARE_WRITE8_MEMBER( xevious_fg_colorram_w );
+ DECLARE_WRITE8_MEMBER( xevious_bg_videoram_w );
+ DECLARE_WRITE8_MEMBER( xevious_bg_colorram_w );
+ DECLARE_WRITE8_MEMBER( xevious_vh_latch_w );
+ DECLARE_WRITE8_MEMBER( xevious_bs_w );
+ DECLARE_READ8_MEMBER( xevious_bb_r );
+
+ // Custom I/O
+ void battles_customio_init();
+
+ DECLARE_READ8_MEMBER( battles_customio0_r );
+ DECLARE_READ8_MEMBER( battles_customio_data0_r );
+ DECLARE_READ8_MEMBER( battles_customio3_r );
+ DECLARE_READ8_MEMBER( battles_customio_data3_r );
+ DECLARE_READ8_MEMBER( battles_input_port_r );
+
+ DECLARE_WRITE8_MEMBER( battles_customio0_w );
+ DECLARE_WRITE8_MEMBER( battles_customio_data0_w );
+ DECLARE_WRITE8_MEMBER( battles_customio3_w );
+ DECLARE_WRITE8_MEMBER( battles_customio_data3_w );
+ DECLARE_WRITE8_MEMBER( battles_CPU4_coin_w );
+ DECLARE_WRITE8_MEMBER( battles_noise_sound_w );
+
+ UINT8 m_customio[16];
+ char m_battles_customio_command;
+ char m_battles_customio_prev_command;
+ char m_battles_customio_command_count;
+ char m_battles_customio_data;
+ char m_battles_sound_played;
};
@@ -138,6 +175,10 @@ public:
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip);
+ DECLARE_WRITE8_MEMBER( bosco_videoram_w );
+ DECLARE_WRITE8_MEMBER( bosco_scrollx_w );
+ DECLARE_WRITE8_MEMBER( bosco_scrolly_w );
+ DECLARE_WRITE8_MEMBER( bosco_starclr_w );
};
class digdug_state : public galaga_state
@@ -165,59 +206,11 @@ public:
DECLARE_PALETTE_INIT(digdug);
UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_WRITE8_MEMBER( digdug_videoram_w );
+ DECLARE_WRITE8_MEMBER( digdug_PORT_w );
};
-/*----------- defined in video/bosco.c -----------*/
-
-DECLARE_WRITE8_HANDLER( bosco_videoram_w );
-DECLARE_WRITE8_HANDLER( bosco_scrollx_w );
-DECLARE_WRITE8_HANDLER( bosco_scrolly_w );
-DECLARE_WRITE8_HANDLER( bosco_starclr_w );
-
/*----------- defined in audio/galaga.c -----------*/
DISCRETE_SOUND_EXTERN( bosco );
DISCRETE_SOUND_EXTERN( galaga );
-
-
-/*----------- defined in video/galaga.c -----------*/
-
-struct star
-{
- UINT16 x,y;
- UINT8 col,set;
-};
-
-extern const struct star star_seed_tab[];
-
-/*----------- defined in video/xevious.c -----------*/
-
-DECLARE_WRITE8_HANDLER( xevious_fg_videoram_w );
-DECLARE_WRITE8_HANDLER( xevious_fg_colorram_w );
-DECLARE_WRITE8_HANDLER( xevious_bg_videoram_w );
-DECLARE_WRITE8_HANDLER( xevious_bg_colorram_w );
-DECLARE_WRITE8_HANDLER( xevious_vh_latch_w );
-DECLARE_WRITE8_HANDLER( xevious_bs_w );
-DECLARE_READ8_HANDLER( xevious_bb_r );
-
-/*----------- defined in machine/xevious.c -----------*/
-
-void battles_customio_init(running_machine &machine);
-
-DECLARE_READ8_HANDLER( battles_customio0_r );
-DECLARE_READ8_HANDLER( battles_customio_data0_r );
-DECLARE_READ8_HANDLER( battles_customio3_r );
-DECLARE_READ8_HANDLER( battles_customio_data3_r );
-DECLARE_READ8_HANDLER( battles_input_port_r );
-
-DECLARE_WRITE8_HANDLER( battles_customio0_w );
-DECLARE_WRITE8_HANDLER( battles_customio_data0_w );
-DECLARE_WRITE8_HANDLER( battles_customio3_w );
-DECLARE_WRITE8_HANDLER( battles_customio_data3_w );
-DECLARE_WRITE8_HANDLER( battles_CPU4_coin_w );
-DECLARE_WRITE8_HANDLER( battles_noise_sound_w );
-
-/*----------- defined in video/digdug.c -----------*/
-
-DECLARE_WRITE8_HANDLER( digdug_videoram_w );
-DECLARE_WRITE8_HANDLER( digdug_PORT_w );
diff --git a/src/mame/machine/xevious.c b/src/mame/machine/xevious.c
index 7065dde20b1..7bc4765b8f0 100644
--- a/src/mame/machine/xevious.c
+++ b/src/mame/machine/xevious.c
@@ -17,31 +17,23 @@
***************************************************************************/
-static UINT8 customio[16];
-static char battles_customio_command;
-static char battles_customio_prev_command;
-static char battles_customio_command_count;
-static char battles_customio_data;
-static char battles_sound_played;
-
-
-void battles_customio_init(running_machine &machine)
+void xevious_state::battles_customio_init()
{
- battles_customio_command = 0;
- battles_customio_prev_command = 0;
- battles_customio_command_count = 0;
- battles_customio_data = 0;
- battles_sound_played = 0;
+ m_battles_customio_command = 0;
+ m_battles_customio_prev_command = 0;
+ m_battles_customio_command_count = 0;
+ m_battles_customio_data = 0;
+ m_battles_sound_played = 0;
}
TIMER_DEVICE_CALLBACK_MEMBER(xevious_state::battles_nmi_generate)
{
- battles_customio_prev_command = battles_customio_command;
+ m_battles_customio_prev_command = m_battles_customio_command;
- if( battles_customio_command & 0x10 )
+ if( m_battles_customio_command & 0x10 )
{
- if( battles_customio_command_count == 0 )
+ if( m_battles_customio_command_count == 0 )
{
machine().device("sub3")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
@@ -56,29 +48,29 @@ TIMER_DEVICE_CALLBACK_MEMBER(xevious_state::battles_nmi_generate)
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
machine().device("sub3")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
- battles_customio_command_count++;
+ m_battles_customio_command_count++;
}
-READ8_HANDLER( battles_customio0_r )
+READ8_MEMBER( xevious_state::battles_customio0_r )
{
- logerror("CPU0 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),battles_customio_command);
- return battles_customio_command;
+ logerror("CPU0 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),m_battles_customio_command);
+ return m_battles_customio_command;
}
-READ8_HANDLER( battles_customio3_r )
+READ8_MEMBER( xevious_state::battles_customio3_r )
{
int return_data;
if( space.device().safe_pc() == 0xAE ){
/* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */
- return_data = ( (battles_customio_command & 0x10) << 3)
+ return_data = ( (m_battles_customio_command & 0x10) << 3)
| 0x00
- | (battles_customio_command & 0x0f);
+ | (m_battles_customio_command & 0x0f);
}else{
- return_data = ( (battles_customio_prev_command & 0x10) << 3)
+ return_data = ( (m_battles_customio_prev_command & 0x10) << 3)
| 0x60
- | (battles_customio_prev_command & 0x0f);
+ | (m_battles_customio_prev_command & 0x0f);
}
logerror("CPU3 %04x: custom I/O Read = %02x\n",space.device().safe_pc(),return_data);
@@ -86,14 +78,14 @@ READ8_HANDLER( battles_customio3_r )
}
-WRITE8_HANDLER( battles_customio0_w )
+WRITE8_MEMBER( xevious_state::battles_customio0_w )
{
- timer_device *timer = space.machine().device<timer_device>("battles_nmi");
+ timer_device *timer = machine().device<timer_device>("battles_nmi");
logerror("CPU0 %04x: custom I/O Write = %02x\n",space.device().safe_pc(),data);
- battles_customio_command = data;
- battles_customio_command_count = 0;
+ m_battles_customio_command = data;
+ m_battles_customio_command_count = 0;
switch (data)
{
@@ -105,78 +97,78 @@ WRITE8_HANDLER( battles_customio0_w )
}
-WRITE8_HANDLER( battles_customio3_w )
+WRITE8_MEMBER( xevious_state::battles_customio3_w )
{
logerror("CPU3 %04x: custom I/O Write = %02x\n",space.device().safe_pc(),data);
- battles_customio_command = data;
+ m_battles_customio_command = data;
}
-READ8_HANDLER( battles_customio_data0_r )
+READ8_MEMBER( xevious_state::battles_customio_data0_r )
{
- logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,battles_customio_data);
+ logerror("CPU0 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,m_battles_customio_data);
- return battles_customio_data;
+ return m_battles_customio_data;
}
-READ8_HANDLER( battles_customio_data3_r )
+READ8_MEMBER( xevious_state::battles_customio_data3_r )
{
- logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,battles_customio_data);
- return battles_customio_data;
+ logerror("CPU3 %04x: custom I/O parameter %02x Read = %02x\n",space.device().safe_pc(),offset,m_battles_customio_data);
+ return m_battles_customio_data;
}
-WRITE8_HANDLER( battles_customio_data0_w )
+WRITE8_MEMBER( xevious_state::battles_customio_data0_w )
{
logerror("CPU0 %04x: custom I/O parameter %02x Write = %02x\n",space.device().safe_pc(),offset,data);
- battles_customio_data = data;
+ m_battles_customio_data = data;
}
-WRITE8_HANDLER( battles_customio_data3_w )
+WRITE8_MEMBER( xevious_state::battles_customio_data3_w )
{
logerror("CPU3 %04x: custom I/O parameter %02x Write = %02x\n",space.device().safe_pc(),offset,data);
- battles_customio_data = data;
+ m_battles_customio_data = data;
}
-WRITE8_HANDLER( battles_CPU4_coin_w )
+WRITE8_MEMBER( xevious_state::battles_CPU4_coin_w )
{
- set_led_status(space.machine(), 0,data & 0x02); // Start 1
- set_led_status(space.machine(), 1,data & 0x01); // Start 2
+ set_led_status(machine(), 0,data & 0x02); // Start 1
+ set_led_status(machine(), 1,data & 0x01); // Start 2
- coin_counter_w(space.machine(), 0,data & 0x20);
- coin_counter_w(space.machine(), 1,data & 0x10);
- coin_lockout_global_w(space.machine(), ~data & 0x04);
+ coin_counter_w(machine(), 0,data & 0x20);
+ coin_counter_w(machine(), 1,data & 0x10);
+ coin_lockout_global_w(machine(), ~data & 0x04);
}
-WRITE8_HANDLER( battles_noise_sound_w )
+WRITE8_MEMBER( xevious_state::battles_noise_sound_w )
{
logerror("CPU3 %04x: 50%02x Write = %02x\n",space.device().safe_pc(),offset,data);
- if( (battles_sound_played == 0) && (data == 0xFF) ){
- samples_device *samples = space.machine().device<samples_device>("samples");
- if( customio[0] == 0x40 ){
+ if( (m_battles_sound_played == 0) && (data == 0xFF) ){
+ samples_device *samples = machine().device<samples_device>("samples");
+ if( m_customio[0] == 0x40 ){
samples->start(0, 0);
}
else{
samples->start(0, 1);
}
}
- battles_sound_played = data;
+ m_battles_sound_played = data;
}
-READ8_HANDLER( battles_input_port_r )
+READ8_MEMBER( xevious_state::battles_input_port_r )
{
switch ( offset )
{
default:
- case 0: return ~BITSWAP8(space.machine().root_device().ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
- case 1: return ~space.machine().root_device().ioport("IN1L")->read();
- case 2: return ~space.machine().root_device().ioport("IN1H")->read();
- case 3: return ~space.machine().root_device().ioport("IN0L")->read();
+ case 0: return ~BITSWAP8(machine().root_device().ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
+ case 1: return ~machine().root_device().ioport("IN1L")->read();
+ case 2: return ~machine().root_device().ioport("IN1H")->read();
+ case 3: return ~machine().root_device().ioport("IN0L")->read();
}
}
diff --git a/src/mame/video/bosco.c b/src/mame/video/bosco.c
index 0542337a4f0..aa5c1b196c3 100644
--- a/src/mame/video/bosco.c
+++ b/src/mame/video/bosco.c
@@ -150,31 +150,26 @@ VIDEO_START_MEMBER(bosco_state,bosco)
***************************************************************************/
-WRITE8_HANDLER( bosco_videoram_w )
+WRITE8_MEMBER( bosco_state::bosco_videoram_w )
{
- bosco_state *state = space.machine().driver_data<bosco_state>();
-
- state->m_videoram[offset] = data;
+ m_videoram[offset] = data;
if (offset & 0x400)
- state->m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
+ m_bg_tilemap->mark_tile_dirty(offset & 0x3ff);
else
- state->m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
+ m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
-WRITE8_HANDLER( bosco_scrollx_w )
+WRITE8_MEMBER( bosco_state::bosco_scrollx_w )
{
- bosco_state *state = space.machine().driver_data<bosco_state>();
-
- state->m_bg_tilemap->set_scrollx(0,data);
+ m_bg_tilemap->set_scrollx(0,data);
}
-WRITE8_HANDLER( bosco_scrolly_w )
+WRITE8_MEMBER( bosco_state::bosco_scrolly_w )
{
- bosco_state *state = space.machine().driver_data<bosco_state>();
- state->m_bg_tilemap->set_scrolly(0,data);
+ m_bg_tilemap->set_scrolly(0,data);
}
-WRITE8_HANDLER( bosco_starclr_w )
+WRITE8_MEMBER( bosco_state::bosco_starclr_w )
{
}
@@ -255,10 +250,10 @@ void bosco_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, in
{
int x,y;
- if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
+ if ( (set_a == m_star_seed_tab[star_cntr].set) || ( set_b == m_star_seed_tab[star_cntr].set) )
{
- x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256;
- y = (star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
+ x = (m_star_seed_tab[star_cntr].x + m_stars_scrollx) % 256;
+ y = (m_star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
/* dont draw the stars that are off the screen */
if ( x < 224 )
@@ -266,7 +261,7 @@ void bosco_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, in
if (flip) x += 20*8;
if (cliprect.contains(x, y))
- bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col;
+ bitmap.pix16(y, x) = STARS_COLOR_BASE + m_star_seed_tab[star_cntr].col;
}
}
}
diff --git a/src/mame/video/digdug.c b/src/mame/video/digdug.c
index 22b84f6904a..470cf8444d9 100644
--- a/src/mame/video/digdug.c
+++ b/src/mame/video/digdug.c
@@ -162,18 +162,14 @@ VIDEO_START_MEMBER(digdug_state,digdug)
***************************************************************************/
-WRITE8_HANDLER( digdug_videoram_w )
+WRITE8_MEMBER( digdug_state::digdug_videoram_w )
{
- digdug_state *state = space.machine().driver_data<digdug_state>();
-
- state->m_videoram[offset] = data;
- state->m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
+ m_videoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
}
-WRITE8_HANDLER( digdug_PORT_w )
+WRITE8_MEMBER( digdug_state::digdug_PORT_w )
{
- digdug_state *state = space.machine().driver_data<digdug_state>();
-
switch (offset)
{
case 0: /* select background picture */
@@ -182,27 +178,27 @@ WRITE8_HANDLER( digdug_PORT_w )
int shift = offset;
int mask = 1 << shift;
- if ((state->m_bg_select & mask) != ((data & 1) << shift))
+ if ((m_bg_select & mask) != ((data & 1) << shift))
{
- state->m_bg_select = (state->m_bg_select & ~mask) | ((data & 1) << shift);
- state->m_bg_tilemap->mark_all_dirty();
+ m_bg_select = (m_bg_select & ~mask) | ((data & 1) << shift);
+ m_bg_tilemap->mark_all_dirty();
}
}
break;
case 2: /* select alpha layer color mode (see tx_get_tile_info) */
- if (state->m_tx_color_mode != (data & 1))
+ if (m_tx_color_mode != (data & 1))
{
- state->m_tx_color_mode = data & 1;
- state->m_fg_tilemap->mark_all_dirty();
+ m_tx_color_mode = data & 1;
+ m_fg_tilemap->mark_all_dirty();
}
break;
case 3: /* "disable" background (see bg_get_tile_info) */
- if (state->m_bg_disable != (data & 1))
+ if (m_bg_disable != (data & 1))
{
- state->m_bg_disable = data & 1;
- state->m_bg_tilemap->mark_all_dirty();
+ m_bg_disable = data & 1;
+ m_bg_tilemap->mark_all_dirty();
}
break;
@@ -212,10 +208,10 @@ WRITE8_HANDLER( digdug_PORT_w )
int shift = offset;
int mask = 1 << shift;
- if ((state->m_bg_color_bank & mask) != ((data & 1) << shift))
+ if ((m_bg_color_bank & mask) != ((data & 1) << shift))
{
- state->m_bg_color_bank = (state->m_bg_color_bank & ~mask) | ((data & 1) << shift);
- state->m_bg_tilemap->mark_all_dirty();
+ m_bg_color_bank = (m_bg_color_bank & ~mask) | ((data & 1) << shift);
+ m_bg_tilemap->mark_all_dirty();
}
}
break;
@@ -224,7 +220,7 @@ WRITE8_HANDLER( digdug_PORT_w )
break;
case 7: /* FLIP */
- state->flip_screen_set(data & 1);
+ flip_screen_set(data & 1);
break;
}
}
diff --git a/src/mame/video/galaga.c b/src/mame/video/galaga.c
index b392e364027..fce68cdc943 100644
--- a/src/mame/video/galaga.c
+++ b/src/mame/video/galaga.c
@@ -31,7 +31,7 @@ There are 63 stars in each set, 126 displayed at any one time
*/
-const struct star star_seed_tab[252]=
+struct galaga_state::star galaga_state::m_star_seed_tab[252]=
{
/* also shared by Bosconian */
@@ -544,13 +544,13 @@ void galaga_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int x,y;
- if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
+ if ( (set_a == m_star_seed_tab[star_cntr].set) || ( set_b == m_star_seed_tab[star_cntr].set) )
{
- x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256 + x_align;
- y = (y_align + star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
+ x = (m_star_seed_tab[star_cntr].x + m_stars_scrollx) % 256 + x_align;
+ y = (y_align + m_star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
if (cliprect.contains(x, y))
- bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col;
+ bitmap.pix16(y, x) = STARS_COLOR_BASE + m_star_seed_tab[ star_cntr ].col;
}
}
diff --git a/src/mame/video/xevious.c b/src/mame/video/xevious.c
index 263f0017dd2..6f079997c26 100644
--- a/src/mame/video/xevious.c
+++ b/src/mame/video/xevious.c
@@ -237,42 +237,32 @@ VIDEO_START_MEMBER(xevious_state,xevious)
***************************************************************************/
-WRITE8_HANDLER( xevious_fg_videoram_w )
+WRITE8_MEMBER( xevious_state::xevious_fg_videoram_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- state->m_xevious_fg_videoram[offset] = data;
- state->m_fg_tilemap->mark_tile_dirty(offset);
+ m_xevious_fg_videoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_HANDLER( xevious_fg_colorram_w )
+WRITE8_MEMBER( xevious_state::xevious_fg_colorram_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- state->m_xevious_fg_colorram[offset] = data;
- state->m_fg_tilemap->mark_tile_dirty(offset);
+ m_xevious_fg_colorram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_HANDLER( xevious_bg_videoram_w )
+WRITE8_MEMBER( xevious_state::xevious_bg_videoram_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- state->m_xevious_bg_videoram[offset] = data;
- state->m_bg_tilemap->mark_tile_dirty(offset);
+ m_xevious_bg_videoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_HANDLER( xevious_bg_colorram_w )
+WRITE8_MEMBER( xevious_state::xevious_bg_colorram_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- state->m_xevious_bg_colorram[offset] = data;
- state->m_bg_tilemap->mark_tile_dirty(offset);
+ m_xevious_bg_colorram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset);
}
-WRITE8_HANDLER( xevious_vh_latch_w )
+WRITE8_MEMBER( xevious_state::xevious_vh_latch_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
int reg;
int scroll = data + ((offset&0x01)<<8); /* A0 -> D8 */
@@ -281,19 +271,19 @@ WRITE8_HANDLER( xevious_vh_latch_w )
switch (reg)
{
case 0:
- state->m_bg_tilemap->set_scrollx(0,scroll);
+ m_bg_tilemap->set_scrollx(0,scroll);
break;
case 1:
- state->m_fg_tilemap->set_scrollx(0,scroll);
+ m_fg_tilemap->set_scrollx(0,scroll);
break;
case 2:
- state->m_bg_tilemap->set_scrolly(0,scroll);
+ m_bg_tilemap->set_scrolly(0,scroll);
break;
case 3:
- state->m_fg_tilemap->set_scrolly(0,scroll);
+ m_fg_tilemap->set_scrolly(0,scroll);
break;
case 7:
- state->flip_screen_set(scroll & 1);
+ flip_screen_set(scroll & 1);
break;
default:
logerror("CRTC WRITE REG: %x Data: %03x\n",reg, scroll);
@@ -303,25 +293,21 @@ WRITE8_HANDLER( xevious_vh_latch_w )
/* emulation for schematic 9B */
-WRITE8_HANDLER( xevious_bs_w )
+WRITE8_MEMBER( xevious_state::xevious_bs_w )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- state->m_xevious_bs[offset & 1] = data;
+ m_xevious_bs[offset & 1] = data;
}
-READ8_HANDLER( xevious_bb_r )
+READ8_MEMBER( xevious_state::xevious_bb_r )
{
- xevious_state *state = space.machine().driver_data<xevious_state>();
-
- UINT8 *rom2a = state->memregion("gfx4")->base();
+ UINT8 *rom2a = memregion("gfx4")->base();
UINT8 *rom2b = rom2a+0x1000;
UINT8 *rom2c = rom2a+0x3000;
int adr_2b,adr_2c;
int dat1,dat2;
/* get BS to 12 bit data from 2A,2B */
- adr_2b = ((state->m_xevious_bs[1] & 0x7e) << 6) | ((state->m_xevious_bs[0] & 0xfe) >> 1);
+ adr_2b = ((m_xevious_bs[1] & 0x7e) << 6) | ((m_xevious_bs[0] & 0xfe) >> 1);
if (adr_2b & 1)
{
@@ -334,7 +320,7 @@ READ8_HANDLER( xevious_bb_r )
dat1 = ((rom2a[adr_2b >> 1] & 0x0f) << 8) | rom2b[adr_2b];
}
- adr_2c = ((dat1 & 0x1ff) << 2) | ((state->m_xevious_bs[1] & 1) << 1) | (state->m_xevious_bs[0] & 1);
+ adr_2c = ((dat1 & 0x1ff) << 2) | ((m_xevious_bs[1] & 1) << 1) | (m_xevious_bs[0] & 1);
if (dat1 & 0x400) adr_2c ^= 1;
if (dat1 & 0x200) adr_2c ^= 2;