Merge pull request #3890 from cam900/taotaido_clean

taotaido.cpp : Various cleanups
This commit is contained in:
R. Belmont 2018-08-25 10:16:41 -04:00 committed by GitHub
commit d04bf0ad47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 39 deletions

View File

@ -80,7 +80,7 @@ zooming might be wrong
void taotaido_state::machine_start() void taotaido_state::machine_start()
{ {
membank("soundbank")->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000); m_soundbank->configure_entries(0, 4, memregion("audiocpu")->base(), 0x8000);
} }
@ -111,7 +111,7 @@ void taotaido_state::main_map(address_map &map)
map(0xffff00, 0xffff0f).w(FUNC(taotaido_state::tileregs_w)); map(0xffff00, 0xffff0f).w(FUNC(taotaido_state::tileregs_w));
map(0xffff10, 0xffff11).nopw(); // unknown map(0xffff10, 0xffff11).nopw(); // unknown
map(0xffff20, 0xffff21).nopw(); // unknown - flip screen related map(0xffff20, 0xffff21).nopw(); // unknown - flip screen related
map(0xffff40, 0xffff47).w(FUNC(taotaido_state::sprite_character_bank_select_w)); map(0xffff40, 0xffff47).w(FUNC(taotaido_state::spritebank_w)).share("spritebank");
map(0xffffc1, 0xffffc1).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // seems right map(0xffffc1, 0xffffc1).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // seems right
map(0xffffe0, 0xffffe1).r(FUNC(taotaido_state::pending_command_r)); // guess - seems to be needed for all the sounds to work map(0xffffe0, 0xffffe1).r(FUNC(taotaido_state::pending_command_r)); // guess - seems to be needed for all the sounds to work
} }
@ -121,7 +121,7 @@ void taotaido_state::main_map(address_map &map)
WRITE8_MEMBER(taotaido_state::sh_bankswitch_w) WRITE8_MEMBER(taotaido_state::sh_bankswitch_w)
{ {
membank("soundbank")->set_entry(data & 0x03); m_soundbank->set_entry(data & 0x03);
} }
void taotaido_state::sound_map(address_map &map) void taotaido_state::sound_map(address_map &map)

View File

