1 // license:BSD-3-Clause 2 // copyright-holders:David Haywood, Luca Elia 3 /************************************************************************* 4 5 kan_pand.h 6 7 Implementation of Kaneko Pandora sprite chip 8 9 **************************************************************************/ 10 11 #ifndef MAME_VIDEO_KAN_PAND_H 12 #define MAME_VIDEO_KAN_PAND_H 13 14 #pragma once 15 16 /*************************************************************************** 17 TYPE DEFINITIONS 18 ***************************************************************************/ 19 20 class kaneko_pandora_device : public device_t, 21 public device_video_interface 22 { 23 public: 24 kaneko_pandora_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 25 26 // configuration set_gfxdecode_tag(T && tag)27 template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); } set_gfx_region(int gfxregion)28 void set_gfx_region(int gfxregion) { m_gfx_region = gfxregion; } set_offsets(int x_offset,int y_offset)29 void set_offsets(int x_offset, int y_offset) 30 { 31 m_xoffset = x_offset; 32 m_yoffset = y_offset; 33 } 34 35 void spriteram_w(offs_t offset, uint8_t data); 36 uint8_t spriteram_r(offs_t offset); 37 void spriteram_LSB_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); 38 uint16_t spriteram_LSB_r(offs_t offset); 39 void update( bitmap_ind16 &bitmap, const rectangle &cliprect ); 40 void set_clear_bitmap( int clear ); 41 void eof(); 42 void set_bg_pen( int pen ); flip_screen_set(bool flip)43 void flip_screen_set(bool flip) { m_flip_screen = flip; } 44 45 protected: 46 // device-level overrides 47 virtual void device_start() override; 48 virtual void device_reset() override; 49 50 void draw( bitmap_ind16 &bitmap, const rectangle &cliprect ); 51 52 private: 53 // internal state 54 std::unique_ptr<uint8_t[]> m_spriteram; 55 std::unique_ptr<bitmap_ind16> m_sprites_bitmap; /* bitmap to render sprites to, Pandora seems to be frame'buffered' */ 56 int m_clear_bitmap; 57 int m_bg_pen; // might work some other way.. 58 uint8_t m_gfx_region; 59 int m_xoffset; 60 int m_yoffset; 61 bool m_flip_screen; 62 required_device<gfxdecode_device> m_gfxdecode; 63 }; 64 65 DECLARE_DEVICE_TYPE(KANEKO_PANDORA, kaneko_pandora_device) 66 67 #endif // MAME_VIDEO_KAN_PAND_H 68