1 // license:BSD-3-Clause 2 // copyright-holders:Aaron Giles 3 /*************************************************************************** 4 5 Sega 16-bit sprite hardware 6 7 ***************************************************************************/ 8 #ifndef MAME_VIDEO_SEGA16SP_H 9 #define MAME_VIDEO_SEGA16SP_H 10 11 #pragma once 12 13 #include "video/sprite.h" 14 #include "segaic16.h" 15 16 17 //************************************************************************** 18 // TYPE DEFINITIONS 19 //************************************************************************** 20 21 22 // ======================> sega_16bit_sprite_device 23 24 class sega_16bit_sprite_device : public sprite16_device_ind16 25 { 26 protected: 27 // construction/destruction 28 sega_16bit_sprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner); 29 30 public: 31 // live configuration set_bank(int banknum,int offset)32 void set_bank(int banknum, int offset) { m_bank[banknum] = offset; } set_flip(bool flip)33 void set_flip(bool flip) { m_flip = flip; } set_local_origin(int x,int y)34 void set_local_origin(int x, int y) 35 { 36 m_xoffs_flipped = m_xoffs = x; 37 m_yoffs_flipped = m_yoffs = y; 38 set_origin(x, y); 39 } 40 set_local_origin(int x,int y,int xf,int yf)41 void set_local_origin(int x, int y, int xf, int yf) 42 { 43 m_xoffs = x; 44 m_yoffs = y; 45 m_xoffs_flipped = xf; 46 m_yoffs_flipped = yf; 47 set_origin(x, y); 48 } 49 set_local_originx(int x)50 void set_local_originx(int x) 51 { 52 m_xoffs_flipped = m_xoffs = x; 53 set_origin(x, m_yoffs); 54 }; 55 set_local_originy(int y)56 void set_local_originy(int y) 57 { 58 m_yoffs_flipped = m_yoffs = y; 59 set_origin(m_xoffs, y); 60 }; 61 62 // write trigger memory handler 63 void draw_write(uint16_t data); 64 65 protected: 66 // device-level overrides 67 virtual void device_start() override; 68 69 // internal state 70 bool m_flip; // screen flip? 71 uint8_t m_bank[16]; // banking redirection 72 int m_xoffs; 73 int m_yoffs; 74 int m_xoffs_flipped; 75 int m_yoffs_flipped; 76 }; 77 78 79 // ======================> sega_hangon_sprite_device 80 81 class sega_hangon_sprite_device : public sega_16bit_sprite_device 82 { 83 public: 84 // construction/destruction 85 sega_hangon_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 86 87 protected: 88 // subclass overrides 89 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 90 91 // memory regions 92 required_region_ptr<uint16_t> m_sprite_region_ptr; 93 }; 94 95 96 // ======================> sega_sharrier_sprite_device 97 98 class sega_sharrier_sprite_device : public sega_16bit_sprite_device 99 { 100 public: 101 // construction/destruction 102 sega_sharrier_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 103 104 protected: 105 // subclass overrides 106 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 107 108 // memory regions 109 required_region_ptr<uint32_t> m_sprite_region_ptr; 110 }; 111 112 113 // ======================> sega_outrun_sprite_device 114 115 class sega_outrun_sprite_device : public sega_16bit_sprite_device 116 { 117 public: 118 // construction/destruction 119 sega_outrun_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 120 protected: 121 sega_outrun_sprite_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool xboard_variant); 122 123 protected: 124 // subclass overrides 125 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 126 127 // configuration 128 bool m_is_xboard; 129 required_region_ptr<uint32_t> m_sprite_region_ptr; 130 }; 131 132 class sega_xboard_sprite_device : public sega_outrun_sprite_device 133 { 134 public: 135 // construction/destruction 136 sega_xboard_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 137 }; 138 139 140 // ======================> sega_sys16a_sprite_device 141 142 class sega_sys16a_sprite_device : public sega_16bit_sprite_device 143 { 144 public: 145 // construction/destruction 146 sega_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 147 148 protected: 149 // subclass overrides 150 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 151 152 // memory regions 153 required_region_ptr<uint16_t> m_sprite_region_ptr; 154 }; 155 156 157 // ======================> bootleg_sys16a_sprite_device 158 159 class bootleg_sys16a_sprite_device : public sega_16bit_sprite_device 160 { 161 public: 162 // construction/destruction bootleg_sys16a_sprite_device(const machine_config & mconfig,const char * tag,device_t * owner,uint32_t clock,int originx,uint8_t offs0,uint8_t offs1,uint8_t offs2,uint8_t offs3,uint8_t offs4,uint8_t offs5,uint8_t offs6,uint8_t offs7)163 bootleg_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, int originx, 164 uint8_t offs0, uint8_t offs1, uint8_t offs2, uint8_t offs3, uint8_t offs4, uint8_t offs5, uint8_t offs6, uint8_t offs7) 165 : bootleg_sys16a_sprite_device(mconfig, tag, owner, clock) 166 { 167 set_local_originx(originx); 168 set_remap(offs0, offs1, offs2, offs3, offs4, offs5, offs6, offs7); 169 } 170 171 bootleg_sys16a_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 172 173 // configuration 174 void set_remap(uint8_t offs0, uint8_t offs1, uint8_t offs2, uint8_t offs3, uint8_t offs4, uint8_t offs5, uint8_t offs6, uint8_t offs7); 175 176 protected: 177 // subclass overrides 178 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 179 180 // memory regions 181 required_region_ptr<uint16_t> m_sprite_region_ptr; 182 183 // internal state 184 uint8_t m_addrmap[8]; 185 }; 186 187 188 // ======================> sega_sys16b_sprite_device 189 190 class sega_sys16b_sprite_device : public sega_16bit_sprite_device 191 { 192 public: 193 // construction/destruction 194 sega_sys16b_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); 195 196 protected: 197 // subclass overrides 198 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 199 200 // memory regions 201 required_region_ptr<uint16_t> m_sprite_region_ptr; 202 }; 203 204 205 // ======================> sega_yboard_sprite_device 206 207 class sega_yboard_sprite_device : public sega_16bit_sprite_device 208 { 209 public: 210 typedef segaic16_video_device::rotate_info rotate_info; 211 212 // construction/destruction 213 sega_yboard_sprite_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); set_rotate_ptr(rotate_info * segaic16_rotate)214 void set_rotate_ptr(rotate_info* segaic16_rotate) { m_segaic16_rotate = segaic16_rotate; } 215 216 protected: 217 // subclass overrides 218 virtual void draw(bitmap_ind16 &bitmap, const rectangle &cliprect) override; 219 220 required_region_ptr<uint64_t> m_sprite_region_ptr; 221 rotate_info* m_segaic16_rotate; 222 }; 223 224 225 // device type definition 226 DECLARE_DEVICE_TYPE(SEGA_HANGON_SPRITES, sega_hangon_sprite_device) 227 DECLARE_DEVICE_TYPE(SEGA_SHARRIER_SPRITES, sega_sharrier_sprite_device) 228 DECLARE_DEVICE_TYPE(SEGA_OUTRUN_SPRITES, sega_outrun_sprite_device) 229 DECLARE_DEVICE_TYPE(SEGA_SYS16A_SPRITES, sega_sys16a_sprite_device) 230 DECLARE_DEVICE_TYPE(BOOTLEG_SYS16A_SPRITES, bootleg_sys16a_sprite_device) 231 DECLARE_DEVICE_TYPE(SEGA_SYS16B_SPRITES, sega_sys16b_sprite_device) 232 DECLARE_DEVICE_TYPE(SEGA_XBOARD_SPRITES, sega_xboard_sprite_device) 233 DECLARE_DEVICE_TYPE(SEGA_YBOARD_SPRITES, sega_yboard_sprite_device) 234 235 236 #endif // MAME_VIDEO_SEGA16SP_H 237