dragrace.c: Added tachometer outputs. [Comboman]

This commit is contained in:
Michaël Banaan Ananas 2014-10-04 12:20:38 +00:00
parent ec2b170c8d
commit 76fb8a3129
3 changed files with 32 additions and 33 deletions

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
Atari Drag Race Driver Atari Drag Race Driver
***************************************************************************/ ***************************************************************************/
@ -14,10 +14,9 @@ Atari Drag Race Driver
TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::dragrace_frame_callback) TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::dragrace_frame_callback)
{ {
int i;
static const char *const portnames[] = { "P1", "P2" }; static const char *const portnames[] = { "P1", "P2" };
for (i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
switch (ioport(portnames[i])->read()) switch (ioport(portnames[i])->read())
{ {
@ -85,6 +84,10 @@ void dragrace_state::dragrace_update_misc_flags( address_space &space )
m_discrete->write(space, DRAGRACE_ATTRACT_EN, (m_misc_flags & 0x00001000) ? 1: 0); // Attract enable m_discrete->write(space, DRAGRACE_ATTRACT_EN, (m_misc_flags & 0x00001000) ? 1: 0); // Attract enable
m_discrete->write(space, DRAGRACE_LOTONE_EN, (m_misc_flags & 0x00002000) ? 1: 0); // LoTone enable m_discrete->write(space, DRAGRACE_LOTONE_EN, (m_misc_flags & 0x00002000) ? 1: 0); // LoTone enable
m_discrete->write(space, DRAGRACE_HITONE_EN, (m_misc_flags & 0x20000000) ? 1: 0); // HiTone enable m_discrete->write(space, DRAGRACE_HITONE_EN, (m_misc_flags & 0x20000000) ? 1: 0); // HiTone enable
// the tachometers are driven from the same frequency generator that creates the engine sound
output_set_value("tachometer", ~m_misc_flags & 0x0000001f);
output_set_value("tachometer2", (~m_misc_flags & 0x001f0000) >> 0x10);
} }
WRITE8_MEMBER(dragrace_state::dragrace_misc_w) WRITE8_MEMBER(dragrace_state::dragrace_misc_w)
@ -116,9 +119,7 @@ READ8_MEMBER(dragrace_state::dragrace_input_r)
UINT8 maskA = 1 << (offset % 8); UINT8 maskA = 1 << (offset % 8);
UINT8 maskB = 1 << (offset / 8); UINT8 maskB = 1 << (offset / 8);
int i; for (int i = 0; i < 2; i++)
for (i = 0; i < 2; i++)
{ {
int in = ioport(portnames[i])->read(); int in = ioport(portnames[i])->read();
@ -139,9 +140,7 @@ READ8_MEMBER(dragrace_state::dragrace_steering_r)
int bitB[2]; int bitB[2];
static const char *const dialnames[] = { "DIAL1", "DIAL2" }; static const char *const dialnames[] = { "DIAL1", "DIAL2" };
int i; for (int i = 0; i < 2; i++)
for (i = 0; i < 2; i++)
{ {
int dial = ioport(dialnames[i])->read(); int dial = ioport(dialnames[i])->read();

View File

@ -47,6 +47,10 @@ public:
/* devices */ /* devices */
required_device<discrete_device> m_discrete; required_device<discrete_device> m_discrete;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
DECLARE_WRITE8_MEMBER(dragrace_misc_w); DECLARE_WRITE8_MEMBER(dragrace_misc_w);
DECLARE_WRITE8_MEMBER(dragrace_misc_clear_w); DECLARE_WRITE8_MEMBER(dragrace_misc_clear_w);
DECLARE_READ8_MEMBER(dragrace_input_r); DECLARE_READ8_MEMBER(dragrace_input_r);
@ -60,9 +64,6 @@ public:
UINT32 screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback); TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback);
void dragrace_update_misc_flags( address_space &space ); void dragrace_update_misc_flags( address_space &space );
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
}; };
/*----------- defined in audio/dragrace.c -----------*/ /*----------- defined in audio/dragrace.c -----------*/

View File

@ -1,6 +1,6 @@
/*************************************************************************** /***************************************************************************
Atari Drag Race video emulation Atari Drag Race video emulation
***************************************************************************/ ***************************************************************************/
@ -47,11 +47,9 @@ void dragrace_state::video_start()
UINT32 dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
int y;
m_bg_tilemap->mark_all_dirty(); m_bg_tilemap->mark_all_dirty();
for (y = 0; y < 256; y += 4) for (int y = 0; y < 256; y += 4)
{ {
rectangle rect = cliprect; rectangle rect = cliprect;
@ -68,5 +66,6 @@ UINT32 dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_ind1
m_bg_tilemap->draw(screen, bitmap, rect, 0, 0); m_bg_tilemap->draw(screen, bitmap, rect, 0, 0);
} }
return 0; return 0;
} }