summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author R. Belmont <rb6502@users.noreply.github.com>2018-08-25 10:16:41 -0400
committer GitHub <noreply@github.com>2018-08-25 10:16:41 -0400
commitd04bf0ad4719d27898377c45f882958070a10f15 (patch)
treedb7416ea19f01f2aad36d21a9d27424c4d31b1f2
parent9e6b57b057dcdcb09673df61832128d7dd641bd4 (diff)
parent5488081108e8d5b2c0b65e4d2515953f27f338ee (diff)
Merge pull request #3890 from cam900/taotaido_clean
taotaido.cpp : Various cleanups
-rw-r--r--src/mame/drivers/taotaido.cpp6
-rw-r--r--src/mame/includes/taotaido.h18
-rw-r--r--src/mame/video/taotaido.cpp53
3 files changed, 38 insertions, 39 deletions
diff --git a/src/mame/drivers/taotaido.cpp b/src/mame/drivers/taotaido.cpp
index e86e1b4215d..3c5077dfe1d 100644
--- a/src/mame/drivers/taotaido.cpp
+++ b/src/mame/drivers/taotaido.cpp
@@ -80,7 +80,7 @@ zooming might be wrong
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(0xffff10, 0xffff11).nopw(); // unknown
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(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)
{
- membank("soundbank")->set_entry(data & 0x03);
+ m_soundbank->set_entry(data & 0x03);
}
void taotaido_state::sound_map(address_map &map)
diff --git a/src/mame/includes/taotaido.h b/src/mame/includes/taotaido.h
index 39152c3451a..a964a17fde1 100644
--- a/src/mame/includes/taotaido.h
+++ b/src/mame/includes/taotaido.h
@@ -10,8 +10,8 @@
class taotaido_state : public driver_device
{
public:
- taotaido_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ taotaido_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
@@ -21,7 +21,10 @@ public:
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"),
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);
@@ -38,8 +41,11 @@ private:
required_shared_ptr<uint16_t> m_scrollram;
required_shared_ptr<uint16_t> m_bgram;
- uint16_t m_sprite_character_bank_select[8];
- uint16_t m_video_bank_select[8];
+ required_memory_bank m_soundbank;
+
+ required_shared_ptr<uint8_t> m_spritebank;
+
+ uint8_t m_bgbank[8];
tilemap_t *m_bg_tilemap;
std::unique_ptr<uint16_t[]> m_spriteram_old;
std::unique_ptr<uint16_t[]> m_spriteram_older;
@@ -49,7 +55,7 @@ private:
DECLARE_READ16_MEMBER(pending_command_r);
DECLARE_WRITE8_MEMBER(unknown_output_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(bgvideoram_w);
diff --git a/src/mame/video/taotaido.cpp b/src/mame/video/taotaido.cpp
index 53189033c2a..9f23e7eb720 100644
--- a/src/mame/video/taotaido.cpp
+++ b/src/mame/video/taotaido.cpp
@@ -15,12 +15,9 @@ zooming might be wrong (only used on title logo?)
#include "screen.h"
/* 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_sprite_character_bank_select[offset*2] = data >> 8;
- if(ACCESSING_BITS_0_7)
- m_sprite_character_bank_select[offset*2+1] = data &0xff;
+ m_spritebank[offset] = data;
}
/* 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 7:
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)
- m_video_bank_select[(offset-4)*2+1] = data &0xff;
+ m_bgbank[((offset - 4) << 1) + 1] = data & 0xff;
m_bg_tilemap->mark_all_dirty();
break;
}
@@ -62,34 +59,31 @@ WRITE16_MEMBER(taotaido_state::bgvideoram_w)
TILE_GET_INFO_MEMBER(taotaido_state::bg_tile_info)
{
- int code = m_bgram[tile_index]&0x01ff;
- int bank = (m_bgram[tile_index]&0x0e00)>>9;
- int col = (m_bgram[tile_index]&0xf000)>>12;
+ int code = m_bgram[tile_index] & 0x01ff;
+ int bank =(m_bgram[tile_index] & 0x0e00) >> 9;
+ 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,
- code,
- col,
- 0);
+ SET_TILE_INFO_MEMBER(1, code, col, 0);
}
TILEMAP_MAPPER_MEMBER(taotaido_state::tilemap_scan_rows)
{
/* 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 )
{
- code = m_spriteram2_older[code&0x7fff];
+ code = m_spriteram2_older[code & 0x7fff];
if (code > 0x3fff)
{
- int block = (code & 0x3800)>>11;
+ int block = (code & 0x3800) >> 11;
code &= 0x07ff;
- code |= m_sprite_character_bank_select[block] * 0x800;
+ code |= m_spritebank[block] << 11;
}
return code;
@@ -106,8 +100,11 @@ void taotaido_state::video_start()
m_spriteram2_old = 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_video_bank_select));
+ save_item(NAME(m_bgbank));
+ 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
/* not amazingly efficient however it should be functional for row select and linescroll */
- int line;
- rectangle clip;
+ rectangle clip = cliprect;
- const rectangle &visarea = screen.visible_area();
- clip = visarea;
-
- for (line = 0; line < 224;line++)
+ for (int line = cliprect.top(); line <= cliprect.bottom(); 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_scrolly(0,((m_scrollram[(0x02+4*line)/2])>>4)-line);
+ 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->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;
}