@ -10,8 +10,8 @@
class taotaido_state : public driver_device class taotaido_state : public driver_device
{ {
public: public:
taotaido_state(const machine_config &mconfig, device_type type, const char *tag) taotaido_state(const machine_config &mconfig, device_type type, const char *tag) :
: driver_device(mconfig, type, tag), driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
@ -21,7 +21,10 @@ public:
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"), m_spriteram2(*this, "spriteram2"),
m_scrollram(*this, "scrollram"), m_scrollram(*this, "scrollram"),
m_bgram(*this, "bgram") { } m_bgram(*this, "bgram"),
m_soundbank(*this, "soundbank"),
m_spritebank(*this, "spritebank", 0)
{ }
void taotaido(machine_config &config); void taotaido(machine_config &config);
@ -38,8 +41,11 @@ private:
required_shared_ptr<uint16_t> m_scrollram; required_shared_ptr<uint16_t> m_scrollram;
required_shared_ptr<uint16_t> m_bgram; required_shared_ptr<uint16_t> m_bgram;
uint16_t m_sprite_character_bank_select[8]; required_memory_bank m_soundbank;
uint16_t m_video_bank_select[8];
required_shared_ptr<uint8_t> m_spritebank;
uint8_t m_bgbank[8];
tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap;
std::unique_ptr<uint16_t[]> m_spriteram_old; std::unique_ptr<uint16_t[]> m_spriteram_old;
std::unique_ptr<uint16_t[]> m_spriteram_older; std::unique_ptr<uint16_t[]> m_spriteram_older;
@ -49,7 +55,7 @@ private:
DECLARE_READ16_MEMBER(pending_command_r); DECLARE_READ16_MEMBER(pending_command_r);
DECLARE_WRITE8_MEMBER(unknown_output_w); DECLARE_WRITE8_MEMBER(unknown_output_w);
DECLARE_WRITE8_MEMBER(sh_bankswitch_w); DECLARE_WRITE8_MEMBER(sh_bankswitch_w);
DECLARE_WRITE16_MEMBER(sprite_character_bank_select_w); DECLARE_WRITE8_MEMBER(spritebank_w);
DECLARE_WRITE16_MEMBER(tileregs_w); DECLARE_WRITE16_MEMBER(tileregs_w);
DECLARE_WRITE16_MEMBER(bgvideoram_w); DECLARE_WRITE16_MEMBER(bgvideoram_w);

View File

@ -15,12 +15,9 @@ zooming might be wrong (only used on title logo?)
#include "screen.h" #include "screen.h"
/* sprite tile codes 0x4000 - 0x7fff get remapped according to the content of these registers */ /* sprite tile codes 0x4000 - 0x7fff get remapped according to the content of these registers */
WRITE16_MEMBER(taotaido_state::sprite_character_bank_select_w) WRITE8_MEMBER(taotaido_state::spritebank_w)
{ {
if(ACCESSING_BITS_8_15) m_spritebank[offset] = data;
m_sprite_character_bank_select[offset*2] = data >> 8;
if(ACCESSING_BITS_0_7)
m_sprite_character_bank_select[offset*2+1] = data &0xff;
} }
/* sprites are like the other video system / psikyo games, we can merge this with aerofgt and plenty of other /* sprites are like the other video system / psikyo games, we can merge this with aerofgt and plenty of other
@ -46,9 +43,9 @@ WRITE16_MEMBER(taotaido_state::tileregs_w)
case 6: case 6:
case 7: case 7:
if(ACCESSING_BITS_8_15) if(ACCESSING_BITS_8_15)
m_video_bank_select[(offset-4)*2] = data >> 8; m_bgbank[(offset - 4) << 1] = data >> 8;
if(ACCESSING_BITS_0_7) if(ACCESSING_BITS_0_7)
m_video_bank_select[(offset-4)*2+1] = data &0xff; m_bgbank[((offset - 4) << 1) + 1] = data & 0xff;
m_bg_tilemap->mark_all_dirty(); m_bg_tilemap->mark_all_dirty();
break; break;
} }
@ -62,34 +59,31 @@ WRITE16_MEMBER(taotaido_state::bgvideoram_w)
TILE_GET_INFO_MEMBER(taotaido_state::bg_tile_info) TILE_GET_INFO_MEMBER(taotaido_state::bg_tile_info)
{ {
int code = m_bgram[tile_index]&0x01ff; int code = m_bgram[tile_index] & 0x01ff;
int bank = (m_bgram[tile_index]&0x0e00)>>9; int bank =(m_bgram[tile_index] & 0x0e00) >> 9;
int col = (m_bgram[tile_index]&0xf000)>>12; int col =(m_bgram[tile_index] & 0xf000) >> 12;
code |= m_video_bank_select[bank]*0x200; code |= m_bgbank[bank] << 9;
SET_TILE_INFO_MEMBER(1, SET_TILE_INFO_MEMBER(1, code, col, 0);
code,
col,
0);
} }
TILEMAP_MAPPER_MEMBER(taotaido_state::tilemap_scan_rows) TILEMAP_MAPPER_MEMBER(taotaido_state::tilemap_scan_rows)
{ {
/* logical (col,row) -> memory offset */ /* logical (col,row) -> memory offset */
return row*0x40 + (col&0x3f) + ((col&0x40)<<6); return (col & 0x3f) | ((row & 0x3f) << 6) | ((col & 0x40) << 6);
} }
uint32_t taotaido_state::tile_callback( uint32_t code ) uint32_t taotaido_state::tile_callback( uint32_t code )
{ {
code = m_spriteram2_older[code&0x7fff]; code = m_spriteram2_older[code & 0x7fff];
if (code > 0x3fff) if (code > 0x3fff)
{ {
int block = (code & 0x3800)>>11; int block = (code & 0x3800) >> 11;
code &= 0x07ff; code &= 0x07ff;
code |= m_sprite_character_bank_select[block] * 0x800; code |= m_spritebank[block] << 11;
} }
return code; return code;
@ -106,8 +100,11 @@ void taotaido_state::video_start()
m_spriteram2_old = std::make_unique<uint16_t[]>(0x10000/2); m_spriteram2_old = std::make_unique<uint16_t[]>(0x10000/2);
m_spriteram2_older = std::make_unique<uint16_t[]>(0x10000/2); m_spriteram2_older = std::make_unique<uint16_t[]>(0x10000/2);
save_item(NAME(m_sprite_character_bank_select)); save_item(NAME(m_bgbank));
save_item(NAME(m_video_bank_select)); save_pointer(NAME(m_spriteram_old), 0x2000/2);
save_pointer(NAME(m_spriteram_older), 0x2000/2);
save_pointer(NAME(m_spriteram2_old), 0x10000/2);
save_pointer(NAME(m_spriteram2_older), 0x10000/2);
} }
@ -117,23 +114,19 @@ uint32_t taotaido_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
// m_bg_tilemap->set_scrolly(0,(m_scrollram[0x382/2]>>4)); // the values put here end up being wrong every other frame // m_bg_tilemap->set_scrolly(0,(m_scrollram[0x382/2]>>4)); // the values put here end up being wrong every other frame
/* not amazingly efficient however it should be functional for row select and linescroll */ /* not amazingly efficient however it should be functional for row select and linescroll */
int line; rectangle clip = cliprect;
rectangle clip;
const rectangle &visarea = screen.visible_area(); for (int line = cliprect.top(); line <= cliprect.bottom(); line++)
clip = visarea;
for (line = 0; line < 224;line++)
{ {
clip.min_y = clip.max_y = line; clip.min_y = clip.max_y = line;
m_bg_tilemap->set_scrollx(0,((m_scrollram[(0x00+4*line)/2])>>4)+30); m_bg_tilemap->set_scrollx(0, ((m_scrollram[(0x00 + 4 * line) / 2]) >> 4) + 30);
m_bg_tilemap->set_scrolly(0,((m_scrollram[(0x02+4*line)/2])>>4)-line); m_bg_tilemap->set_scrolly(0, ((m_scrollram[(0x02 + 4 * line) / 2]) >> 4) - line);
m_bg_tilemap->draw(screen, bitmap, clip, 0,0); m_bg_tilemap->draw(screen, bitmap, clip, 0,0);
} }
m_spr->draw_sprites(m_spriteram_older.get(), m_spriteram.bytes(), screen, bitmap,cliprect); m_spr->draw_sprites(m_spriteram_older.get(), m_spriteram.bytes(), screen, bitmap, cliprect);
return 0; return 0;
} }