1 // license:BSD-3-Clause 2 // copyright-holders:Nicola Salmoria 3 /************************************************************************* 4 5 Commando 6 7 *************************************************************************/ 8 #ifndef MAME_INCLUDES_COMMANDO_H 9 #define MAME_INCLUDES_COMMANDO_H 10 11 #pragma once 12 13 #include "video/bufsprite.h" 14 #include "emupal.h" 15 #include "tilemap.h" 16 17 class commando_state : public driver_device 18 { 19 public: commando_state(const machine_config & mconfig,device_type type,const char * tag)20 commando_state(const machine_config &mconfig, device_type type, const char *tag) : 21 driver_device(mconfig, type, tag), 22 m_spriteram(*this, "spriteram"), 23 m_videoram2(*this, "videoram2"), 24 m_colorram2(*this, "colorram2"), 25 m_videoram(*this, "videoram"), 26 m_colorram(*this, "colorram"), 27 m_audiocpu(*this, "audiocpu"), 28 m_maincpu(*this, "maincpu"), 29 m_gfxdecode(*this, "gfxdecode"), 30 m_palette(*this, "palette"), 31 m_decrypted_opcodes(*this, "decrypted_opcodes") 32 { } 33 34 void init_spaceinv(); 35 void init_commando(); 36 37 void commando(machine_config &config); 38 39 protected: 40 void commando_videoram_w(offs_t offset, uint8_t data); 41 void commando_colorram_w(offs_t offset, uint8_t data); 42 void commando_videoram2_w(offs_t offset, uint8_t data); 43 void commando_colorram2_w(offs_t offset, uint8_t data); 44 void commando_scrollx_w(offs_t offset, uint8_t data); 45 void commando_scrolly_w(offs_t offset, uint8_t data); 46 void commando_c804_w(uint8_t data); 47 TILE_GET_INFO_MEMBER(get_bg_tile_info); 48 TILE_GET_INFO_MEMBER(get_fg_tile_info); 49 virtual void machine_start() override; 50 virtual void machine_reset() override; 51 virtual void video_start() override; 52 uint32_t screen_update_commando(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); 53 DECLARE_WRITE_LINE_MEMBER(vblank_irq); 54 void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); 55 56 void commando_map(address_map &map); 57 void decrypted_opcodes_map(address_map &map); 58 void sound_map(address_map &map); 59 60 private: 61 /* memory pointers */ 62 required_device<buffered_spriteram8_device> m_spriteram; 63 required_shared_ptr<uint8_t> m_videoram2; 64 required_shared_ptr<uint8_t> m_colorram2; 65 required_shared_ptr<uint8_t> m_videoram; 66 required_shared_ptr<uint8_t> m_colorram; 67 68 /* video-related */ 69 tilemap_t *m_bg_tilemap; 70 tilemap_t *m_fg_tilemap; 71 uint8_t m_scroll_x[2]; 72 uint8_t m_scroll_y[2]; 73 74 /* devices */ 75 required_device<cpu_device> m_audiocpu; 76 required_device<cpu_device> m_maincpu; 77 required_device<gfxdecode_device> m_gfxdecode; 78 required_device<palette_device> m_palette; 79 optional_shared_ptr<uint8_t> m_decrypted_opcodes; 80 }; 81 82 #endif // MAME_INCLUDES_COMMANDO_H 83