1 // license:BSD-3-Clause 2 // copyright-holders:Bryan McPhail 3 /************************************************************************* 4 5 Last Duel 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_LASTDUEL_H 9 #define MAME_INCLUDES_LASTDUEL_H 10 11 #pragma once 12 13 #include "machine/gen_latch.h" 14 #include "machine/timer.h" 15 #include "video/bufsprite.h" 16 #include "emupal.h" 17 #include "tilemap.h" 18 19 class lastduel_state : public driver_device 20 { 21 public: lastduel_state(const machine_config & mconfig,device_type type,const char * tag)22 lastduel_state(const machine_config &mconfig, device_type type, const char *tag) : 23 driver_device(mconfig, type, tag), 24 m_maincpu(*this, "maincpu"), 25 m_audiocpu(*this, "audiocpu"), 26 m_gfxdecode(*this, "gfxdecode"), 27 m_palette(*this, "palette"), 28 m_soundlatch(*this, "soundlatch"), 29 m_spriteram(*this, "spriteram"), 30 m_txram(*this, "txram"), 31 m_vram(*this, "vram_%u", 0U), 32 m_audiobank(*this, "audiobank") 33 { } 34 35 void lastduel(machine_config &config); 36 void madgear(machine_config &config); 37 38 private: 39 /* devices */ 40 required_device<cpu_device> m_maincpu; 41 required_device<cpu_device> m_audiocpu; 42 required_device<gfxdecode_device> m_gfxdecode; 43 required_device<palette_device> m_palette; 44 required_device<generic_latch_8_device> m_soundlatch; 45 46 /* memory pointers */ 47 required_device<buffered_spriteram16_device> m_spriteram; 48 required_shared_ptr<uint16_t> m_txram; 49 required_shared_ptr_array<uint16_t, 2> m_vram; 50 51 optional_memory_bank m_audiobank; 52 53 /* video-related */ 54 tilemap_t *m_tilemap[2]; 55 tilemap_t *m_tx_tilemap; 56 uint16_t m_vctrl[8]; 57 int m_sprite_flipy_mask; 58 int m_sprite_pri_mask; 59 int m_tilemap_priority; 60 61 void mg_bankswitch_w(uint8_t data); 62 void flip_w(uint8_t data); 63 void vctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 64 template<int Layer> void lastduel_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 65 void txram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 66 template<int Layer> void madgear_vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 67 static rgb_t lastduel_RRRRGGGGBBBBIIII(uint32_t raw); 68 TILE_GET_INFO_MEMBER(ld_get_bg_tile_info); 69 TILE_GET_INFO_MEMBER(ld_get_fg_tile_info); 70 TILE_GET_INFO_MEMBER(get_bg_tile_info); 71 TILE_GET_INFO_MEMBER(get_fg_tile_info); 72 TILE_GET_INFO_MEMBER(get_fix_info); 73 virtual void machine_reset() override; 74 DECLARE_MACHINE_START(lastduel); 75 DECLARE_VIDEO_START(lastduel); 76 DECLARE_MACHINE_START(madgear); 77 DECLARE_VIDEO_START(madgear); 78 uint32_t screen_update_lastduel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 79 uint32_t screen_update_madgear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 80 TIMER_DEVICE_CALLBACK_MEMBER(lastduel_timer_cb); 81 TIMER_DEVICE_CALLBACK_MEMBER(madgear_timer_cb); 82 void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri); 83 void lastduel_map(address_map &map); 84 void madgear_map(address_map &map); 85 void madgear_sound_map(address_map &map); 86 void sound_map(address_map &map); 87 }; 88 89 #endif // MAME_INCLUDES_LASTDUEL_H 90