summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ivan Vangelista <mesgnet@yahoo.it>2021-05-23 08:28:08 +0200
committer Ivan Vangelista <mesgnet@yahoo.it>2021-05-23 08:28:08 +0200
commitba8816ab88c6729c875f422729ac1a855a645433 (patch)
tree38e41e26ad0474847fbf1475e68a577c08b111f5
parenta5e4a9ce551117eb7e7c39aa3f74a6b78ff09f50 (diff)
dragrace.cpp: added dip locations [Guru]
-rw-r--r--src/mame/audio/dragrace.cpp42
-rw-r--r--src/mame/drivers/dragrace.cpp120
-rw-r--r--src/mame/includes/dragrace.h69
-rw-r--r--src/mame/video/dragrace.cpp12
4 files changed, 127 insertions, 116 deletions
diff --git a/src/mame/audio/dragrace.cpp b/src/mame/audio/dragrace.cpp
index 5c84331ce4e..56f68bd34cc 100644
--- a/src/mame/audio/dragrace.cpp
+++ b/src/mame/audio/dragrace.cpp
@@ -2,7 +2,7 @@
// copyright-holders:Derrick Renaud
/*************************************************************************
- audio\dragrace.c
+ audio\dragrace.cpp
*************************************************************************/
#include "emu.h"
@@ -16,19 +16,19 @@
static const discrete_lfsr_desc dragrace_lfsr =
{
DISC_CLK_IS_FREQ,
- 16, /* Bit Length */
- 0, /* Reset Value */
- 0, /* Use Bit 0 as XOR input 0 */
- 14, /* Use Bit 14 as XOR input 1 */
- DISC_LFSR_XNOR, /* Feedback stage1 is XNOR */
- DISC_LFSR_OR, /* Feedback stage2 is just stage 1 output OR with external feed */
- DISC_LFSR_REPLACE, /* Feedback stage3 replaces the shifted register contents */
- 0x000001, /* Everything is shifted into the first bit only */
- 0, /* Output is already inverted by XNOR */
- 15 /* Output bit */
+ 16, // Bit Length
+ 0, // Reset Value
+ 0, // Use Bit 0 as XOR input 0
+ 14, // Use Bit 14 as XOR input 1
+ DISC_LFSR_XNOR, // Feedback stage1 is XNOR
+ DISC_LFSR_OR, // Feedback stage2 is just stage 1 output OR with external feed
+ DISC_LFSR_REPLACE, // Feedback stage3 replaces the shifted register contents
+ 0x000001, // Everything is shifted into the first bit only
+ 0, // Output is already inverted by XNOR
+ 15 // Output bit
};
-/* Nodes - Sounds */
+// Nodes - Sounds
#define DRAGRACE_NOISE NODE_10
#define DRAGRACE_SCREECH1_SND NODE_11
#define DRAGRACE_SCREECH2_SND NODE_12
@@ -42,7 +42,7 @@ static const discrete_lfsr_desc dragrace_lfsr =
DISCRETE_SOUND_START(dragrace_discrete)
/************************************************/
- /* dragrace Effects Relataive Gain Table */
+ /* dragrace Effects Relative Gain Table */
/* */
/* Effect V-ampIn Gain ratio Relative */
/* LoTone 3.8 10/32 593.8 */
@@ -73,7 +73,7 @@ DISCRETE_SOUND_START(dragrace_discrete)
/************************************************/
/* Motor sound circuit is based on a 556 VCO */
/* with the input frequency set by the MotorSND */
- /* latch (4 bit). This freqency is then used to */
+ /* latch (4 bit). This frequency is then used to*/
/* driver a modulo 12 counter, with div6, 4 & 3 */
/* summed as the output of the circuit. */
/* VCO Output is Sq wave = 27-382Hz */
@@ -88,7 +88,7 @@ DISCRETE_SOUND_START(dragrace_discrete)
/* to a 2.2uf capacitor on the R-ladder. */
/* Note the VCO freq. is controlled by a 250k */
/* pot. The freq. used here is for the pot set */
- /* to 125k. The low freq is allways the same. */
+ /* to 125k. The low freq is always the same. */
/* This adjusts the high end. */
/* 0k = 214Hz. 250k = 4416Hz */
/* NOTE: freqs are ripped from Sprint for now. */
@@ -97,15 +97,15 @@ DISCRETE_SOUND_START(dragrace_discrete)
DISCRETE_ADJUSTMENT(NODE_21, (214.0-27.0)/12/31, (4416.0-27.0)/12/31, DISC_LOGADJ, "MOTOR1")
DISCRETE_MULTIPLY(NODE_22, NODE_20, NODE_21)
- DISCRETE_MULTADD(NODE_23, NODE_22, 2, 27.0/6) /* F1 = /12*2 = /6 */
+ DISCRETE_MULTADD(NODE_23, NODE_22, 2, 27.0/6) // F1 = /12*2 = /6
DISCRETE_SQUAREWAVE(NODE_24, 1, NODE_23, (581.6/3), 50.0, 0, 0)
DISCRETE_RCFILTER(NODE_25, NODE_24, 10000, 1e-7)
- DISCRETE_MULTADD(NODE_26, NODE_22, 3, 27.0/4) /* F2 = /12*3 = /4 */
+ DISCRETE_MULTADD(NODE_26, NODE_22, 3, 27.0/4) // F2 = /12*3 = /4
DISCRETE_SQUAREWAVE(NODE_27, 1, NODE_26, (581.6/3), 50.0, 0, 0)
DISCRETE_RCFILTER(NODE_28, NODE_27, 10000, 1e-7)
- DISCRETE_MULTADD(NODE_29, NODE_22, 4, 27.0/3) /* F3 = /12*4 = /3 */
+ DISCRETE_MULTADD(NODE_29, NODE_22, 4, 27.0/3) // F3 = /12*4 = /3
DISCRETE_SQUAREWAVE(NODE_30, 1, NODE_29, (581.6/3), 100.0/3, 0, 360.0/3)
DISCRETE_RCFILTER(NODE_31, NODE_30, 10000, 1e-7)
@@ -120,15 +120,15 @@ DISCRETE_SOUND_START(dragrace_discrete)
DISCRETE_ADJUSTMENT(NODE_41, (214.0-27.0)/12/31, (4416.0-27.0)/12/31, DISC_LOGADJ, "MOTOR2")
DISCRETE_MULTIPLY(NODE_42, NODE_40, NODE_41)
- DISCRETE_MULTADD(NODE_43, NODE_42, 2, 27.0/6) /* F1 = /12*2 = /6 */
+ DISCRETE_MULTADD(NODE_43, NODE_42, 2, 27.0/6) // F1 = /12*2 = /6
DISCRETE_SQUAREWAVE(NODE_44, 1, NODE_43, (581.6/3), 50.0, 0, 0)
DISCRETE_RCFILTER(NODE_45, NODE_44, 10000, 1e-7)
- DISCRETE_MULTADD(NODE_46, NODE_42, 3, 27.0/4) /* F2 = /12*3 = /4 */
+ DISCRETE_MULTADD(NODE_46, NODE_42, 3, 27.0/4) // F2 = /12*3 = /4
DISCRETE_SQUAREWAVE(NODE_47, 1, NODE_46, (581.6/3), 50.0, 0, 0)
DISCRETE_RCFILTER(NODE_48, NODE_47, 10000, 1e-7)
- DISCRETE_MULTADD(NODE_49, NODE_42, 4, 27.0/3) /* F3 = /12*4 = /3 */
+ DISCRETE_MULTADD(NODE_49, NODE_42, 4, 27.0/3) // F3 = /12*4 = /3
DISCRETE_SQUAREWAVE(NODE_50, 1, NODE_49, (581.6/3), 100.0/3, 0, 360.0/3)
DISCRETE_RCFILTER(NODE_51, NODE_50, 10000, 1e-7)
diff --git a/src/mame/drivers/dragrace.cpp b/src/mame/drivers/dragrace.cpp
index 80b403fee17..86d42456e8a 100644
--- a/src/mame/drivers/dragrace.cpp
+++ b/src/mame/drivers/dragrace.cpp
@@ -17,13 +17,11 @@
#include "dragrace.lh"
-TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::dragrace_frame_callback)
+TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::frame_callback)
{
- static const char *const portnames[] = { "P1", "P2" };
-
for (int i = 0; i < 2; i++)
{
- switch (ioport(portnames[i])->read())
+ switch (m_p[i]->read())
{
case 0x01: m_gear[i] = 1; break;
case 0x02: m_gear[i] = 2; break;
@@ -32,11 +30,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::dragrace_frame_callback)
case 0x10: m_gear[i] = 0; break;
}
}
- output().set_value("P1gear", m_gear[0]);
- output().set_value("P2gear", m_gear[1]);
- /* watchdog is disabled during service mode */
- m_watchdog->watchdog_enable(ioport("IN0")->read() & 0x20);
+ m_gear_sel[0] = m_gear[0];
+ m_gear_sel[1] = m_gear[1];
+
+ // watchdog is disabled during service mode
+ m_watchdog->watchdog_enable(m_in[0]->read() & 0x20);
}
@@ -46,7 +45,7 @@ void dragrace_state::speed1_w(uint8_t data)
m_discrete->write(DRAGRACE_MOTOR1_DATA, freq);
// the tachometers are driven from the same frequency generator that creates the engine sound
- output().set_value("tachometer", freq);
+ m_tacho_sel[0] = freq;
}
void dragrace_state::speed2_w(uint8_t data)
@@ -55,20 +54,19 @@ void dragrace_state::speed2_w(uint8_t data)
m_discrete->write(DRAGRACE_MOTOR2_DATA, freq);
// the tachometers are driven from the same frequency generator that creates the engine sound
- output().set_value("tachometer2", freq);
+ m_tacho_sel[1] = freq;
}
-uint8_t dragrace_state::dragrace_input_r(offs_t offset)
+uint8_t dragrace_state::input_r(offs_t offset)
{
- int val = ioport("IN2")->read();
- static const char *const portnames[] = { "IN0", "IN1" };
+ int val = m_in[2]->read();
uint8_t maskA = 1 << (offset % 8);
uint8_t maskB = 1 << (offset / 8);
for (int i = 0; i < 2; i++)
{
- int in = ioport(portnames[i])->read();
+ int in = m_in[i]->read();
if (m_gear[i] != 0)
in &= ~(1 << m_gear[i]);
@@ -81,15 +79,14 @@ uint8_t dragrace_state::dragrace_input_r(offs_t offset)
}
-uint8_t dragrace_state::dragrace_steering_r()
+uint8_t dragrace_state::steering_r()
{
int bitA[2];
int bitB[2];
- static const char *const dialnames[] = { "DIAL1", "DIAL2" };
for (int i = 0; i < 2; i++)
{
- int dial = ioport(dialnames[i])->read();
+ int dial = m_dial[i]->read();
bitA[i] = ((dial + 1) / 2) & 1;
bitB[i] = ((dial + 0) / 2) & 1;
@@ -101,16 +98,16 @@ uint8_t dragrace_state::dragrace_steering_r()
}
-uint8_t dragrace_state::dragrace_scanline_r()
+uint8_t dragrace_state::scanline_r()
{
return (m_screen->vpos() ^ 0xf0) | 0x0f;
}
-void dragrace_state::dragrace_map(address_map &map)
+void dragrace_state::main_map(address_map &map)
{
map(0x0080, 0x00ff).ram();
- map(0x0800, 0x083f).r(FUNC(dragrace_state::dragrace_input_r));
+ map(0x0800, 0x083f).r(FUNC(dragrace_state::input_r));
map(0x0900, 0x0907).w("latch_f5", FUNC(addressable_latch_device::write_d0));
map(0x0908, 0x090f).w("latch_a5", FUNC(addressable_latch_device::write_d0));
map(0x0910, 0x0917).w("latch_h5", FUNC(addressable_latch_device::write_d0));
@@ -119,25 +116,25 @@ void dragrace_state::dragrace_map(address_map &map)
map(0x0928, 0x092f).w("latch_a5", FUNC(addressable_latch_device::clear));
map(0x0930, 0x0937).w("latch_h5", FUNC(addressable_latch_device::clear));
map(0x0938, 0x093f).w("latch_e5", FUNC(addressable_latch_device::clear));
- map(0x0a00, 0x0aff).writeonly().share("playfield_ram");
- map(0x0b00, 0x0bff).writeonly().share("position_ram");
- map(0x0c00, 0x0c00).r(FUNC(dragrace_state::dragrace_steering_r));
- map(0x0d00, 0x0d00).r(FUNC(dragrace_state::dragrace_scanline_r));
+ map(0x0a00, 0x0aff).writeonly().share(m_playfield_ram);
+ map(0x0b00, 0x0bff).writeonly().share(m_position_ram);
+ map(0x0c00, 0x0c00).r(FUNC(dragrace_state::steering_r));
+ map(0x0d00, 0x0d00).r(FUNC(dragrace_state::scanline_r));
map(0x0e00, 0x0eff).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
- map(0x1000, 0x1fff).rom(); /* program */
- map(0xf800, 0xffff).rom(); /* program mirror */
+ map(0x1000, 0x1fff).rom(); // program
+ map(0xf800, 0xffff).rom(); // program mirror
}
static INPUT_PORTS_START( dragrace )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 1 */
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 2 */
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 3 */
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 1 gear 4 */
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // player 1 gear 1
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // player 1 gear 2
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // player 1 gear 3
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // player 1 gear 4
PORT_SERVICE( 0x20, IP_ACTIVE_LOW )
- PORT_DIPNAME( 0xc0, 0x80, "Extended Play" )
+ PORT_DIPNAME( 0xc0, 0x80, "Extended Play" ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x00, "6.9 seconds" )
PORT_DIPSETTING( 0x80, "5.9 seconds" )
PORT_DIPSETTING( 0x40, "4.9 seconds" )
@@ -145,24 +142,24 @@ static INPUT_PORTS_START( dragrace )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 1 */
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 2 */
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 3 */
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* player 2 gear 4 */
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // player 2 gear 1
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // player 2 gear 2
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // player 2 gear 3
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) // player 2 gear 4
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
- PORT_DIPNAME( 0xc0, 0x80, "Number Of Heats" )
+ PORT_DIPNAME( 0xc0, 0x80, "Number Of Heats" ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_DIPSETTING( 0x00, "5" )
PORT_START("IN2")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN0 connects here */
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* IN1 connects here */
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) // IN0 connects here
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) // IN1 connects here
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
- PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Coinage ) )
+ PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:5,6")
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ) )
@@ -198,10 +195,10 @@ INPUT_PORTS_END
static const gfx_layout dragrace_tile_layout1 =
{
- 16, 16, /* width, height */
- 0x40, /* total */
- 1, /* planes */
- { 0 }, /* plane offsets */
+ 16, 16, // width, height
+ 0x40, // total
+ 1, // planes
+ { 0 }, // plane offsets
{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87
@@ -210,16 +207,16 @@ static const gfx_layout dragrace_tile_layout1 =
0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78
},
- 0x100 /* increment */
+ 0x100 // increment
};
static const gfx_layout dragrace_tile_layout2 =
{
- 16, 16, /* width, height */
- 0x20, /* total */
- 2, /* planes */
- { /* plane offsets */
+ 16, 16, // width, height
+ 0x20, // total
+ 2, // planes
+ { // plane offsets
0x0000, 0x2000
},
{
@@ -230,7 +227,7 @@ static const gfx_layout dragrace_tile_layout2 =
0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38,
0x40, 0x48, 0x50, 0x58, 0x60, 0x68, 0x70, 0x78
},
- 0x100 /* increment */
+ 0x100 // increment
};
@@ -240,7 +237,7 @@ static GFXDECODE_START( gfx_dragrace )
GFXDECODE_END
-void dragrace_state::dragrace_palette(palette_device &palette) const
+void dragrace_state::palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0xff, 0xff, 0xff)); // 2 color tiles
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00));
@@ -263,6 +260,9 @@ void dragrace_state::dragrace_palette(palette_device &palette) const
void dragrace_state::machine_start()
{
+ m_gear_sel.resolve();
+ m_tacho_sel.resolve();
+
save_item(NAME(m_gear));
}
@@ -274,27 +274,27 @@ void dragrace_state::machine_reset()
void dragrace_state::dragrace(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
M6800(config, m_maincpu, 12.096_MHz_XTAL / 12);
- m_maincpu->set_addrmap(AS_PROGRAM, &dragrace_state::dragrace_map);
+ m_maincpu->set_addrmap(AS_PROGRAM, &dragrace_state::main_map);
m_maincpu->set_periodic_int(FUNC(dragrace_state::irq0_line_hold), attotime::from_hz(4*60));
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 8);
- TIMER(config, "frame_timer").configure_periodic(FUNC(dragrace_state::dragrace_frame_callback), attotime::from_hz(60));
+ TIMER(config, "frame_timer").configure_periodic(FUNC(dragrace_state::frame_callback), attotime::from_hz(60));
- /* video hardware */
+ // video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_size(256, 262);
m_screen->set_visarea(0, 255, 0, 239);
- m_screen->set_screen_update(FUNC(dragrace_state::screen_update_dragrace));
+ m_screen->set_screen_update(FUNC(dragrace_state::screen_update));
m_screen->set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_dragrace);
- PALETTE(config, "palette", FUNC(dragrace_state::dragrace_palette), 16);
+ PALETTE(config, "palette", FUNC(dragrace_state::palette), 16);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
@@ -333,18 +333,18 @@ ROM_START( dragrace )
ROM_LOAD( "8514.a1", 0x1800, 0x0800, CRC(ad218690) SHA1(08ba5f4fa4c75d8dad1a7162888d44b3349cbbe4) )
ROM_RELOAD( 0xf800, 0x0800 )
- ROM_REGION( 0x800, "gfx1", 0 ) /* 2 color tiles */
+ ROM_REGION( 0x800, "gfx1", 0 ) // 2 color tiles
ROM_LOAD( "8519dr.j0", 0x000, 0x200, CRC(aa221ba0) SHA1(450acbf349d77a790a25f3e303c31b38cc426a38) )
ROM_LOAD( "8521dr.k0", 0x200, 0x200, CRC(0cb33f12) SHA1(d50cb55391aec03e064eecad1624d50d4c30ccab) )
ROM_LOAD( "8520dr.r0", 0x400, 0x200, CRC(ee1ae6a7) SHA1(83491095260c8b7c616ff17ec1e888d05620f166) )
- ROM_REGION( 0x800, "gfx2", 0 ) /* 4 color tiles */
+ ROM_REGION( 0x800, "gfx2", 0 ) // 4 color tiles
ROM_LOAD( "8515dr.e0", 0x000, 0x200, CRC(9510a59e) SHA1(aea0782b919279efe55a07007bd55a16f7f59239) )
ROM_LOAD( "8517dr.h0", 0x200, 0x200, CRC(8b5bff1f) SHA1(fdcd719c66bff7c4b9f3d56d1e635259dd8add61) )
ROM_LOAD( "8516dr.l0", 0x400, 0x200, CRC(d1e74af1) SHA1(f55a3bfd7d152ac9af128697f55c9a0c417779f5) )
ROM_LOAD( "8518dr.n0", 0x600, 0x200, CRC(b1369028) SHA1(598a8779982d532c9f34345e793a79fcb29cac62) )
- ROM_REGION( 0x100, "sync", 0 ) /* sync prom located at L8, it's a 82s129 */
+ ROM_REGION( 0x100, "sync", 0 ) // sync prom located at L8, it's a 82s129
ROM_LOAD( "l8.bin", 0x000, 0x100, CRC(3610b453) SHA1(9e33ee04f22a9174c29fafb8e71781fa330a7a08) )
ROM_END
diff --git a/src/mame/includes/dragrace.h b/src/mame/includes/dragrace.h
index f2440d851ed..6a2d7d81717 100644
--- a/src/mame/includes/dragrace.h
+++ b/src/mame/includes/dragrace.h
@@ -17,7 +17,7 @@
#include "screen.h"
#include "tilemap.h"
-/* Discrete Sound Input Nodes */
+// Discrete Sound Input Nodes
#define DRAGRACE_SCREECH1_EN NODE_01
#define DRAGRACE_SCREECH2_EN NODE_02
#define DRAGRACE_LOTONE_EN NODE_03
@@ -38,54 +38,67 @@ class dragrace_state : public driver_device
public:
dragrace_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
- m_playfield_ram(*this, "playfield_ram"),
- m_position_ram(*this, "position_ram"),
- m_discrete(*this, "discrete"),
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen")
+ m_screen(*this, "screen"),
+ m_discrete(*this, "discrete"),
+ m_playfield_ram(*this, "playfield_ram"),
+ m_position_ram(*this, "position_ram"),
+ m_p(*this, "P%u", 1U),
+ m_dial(*this, "DIAL%u", 1U),
+ m_in(*this, "IN%u", 0U),
+ m_gear_sel(*this, "P%ugear", 1U),
+ m_tacho_sel(*this, "tachometer%u", 1U)
{
}
void dragrace(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
void speed1_w(uint8_t data);
void speed2_w(uint8_t data);
- uint8_t dragrace_input_r(offs_t offset);
- uint8_t dragrace_steering_r();
- uint8_t dragrace_scanline_r();
+ uint8_t input_r(offs_t offset);
+ uint8_t steering_r();
+ uint8_t scanline_r();
TILE_GET_INFO_MEMBER(get_tile_info);
- void dragrace_palette(palette_device &palette) const;
- uint32_t screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback);
- void dragrace_update_misc_flags( address_space &space );
+ void palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TIMER_DEVICE_CALLBACK_MEMBER(frame_callback);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- void dragrace_map(address_map &map);
+ void main_map(address_map &map);
- /* memory pointers */
+ // devices
+ required_device<cpu_device> m_maincpu;
+ required_device<watchdog_timer_device> m_watchdog;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<discrete_sound_device> m_discrete;
+
+ // memory pointers
required_shared_ptr<uint8_t> m_playfield_ram;
required_shared_ptr<uint8_t> m_position_ram;
- /* video-related */
- tilemap_t *m_bg_tilemap;
+ // inputs
+ required_ioport_array<2> m_p, m_dial;
+ required_ioport_array<3> m_in;
- /* misc */
- int m_gear[2];
+ // outputs
+ output_finder<2> m_gear_sel, m_tacho_sel;
- /* devices */
- required_device<discrete_sound_device> m_discrete;
- required_device<cpu_device> m_maincpu;
- required_device<watchdog_timer_device> m_watchdog;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<screen_device> m_screen;
+ // video-related
+ tilemap_t *m_bg_tilemap;
+
+ // misc
+ uint8_t m_gear[2];
};
-/*----------- defined in audio/dragrace.c -----------*/
+//----------- defined in audio/dragrace.cpp -----------
DISCRETE_SOUND_EXTERN( dragrace_discrete );
#endif // MAME_INCLUDES_DRAGRACE_H
diff --git a/src/mame/video/dragrace.cpp b/src/mame/video/dragrace.cpp
index 84f02b0edcc..8e3469212fc 100644
--- a/src/mame/video/dragrace.cpp
+++ b/src/mame/video/dragrace.cpp
@@ -13,15 +13,13 @@
TILE_GET_INFO_MEMBER(dragrace_state::get_tile_info)
{
uint8_t code = m_playfield_ram[tile_index];
- int num = 0;
+ int num = code & 0x1f;
int col = 0;
- num = code & 0x1f;
-
if ((code & 0xc0) == 0x40)
num |= 0x20;
- switch (code & 0xA0)
+ switch (code & 0xa0)
{
case 0x00:
col = 0;
@@ -32,12 +30,12 @@ TILE_GET_INFO_MEMBER(dragrace_state::get_tile_info)
case 0x80:
col = (code & 0x40) ? 1 : 0;
break;
- case 0xA0:
+ case 0xa0:
col = (code & 0x40) ? 3 : 2;
break;
}
- tileinfo.set(((code & 0xA0) == 0x80) ? 1 : 0, num, col, 0);
+ tileinfo.set(((code & 0xa0) == 0x80) ? 1 : 0, num, col, 0);
}
@@ -47,7 +45,7 @@ void dragrace_state::video_start()
}
-uint32_t dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t dragrace_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->mark_all_dirty();