1 // license:LGPL-2.1+ 2 // copyright-holders:Ville Linde, Angelo Salese, hap 3 /************************************************************************* 4 5 Taito JC System 6 7 *************************************************************************/ 8 9 #include "video/tc0780fpa.h" 10 #include "machine/taitoio.h" 11 #include "emupal.h" 12 #include "screen.h" 13 #include "tilemap.h" 14 15 class taitojc_state : public driver_device 16 { 17 public: taitojc_state(const machine_config & mconfig,device_type type,const char * tag)18 taitojc_state(const machine_config &mconfig, device_type type, const char *tag) 19 : driver_device(mconfig, type, tag), 20 m_maincpu(*this,"maincpu"), 21 m_dsp(*this,"dsp"), 22 m_tc0640fio(*this, "tc0640fio"), 23 m_dspgfx(*this, "dspgfx"), 24 m_vram(*this, "vram"), 25 m_objlist(*this, "objlist"), 26 m_main_ram(*this, "main_ram"), 27 m_dsp_shared_ram(*this, "dsp_shared"), 28 m_palette_ram(*this, "palette_ram"), 29 m_gfxdecode(*this, "gfxdecode"), 30 m_screen(*this, "screen"), 31 m_palette(*this, "palette"), 32 m_analog_ports(*this, "AN.%u", 0), 33 m_tc0780fpa(*this, "tc0780fpa"), 34 m_lamps(*this, "lamp%u", 0U), 35 m_counters(*this, "counter%u", 0U) 36 { 37 m_speed_meter = 0; 38 m_brake_meter = 0; 39 } 40 41 void taitojc(machine_config &config); 42 void dendego(machine_config &config); 43 44 void init_dendego2(); 45 void init_dangcurv(); 46 void init_taitojc(); 47 48 private: 49 // device/memory pointers 50 required_device<cpu_device> m_maincpu; 51 required_device<cpu_device> m_dsp; 52 required_device<tc0640fio_device> m_tc0640fio; 53 required_region_ptr<uint16_t> m_dspgfx; 54 55 required_shared_ptr<uint32_t> m_vram; 56 required_shared_ptr<uint32_t> m_objlist; 57 required_shared_ptr<uint32_t> m_main_ram; 58 required_shared_ptr<uint16_t> m_dsp_shared_ram; 59 required_shared_ptr<uint32_t> m_palette_ram; 60 61 required_device<gfxdecode_device> m_gfxdecode; 62 required_device<screen_device> m_screen; 63 required_device<palette_device> m_palette; 64 optional_ioport_array<8> m_analog_ports; 65 66 required_device<tc0780fpa_device> m_tc0780fpa; 67 68 output_finder<8> m_lamps; 69 output_finder<5> m_counters; 70 71 uint32_t m_dsp_rom_pos; 72 73 int m_first_dsp_reset; 74 int16_t m_viewport_data[3]; 75 int16_t m_projection_data[3]; 76 int16_t m_intersection_data[3]; 77 78 int m_gfx_index; 79 80 std::unique_ptr<uint32_t[]> m_char_ram; 81 std::unique_ptr<uint32_t[]> m_tile_ram; 82 tilemap_t *m_tilemap; 83 84 uint8_t m_mcu_comm_main; 85 uint8_t m_mcu_comm_hc11; 86 uint8_t m_mcu_data_main; 87 uint8_t m_mcu_data_hc11; 88 89 uint8_t m_has_dsp_hack; 90 91 int m_speed_meter; 92 int m_brake_meter; 93 94 void coin_control_w(uint8_t data); 95 96 uint8_t mcu_comm_r(offs_t offset); 97 void mcu_comm_w(offs_t offset, uint8_t data); 98 uint8_t jc_pcbid_r(offs_t offset); 99 uint8_t jc_lan_r(); 100 void jc_lan_w(uint8_t data); 101 void jc_irq_unk_w(uint8_t data); 102 void dendego_speedmeter_w(uint8_t data); 103 void dendego_brakemeter_w(uint8_t data); 104 105 uint8_t hc11_comm_r(); 106 void hc11_comm_w(uint8_t data); 107 void hc11_output_w(uint8_t data); 108 uint8_t hc11_data_r(); 109 void hc11_data_w(uint8_t data); 110 template <int Ch> uint8_t hc11_analog_r(); 111 112 uint16_t dsp_shared_r(offs_t offset); 113 void dsp_shared_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 114 uint16_t dsp_to_main_7fe_r(offs_t offset, uint16_t mem_mask = ~0); 115 void dsp_to_main_7fe_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 116 void main_to_dsp_7ff_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 117 118 uint16_t dsp_rom_r(); 119 void dsp_rom_w(offs_t offset, uint16_t data); 120 121 void dsp_math_viewport_w(offs_t offset, uint16_t data); 122 void dsp_math_projection_w(offs_t offset, uint16_t data); 123 uint16_t dsp_math_projection_y_r(); 124 uint16_t dsp_math_projection_x_r(); 125 void dsp_math_intersection_w(offs_t offset, uint16_t data); 126 uint16_t dsp_math_intersection_r(); 127 uint16_t dsp_math_unk_r(); 128 129 uint16_t taitojc_dsp_idle_skip_r(); 130 uint16_t dendego2_dsp_idle_skip_r(); 131 132 uint32_t taitojc_palette_r(offs_t offset); 133 void taitojc_palette_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 134 uint32_t taitojc_tile_r(offs_t offset); 135 uint32_t taitojc_char_r(offs_t offset); 136 void taitojc_tile_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 137 void taitojc_char_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 138 139 TILE_GET_INFO_MEMBER(taitojc_tile_info); 140 virtual void machine_reset() override; 141 virtual void machine_start() override; 142 virtual void video_start() override; 143 uint32_t screen_update_taitojc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 144 uint32_t screen_update_dendego(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 145 INTERRUPT_GEN_MEMBER(taitojc_vblank); 146 void draw_object(bitmap_ind16 &bitmap, const rectangle &cliprect, uint32_t w1, uint32_t w2, uint8_t bank_type); 147 void draw_object_bank(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t bank_type, uint8_t pri); 148 149 void dendego_map(address_map &map); 150 void hc11_pgm_map(address_map &map); 151 void taitojc_map(address_map &map); 152 void tms_data_map(address_map &map); 153 void tms_program_map(address_map &map); 154 void cpu_space_map(address_map &map); 155 }; 156