trunk/src/mame/includes/firetrk.h
| r26904 | r26905 | |
| 33 | 33 | class firetrk_state : public driver_device |
| 34 | 34 | { |
| 35 | 35 | public: |
| 36 | | enum |
| 37 | | { |
| 38 | | TIMER_PERIODIC |
| 39 | | }; |
| 40 | | |
| 41 | 36 | firetrk_state(const machine_config &mconfig, device_type type, const char *tag) |
| 42 | 37 | : driver_device(mconfig, type, tag), |
| 38 | m_maincpu(*this, "maincpu"), |
| 39 | m_discrete(*this, "discrete"), |
| 43 | 40 | m_alpha_num_ram(*this, "alpha_num_ram"), |
| 44 | 41 | m_playfield_ram(*this, "playfield_ram"), |
| 45 | 42 | m_scroll_y(*this, "scroll_y"), |
| r26904 | r26905 | |
| 48 | 45 | m_blink(*this, "blink"), |
| 49 | 46 | m_drone_x(*this, "drone_x"), |
| 50 | 47 | m_drone_y(*this, "drone_y"), |
| 51 | | m_drone_rot(*this, "drone_rot"), |
| 52 | | m_discrete(*this, "discrete"), |
| 53 | | m_maincpu(*this, "maincpu") { } |
| 48 | m_drone_rot(*this, "drone_rot") |
| 49 | { } |
| 54 | 50 | |
| 55 | | UINT8 m_in_service_mode; |
| 56 | | UINT32 m_dial[2]; |
| 57 | | UINT8 m_steer_dir[2]; |
| 58 | | UINT8 m_steer_flag[2]; |
| 59 | | UINT8 m_gear; |
| 51 | required_device<cpu_device> m_maincpu; |
| 52 | required_device<discrete_device> m_discrete; |
| 60 | 53 | required_shared_ptr<UINT8> m_alpha_num_ram; |
| 61 | 54 | required_shared_ptr<UINT8> m_playfield_ram; |
| 62 | 55 | required_shared_ptr<UINT8> m_scroll_y; |
| r26904 | r26905 | |
| 66 | 59 | optional_shared_ptr<UINT8> m_drone_x; |
| 67 | 60 | optional_shared_ptr<UINT8> m_drone_y; |
| 68 | 61 | optional_shared_ptr<UINT8> m_drone_rot; |
| 69 | | required_device<discrete_device> m_discrete; |
| 62 | |
| 63 | UINT8 m_in_service_mode; |
| 64 | UINT32 m_dial[2]; |
| 65 | UINT8 m_steer_dir[2]; |
| 66 | UINT8 m_steer_flag[2]; |
| 67 | UINT8 m_gear; |
| 68 | |
| 70 | 69 | UINT8 m_flash; |
| 71 | 70 | UINT8 m_crash[2]; |
| 72 | 71 | UINT8 m_skid[2]; |
| r26904 | r26905 | |
| 76 | 75 | UINT32 m_color2_mask; |
| 77 | 76 | tilemap_t *m_tilemap1; |
| 78 | 77 | tilemap_t *m_tilemap2; |
| 78 | |
| 79 | 79 | DECLARE_WRITE8_MEMBER(firetrk_output_w); |
| 80 | 80 | DECLARE_WRITE8_MEMBER(superbug_output_w); |
| 81 | 81 | DECLARE_WRITE8_MEMBER(montecar_output_1_w); |
| r26904 | r26905 | |
| 112 | 112 | UINT32 screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 113 | 113 | UINT32 screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 114 | 114 | UINT32 screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 115 | | INTERRUPT_GEN_MEMBER(firetrk_interrupt); |
| 116 | | TIMER_CALLBACK_MEMBER(periodic_callback); |
| 115 | TIMER_DEVICE_CALLBACK_MEMBER(firetrk_scanline); |
| 117 | 116 | DECLARE_WRITE8_MEMBER(firetrk_skid_reset_w); |
| 118 | 117 | DECLARE_WRITE8_MEMBER(montecar_skid_reset_w); |
| 119 | 118 | DECLARE_WRITE8_MEMBER(firetrk_crash_snd_w); |
| r26904 | r26905 | |
| 127 | 126 | void montecar_draw_car(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx, int which, int is_collision_detection); |
| 128 | 127 | void check_collision(firetrk_state *state, int which); |
| 129 | 128 | void set_service_mode(int enable); |
| 130 | | required_device<cpu_device> m_maincpu; |
| 131 | | |
| 132 | | protected: |
| 133 | | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 134 | 129 | }; |
| 135 | 130 | |
| 136 | 131 | |
| 137 | 132 | /*----------- defined in audio/firetrk.c -----------*/ |
| 138 | 133 | |
| 139 | | |
| 140 | 134 | DISCRETE_SOUND_EXTERN( firetrk ); |
| 141 | 135 | DISCRETE_SOUND_EXTERN( superbug ); |
| 142 | 136 | DISCRETE_SOUND_EXTERN( montecar ); |
trunk/src/mame/drivers/firetrk.c
| r26904 | r26905 | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | | |
| 8 | 7 | #include "emu.h" |
| 9 | 8 | #include "cpu/m6800/m6800.h" |
| 10 | 9 | #include "includes/firetrk.h" |
| r26904 | r26905 | |
| 24 | 23 | machine().watchdog_enable(!enable); |
| 25 | 24 | |
| 26 | 25 | /* change CPU clock speed according to service switch change */ |
| 27 | | m_maincpu->set_unscaled_clock(enable ? (MASTER_CLOCK/12) : (MASTER_CLOCK/16)); |
| 26 | m_maincpu->set_unscaled_clock(enable ? (MASTER_CLOCK/16) : (MASTER_CLOCK/12)); |
| 28 | 27 | } |
| 29 | 28 | |
| 30 | 29 | |
| r26904 | r26905 | |
| 47 | 46 | } |
| 48 | 47 | |
| 49 | 48 | |
| 50 | | INTERRUPT_GEN_MEMBER(firetrk_state::firetrk_interrupt) |
| 49 | TIMER_DEVICE_CALLBACK_MEMBER(firetrk_state::firetrk_scanline) |
| 51 | 50 | { |
| 52 | | /* NMI interrupts are disabled during service mode in firetrk and montecar */ |
| 53 | | if (!m_in_service_mode) |
| 54 | | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 55 | | } |
| 56 | | |
| 57 | | |
| 58 | | void firetrk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 59 | | { |
| 60 | | switch (id) |
| 61 | | { |
| 62 | | case TIMER_PERIODIC: |
| 63 | | periodic_callback(ptr, param); |
| 64 | | break; |
| 65 | | default: |
| 66 | | assert_always(FALSE, "Unknown id in firetrk_state::device_timer"); |
| 67 | | } |
| 68 | | } |
| 69 | | |
| 70 | | |
| 71 | | TIMER_CALLBACK_MEMBER(firetrk_state::periodic_callback) |
| 72 | | { |
| 73 | 51 | int scanline = param; |
| 74 | | |
| 75 | | generic_pulse_irq_line(m_maincpu, 0, 1); |
| 76 | | |
| 77 | | /* IRQs are generated by inverse 16V signal */ |
| 78 | | scanline += 32; |
| 79 | | |
| 80 | | if (scanline > 262) |
| 81 | | scanline = 0; |
| 82 | | |
| 83 | | timer_set(m_screen->time_until_pos(scanline), TIMER_PERIODIC, scanline); |
| 52 | |
| 53 | // periodic IRQs are generated by inverse 16V signal |
| 54 | if ((scanline & 0x1f) == 0) |
| 55 | generic_pulse_irq_line(m_maincpu, 0, 1); |
| 56 | |
| 57 | // vblank interrupt |
| 58 | // NMIs are disabled during service mode |
| 59 | if (!m_in_service_mode && scanline == 240) |
| 60 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 84 | 61 | } |
| 85 | 62 | |
| 86 | 63 | |
| r26904 | r26905 | |
| 168 | 145 | void firetrk_state::machine_reset() |
| 169 | 146 | { |
| 170 | 147 | set_service_mode(0); |
| 171 | | |
| 172 | | machine().scheduler().synchronize(timer_expired_delegate(FUNC(firetrk_state::periodic_callback),this)); |
| 173 | 148 | } |
| 174 | 149 | |
| 175 | 150 | |
| r26904 | r26905 | |
| 879 | 854 | /* basic machine hardware */ |
| 880 | 855 | MCFG_CPU_ADD("maincpu", M6800, MASTER_CLOCK/12) /* 750Khz during service mode */ |
| 881 | 856 | MCFG_CPU_PROGRAM_MAP(firetrk_map) |
| 882 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", firetrk_state, firetrk_interrupt) |
| 857 | MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", firetrk_state, firetrk_scanline, "screen", 0, 1) |
| 883 | 858 | MCFG_WATCHDOG_VBLANK_INIT(5) |
| 884 | 859 | |
| 885 | | |
| 886 | 860 | /* video hardware */ |
| 887 | 861 | MCFG_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) |
| 888 | 862 | |
| r26904 | r26905 | |
| 928 | 902 | static MACHINE_CONFIG_DERIVED( montecar, firetrk ) |
| 929 | 903 | |
| 930 | 904 | /* basic machine hardware */ |
| 931 | | MCFG_CPU_MODIFY("maincpu") /* 750Khz during service mode */ |
| 905 | MCFG_CPU_MODIFY("maincpu") |
| 932 | 906 | MCFG_CPU_PROGRAM_MAP(montecar_map) |
| 933 | 907 | |
| 934 | 908 | /* video hardware */ |