cave : Cleanup duplicates, Notes (#3225)

* cave : Cleanup duplicates, Notes

* cave.cpp : Fix spacing

* cave : Build fixes

* cave : Fix compile
This commit is contained in:
cam900 2018-02-22 23:07:51 +09:00 committed by Vas Crabb
parent 8a514fdba8
commit 9cd1af602e
3 changed files with 402 additions and 549 deletions

File diff suppressed because it is too large Load Diff

View File

@ -49,11 +49,17 @@ public:
, m_vram(*this, "vram.%u", 0) , m_vram(*this, "vram.%u", 0)
, m_vctrl(*this, "vctrl.%u", 0) , m_vctrl(*this, "vctrl.%u", 0)
, m_spriteram(*this, "spriteram.%u", 0) , m_spriteram(*this, "spriteram.%u", 0)
, m_spriteram_2(*this, "spriteram_2.%u", 0)
, m_paletteram(*this, "paletteram.%u", 0) , m_paletteram(*this, "paletteram.%u", 0)
, m_spriteregion(*this, "sprites%u", 0)
, m_tileregion(*this, "layer%u", 0)
, m_okiregion(*this, "oki%u", 1)
, m_z80region(*this, "audiocpu")
, m_z80bank(*this, "z80bank")
, m_okibank_lo(*this, "oki%u_banklo", 1)
, m_okibank_hi(*this, "oki%u_bankhi", 1)
, m_maincpu(*this, "maincpu") , m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu") , m_audiocpu(*this, "audiocpu")
, m_oki(*this, "oki") , m_oki(*this, "oki%u", 1)
, m_int_timer(*this, "int_timer") , m_int_timer(*this, "int_timer")
, m_int_timer_left(*this, "int_timer_left") , m_int_timer_left(*this, "int_timer_left")
, m_int_timer_right(*this, "int_timer_right") , m_int_timer_right(*this, "int_timer_right")
@ -68,9 +74,17 @@ public:
optional_shared_ptr_array<uint16_t, 4> m_vram; optional_shared_ptr_array<uint16_t, 4> m_vram;
optional_shared_ptr_array<uint16_t, 4> m_vctrl; optional_shared_ptr_array<uint16_t, 4> m_vctrl;
optional_shared_ptr_array<uint16_t, 4> m_spriteram; optional_shared_ptr_array<uint16_t, 4> m_spriteram;
optional_shared_ptr_array<uint16_t, 4> m_spriteram_2;
optional_shared_ptr_array<uint16_t, 4> m_paletteram; optional_shared_ptr_array<uint16_t, 4> m_paletteram;
/* memory regions */
optional_memory_region_array<4> m_spriteregion;
optional_memory_region_array<4> m_tileregion;
optional_memory_region_array<2> m_okiregion;
optional_memory_region m_z80region;
optional_memory_bank m_z80bank;
optional_memory_bank_array<2> m_okibank_lo;
optional_memory_bank_array<2> m_okibank_hi;
/* video-related */ /* video-related */
std::unique_ptr<sprite_cave []> m_sprite[4]; std::unique_ptr<sprite_cave []> m_sprite[4];
sprite_cave *m_sprite_table[4][MAX_PRIORITY][MAX_SPRITE_NUM + 1]; sprite_cave *m_sprite_table[4][MAX_PRIORITY][MAX_SPRITE_NUM + 1];
@ -93,7 +107,7 @@ public:
int m_old_tiledim[4]; int m_old_tiledim[4];
bitmap_ind16 m_sprite_zbuf; bitmap_ind16 m_sprite_zbuf;
uint16_t m_sprite_zbuf_baseval; uint16_t m_sprite_zbuf_baseval;
int m_num_sprites[4]; int m_num_sprites[4];
@ -115,31 +129,32 @@ public:
/* misc */ /* misc */
int m_time_vblank_irq; int m_time_vblank_irq;
uint8_t m_irq_level; uint8_t m_irq_level;
uint8_t m_vblank_irq; uint8_t m_vblank_irq;
uint8_t m_sound_irq; uint8_t m_sound_irq;
uint8_t m_unknown_irq; uint8_t m_unknown_irq;
uint8_t m_agallet_vblank_irq; uint8_t m_agallet_vblank_irq;
/* sound related */ /* sound related */
int m_soundbuf_len; int m_soundbuf_wptr;
uint8_t m_soundbuf_data[32]; int m_soundbuf_rptr;
//uint8_t m_sound_flag1; uint8_t m_soundbuf_data[32];
//uint8_t m_sound_flag2; //uint8_t m_sound_flag1;
//uint8_t m_sound_flag2;
/* game specific */ /* game specific */
// sailormn // sailormn
int m_sailormn_tilebank; int m_sailormn_tilebank;
// korokoro // korokoro
uint16_t m_leds[2]; uint16_t m_leds[2];
int m_hopper; int m_hopper;
// ppsatan // ppsatan
uint16_t m_ppsatan_io_mux; uint16_t m_ppsatan_io_mux;
/* devices */ /* devices */
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_audiocpu;
optional_device<okim6295_device> m_oki; optional_device_array<okim6295_device, 2> m_oki;
required_device<timer_device> m_int_timer; required_device<timer_device> m_int_timer;
optional_device<timer_device> m_int_timer_left; optional_device<timer_device> m_int_timer_left;
optional_device<timer_device> m_int_timer_right; optional_device<timer_device> m_int_timer_right;
@ -162,31 +177,15 @@ public:
DECLARE_WRITE16_MEMBER(gaia_coin_lsb_w); DECLARE_WRITE16_MEMBER(gaia_coin_lsb_w);
DECLARE_READ16_MEMBER(donpachi_videoregs_r); DECLARE_READ16_MEMBER(donpachi_videoregs_r);
DECLARE_WRITE16_MEMBER(korokoro_leds_w); DECLARE_WRITE16_MEMBER(korokoro_leds_w);
DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_0_w); template<int Chip> DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_w);
DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_1_w);
DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_2_w);
DECLARE_WRITE16_MEMBER(pwrinst2_vctrl_3_w);
DECLARE_READ16_MEMBER(sailormn_input0_r); DECLARE_READ16_MEMBER(sailormn_input0_r);
DECLARE_WRITE16_MEMBER(tjumpman_leds_w); DECLARE_WRITE16_MEMBER(tjumpman_leds_w);
DECLARE_WRITE16_MEMBER(pacslot_leds_w); DECLARE_WRITE16_MEMBER(pacslot_leds_w);
DECLARE_WRITE8_MEMBER(hotdogst_rombank_w); template<int Mask> DECLARE_WRITE8_MEMBER(z80_rombank_w);
DECLARE_WRITE8_MEMBER(hotdogst_okibank_w); template<int Mask> DECLARE_WRITE8_MEMBER(oki1_bank_w);
DECLARE_WRITE8_MEMBER(mazinger_rombank_w); template<int Mask> DECLARE_WRITE8_MEMBER(oki2_bank_w);
DECLARE_WRITE8_MEMBER(metmqstr_rombank_w); template<int Chip> DECLARE_WRITE16_MEMBER(vram_w);
DECLARE_WRITE8_MEMBER(metmqstr_okibank_w); template<int Chip> DECLARE_WRITE16_MEMBER(vram_8x8_w);
DECLARE_WRITE8_MEMBER(metmqstr_oki2bank_w);
DECLARE_WRITE8_MEMBER(pwrinst2_rombank_w);
DECLARE_WRITE8_MEMBER(sailormn_rombank_w);
DECLARE_WRITE8_MEMBER(sailormn_okibank_w);
DECLARE_WRITE8_MEMBER(sailormn_oki2bank_w);
DECLARE_WRITE16_MEMBER(cave_vram_0_w);
DECLARE_WRITE16_MEMBER(cave_vram_1_w);
DECLARE_WRITE16_MEMBER(cave_vram_2_w);
DECLARE_WRITE16_MEMBER(cave_vram_3_w);
DECLARE_WRITE16_MEMBER(cave_vram_0_8x8_w);
DECLARE_WRITE16_MEMBER(cave_vram_1_8x8_w);
DECLARE_WRITE16_MEMBER(cave_vram_2_8x8_w);
DECLARE_WRITE16_MEMBER(cave_vram_3_8x8_w);
DECLARE_CUSTOM_INPUT_MEMBER(korokoro_hopper_r); DECLARE_CUSTOM_INPUT_MEMBER(korokoro_hopper_r);
DECLARE_CUSTOM_INPUT_MEMBER(tjumpman_hopper_r); DECLARE_CUSTOM_INPUT_MEMBER(tjumpman_hopper_r);
DECLARE_WRITE16_MEMBER(cave_eeprom_msb_w); DECLARE_WRITE16_MEMBER(cave_eeprom_msb_w);
@ -222,10 +221,7 @@ public:
DECLARE_DRIVER_INIT(metmqstr); DECLARE_DRIVER_INIT(metmqstr);
DECLARE_DRIVER_INIT(ppsatan); DECLARE_DRIVER_INIT(ppsatan);
TILE_GET_INFO_MEMBER(sailormn_get_tile_info_2); TILE_GET_INFO_MEMBER(sailormn_get_tile_info_2);
TILE_GET_INFO_MEMBER(get_tile_info_0); template<int Chip> TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info_1);
TILE_GET_INFO_MEMBER(get_tile_info_2);
TILE_GET_INFO_MEMBER(get_tile_info_3);
DECLARE_MACHINE_START(cave); DECLARE_MACHINE_START(cave);
DECLARE_MACHINE_RESET(cave); DECLARE_MACHINE_RESET(cave);
DECLARE_MACHINE_RESET(sailormn); DECLARE_MACHINE_RESET(sailormn);
@ -260,10 +256,9 @@ public:
void sailormn_tilebank_w(int bank); void sailormn_tilebank_w(int bank);
DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen);
void update_irq_state(); void update_irq_state();
void unpack_sprites(const char *region); void unpack_sprites(int chip);
void ddonpach_unpack_sprites(const char *region); void esprade_unpack_sprites(int chip);
void esprade_unpack_sprites(const char *region); void sailormn_unpack_tiles(int chip);
void sailormn_unpack_tiles(const char *region);
void uopoko(machine_config &config); void uopoko(machine_config &config);
void sailormn(machine_config &config); void sailormn(machine_config &config);
@ -318,11 +313,7 @@ public:
void tjumpman_map(address_map &map); void tjumpman_map(address_map &map);
void uopoko_map(address_map &map); void uopoko_map(address_map &map);
private: private:
inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX );
inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t priority, uint32_t priority2, int GFX ); inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, uint32_t flags, uint32_t priority, uint32_t priority2, int GFX );
inline void vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask, int GFX );
inline void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask, int GFX );
inline void vctrl_w( address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask, int GFX );
void set_pens(int chip); void set_pens(int chip);
void cave_vh_start( int num ); void cave_vh_start( int num );
void get_sprite_info_cave(int chip); void get_sprite_info_cave(int chip);
@ -338,6 +329,8 @@ private:
void sprite_draw_donpachi( int chip, int priority ); void sprite_draw_donpachi( int chip, int priority );
void sprite_draw_donpachi_zbuf( int chip, int priority ); void sprite_draw_donpachi_zbuf( int chip, int priority );
void init_cave(); void init_cave();
void init_z80_bank();
void init_oki_bank(int chip);
void show_leds(); void show_leds();
}; };

