1 // license:BSD-3-Clause 2 // copyright-holders:Bryan McPhail 3 /************************************************************************* 4 5 Haunted Castle 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_HCASTLE_H 9 #define MAME_INCLUDES_HCASTLE_H 10 11 #pragma once 12 13 #include "video/bufsprite.h" 14 #include "sound/k007232.h" 15 #include "video/k007121.h" 16 #include "emupal.h" 17 #include "tilemap.h" 18 19 class hcastle_state : public driver_device 20 { 21 public: hcastle_state(const machine_config & mconfig,device_type type,const char * tag)22 hcastle_state(const machine_config &mconfig, device_type type, const char *tag) : 23 driver_device(mconfig, type, tag), 24 m_spriteram(*this, "spriteram"), 25 m_spriteram2(*this, "spriteram2") , 26 m_pf1_videoram(*this, "pf1_videoram"), 27 m_pf2_videoram(*this, "pf2_videoram"), 28 m_audiocpu(*this, "audiocpu"), 29 m_k007121_1(*this, "k007121_1"), 30 m_k007121_2(*this, "k007121_2"), 31 m_k007232(*this, "k007232"), 32 m_maincpu(*this, "maincpu"), 33 m_gfxdecode(*this, "gfxdecode"), 34 m_palette(*this, "palette") 35 { } 36 37 void hcastle(machine_config &config); 38 39 private: 40 required_device<buffered_spriteram8_device> m_spriteram; 41 required_device<buffered_spriteram8_device> m_spriteram2; 42 /* memory pointers */ 43 required_shared_ptr<uint8_t> m_pf1_videoram; 44 required_shared_ptr<uint8_t> m_pf2_videoram; 45 46 /* video-related */ 47 tilemap_t *m_fg_tilemap; 48 tilemap_t *m_bg_tilemap; 49 int m_pf2_bankbase; 50 int m_pf1_bankbase; 51 int m_old_pf1; 52 int m_old_pf2; 53 int m_gfx_bank; 54 55 /* devices */ 56 required_device<cpu_device> m_audiocpu; 57 required_device<k007121_device> m_k007121_1; 58 required_device<k007121_device> m_k007121_2; 59 required_device<k007232_device> m_k007232; 60 61 void hcastle_bankswitch_w(uint8_t data); 62 void hcastle_soundirq_w(uint8_t data); 63 void hcastle_coin_w(uint8_t data); 64 void hcastle_pf1_video_w(offs_t offset, uint8_t data); 65 void hcastle_pf2_video_w(offs_t offset, uint8_t data); 66 void hcastle_gfxbank_w(uint8_t data); 67 uint8_t hcastle_gfxbank_r(); 68 void hcastle_pf1_control_w(offs_t offset, uint8_t data); 69 void hcastle_pf2_control_w(offs_t offset, uint8_t data); 70 void sound_bank_w(uint8_t data); 71 TILEMAP_MAPPER_MEMBER(tilemap_scan); 72 TILE_GET_INFO_MEMBER(get_fg_tile_info); 73 TILE_GET_INFO_MEMBER(get_bg_tile_info); 74 virtual void machine_start() override; 75 virtual void machine_reset() override; 76 virtual void video_start() override; 77 void hcastle_palette(palette_device &palette) const; 78 uint32_t screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 79 void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank, int bank ); 80 void volume_callback(uint8_t data); 81 required_device<cpu_device> m_maincpu; 82 required_device<gfxdecode_device> m_gfxdecode; 83 required_device<palette_device> m_palette; 84 void hcastle_map(address_map &map); 85 void sound_map(address_map &map); 86 }; 87 88 #endif // MAME_INCLUDES_HCASTLE_H 89