1 // license:BSD-3-Clause 2 // copyright-holders:Phil Stroffolino 3 4 #include "video/tigeroad_spr.h" 5 6 #include "cpu/m68000/m68000.h" 7 #include "cpu/m6805/m68705.h" 8 #include "cpu/z80/z80.h" 9 #include "cpu/mcs51/mcs51.h" 10 11 #include "sound/2203intf.h" 12 #include "sound/msm5205.h" 13 14 #include "video/bufsprite.h" 15 16 #include "emupal.h" 17 #include "tilemap.h" 18 19 20 class tigeroad_state : public driver_device 21 { 22 public: tigeroad_state(const machine_config & mconfig,device_type type,const char * tag)23 tigeroad_state(const machine_config &mconfig, device_type type, const char *tag) 24 : driver_device(mconfig, type, tag) 25 , m_maincpu(*this, "maincpu") 26 , m_palette(*this, "palette") 27 , m_has_coinlock(true) 28 , m_spriteram(*this, "spriteram") 29 , m_videoram(*this, "videoram") 30 , m_audiocpu(*this, "audiocpu") 31 , m_msm(*this, "msm") 32 , m_gfxdecode(*this, "gfxdecode") 33 , m_spritegen(*this, "spritegen") 34 { } 35 36 void toramich(machine_config &config); 37 void tigeroad(machine_config &config); 38 void f1dream_comad(machine_config &config); 39 40 protected: 41 required_device<cpu_device> m_maincpu; 42 required_device<palette_device> m_palette; 43 44 void soundcmd_w(offs_t offset, u16 data, u16 mem_mask = ~0); 45 void videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0); 46 void videoctrl_w(u8 data); 47 void scroll_w(offs_t offset, u16 data, u16 mem_mask = ~0); 48 49 void main_map(address_map &map); 50 // misc 51 bool m_has_coinlock; 52 53 private: 54 required_device<buffered_spriteram16_device> m_spriteram; 55 required_shared_ptr<u16> m_videoram; 56 required_device<cpu_device> m_audiocpu; 57 optional_device<msm5205_device> m_msm; 58 required_device<gfxdecode_device> m_gfxdecode; 59 required_device<tigeroad_spr_device> m_spritegen; 60 61 u8 m_bgcharbank; 62 tilemap_t *m_bg_tilemap; 63 tilemap_t *m_fg_tilemap; 64 65 void comad_sound_io_map(address_map &map); 66 void comad_sound_map(address_map &map); 67 void sample_map(address_map &map); 68 void sample_port_map(address_map &map); 69 void sound_map(address_map &map); 70 void sound_port_map(address_map &map); 71 72 void msm5205_w(u8 data); 73 TILE_GET_INFO_MEMBER(get_bg_tile_info); 74 TILE_GET_INFO_MEMBER(get_fg_tile_info); 75 TILEMAP_MAPPER_MEMBER(tigeroad_tilemap_scan); 76 virtual void video_start() override; 77 u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 78 }; 79 80 81 class pushman_state : public tigeroad_state 82 { 83 public: pushman_state(const machine_config & mconfig,device_type type,const char * tag)84 pushman_state(const machine_config &mconfig, device_type type, const char *tag) 85 : tigeroad_state(mconfig, type, tag) 86 , m_mcu(*this, "mcu") 87 , m_host_semaphore(false) 88 , m_mcu_semaphore(false) 89 , m_host_latch(0xffff) 90 , m_mcu_latch(0xffff) 91 , m_mcu_output(0xffff) 92 , m_mcu_latch_ctl(0xff) 93 { 94 m_has_coinlock = false; 95 } 96 97 void pushman(machine_config &config); 98 void bballs(machine_config &config); 99 100 protected: 101 virtual void machine_start() override; 102 103 private: 104 u16 mcu_comm_r(offs_t offset, u16 mem_mask = ~0); 105 void pushman_mcu_comm_w(offs_t offset, u16 data); 106 void bballs_mcu_comm_w(u16 data); 107 108 void mcu_pa_w(u8 data); 109 void mcu_pb_w(u8 data); 110 void mcu_pc_w(u8 data); 111 112 void bballs_map(address_map &map); 113 void pushman_map(address_map &map); 114 115 required_device<m68705u_device> m_mcu; 116 117 bool m_host_semaphore, m_mcu_semaphore; 118 u16 m_host_latch, m_mcu_latch; 119 u16 m_mcu_output; 120 u8 m_mcu_latch_ctl; 121 }; 122 123 class f1dream_state : public tigeroad_state 124 { 125 public: f1dream_state(const machine_config & mconfig,device_type type,const char * tag)126 f1dream_state(const machine_config &mconfig, device_type type, const char *tag) 127 : tigeroad_state(mconfig, type, tag) 128 , m_mcu(*this, "mcu") 129 , m_ram16(*this, "ram16") 130 , m_old_p3(0xff) 131 { 132 } 133 134 void f1dream(machine_config &config); 135 136 protected: 137 virtual void machine_start() override; 138 139 private: 140 void f1dream_map(address_map &map); 141 void f1dream_mcu_io(address_map &map); 142 143 void out3_w(u8 data); 144 145 u8 mcu_shared_r(offs_t offset); 146 void mcu_shared_w(offs_t offset, u8 data); 147 148 void to_mcu_w(u16 data); 149 150 required_device<i8751_device> m_mcu; 151 required_shared_ptr<u16> m_ram16; 152 u8 m_old_p3; 153 }; 154