summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/cischeat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/cischeat.cpp')
-rw-r--r--src/mame/drivers/cischeat.cpp84
1 files changed, 43 insertions, 41 deletions
diff --git a/src/mame/drivers/cischeat.cpp b/src/mame/drivers/cischeat.cpp
index bbf0a46dfe3..1fbf37acc69 100644
--- a/src/mame/drivers/cischeat.cpp
+++ b/src/mame/drivers/cischeat.cpp
@@ -698,7 +698,7 @@ void cischeat_state::armchmp2_map(address_map &map)
#define RIGHT 0
#define LEFT 1
-WRITE16_MEMBER(cischeat_state::captflag_leds_w)
+WRITE16_MEMBER(captflag_state::leds_w)
{
COMBINE_DATA( &m_captflag_leds );
if (ACCESSING_BITS_8_15)
@@ -709,13 +709,13 @@ WRITE16_MEMBER(cischeat_state::captflag_leds_w)
m_leds[1] = BIT(data, 13); // select
int power = (data & 0x1000);
- m_captflag_hopper->motor_w(power ? 1 : 0); // prize motor
+ m_hopper->motor_w(power ? 1 : 0); // prize motor
if (!power)
- m_captflag_hopper->reset();
+ m_hopper->reset();
}
}
-WRITE16_MEMBER(cischeat_state::captflag_oki_bank_w)
+WRITE16_MEMBER(captflag_state::oki_bank_w)
{
if (ACCESSING_BITS_0_7)
{
@@ -726,32 +726,32 @@ WRITE16_MEMBER(cischeat_state::captflag_oki_bank_w)
// Motors
-WRITE16_MEMBER(cischeat_state::captflag_motor_command_right_w)
+WRITE16_MEMBER(captflag_state::motor_command_right_w)
{
// Output check:
// e09a up
// 80b9 - (when not busy)
// 0088 - (when busy)
// e0ba down
- data = COMBINE_DATA( &m_captflag_motor_command[RIGHT] );
- captflag_motor_move(RIGHT, data);
+ data = COMBINE_DATA( &m_motor_command[RIGHT] );
+ motor_move(RIGHT, data);
}
-WRITE16_MEMBER(cischeat_state::captflag_motor_command_left_w)
+WRITE16_MEMBER(captflag_state::motor_command_left_w)
{
// Output check:
// e0ba up
// 8099 - (when not busy)
// 0088 - (when busy)
// e09a down
- data = COMBINE_DATA( &m_captflag_motor_command[LEFT] );
- captflag_motor_move(LEFT, data);
+ data = COMBINE_DATA( &m_motor_command[LEFT] );
+ motor_move(LEFT, data);
}
-void cischeat_state::captflag_motor_move(int side, uint16_t data)
+void captflag_state::motor_move(int side, uint16_t data)
{
- uint16_t & pos = m_captflag_motor_pos[side];
+ uint16_t & pos = m_motor_pos[side];
- timer_device &dev((side == RIGHT) ? *m_captflag_motor_right : *m_captflag_motor_left);
+ timer_device &dev((side == RIGHT) ? *m_motor_right : *m_motor_left);
// bool busy = !(dev.time_left() == attotime::never);
bool busy = false;
@@ -802,20 +802,22 @@ void cischeat_state::captflag_motor_move(int side, uint16_t data)
output().set_value((side == RIGHT) ? "right" : "left", pos);
}
-CUSTOM_INPUT_MEMBER(cischeat_state::captflag_motor_pos_r)
+template <int N>
+CUSTOM_INPUT_MEMBER(captflag_state::motor_pos_r)
{
const uint8_t pos[4] = {1,0,2,3}; // -> 2,3,1,0 offsets -> 0123
- return ~pos[m_captflag_motor_pos[(uintptr_t)param]];
+ return ~pos[m_motor_pos[N]];
}
-CUSTOM_INPUT_MEMBER(cischeat_state::captflag_motor_busy_r)
+template <int N>
+READ_LINE_MEMBER(captflag_state::motor_busy_r)
{
-// timer_device & dev = ((side == RIGHT) ? m_captflag_motor_right : m_captflag_motor_left);
+// timer_device & dev = ((side == RIGHT) ? m_motor_right : m_motor_left);
// return (dev.time_left() == attotime::never) ? 0 : 1;
return 0;
}
-void cischeat_state::captflag_map(address_map &map)
+void captflag_state::captflag_map(address_map &map)
{
map(0x000000, 0x07ffff).rom(); // ROM
map(0x082000, 0x082005).w("scroll0", FUNC(megasys1_tilemap_device::scroll_w));
@@ -827,24 +829,24 @@ void cischeat_state::captflag_map(address_map &map)
map(0x0b0000, 0x0b7fff).ram().w("scroll2", FUNC(megasys1_tilemap_device::write)).share("scroll2"); // Scroll RAM 2
map(0x0b8000, 0x0bffff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette
map(0x0f0000, 0x0fffff).ram().share("ram"); // Work RAM + Spriteram
- map(0x100000, 0x100001).portr("SW1_2").w(FUNC(cischeat_state::captflag_oki_bank_w)); // 2 x DSW + Sound
- map(0x100008, 0x100009).portr("Buttons").w(FUNC(cischeat_state::captflag_leds_w)); // Buttons + Leds
+ map(0x100000, 0x100001).portr("SW1_2").w(FUNC(captflag_state::oki_bank_w)); // 2 x DSW + Sound
+ map(0x100008, 0x100009).portr("Buttons").w(FUNC(captflag_state::leds_w)); // Buttons + Leds
map(0x100015, 0x100015).rw(m_oki1, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // Sound
map(0x100019, 0x100019).rw(m_oki2, FUNC(okim6295_device::read), FUNC(okim6295_device::write)); //
- map(0x10001c, 0x10001d).w(FUNC(cischeat_state::scudhamm_enable_w)); // ?
+ map(0x10001c, 0x10001d).w(FUNC(captflag_state::scudhamm_enable_w)); // ?
map(0x100040, 0x100041).portr("SW01"); // DSW + Motor
- map(0x100044, 0x100045).w(FUNC(cischeat_state::captflag_motor_command_left_w)); // Motor Command (Left)
- map(0x100048, 0x100049).w(FUNC(cischeat_state::captflag_motor_command_right_w)); // Motor Command (Right)
+ map(0x100044, 0x100045).w(FUNC(captflag_state::motor_command_left_w)); // Motor Command (Left)
+ map(0x100048, 0x100049).w(FUNC(captflag_state::motor_command_right_w)); // Motor Command (Right)
map(0x100060, 0x10007f).ram().share("nvram"); // NVRAM (even bytes only)
}
-void cischeat_state::captflag_oki1_map(address_map &map)
+void captflag_state::oki1_map(address_map &map)
{
map(0x00000, 0x1ffff).rom();
map(0x20000, 0x3ffff).bankr("oki1_bank");
}
-void cischeat_state::captflag_oki2_map(address_map &map)
+void captflag_state::oki2_map(address_map &map)
{
map(0x00000, 0x1ffff).rom();
map(0x20000, 0x3ffff).bankr("oki2_bank");
@@ -1752,11 +1754,11 @@ static INPUT_PORTS_START( captflag )
PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" )
PORT_START("SW01")
- PORT_BIT( 0x0003, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_CUSTOM_MEMBER(DEVICE_SELF, cischeat_state, captflag_motor_pos_r, (void *)LEFT)
- PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_CUSTOM_MEMBER(DEVICE_SELF, cischeat_state, captflag_motor_pos_r, (void *)RIGHT)
+ PORT_BIT( 0x0003, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_CUSTOM_MEMBER(captflag_state, motor_pos_r<LEFT>)
+ PORT_BIT( 0x000c, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_CUSTOM_MEMBER(captflag_state, motor_pos_r<RIGHT>)
- PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(DEVICE_SELF, cischeat_state, captflag_motor_busy_r, (void *)LEFT)
- PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(DEVICE_SELF, cischeat_state, captflag_motor_busy_r, (void *)RIGHT)
+ PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_READ_LINE_MEMBER(captflag_state, motor_busy_r<LEFT>)
+ PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_READ_LINE_MEMBER(captflag_state, motor_busy_r<RIGHT>)
PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW01:1,2")
PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) )
@@ -2157,7 +2159,7 @@ void cischeat_state::armchmp2(machine_config &config)
4-7] rte
*/
-TIMER_DEVICE_CALLBACK_MEMBER(cischeat_state::captflag_scanline)
+TIMER_DEVICE_CALLBACK_MEMBER(captflag_state::captflag_scanline)
{
int scanline = param;
@@ -2168,14 +2170,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(cischeat_state::captflag_scanline)
m_maincpu->set_input_line(3, HOLD_LINE);
}
-void cischeat_state::captflag(machine_config &config)
+void captflag_state::captflag(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, XTAL(24'000'000) / 2); // TMP68000P-12
- m_maincpu->set_addrmap(AS_PROGRAM, &cischeat_state::captflag_map);
- TIMER(config, "scantimer").configure_scanline(FUNC(cischeat_state::captflag_scanline), "screen", 0, 1);
+ m_maincpu->set_addrmap(AS_PROGRAM, &captflag_state::captflag_map);
+ TIMER(config, "scantimer").configure_scanline(FUNC(captflag_state::captflag_scanline), "screen", 0, 1);
- TICKET_DISPENSER(config, m_captflag_hopper, attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH );
+ TICKET_DISPENSER(config, m_hopper, attotime::from_msec(2000), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH );
WATCHDOG_TIMER(config, m_watchdog);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
@@ -2187,7 +2189,7 @@ void cischeat_state::captflag(machine_config &config)
// m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500 * 3) /* not accurate */);
m_screen->set_size(256, 256);
m_screen->set_visarea(0, 256-1, 0 +16, 256-1 -16);
- m_screen->set_screen_update(FUNC(cischeat_state::screen_update_scudhamm));
+ m_screen->set_screen_update(FUNC(captflag_state::screen_update_scudhamm));
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_scudhamm);
@@ -2198,8 +2200,8 @@ void cischeat_state::captflag(machine_config &config)
MEGASYS1_TILEMAP(config, m_tmap[2], m_palette, 0x4e00/2);
// Motors
- TIMER(config, m_captflag_motor_left).configure_generic(timer_device::expired_delegate());
- TIMER(config, m_captflag_motor_right).configure_generic(timer_device::expired_delegate());
+ TIMER(config, m_motor_left).configure_generic(timer_device::expired_delegate());
+ TIMER(config, m_motor_right).configure_generic(timer_device::expired_delegate());
// Layout
config.set_default_layout(layout_captflag);
@@ -2209,12 +2211,12 @@ void cischeat_state::captflag(machine_config &config)
SPEAKER(config, "rspeaker").front_right();
OKIM6295(config, m_oki1, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
- m_oki1->set_addrmap(0, &cischeat_state::captflag_oki1_map);
+ m_oki1->set_addrmap(0, &captflag_state::oki1_map);
m_oki1->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
m_oki1->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
OKIM6295(config, m_oki2, 4000000/2, okim6295_device::PIN7_HIGH); // pin 7 not verified
- m_oki2->set_addrmap(0, &cischeat_state::captflag_oki2_map);
+ m_oki2->set_addrmap(0, &captflag_state::oki2_map);
m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 0.5);
m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 0.5);
}
@@ -3711,7 +3713,7 @@ ROM_START( captflag )
ROM_LOAD( "mr92027-09_w26.ic18", 0x000000, 0x100000, CRC(3aaa332a) SHA1(6c19364069e0b077a07ac4f9c4b0cf0c0985a42a) ) // 1 on the PCB
ROM_END
-void cischeat_state::init_captflag()
+void captflag_state::init_captflag()
{
m_oki1_bank->configure_entries(0, 0x100000 / 0x20000, memregion("oki1")->base(), 0x20000);
m_oki2_bank->configure_entries(0, 0x100000 / 0x20000, memregion("oki2")->base(), 0x20000);
@@ -3736,5 +3738,5 @@ GAME( 1992, armchmp2o2,armchmp2, armchmp2, armchmp2, cischeat_state, empty_init
GAME( 1992, armchmp2o, armchmp2, armchmp2, armchmp2, cischeat_state, empty_init, ROT270, "Jaleco", "Arm Champs II (ver 1.7)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1992, wildplt, 0, wildplt, wildplt, wildplt_state, init_f1gpstar, ROT0, "Jaleco", "Wild Pilot", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // busted timings
GAMEL( 1993, f1gpstr2, 0, f1gpstr2, f1gpstr2, cischeat_state, init_f1gpstar, ROT0, "Jaleco", "F-1 Grand Prix Star II", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN, layout_f1gpstar )
-GAME( 1993, captflag, 0, captflag, captflag, cischeat_state, init_captflag, ROT270, "Jaleco", "Captain Flag (Japan)", MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1993, captflag, 0, captflag, captflag, captflag_state, init_captflag, ROT270, "Jaleco", "Captain Flag (Japan)", MACHINE_IMPERFECT_GRAPHICS )
GAME( 1994, scudhamm, 0, scudhamm, scudhamm, cischeat_state, empty_init, ROT270, "Jaleco", "Scud Hammer", MACHINE_IMPERFECT_GRAPHICS )