1 // license:LGPL-2.1+ 2 // copyright-holders:David Haywood, Angelo Salese, Olivier Galibert, Mariusz Wojcieszek, R. Belmont 3 #ifndef MAME_INCLUDES_STV_H 4 #define MAME_INCLUDES_STV_H 5 6 #pragma once 7 8 #include "includes/saturn.h" 9 #include "audio/rax.h" 10 #include "machine/eepromser.h" 11 #include "machine/ticket.h" 12 #include "machine/segabill.h" 13 14 class stv_state : public saturn_state 15 { 16 public: stv_state(const machine_config & mconfig,device_type type,const char * tag)17 stv_state(const machine_config &mconfig, device_type type, const char *tag) 18 : saturn_state(mconfig, type, tag), 19 m_cart1(*this, "stv_slot1"), 20 m_cart2(*this, "stv_slot2"), 21 m_cart3(*this, "stv_slot3"), 22 m_cart4(*this, "stv_slot4"), 23 m_rax(*this, "rax"), 24 m_protbank(*this, "protbank"), 25 m_eeprom(*this, "eeprom"), 26 m_cryptdevice(*this, "315_5881"), 27 m_5838crypt(*this, "315_5838"), 28 m_hopper(*this, "hopper"), 29 m_billboard(*this, "billboard") 30 { 31 } 32 33 void stv_slot(machine_config &config); 34 void stv_cartslot(machine_config &config); 35 void stv(machine_config &config); 36 void critcrsh(machine_config &config); 37 void magzun(machine_config &config); 38 void stvmp(machine_config &config); 39 void hopper(machine_config &config); 40 void batmanfr(machine_config &config); 41 void shienryu(machine_config &config); 42 void stv_5838(machine_config &config); 43 void stv_5881(machine_config &config); 44 void stvcd(machine_config &config); 45 46 void init_astrass(); 47 void init_batmanfr(); 48 void init_finlarch(); 49 void init_decathlt(); 50 void init_decathlt_nokey(); 51 void init_sanjeon(); 52 void init_puyosun(); 53 void init_winterht(); 54 void init_gaxeduel(); 55 void init_rsgun(); 56 void init_groovef(); 57 void init_sandor(); 58 void init_cottonbm(); 59 void init_smleague(); 60 void init_nameclv3(); 61 void init_danchiq(); 62 void init_hanagumi(); 63 void init_cotton2(); 64 void init_seabass(); 65 void init_stv(); 66 void init_thunt(); 67 void init_sasissu(); 68 void init_dnmtdeka(); 69 void init_ffreveng(); 70 void init_fhboxers(); 71 void init_pblbeach(); 72 void init_sss(); 73 void init_diehard(); 74 void init_danchih(); 75 void init_shienryu(); 76 void init_elandore(); 77 void init_prikura(); 78 void init_maruchan(); 79 void init_colmns97(); 80 void init_grdforce(); 81 void init_suikoenb(); 82 void init_magzun(); 83 void init_shanhigw(); 84 void init_sokyugrt(); 85 void init_vfremix(); 86 void init_twcup98(); 87 void init_znpwfv(); 88 void init_othellos(); 89 void init_mausuke(); 90 91 private: 92 uint8_t stv_ioga_r(offs_t offset); 93 void stv_ioga_w(offs_t offset, uint8_t data); 94 uint8_t critcrsh_ioga_r(offs_t offset); 95 uint8_t magzun_ioga_r(offs_t offset); 96 void magzun_ioga_w(offs_t offset, uint8_t data); 97 uint8_t stvmp_ioga_r(offs_t offset); 98 void stvmp_ioga_w(offs_t offset, uint8_t data); 99 uint32_t magzun_hef_hack_r(); 100 uint32_t magzun_rx_hack_r(); 101 void hop_ioga_w(offs_t offset, uint8_t data); 102 103 image_init_result load_cart(device_image_interface &image, generic_slot_device *slot); DECLARE_DEVICE_IMAGE_LOAD_MEMBER(stv_cart1)104 DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart1 ) { return load_cart(image, m_cart1); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(stv_cart2)105 DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart2 ) { return load_cart(image, m_cart2); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(stv_cart3)106 DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart3 ) { return load_cart(image, m_cart3); } DECLARE_DEVICE_IMAGE_LOAD_MEMBER(stv_cart4)107 DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart4 ) { return load_cart(image, m_cart4); } 108 optional_device<generic_slot_device> m_cart1; 109 optional_device<generic_slot_device> m_cart2; 110 optional_device<generic_slot_device> m_cart3; 111 optional_device<generic_slot_device> m_cart4; 112 113 void install_stvbios_speedups( void ); 114 115 DECLARE_MACHINE_START(stv); 116 DECLARE_MACHINE_RESET(stv); 117 118 DECLARE_MACHINE_RESET(batmanfr); 119 void batmanfr_sound_comms_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 120 optional_device<acclaim_rax_device> m_rax; 121 122 uint8_t m_port_sel,m_mux_data; 123 uint8_t m_system_output; 124 uint8_t m_ioga_mode; 125 uint8_t m_ioga_portg; 126 uint16_t m_serial_tx; 127 128 // protection specific variables and functions (see machine/stvprot.cpp) 129 uint32_t m_abus_protenable; 130 uint32_t m_abus_protkey; 131 132 uint32_t decathlt_prot_r(offs_t offset, uint32_t mem_mask = ~0); 133 void sega5838_map(address_map &map); 134 optional_memory_bank m_protbank; 135 bool m_newprotection_element; // debug helper only, doesn't need saving 136 int m_protbankval; // debug helper only, doesn't need saving 137 void decathlt_prot_srcaddr_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 138 139 uint32_t m_a_bus[4]; 140 141 uint32_t common_prot_r(offs_t offset); 142 void common_prot_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); 143 144 void install_common_protection(); 145 void stv_register_protection_savestates(); 146 147 required_device<eeprom_serial_93cxx_device> m_eeprom; 148 optional_device<sega_315_5881_crypt_device> m_cryptdevice; 149 optional_device<sega_315_5838_comp_device> m_5838crypt; 150 optional_device<ticket_dispenser_device> m_hopper; 151 required_device<sega_billboard_device> m_billboard; 152 uint16_t crypt_read_callback(uint32_t addr); 153 154 uint8_t pdr1_input_r(); 155 uint8_t pdr2_input_r(); 156 void pdr1_output_w(uint8_t data); 157 void pdr2_output_w(uint8_t data); 158 void stv_select_game(int gameno); 159 uint8_t m_prev_gamebank_select; 160 161 void sound_mem(address_map &map); 162 void scsp_mem(address_map &map); 163 void stv_mem(address_map &map); 164 void critcrsh_mem(address_map &map); 165 void magzun_mem(address_map &map); 166 void stvmp_mem(address_map &map); 167 void hopper_mem(address_map &map); 168 void stvcd_mem(address_map &map); 169 }; 170 171 class stvpc_state : public stv_state 172 { 173 public: 174 using stv_state::stv_state; unemulated_features()175 static constexpr feature_type unemulated_features() { return feature::CAMERA | feature::PRINTER; } 176 }; 177 178 //#define MASTER_CLOCK_352 57272720 179 //#define MASTER_CLOCK_320 53693174 180 #define CEF_1 m_vdp1_regs[0x010/2]|=0x0002 181 #define CEF_0 m_vdp1_regs[0x010/2]&=~0x0002 182 #define BEF_1 m_vdp1_regs[0x010/2]|=0x0001 183 #define BEF_0 m_vdp1_regs[0x010/2]&=~0x0001 184 #define STV_VDP1_TVMR ((m_vdp1_regs[0x000/2])&0xffff) 185 #define STV_VDP1_VBE ((STV_VDP1_TVMR & 0x0008) >> 3) 186 #define STV_VDP1_TVM ((STV_VDP1_TVMR & 0x0007) >> 0) 187 188 extern gfx_decode_entry const gfx_stv[]; 189 190 #endif // MAME_INCLUDES_STV_H 191