1 // license:BSD-3-Clause 2 // copyright-holders:Ernesto Corvi 3 /************************************************************************* 4 5 Karate Champ 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_KCHAMP_H 9 #define MAME_INCLUDES_KCHAMP_H 10 11 #pragma once 12 13 #include "machine/74157.h" 14 #include "machine/gen_latch.h" 15 #include "sound/ay8910.h" 16 #include "sound/msm5205.h" 17 #include "sound/dac.h" 18 #include "emupal.h" 19 #include "tilemap.h" 20 21 class kchamp_state : public driver_device 22 { 23 public: kchamp_state(const machine_config & mconfig,device_type type,const char * tag)24 kchamp_state(const machine_config &mconfig, device_type type, const char *tag) : 25 driver_device(mconfig, type, tag), 26 m_videoram(*this, "videoram"), 27 m_colorram(*this, "colorram"), 28 m_spriteram(*this, "spriteram"), 29 m_decrypted_opcodes(*this, "decrypted_opcodes"), 30 m_maincpu(*this, "maincpu"), 31 m_audiocpu(*this, "audiocpu"), 32 m_ay(*this, "ay%u", 1), 33 m_adpcm_select(*this, "adpcm_select"), 34 m_msm(*this, "msm"), 35 m_dac(*this, "dac"), 36 m_gfxdecode(*this, "gfxdecode"), 37 m_palette(*this, "palette"), 38 m_soundlatch(*this, "soundlatch") 39 { } 40 41 void kchamp(machine_config &config); 42 void kchampvs(machine_config &config); 43 void kchamp_arfyc(machine_config &config); 44 45 void init_kchampvs(); 46 void init_kchampvs2(); 47 48 private: 49 /* memory pointers */ 50 required_shared_ptr<uint8_t> m_videoram; 51 required_shared_ptr<uint8_t> m_colorram; 52 required_shared_ptr<uint8_t> m_spriteram; 53 optional_shared_ptr<uint8_t> m_decrypted_opcodes; 54 55 /* video-related */ 56 tilemap_t *m_bg_tilemap; 57 58 /* misc */ 59 bool m_nmi_enable; 60 bool m_sound_nmi_enable; 61 bool m_msm_play_lo_nibble; 62 63 /* devices */ 64 required_device<cpu_device> m_maincpu; 65 required_device<cpu_device> m_audiocpu; 66 required_device_array<ay8910_device, 2> m_ay; 67 optional_device<ls157_device> m_adpcm_select; 68 optional_device<msm5205_device> m_msm; 69 optional_device<dac08_device> m_dac; 70 required_device<gfxdecode_device> m_gfxdecode; 71 required_device<palette_device> m_palette; 72 required_device<generic_latch_8_device> m_soundlatch; 73 74 DECLARE_WRITE_LINE_MEMBER(nmi_enable_w); 75 DECLARE_WRITE_LINE_MEMBER(sound_reset_w); 76 uint8_t sound_reset_r(); 77 void kc_sound_control_w(offs_t offset, uint8_t data); 78 void kchamp_videoram_w(offs_t offset, uint8_t data); 79 void kchamp_colorram_w(offs_t offset, uint8_t data); 80 DECLARE_WRITE_LINE_MEMBER(flipscreen_w); 81 void sound_control_w(u8 data); 82 TILE_GET_INFO_MEMBER(get_bg_tile_info); 83 virtual void machine_reset() override; 84 virtual void video_start() override; 85 void kchamp_palette(palette_device &palette) const; 86 DECLARE_MACHINE_START(kchampvs); 87 DECLARE_MACHINE_START(kchamp); 88 uint32_t screen_update_kchampvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 89 uint32_t screen_update_kchamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 90 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 91 INTERRUPT_GEN_MEMBER(sound_int); 92 void kchamp_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); 93 void kchampvs_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); 94 void decrypt_code(); 95 DECLARE_WRITE_LINE_MEMBER(msmint); 96 void decrypted_opcodes_map(address_map &map); 97 void kchamp_io_map(address_map &map); 98 void kchamp_map(address_map &map); 99 void kchamp_sound_io_map(address_map &map); 100 void kchamp_sound_map(address_map &map); 101 void kchampvs_io_map(address_map &map); 102 void kchampvs_map(address_map &map); 103 void kchampvs_sound_io_map(address_map &map); 104 void kchampvs_sound_map(address_map &map); 105 }; 106 107 #endif // MAME_INCLUDES_KCHAMP_H 108