View File

@ -33,8 +33,8 @@ Note: if MAME_DEBUG is defined, pressing:
[ 1024 Zooming Sprites ] [ 1024 Zooming Sprites ]
There are 2 sprite RAMs. A hardware register's bit selects There are 2 or 4 0x4000 Sprite RAM Areas. A hardware register's
the one to display (sprites double buffering). bit selects an area to display (sprites double buffering).
The sprites are NOT tile based: the "tile" size and start address The sprites are NOT tile based: the "tile" size and start address
is selectable for each sprite with a 16 pixel granularity. is selectable for each sprite with a 16 pixel granularity.
@ -58,8 +58,6 @@ Note: if MAME_DEBUG is defined, pressing:
#define SPRITE_FLIPY_CAVE 0x02 #define SPRITE_FLIPY_CAVE 0x02
#define SPRITE_VISIBLE_CAVE 0x04 #define SPRITE_VISIBLE_CAVE 0x04
#define SWAP(X,Y) { int temp = X; X = Y; Y = temp; }
/*************************************************************************** /***************************************************************************
@ -218,10 +216,11 @@ void cave_state::set_pens(int chip)
***************************************************************************/ ***************************************************************************/
inline void cave_state::get_tile_info( tile_data &tileinfo, int tile_index, int GFX ) template<int Chip>
TILE_GET_INFO_MEMBER(cave_state::get_tile_info)
{ {
uint16_t *VRAM = m_vram[GFX]; uint16_t *VRAM = m_vram[Chip];
int TDIM = m_tiledim[GFX]; int TDIM = m_tiledim[Chip];
uint32_t code, color, pri, tile; uint32_t code, color, pri, tile;
if (TDIM) if (TDIM)
@ -245,7 +244,7 @@ inline void cave_state::get_tile_info( tile_data &tileinfo, int tile_index, int
code = (code & 0x00ffffff); code = (code & 0x00ffffff);
} }
SET_TILE_INFO_MEMBER(GFX, code, color, 0 ); SET_TILE_INFO_MEMBER(Chip, code, color, 0 );
tileinfo.category = pri; tileinfo.category = pri;
} }
@ -294,64 +293,6 @@ TILE_GET_INFO_MEMBER(cave_state::sailormn_get_tile_info_2)
} }
inline void cave_state::vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask, int GFX )
{
uint16_t *VRAM = m_vram[GFX];
tilemap_t *TILEMAP = m_tilemap[GFX];
if ((VRAM[offset] & mem_mask) == (data & mem_mask))
return;
COMBINE_DATA(&VRAM[offset]);
offset /= 2;
if (offset < 0x1000 / 4) // 16x16 tilemap
{
offset = (offset % (512 / 16)) * 2 + (offset / (512 / 16)) * (512 / 8) * 2;
TILEMAP->mark_tile_dirty(offset + 0);
TILEMAP->mark_tile_dirty(offset + 1);
TILEMAP->mark_tile_dirty(offset + 0 + 512 / 8);
TILEMAP->mark_tile_dirty(offset + 1 + 512 / 8);
}
else if (offset >= 0x4000 / 4) // 8x8 tilemap
TILEMAP->mark_tile_dirty(offset - 0x4000 / 4);
}
/* Some games, that only ever use the 8x8 tiles and no line scroll,
use mirror ram. For example in donpachi, writes to 400000-403fff
and 408000-407fff both go to the 8x8 tilemap ram. Use this function
in this cases. Note that the get_tile_info function looks in the
4000-7fff range for tiles, so we have to write the data there. */
inline void cave_state::vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint16_t data, ATTR_UNUSED uint16_t mem_mask, int GFX )
{
uint16_t *VRAM = m_vram[GFX];
tilemap_t *TILEMAP = m_tilemap[GFX];
offset %= 0x4000 / 2;
if ((VRAM[offset] & mem_mask) == (data & mem_mask))
return;
COMBINE_DATA(&VRAM[offset + 0x0000 / 2]);
COMBINE_DATA(&VRAM[offset + 0x4000 / 2]);
TILEMAP->mark_tile_dirty(offset / 2);
}
TILE_GET_INFO_MEMBER(cave_state::get_tile_info_0){ get_tile_info(tileinfo, tile_index, 0); }
TILE_GET_INFO_MEMBER(cave_state::get_tile_info_1){ get_tile_info(tileinfo, tile_index, 1); }
TILE_GET_INFO_MEMBER(cave_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); }
TILE_GET_INFO_MEMBER(cave_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); }
WRITE16_MEMBER(cave_state::cave_vram_0_w){ vram_w(space, offset, data, mem_mask, 0); }
WRITE16_MEMBER(cave_state::cave_vram_1_w){ vram_w(space, offset, data, mem_mask, 1); }
WRITE16_MEMBER(cave_state::cave_vram_2_w){ vram_w(space, offset, data, mem_mask, 2); }
WRITE16_MEMBER(cave_state::cave_vram_3_w){ vram_w(space, offset, data, mem_mask, 3); }
WRITE16_MEMBER(cave_state::cave_vram_0_8x8_w){ vram_8x8_w(space, offset, data, mem_mask, 0); }
WRITE16_MEMBER(cave_state::cave_vram_1_8x8_w){ vram_8x8_w(space, offset, data, mem_mask, 1); }
WRITE16_MEMBER(cave_state::cave_vram_2_8x8_w){ vram_8x8_w(space, offset, data, mem_mask, 2); }
WRITE16_MEMBER(cave_state::cave_vram_3_8x8_w){ vram_8x8_w(space, offset, data, mem_mask, 3); }
/*************************************************************************** /***************************************************************************
Video Init Routines Video Init Routines
@ -385,7 +326,7 @@ void cave_state::cave_vh_start( int num )
switch (num) switch (num)
{ {
case 4: case 4:
m_tilemap[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info_3),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8); m_tilemap[3] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info<3>),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8);
m_tilemap[3]->set_transparent_pen(0); m_tilemap[3]->set_transparent_pen(0);
m_tilemap[3]->set_scroll_rows(1); m_tilemap[3]->set_scroll_rows(1);
m_tilemap[3]->set_scroll_cols(1); m_tilemap[3]->set_scroll_cols(1);
@ -393,7 +334,7 @@ void cave_state::cave_vh_start( int num )
save_item(NAME(m_old_tiledim[3])); save_item(NAME(m_old_tiledim[3]));
case 3: case 3:
m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info_2),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8); m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info<2>),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8);
m_tilemap[2]->set_transparent_pen(0); m_tilemap[2]->set_transparent_pen(0);
m_tilemap[2]->set_scroll_rows(1); m_tilemap[2]->set_scroll_rows(1);
m_tilemap[2]->set_scroll_cols(1); m_tilemap[2]->set_scroll_cols(1);
@ -401,7 +342,7 @@ void cave_state::cave_vh_start( int num )
save_item(NAME(m_old_tiledim[2])); save_item(NAME(m_old_tiledim[2]));
case 2: case 2:
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info_1),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8); m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info<1>),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8);
m_tilemap[1]->set_transparent_pen(0); m_tilemap[1]->set_transparent_pen(0);
m_tilemap[1]->set_scroll_rows(1); m_tilemap[1]->set_scroll_rows(1);
m_tilemap[1]->set_scroll_cols(1); m_tilemap[1]->set_scroll_cols(1);
@ -409,7 +350,7 @@ void cave_state::cave_vh_start( int num )
save_item(NAME(m_old_tiledim[1])); save_item(NAME(m_old_tiledim[1]));
case 1: case 1:
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info_0),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8); m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(cave_state::get_tile_info<0>),this), TILEMAP_SCAN_ROWS, 8, 8, 512 / 8, 512 / 8);
m_tilemap[0]->set_transparent_pen(0); m_tilemap[0]->set_transparent_pen(0);
m_tilemap[0]->set_scroll_rows(1); m_tilemap[0]->set_scroll_rows(1);
m_tilemap[0]->set_scroll_cols(1); m_tilemap[0]->set_scroll_cols(1);
@ -499,10 +440,10 @@ VIDEO_START_MEMBER(cave_state,sailormn_3_layers)
void cave_state::get_sprite_info_cave(int chip) void cave_state::get_sprite_info_cave(int chip)
{ {
chip %= 4;
pen_t base_pal = 0; pen_t base_pal = 0;
const char *region[4] = { "sprites0", "sprites1", "sprites2", "sprites3" }; const uint8_t *base_gfx = m_spriteregion[chip]->base();
const uint8_t *base_gfx = memregion(region[chip])->base(); int code_max = m_spriteregion[chip]->bytes() / (16*16);
int code_max = memregion(region[chip])->bytes() / (16*16);
uint16_t *source; uint16_t *source;
uint16_t *finish; uint16_t *finish;
@ -514,13 +455,9 @@ void cave_state::get_sprite_info_cave(int chip)
int max_x = m_screen->width(); int max_x = m_screen->width();
int max_y = m_screen->height(); int max_y = m_screen->height();
source = m_spriteram[chip] + ((m_spriteram[chip].bytes() / 2) / 2) * m_spriteram_bank[chip%4]; source = m_spriteram[chip] + (0x4000 / 2) * m_spriteram_bank[chip];
if (m_videoregs[chip][4] & 0x02) finish = source + (0x4000 / 2);
if (m_spriteram_2[chip])
source = m_spriteram_2[chip] + ((m_spriteram[chip].bytes() / 2) / 2) * m_spriteram_bank[chip];
finish = source + ((m_spriteram[chip].bytes() / 2) / 2);
for (; source < finish; source += 8) for (; source < finish; source += 8)
@ -628,10 +565,10 @@ void cave_state::get_sprite_info_cave(int chip)
void cave_state::get_sprite_info_donpachi(int chip) void cave_state::get_sprite_info_donpachi(int chip)
{ {
chip %= 4;
pen_t base_pal = 0; pen_t base_pal = 0;
const char *region[4] = { "sprites0", "sprites1", "sprites2", "sprites3" }; const uint8_t *base_gfx = m_spriteregion[chip]->base();
const uint8_t *base_gfx = memregion(region[chip])->base(); int code_max = m_spriteregion[chip]->bytes() / (16*16);
int code_max = memregion(region[chip])->bytes() / (16*16);
uint16_t *source; uint16_t *source;
uint16_t *finish; uint16_t *finish;
@ -644,13 +581,9 @@ void cave_state::get_sprite_info_donpachi(int chip)
int max_x = m_screen->width(); int max_x = m_screen->width();
int max_y = m_screen->height(); int max_y = m_screen->height();
source = m_spriteram[chip] + ((m_spriteram[chip].bytes() / 2) / 2) * m_spriteram_bank[chip%4]; source = m_spriteram[chip] + (0x4000 / 2) * m_spriteram_bank[chip];
if (m_videoregs[chip][4] & 0x02) finish = source + (0x4000 / 2);
if (m_spriteram_2[chip])
source = m_spriteram_2[chip] + ((m_spriteram[chip].bytes() / 2) / 2) * m_spriteram_bank[chip];
finish = source + ((m_spriteram[chip].bytes() / 2) / 2);
for (; source < finish; source += 8) for (; source < finish; source += 8)
{ {
@ -1386,8 +1319,8 @@ void cave_state::sprite_draw_donpachi_zbuf( int chip, int priority )
.. ..
8.w fedc ba98 7654 321- 8.w fedc ba98 7654 32--
---- ---- ---- ---0 Sprite RAM Bank ---- ---- ---- --10 Sprite RAM Bank
There are more! There are more!
@ -1632,6 +1565,7 @@ uint32_t cave_state::screen_update_cave(screen_device &screen, bitmap_rgb32 &bit
void cave_state::cave_get_sprite_info(int chip) void cave_state::cave_get_sprite_info(int chip)
{ {
int spriteram_bankmax = m_spriteram[chip].bytes() / 0x4000;
if (m_videoregs[chip] == nullptr) if (m_videoregs[chip] == nullptr)
return; return;
@ -1642,13 +1576,13 @@ void cave_state::cave_get_sprite_info(int chip)
m_spriteram_bank[chip] = m_spriteram_bank_delay[chip]; m_spriteram_bank[chip] = m_spriteram_bank_delay[chip];
(this->*m_get_sprite_info)(chip); (this->*m_get_sprite_info)(chip);
} }
m_spriteram_bank_delay[chip] = m_videoregs[chip][4] & 1; m_spriteram_bank_delay[chip] = (m_videoregs[chip][4] & 3) % spriteram_bankmax;
} }
else else
{ {
if (machine().video().skip_this_frame() == 0) if (machine().video().skip_this_frame() == 0)
{ {
m_spriteram_bank[chip] = m_videoregs[chip][4] & 1; m_spriteram_bank[chip] = (m_videoregs[chip][4] & 3) % spriteram_bankmax;
(this->*m_get_sprite_info)(chip); (this->*m_get_sprite_info)(chip);
} }
} }