// license:BSD-3-Clause // copyright-holders:Bryan McPhail, David Haywood #ifndef MAME_VIDEO_DECOBAC06_H #define MAME_VIDEO_DECOBAC06_H #pragma once #include #define MCFG_BAC06_BOOTLEG_DISABLE_8x8 \ downcast(*device).disable_8x8(); #define MCFG_BAC06_BOOTLEG_DISABLE_16x16 \ downcast(*device).disable_16x16(); #define MCFG_BAC06_BOOTLEG_DISABLE_RC_SCROLL \ downcast(*device).disable_rc_scroll(); class deco_bac06_device : public device_t { public: deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration void set_gfxdecode_tag(const char *tag) { m_gfxdecode.set_tag(tag); } void set_gfx_region_wide(int region8x8, int region16x16, int wide) { m_gfxregion8x8 = region8x8; m_gfxregion16x16 = region16x16; m_wide = wide; } void disable_8x8() { m_supports_8x8 = false; } void disable_16x16() { m_supports_16x16 = false; } void disable_rc_scroll() { m_supports_rc_scroll = false; } std::unique_ptr m_pf_data; std::unique_ptr m_pf_rowscroll; std::unique_ptr m_pf_colscroll; tilemap_t* m_pf8x8_tilemap[3]; tilemap_t* m_pf16x16_tilemap[3]; int m_tile_region_8; int m_tile_region_16; // some bootlegs (eg midresb / midresbj) don't appear to actually support the alt modes, they set them and end up with broken gfx on later levels. bool m_supports_8x8; bool m_supports_16x16; bool m_supports_rc_scroll; void create_tilemaps(int region8x8,int region16x16); uint16_t m_pf_control_0[8]; uint16_t m_pf_control_1[8]; void deco_bac06_pf_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags,uint16_t penmask, uint16_t pencondition,uint16_t colprimask, uint16_t colpricondition); void deco_bac06_pf_draw_bootleg(bitmap_ind16 &bitmap,const rectangle &cliprect,int flags, int mode, int type); /* I wonder if pf_control_0 is really registers, or a selection of pins. For games with multiple chips typically the flip bit only gets set on one of the chips, but is expected to apply to both (and often the sprites as well?) Furthermore we have the m_rambank thing used by Stadium Hero which appears to be used to control the upper address line on some external RAM even if it gets written to the control_0 area For now we have this get_flip_state function so that drivers can query the bit and set other flip flags accordingly */ uint8_t get_flip_state(void) { return m_pf_control_0[0]&0x80; }; void set_colmask(int data) { m_gfxcolmask = data; } void set_bppmultmask( int mult, int mask ) { m_bppmult = mult; m_bppmask = mask; } // stadium hero has 3bpp tiles void set_flip_screen(bool flip); uint8_t m_gfxcolmask; int m_rambank; // external connection? bool m_flip_screen; /* 16-bit accessors */ DECLARE_WRITE16_MEMBER( pf_control_0_w ); DECLARE_READ16_MEMBER( pf_control_1_r ); DECLARE_WRITE16_MEMBER( pf_control_1_w ); DECLARE_WRITE16_MEMBER( pf_data_w ); DECLARE_READ16_MEMBER( pf_data_r ); DECLARE_WRITE16_MEMBER( pf_rowscroll_w ); DECLARE_READ16_MEMBER( pf_rowscroll_r ); DECLARE_WRITE16_MEMBER( pf_colscroll_w ); DECLARE_READ16_MEMBER( pf_colscroll_r ); /* 8-bit accessors */ /* for dec8.c, pcktgal.c */ DECLARE_READ8_MEMBER( pf_data_8bit_r ); DECLARE_WRITE8_MEMBER( pf_data_8bit_w ); DECLARE_WRITE8_MEMBER( pf_control0_8bit_w ); DECLARE_READ8_MEMBER( pf_control1_8bit_r ); DECLARE_WRITE8_MEMBER( pf_control1_8bit_w ); DECLARE_READ8_MEMBER( pf_rowscroll_8bit_r ); DECLARE_WRITE8_MEMBER( pf_rowscroll_8bit_w ); /* for hippodrm (dec0.c) and actfancr / triothep (H6280 based games)*/ DECLARE_WRITE8_MEMBER( pf_control0_8bit_packed_w ); DECLARE_WRITE8_MEMBER( pf_control1_8bit_swap_w ); DECLARE_READ8_MEMBER( pf_data_8bit_swap_r ); DECLARE_WRITE8_MEMBER( pf_data_8bit_swap_w ); DECLARE_READ8_MEMBER( pf_rowscroll_8bit_swap_r ); DECLARE_WRITE8_MEMBER( pf_rowscroll_8bit_swap_w ); protected: virtual void device_start() override; virtual void device_reset() override; uint8_t m_gfxregion8x8; uint8_t m_gfxregion16x16; int m_wide; uint8_t m_bppmult; uint8_t m_bppmask; void custom_tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t *tilemap_ptr, const uint16_t *rowscroll_ptr, const uint16_t *colscroll_ptr, const uint16_t *control0, const uint16_t *control1, int flags, uint16_t penmask, uint16_t pencondition,uint16_t colprimask, uint16_t colpricondition); private: TILEMAP_MAPPER_MEMBER(tile_shape0_scan); TILEMAP_MAPPER_MEMBER(tile_shape1_scan); TILEMAP_MAPPER_MEMBER(tile_shape2_scan); TILEMAP_MAPPER_MEMBER(tile_shape0_8x8_scan); TILEMAP_MAPPER_MEMBER(tile_shape1_8x8_scan); TILEMAP_MAPPER_MEMBER(tile_shape2_8x8_scan); TILE_GET_INFO_MEMBER(get_pf8x8_tile_info); TILE_GET_INFO_MEMBER(get_pf16x16_tile_info); required_device m_gfxdecode; }; DECLARE_DEVICE_TYPE(DECO_BAC06, deco_bac06_device) #define MCFG_DECO_BAC06_GFXDECODE(_gfxtag) \ downcast(*device).set_gfxdecode_tag(_gfxtag); #define MCFG_DECO_BAC06_GFX_REGION_WIDE(_8x8, _16x16, _wide) \ downcast(*device).set_gfx_region_wide(_8x8, _16x16, _wide); #endif // MAME_VIDEO_DECOBAC06_H