trunk/src/mame/drivers/dragrace.c
| r32526 | r32527 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Atari Drag Race Driver |
| 3 | Atari Drag Race Driver |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| r32526 | r32527 | |
| 14 | 14 | |
| 15 | 15 | TIMER_DEVICE_CALLBACK_MEMBER(dragrace_state::dragrace_frame_callback) |
| 16 | 16 | { |
| 17 | | int i; |
| 18 | 17 | static const char *const portnames[] = { "P1", "P2" }; |
| 19 | 18 | |
| 20 | | for (i = 0; i < 2; i++) |
| 19 | for (int i = 0; i < 2; i++) |
| 21 | 20 | { |
| 22 | 21 | switch (ioport(portnames[i])->read()) |
| 23 | 22 | { |
| 24 | | case 0x01: m_gear[i] = 1; break; |
| 25 | | case 0x02: m_gear[i] = 2; break; |
| 26 | | case 0x04: m_gear[i] = 3; break; |
| 27 | | case 0x08: m_gear[i] = 4; break; |
| 28 | | case 0x10: m_gear[i] = 0; break; |
| 23 | case 0x01: m_gear[i] = 1; break; |
| 24 | case 0x02: m_gear[i] = 2; break; |
| 25 | case 0x04: m_gear[i] = 3; break; |
| 26 | case 0x08: m_gear[i] = 4; break; |
| 27 | case 0x10: m_gear[i] = 0; break; |
| 29 | 28 | } |
| 30 | 29 | } |
| 31 | 30 | |
| r32526 | r32527 | |
| 85 | 84 | m_discrete->write(space, DRAGRACE_ATTRACT_EN, (m_misc_flags & 0x00001000) ? 1: 0); // Attract enable |
| 86 | 85 | m_discrete->write(space, DRAGRACE_LOTONE_EN, (m_misc_flags & 0x00002000) ? 1: 0); // LoTone enable |
| 87 | 86 | m_discrete->write(space, DRAGRACE_HITONE_EN, (m_misc_flags & 0x20000000) ? 1: 0); // HiTone enable |
| 87 | |
| 88 | // the tachometers are driven from the same frequency generator that creates the engine sound |
| 89 | output_set_value("tachometer", ~m_misc_flags & 0x0000001f); |
| 90 | output_set_value("tachometer2", (~m_misc_flags & 0x001f0000) >> 0x10); |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | 93 | WRITE8_MEMBER(dragrace_state::dragrace_misc_w) |
| r32526 | r32527 | |
| 116 | 119 | UINT8 maskA = 1 << (offset % 8); |
| 117 | 120 | UINT8 maskB = 1 << (offset / 8); |
| 118 | 121 | |
| 119 | | int i; |
| 120 | | |
| 121 | | for (i = 0; i < 2; i++) |
| 122 | for (int i = 0; i < 2; i++) |
| 122 | 123 | { |
| 123 | 124 | int in = ioport(portnames[i])->read(); |
| 124 | 125 | |
| r32526 | r32527 | |
| 139 | 140 | int bitB[2]; |
| 140 | 141 | static const char *const dialnames[] = { "DIAL1", "DIAL2" }; |
| 141 | 142 | |
| 142 | | int i; |
| 143 | | |
| 144 | | for (i = 0; i < 2; i++) |
| 143 | for (int i = 0; i < 2; i++) |
| 145 | 144 | { |
| 146 | 145 | int dial = ioport(dialnames[i])->read(); |
| 147 | 146 | |
trunk/src/mame/includes/dragrace.h
| r32526 | r32527 | |
| 47 | 47 | |
| 48 | 48 | /* devices */ |
| 49 | 49 | required_device<discrete_device> m_discrete; |
| 50 | required_device<cpu_device> m_maincpu; |
| 51 | required_device<gfxdecode_device> m_gfxdecode; |
| 52 | required_device<screen_device> m_screen; |
| 53 | |
| 50 | 54 | DECLARE_WRITE8_MEMBER(dragrace_misc_w); |
| 51 | 55 | DECLARE_WRITE8_MEMBER(dragrace_misc_clear_w); |
| 52 | 56 | DECLARE_READ8_MEMBER(dragrace_input_r); |
| r32526 | r32527 | |
| 60 | 64 | UINT32 screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | 65 | TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback); |
| 62 | 66 | void dragrace_update_misc_flags( address_space &space ); |
| 63 | | required_device<cpu_device> m_maincpu; |
| 64 | | required_device<gfxdecode_device> m_gfxdecode; |
| 65 | | required_device<screen_device> m_screen; |
| 66 | 67 | }; |
| 67 | 68 | |
| 68 | 69 | /*----------- defined in audio/dragrace.c -----------*/ |
trunk/src/mame/video/dragrace.c
| r32526 | r32527 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Atari Drag Race video emulation |
| 3 | Atari Drag Race video emulation |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| r32526 | r32527 | |
| 21 | 21 | |
| 22 | 22 | switch (code & 0xA0) |
| 23 | 23 | { |
| 24 | | case 0x00: |
| 25 | | col = 0; |
| 26 | | break; |
| 27 | | case 0x20: |
| 28 | | col = 1; |
| 29 | | break; |
| 30 | | case 0x80: |
| 31 | | col = (code & 0x40) ? 1 : 0; |
| 32 | | break; |
| 33 | | case 0xA0: |
| 34 | | col = (code & 0x40) ? 3 : 2; |
| 35 | | break; |
| 24 | case 0x00: |
| 25 | col = 0; |
| 26 | break; |
| 27 | case 0x20: |
| 28 | col = 1; |
| 29 | break; |
| 30 | case 0x80: |
| 31 | col = (code & 0x40) ? 1 : 0; |
| 32 | break; |
| 33 | case 0xA0: |
| 34 | col = (code & 0x40) ? 3 : 2; |
| 35 | break; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | SET_TILE_INFO_MEMBER(((code & 0xA0) == 0x80) ? 1 : 0, num, col, 0); |
| r32526 | r32527 | |
| 47 | 47 | |
| 48 | 48 | UINT32 dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 49 | 49 | { |
| 50 | | int y; |
| 51 | | |
| 52 | 50 | m_bg_tilemap->mark_all_dirty(); |
| 53 | 51 | |
| 54 | | for (y = 0; y < 256; y += 4) |
| 52 | for (int y = 0; y < 256; y += 4) |
| 55 | 53 | { |
| 56 | 54 | rectangle rect = cliprect; |
| 57 | 55 | |
| r32526 | r32527 | |
| 68 | 66 | |
| 69 | 67 | m_bg_tilemap->draw(screen, bitmap, rect, 0, 0); |
| 70 | 68 | } |
| 69 | |
| 71 | 70 | return 0; |
| 72 | 71 | } |