From dd82e0eda81ff7ffa74d300adf995a6857493163 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 6 Apr 2019 17:53:39 +0900 Subject: tc0100scn.cpp : Updates Internalize text GFX, Reduce duplicates, unnecessary values and functions, Make some draw routine related to cliprect, Correct type value, Fix spacing --- src/mame/drivers/asuka.cpp | 15 ++-- src/mame/drivers/galastrm.cpp | 3 +- src/mame/drivers/groundfx.cpp | 3 +- src/mame/drivers/ninjaw.cpp | 18 ++-- src/mame/drivers/othunder.cpp | 3 +- src/mame/drivers/taito_f2.cpp | 84 +++++++------------ src/mame/drivers/taito_z.cpp | 24 ++---- src/mame/drivers/undrfire.cpp | 6 +- src/mame/drivers/warriorb.cpp | 12 +-- src/mame/drivers/wgp.cpp | 3 +- src/mame/video/tc0100scn.cpp | 187 ++++++++++++++++++------------------------ src/mame/video/tc0100scn.h | 24 ++---- 12 files changed, 145 insertions(+), 237 deletions(-) diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp index a052ebc3508..3af63a9d581 100644 --- a/src/mame/drivers/asuka.cpp +++ b/src/mame/drivers/asuka.cpp @@ -889,9 +889,8 @@ void asuka_state::bonzeadv(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag("gfxdecode"); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); @@ -950,9 +949,8 @@ void asuka_state::asuka(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag("gfxdecode"); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); @@ -1023,10 +1021,9 @@ void asuka_state::cadash(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_gfxdecode_tag("gfxdecode"); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); @@ -1084,10 +1081,9 @@ void asuka_state::mofflott(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_gfxdecode_tag("gfxdecode"); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); @@ -1153,10 +1149,9 @@ void asuka_state::eto(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_gfxdecode_tag("gfxdecode"); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); diff --git a/src/mame/drivers/galastrm.cpp b/src/mame/drivers/galastrm.cpp index 40b7019d296..a19c507b24e 100644 --- a/src/mame/drivers/galastrm.cpp +++ b/src/mame/drivers/galastrm.cpp @@ -225,10 +225,9 @@ void galastrm_state::galastrm(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(0); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(-48, -56); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0480SCP(config, m_tc0480scp, 0); m_tc0480scp->set_gfx_region(1); diff --git a/src/mame/drivers/groundfx.cpp b/src/mame/drivers/groundfx.cpp index 77ead18f89c..71957ab1a94 100644 --- a/src/mame/drivers/groundfx.cpp +++ b/src/mame/drivers/groundfx.cpp @@ -275,10 +275,9 @@ void groundfx_state::groundfx(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(2); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(50, 8); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0480SCP(config, m_tc0480scp, 0); m_tc0480scp->set_gfx_region(1); diff --git a/src/mame/drivers/ninjaw.cpp b/src/mame/drivers/ninjaw.cpp index 40f6665145a..06dac881efc 100644 --- a/src/mame/drivers/ninjaw.cpp +++ b/src/mame/drivers/ninjaw.cpp @@ -776,34 +776,31 @@ void ninjaw_state::ninjaw(machine_config &config) TC0100SCN(config, m_tc0100scn[0], 0); m_tc0100scn[0]->set_gfx_region(1); - m_tc0100scn[0]->set_tx_region(3); m_tc0100scn[0]->set_offsets(22, 0); m_tc0100scn[0]->set_multiscr_xoffs(0); m_tc0100scn[0]->set_multiscr_hack(0); m_tc0100scn[0]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[0]->set_palette_tag(m_palette); + m_tc0100scn[0]->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr[0], 0, m_palette); TC0100SCN(config, m_tc0100scn[1], 0); m_tc0100scn[1]->set_gfx_region(2); - m_tc0100scn[1]->set_tx_region(3); m_tc0100scn[1]->set_offsets(22, 0); m_tc0100scn[1]->set_multiscr_xoffs(2); m_tc0100scn[1]->set_multiscr_hack(1); m_tc0100scn[1]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[1]->set_palette_tag("palette2"); + m_tc0100scn[1]->set_palette("palette2"); TC0110PCR(config, m_tc0110pcr[1], 0, "palette2"); TC0100SCN(config, m_tc0100scn[2], 0); m_tc0100scn[2]->set_gfx_region(2); - m_tc0100scn[2]->set_tx_region(3); m_tc0100scn[2]->set_offsets(22, 0); m_tc0100scn[2]->set_multiscr_xoffs(4); m_tc0100scn[2]->set_multiscr_hack(1); m_tc0100scn[2]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[2]->set_palette_tag("palette3"); + m_tc0100scn[2]->set_palette("palette3"); TC0110PCR(config, m_tc0110pcr[2], 0, "palette3"); @@ -892,34 +889,31 @@ void ninjaw_state::darius2(machine_config &config) TC0100SCN(config, m_tc0100scn[0], 0); m_tc0100scn[0]->set_gfx_region(1); - m_tc0100scn[0]->set_tx_region(3); m_tc0100scn[0]->set_offsets(22, 0); m_tc0100scn[0]->set_multiscr_xoffs(0); m_tc0100scn[0]->set_multiscr_hack(0); m_tc0100scn[0]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[0]->set_palette_tag(m_palette); + m_tc0100scn[0]->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr[0], 0, m_palette); TC0100SCN(config, m_tc0100scn[1], 0); m_tc0100scn[1]->set_gfx_region(2); - m_tc0100scn[1]->set_tx_region(3); m_tc0100scn[1]->set_offsets(22, 0); m_tc0100scn[1]->set_multiscr_xoffs(2); m_tc0100scn[1]->set_multiscr_hack(1); m_tc0100scn[1]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[1]->set_palette_tag("palette2"); + m_tc0100scn[1]->set_palette("palette2"); TC0110PCR(config, m_tc0110pcr[1], 0, "palette2"); TC0100SCN(config, m_tc0100scn[2], 0); m_tc0100scn[2]->set_gfx_region(2); - m_tc0100scn[2]->set_tx_region(3); m_tc0100scn[2]->set_offsets(22, 0); m_tc0100scn[2]->set_multiscr_xoffs(4); m_tc0100scn[2]->set_multiscr_hack(1); m_tc0100scn[2]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[2]->set_palette_tag("palette3"); + m_tc0100scn[2]->set_palette("palette3"); TC0110PCR(config, m_tc0110pcr[2], 0, "palette3"); diff --git a/src/mame/drivers/othunder.cpp b/src/mame/drivers/othunder.cpp index f6c684fedb0..10e4485b26b 100644 --- a/src/mame/drivers/othunder.cpp +++ b/src/mame/drivers/othunder.cpp @@ -631,10 +631,9 @@ void othunder_state::othunder(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(4, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr, 0, m_palette); diff --git a/src/mame/drivers/taito_f2.cpp b/src/mame/drivers/taito_f2.cpp index fea661d9614..a98dc17e0d4 100644 --- a/src/mame/drivers/taito_f2.cpp +++ b/src/mame/drivers/taito_f2.cpp @@ -2953,10 +2953,9 @@ void taitof2_state::finalb(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr, 0, m_palette); } @@ -2976,10 +2975,9 @@ void taitof2_state::dondokod(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0280GRD(config, m_tc0280grd, 0); m_tc0280grd->set_gfx_region(2); @@ -3007,10 +3005,9 @@ void taitof2_state::megab(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3030,23 +3027,21 @@ void taitof2_state::thundfox(machine_config &config) TC0100SCN(config, m_tc0100scn_1, 0); m_tc0100scn_1->set_gfx_region(1); - m_tc0100scn_1->set_tx_region(3); m_tc0100scn_1->set_offsets(3, 0); m_tc0100scn_1->set_offsets_flip(5, 0); m_tc0100scn_1->set_offsets_fliptx(4, 1); m_tc0100scn_1->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn_1->set_palette_tag(m_palette); + m_tc0100scn_1->set_palette(m_palette); TC0100SCN(config, m_tc0100scn_2, 0); m_tc0100scn_2->set_gfx_region(2); - m_tc0100scn_2->set_tx_region(4); m_tc0100scn_2->set_offsets(3, 0); m_tc0100scn_2->set_offsets_flip(5, 0); m_tc0100scn_2->set_offsets_fliptx(4, 1); m_tc0100scn_2->set_multiscr_xoffs(tc0100scn_device::SINGLE_VDU); m_tc0100scn_2->set_multiscr_hack(1); m_tc0100scn_2->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn_2->set_palette_tag(m_palette); + m_tc0100scn_2->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3065,10 +3060,9 @@ void taitof2_state::cameltry(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0280GRD(config, m_tc0280grd, 0); m_tc0280grd->set_gfx_region(2); @@ -3090,9 +3084,8 @@ void taitof2_state::qtorimon(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr, 0, m_palette); } @@ -3111,10 +3104,9 @@ void taitof2_state::liquidk(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3132,9 +3124,8 @@ void taitof2_state::quizhq(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr, 0, m_palette); } @@ -3155,10 +3146,9 @@ void taitof2_state::ssi(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); } void taitof2_state::gunfront(machine_config &config) @@ -3177,10 +3167,9 @@ void taitof2_state::gunfront(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3200,10 +3189,9 @@ void taitof2_state::growl(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3220,9 +3208,8 @@ void taitof2_state::mjnquest(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); m_tc0100scn->set_tile_callback(FUNC(taitof2_state::mjnquest_tmap_cb), this); TC0110PCR(config, m_tc0110pcr, 0, m_palette); @@ -3299,11 +3286,10 @@ void taitof2_state::koshien(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_offsets_flip(2, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3324,10 +3310,9 @@ void taitof2_state::yuyugogo(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); } void taitof2_state::ninjak(machine_config &config) @@ -3353,10 +3338,9 @@ void taitof2_state::ninjak(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(1, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3374,12 +3358,11 @@ void taitof2_state::solfigtr(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_offsets_flip(6, 0); m_tc0100scn->set_offsets_fliptx(6, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3396,9 +3379,8 @@ void taitof2_state::qzquest(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); } void taitof2_state::pulirula(machine_config &config) @@ -3415,10 +3397,9 @@ void taitof2_state::pulirula(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0430GRW(config, m_tc0430grw, 0); m_tc0430grw->set_gfx_region(2); @@ -3466,12 +3447,11 @@ void taitof2_state::qzchikyu(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(0, 0); m_tc0100scn->set_offsets_flip(-4, 0); m_tc0100scn->set_offsets_fliptx(-11, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); } void taitof2_state::yesnoj(machine_config &config) @@ -3490,10 +3470,9 @@ void taitof2_state::yesnoj(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC8521(config, "rtc", XTAL(32'768)); } @@ -3561,10 +3540,9 @@ void taitof2_state::dinorex(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3584,10 +3562,9 @@ void taitof2_state::qjinsei(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3607,10 +3584,9 @@ void taitof2_state::qcrayon(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3630,10 +3606,9 @@ void taitof2_state::qcrayon2(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0360PRI(config, m_tc0360pri, 0); } @@ -3653,10 +3628,9 @@ void taitof2_state::driftout(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0430GRW(config, m_tc0430grw, 0); m_tc0430grw->set_gfx_region(2); @@ -3702,10 +3676,9 @@ void taitof2_state::cameltrya(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0280GRD(config, m_tc0280grd, 0); m_tc0280grd->set_gfx_region(2); @@ -3769,10 +3742,9 @@ void taitof2_state::driveout(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(3, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0430GRW(config, m_tc0430grw, 0); m_tc0430grw->set_gfx_region(2); diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index 7f86e225126..3238ae014f0 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -3203,9 +3203,8 @@ void taitoz_state::contcirc(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3275,9 +3274,8 @@ void taitoz_state::chasehq(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3349,9 +3347,8 @@ void taitoz_state::enforce(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3420,9 +3417,8 @@ void taitoz_state::bshark_base(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3507,9 +3503,8 @@ void taitoz_state::sci(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3586,9 +3581,8 @@ void taitoz_state::nightstr(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3660,9 +3654,8 @@ void taitoz_state::aquajack(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0150ROD(config, m_tc0150rod, 0); @@ -3737,10 +3730,9 @@ void taitoz_state::spacegun(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(2); m_tc0100scn->set_offsets(4, 0); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag("palette"); + m_tc0100scn->set_palette("palette"); TC0110PCR(config, m_tc0110pcr, 0, "palette"); diff --git a/src/mame/drivers/undrfire.cpp b/src/mame/drivers/undrfire.cpp index 61c2bb1a7f2..d92b5605bd9 100644 --- a/src/mame/drivers/undrfire.cpp +++ b/src/mame/drivers/undrfire.cpp @@ -601,10 +601,9 @@ void undrfire_state::undrfire(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(2); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(50, 8); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0480SCP(config, m_tc0480scp, 0); m_tc0480scp->set_gfx_region(1); @@ -663,10 +662,9 @@ void undrfire_state::cbombers(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(2); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_offsets(50, 8); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); TC0480SCP(config, m_tc0480scp, 0); m_tc0480scp->set_gfx_region(1); diff --git a/src/mame/drivers/warriorb.cpp b/src/mame/drivers/warriorb.cpp index 2044fdd5196..d1bb5270267 100644 --- a/src/mame/drivers/warriorb.cpp +++ b/src/mame/drivers/warriorb.cpp @@ -456,10 +456,9 @@ void warriorb_state::darius2d(machine_config &config) TC0100SCN(config, m_tc0100scn[0], 0); m_tc0100scn[0]->set_gfx_region(1); - m_tc0100scn[0]->set_tx_region(3); m_tc0100scn[0]->set_offsets(4, 0); m_tc0100scn[0]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[0]->set_palette_tag(m_palette); + m_tc0100scn[0]->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr[0], 0, m_palette); @@ -473,11 +472,10 @@ void warriorb_state::darius2d(machine_config &config) TC0100SCN(config, m_tc0100scn[1], 0); m_tc0100scn[1]->set_gfx_region(2); - m_tc0100scn[1]->set_tx_region(3); m_tc0100scn[1]->set_offsets(4, 0); m_tc0100scn[1]->set_multiscr_hack(1); m_tc0100scn[1]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[1]->set_palette_tag("palette2"); + m_tc0100scn[1]->set_palette("palette2"); TC0110PCR(config, m_tc0110pcr[1], 0, "palette2"); @@ -539,10 +537,9 @@ void warriorb_state::warriorb(machine_config &config) TC0100SCN(config, m_tc0100scn[0], 0); m_tc0100scn[0]->set_gfx_region(1); - m_tc0100scn[0]->set_tx_region(3); m_tc0100scn[0]->set_offsets(4, 0); m_tc0100scn[0]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[0]->set_palette_tag(m_palette); + m_tc0100scn[0]->set_palette(m_palette); TC0110PCR(config, m_tc0110pcr[0], 0, m_palette); @@ -556,12 +553,11 @@ void warriorb_state::warriorb(machine_config &config) TC0100SCN(config, m_tc0100scn[1], 0); m_tc0100scn[1]->set_gfx_region(2); - m_tc0100scn[1]->set_tx_region(3); m_tc0100scn[1]->set_offsets(4, 0); m_tc0100scn[1]->set_multiscr_xoffs(1); m_tc0100scn[1]->set_multiscr_hack(1); m_tc0100scn[1]->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn[1]->set_palette_tag("palette2"); + m_tc0100scn[1]->set_palette("palette2"); TC0110PCR(config, m_tc0110pcr[1], 0, "palette2"); diff --git a/src/mame/drivers/wgp.cpp b/src/mame/drivers/wgp.cpp index f9e12bc6b52..e709c2e99e0 100644 --- a/src/mame/drivers/wgp.cpp +++ b/src/mame/drivers/wgp.cpp @@ -950,9 +950,8 @@ void wgp_state::wgp(machine_config &config) TC0100SCN(config, m_tc0100scn, 0); m_tc0100scn->set_gfx_region(1); - m_tc0100scn->set_tx_region(3); m_tc0100scn->set_gfxdecode_tag(m_gfxdecode); - m_tc0100scn->set_palette_tag(m_palette); + m_tc0100scn->set_palette(m_palette); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/video/tc0100scn.cpp b/src/mame/video/tc0100scn.cpp index 6c8d8000def..d40cef83a33 100644 --- a/src/mame/video/tc0100scn.cpp +++ b/src/mame/video/tc0100scn.cpp @@ -144,43 +144,39 @@ the wide tilemap mode) #include "tc0100scn.h" #include "screen.h" +#include + #define TC0100SCN_RAM_SIZE 0x14000 /* enough for double-width tilemaps */ #define TC0100SCN_TOTAL_CHARS 256 DEFINE_DEVICE_TYPE(TC0100SCN, tc0100scn_device, "tc0100scn", "Taito TC0100SCN") tc0100scn_device::tc0100scn_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, TC0100SCN, tag, owner, clock), - m_ram(nullptr), - m_bg_ram(nullptr), - m_fg_ram(nullptr), - m_tx_ram(nullptr), - m_char_ram(nullptr), - m_bgscroll_ram(nullptr), - m_fgscroll_ram(nullptr), - m_colscroll_ram(nullptr), - m_bgscrollx(0), - m_bgscrolly(0), - m_fgscrollx(0), - m_fgscrolly(0), - m_bg0_colbank(0), - m_bg1_colbank(0), - m_tx_colbank(0), - m_dblwidth(0), - m_dirty(false), - m_gfxnum(0), - m_txnum(0), - m_x_offset(0), - m_y_offset(0), - m_flip_xoffs(0), - m_flip_yoffs(0), - m_flip_text_xoffs(0), - m_flip_text_yoffs(0), - m_multiscrn_xoffs(0), - m_multiscrn_hack(0), - m_gfxdecode(*this, finder_base::DUMMY_TAG), - m_palette(*this, finder_base::DUMMY_TAG) + : device_t(mconfig, TC0100SCN, tag, owner, clock) + , device_gfx_interface(mconfig, *this) + , m_ram(nullptr) + , m_bgscroll_ram(nullptr) + , m_fgscroll_ram(nullptr) + , m_colscroll_ram(nullptr) + , m_bgscrollx(0) + , m_bgscrolly(0) + , m_fgscrollx(0) + , m_fgscrolly(0) + , m_tx_colbank(0) + , m_dblwidth(0) + , m_dirty(false) + , m_gfxnum(0) + , m_x_offset(0) + , m_y_offset(0) + , m_flip_xoffs(0) + , m_flip_yoffs(0) + , m_flip_text_xoffs(0) + , m_flip_text_yoffs(0) + , m_multiscrn_xoffs(0) + , m_multiscrn_hack(0) + , m_gfxdecode(*this, finder_base::DUMMY_TAG) { + std::fill(std::begin(m_bg_colbank), std::end(m_bg_colbank), 0); } //------------------------------------------------- @@ -192,7 +188,7 @@ void tc0100scn_device::device_start() // bind callbacks m_tc0100scn_cb.bind_relative_to(*owner()); - static const gfx_layout tc0100scn_charlayout = + static const gfx_layout charlayout = { 8,8, /* 8*8 characters */ 256, /* 256 characters */ @@ -214,14 +210,14 @@ void tc0100scn_device::device_start() we're safe as it uses single width tilemaps. */ /* Single width versions */ - m_tilemap[0][0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - m_tilemap[1][0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); - m_tilemap[2][0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + m_tilemap[0][0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&tc0100scn_device::get_bg_tile_info<0x00000, 0>, "bg0_std", this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + m_tilemap[1][0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&tc0100scn_device::get_bg_tile_info<0x04000, 1>, "bg1_std", this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); + m_tilemap[2][0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(&tc0100scn_device::get_tx_tile_info<0x02000, 0>, "txt_std", this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64); /* Double width versions */ - m_tilemap[0][1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); - m_tilemap[1][1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); - m_tilemap[2][1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(tc0100scn_device::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); + m_tilemap[0][1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&tc0100scn_device::get_bg_tile_info<0x00000, 0>, "bg0_wide", this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); + m_tilemap[1][1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(&tc0100scn_device::get_bg_tile_info<0x04000, 1>, "bg1_wide", this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64); + m_tilemap[2][1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(&tc0100scn_device::get_tx_tile_info<0x09000, 1>, "txt_wide", this), TILEMAP_SCAN_ROWS, 8, 8, 128, 32); m_tilemap[0][0]->set_transparent_pen(0); m_tilemap[1][0]->set_transparent_pen(0); @@ -270,15 +266,18 @@ void tc0100scn_device::device_start() set_layer_ptrs(); /* create the char set (gfx will then be updated dynamically from RAM) */ - m_gfxdecode->set_gfx(m_txnum, std::make_unique(m_palette, tc0100scn_charlayout, (u8 *)m_char_ram, NATIVE_ENDIAN_VALUE_LE_BE(8,0), 256, 0)); + set_gfx(0, std::make_unique(&palette(), charlayout, (u8 *)&m_ram[0x6000 / 2], NATIVE_ENDIAN_VALUE_LE_BE(8,0), 256, 0)); + set_gfx(1, std::make_unique(&palette(), charlayout, (u8 *)&m_ram[0x11000 / 2], NATIVE_ENDIAN_VALUE_LE_BE(8,0), 256, 0)); - gfx_element *gfx = m_gfxdecode->gfx(m_gfxnum); - gfx_element *txt = m_gfxdecode->gfx(m_txnum); + gfx_element *bg_gfx = m_gfxdecode->gfx(m_gfxnum); + gfx_element *txt0 = gfx(0); + gfx_element *txt1 = gfx(1); - if (gfx->granularity() == 2) /* Yuyugogo, Yesnoj */ - gfx->set_granularity(16); + if (bg_gfx->granularity() == 2) /* Yuyugogo, Yesnoj */ + bg_gfx->set_granularity(16); - txt->set_granularity(gfx->granularity()); + txt0->set_granularity(bg_gfx->granularity()); + txt1->set_granularity(bg_gfx->granularity()); set_colbanks(0, 0, 0); /* standard values, only Wgp & multiscreen games change them */ /* we call this here, so that they can be modified at video_start*/ @@ -305,10 +304,11 @@ void tc0100scn_device::device_reset() DEVICE HANDLERS *****************************************************************************/ -void tc0100scn_device::common_get_tile_info( tile_data &tileinfo, int tile_index, u16 *ram, int colbank ) +template +TILE_GET_INFO_MEMBER(tc0100scn_device::get_bg_tile_info) { - u32 code = ram[2 * tile_index + 1]; - const u16 attr = ram[2 * tile_index]; + u32 code = m_ram[(2 * tile_index) + 1 + Offset]; + const u16 attr = m_ram[(2 * tile_index) + Offset]; u16 color = attr & 0xff; /* Mahjong Quest (F2 system) inexplicably has a banking feature */ @@ -317,25 +317,16 @@ void tc0100scn_device::common_get_tile_info( tile_data &tileinfo, int tile_index SET_TILE_INFO_MEMBER(m_gfxnum, code, - ((attr + colbank) & 0xff), + ((color + m_bg_colbank[Colbank]) & 0xff), TILE_FLIPYX((attr & 0xc000) >> 14)); } -TILE_GET_INFO_MEMBER(tc0100scn_device::get_bg_tile_info) -{ - common_get_tile_info(tileinfo, tile_index, m_bg_ram, m_bg0_colbank); -} - -TILE_GET_INFO_MEMBER(tc0100scn_device::get_fg_tile_info) -{ - common_get_tile_info(tileinfo, tile_index, m_fg_ram, m_bg1_colbank); -} - +template TILE_GET_INFO_MEMBER(tc0100scn_device::get_tx_tile_info) { - int attr = m_tx_ram[tile_index]; + int attr = m_ram[Offset + tile_index]; - SET_TILE_INFO_MEMBER(m_txnum, + SET_TILE_INFO_MEMBER(Gfx, attr & 0x00ff, ((attr & 0x3f00) >> 8) + m_tx_colbank, TILE_FLIPYX((attr & 0xc000) >> 14)); @@ -343,8 +334,8 @@ TILE_GET_INFO_MEMBER(tc0100scn_device::get_tx_tile_info) void tc0100scn_device::set_colbanks( int bg0, int bg1, int tx ) { - m_bg0_colbank = bg0; - m_bg1_colbank = bg1; + m_bg_colbank[0] = bg0; + m_bg_colbank[1] = bg1; m_tx_colbank = tx; } @@ -358,33 +349,18 @@ void tc0100scn_device::set_layer_ptrs() { if (!m_dblwidth) { - m_bg_ram = m_ram.get() + 0x0; - m_tx_ram = m_ram.get() + 0x4000 /2; - m_char_ram = m_ram.get() + 0x6000 /2; - m_fg_ram = m_ram.get() + 0x8000 /2; m_bgscroll_ram = m_ram.get() + 0xc000 /2; m_fgscroll_ram = m_ram.get() + 0xc400 /2; m_colscroll_ram = m_ram.get() + 0xe000 /2; } else { - m_bg_ram = m_ram.get() + 0x0; - m_fg_ram = m_ram.get() + 0x08000 /2; m_bgscroll_ram = m_ram.get() + 0x10000 /2; m_fgscroll_ram = m_ram.get() + 0x10400 /2; m_colscroll_ram = m_ram.get() + 0x10800 /2; - m_char_ram = m_ram.get() + 0x11000 /2; - m_tx_ram = m_ram.get() + 0x12000 /2; } } -void tc0100scn_device::dirty_tilemaps() -{ - m_tilemap[0][m_dblwidth]->mark_all_dirty(); - m_tilemap[1][m_dblwidth]->mark_all_dirty(); - m_tilemap[2][m_dblwidth]->mark_all_dirty(); -} - void tc0100scn_device::restore_scroll() { int flip; @@ -417,8 +393,6 @@ void tc0100scn_device::device_post_load() set_layer_ptrs(); restore_scroll(); - m_gfxdecode->gfx(m_txnum)->set_source((u8 *)m_char_ram); - m_tilemap[0][0]->mark_all_dirty(); m_tilemap[1][0]->mark_all_dirty(); m_tilemap[2][0]->mark_all_dirty(); @@ -435,28 +409,36 @@ u16 tc0100scn_device::ram_r(offs_t offset) void tc0100scn_device::ram_w(offs_t offset, u16 data, u16 mem_mask) { COMBINE_DATA(&m_ram[offset]); - if (!m_dblwidth) + /* Double-width tilemaps have a different memory map */ + if (offset < 0x2000) + { + m_tilemap[0][0]->mark_tile_dirty(offset / 2); + m_tilemap[0][1]->mark_tile_dirty(offset / 2); + } + else if (offset < 0x3000) { - if (offset < 0x2000) - m_tilemap[0][0]->mark_tile_dirty(offset / 2); - else if (offset < 0x3000) - m_tilemap[2][0]->mark_tile_dirty((offset & 0x0fff)); - else if (offset < 0x3800) - m_gfxdecode->gfx(m_txnum)->mark_dirty((offset - 0x3000) / 8); - else if (offset >= 0x4000 && offset < 0x6000) - m_tilemap[1][0]->mark_tile_dirty((offset & 0x1fff) / 2); + m_tilemap[2][0]->mark_tile_dirty((offset & 0x0fff)); + m_tilemap[0][1]->mark_tile_dirty(offset / 2); } - else /* Double-width tilemaps have a different memory map */ + else if (offset < 0x3800) { - if (offset < 0x4000) - m_tilemap[0][1]->mark_tile_dirty(offset / 2); - else if (offset >= 0x4000 && offset < 0x8000) - m_tilemap[1][1]->mark_tile_dirty((offset & 0x3fff) / 2); - else if (offset >= 0x8800 && offset < 0x9000) - m_gfxdecode->gfx(m_txnum)->mark_dirty((offset - 0x8800) / 8); - else if (offset >= 0x9000) - m_tilemap[2][1]->mark_tile_dirty((offset & 0x0fff)); + gfx(0)->mark_dirty((offset - 0x3000) / 8); + m_tilemap[0][1]->mark_tile_dirty(offset / 2); } + else if (offset < 0x4000) + m_tilemap[0][1]->mark_tile_dirty(offset / 2); + else if (offset < 0x6000) + { + m_tilemap[1][0]->mark_tile_dirty((offset & 0x1fff) / 2); + m_tilemap[1][1]->mark_tile_dirty((offset & 0x3fff) / 2); + } + else if (offset < 0x8000) + m_tilemap[1][1]->mark_tile_dirty((offset & 0x3fff) / 2); + else if (offset >= 0x8800 && offset < 0x9000) + gfx(1)->mark_dirty((offset - 0x8800) / 8); + else if (offset >= 0x9000) + m_tilemap[2][1]->mark_tile_dirty((offset & 0x0fff)); + } u16 tc0100scn_device::ctrl_r(offs_t offset) @@ -507,12 +489,6 @@ void tc0100scn_device::ctrl_w(offs_t offset, u16 data, u16 mem_mask) { /* Reinitialise layer pointers */ set_layer_ptrs(); - - /* and ensure full redraw of the tilemaps */ - dirty_tilemaps(); - - /* reset the pointer to the text characters (and dirty them all) */ - m_gfxdecode->gfx(m_txnum)->set_source((u8 *)m_char_ram); } break; @@ -560,7 +536,7 @@ void tc0100scn_device::tilemap_update() m_tilemap[1][m_dblwidth]->set_scrollx((j + m_fgscrolly) & 0x1ff, m_fgscrollx - m_fgscroll_ram[j]); } -void tc0100scn_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u32 priority, u8 pmask ) +void tc0100scn_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u8 priority, u8 pmask ) { const bitmap_ind16 &src_bitmap = tmap->pixmap(); int width_mask, height_mask, x, y, p; @@ -577,8 +553,9 @@ void tc0100scn_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bit //We use cliprect.max_y and cliprect.max_x to support games which use more than 1 screen + src_y += cliprect.top(); // Row offsets are 'screen space' 0-255 regardless of Y scroll - for (y = 0; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { src_x = (m_fgscrollx - m_fgscroll_ram[(y + scrolly_delta) & 0x1ff] + scrollx_delta + cliprect.min_x) & width_mask; if (m_ctrl[0x7] & 1) // Flipscreen @@ -605,7 +582,7 @@ void tc0100scn_device::tilemap_draw_fg( screen_device &screen, bitmap_ind16 &bit } } -int tc0100scn_device::tilemap_draw( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u32 priority, u8 pmask ) +int tc0100scn_device::tilemap_draw( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u8 priority, u8 pmask ) { int disable = m_ctrl[6] & 0xf7; rectangle clip = cliprect; diff --git a/src/mame/video/tc0100scn.h b/src/mame/video/tc0100scn.h index 5f61ce72440..51e2846ab33 100644 --- a/src/mame/video/tc0100scn.h +++ b/src/mame/video/tc0100scn.h @@ -10,17 +10,15 @@ typedef device_delegate tc0100scn_cb_delegate; #define TC0100SCN_CB_MEMBER(_name) void _name(u32 *code, u16 *color) -class tc0100scn_device : public device_t +class tc0100scn_device : public device_t, public device_gfx_interface { public: tc0100scn_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration template void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward(tag)); } - template void set_palette_tag(T &&tag) { m_palette.set_tag(std::forward(tag)); } template void set_tile_callback(T &&... args) { m_tc0100scn_cb = tc0100scn_cb_delegate(std::forward(args)...); } void set_gfx_region(int gfxregion) { m_gfxnum = gfxregion; } - void set_tx_region(int txregion) { m_txnum = txregion; } void set_multiscr_xoffs(int xoffs) { m_multiscrn_xoffs = xoffs; } void set_multiscr_hack(int hack) { m_multiscrn_hack = hack; } void set_offsets(int x_offset, int y_offset) @@ -51,7 +49,7 @@ public: void ctrl_w(offs_t offset, u16 data, u16 mem_mask = ~0); void tilemap_update(); - int tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u32 priority, u8 pmask = 0xff); + int tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u8 priority, u8 pmask = 0xff); void tilemap_set_dirty(); /* returns 0 or 1 depending on the lowest priority tilemap set in the internal @@ -71,10 +69,6 @@ private: u16 m_ctrl[8]; std::unique_ptr m_ram; - u16 * m_bg_ram; - u16 * m_fg_ram; - u16 * m_tx_ram; - u16 * m_char_ram; u16 * m_bgscroll_ram; u16 * m_fgscroll_ram; u16 * m_colscroll_ram; @@ -84,12 +78,11 @@ private: /* We keep two tilemaps for each of the 3 actual tilemaps: one at standard width, one double */ tilemap_t *m_tilemap[3][2]; - s32 m_bg0_colbank, m_bg1_colbank, m_tx_colbank; + s32 m_bg_colbank[2], m_tx_colbank; int m_dblwidth; bool m_dirty; int m_gfxnum; - int m_txnum; int m_x_offset, m_y_offset; int m_flip_xoffs, m_flip_yoffs; int m_flip_text_xoffs, m_flip_text_yoffs; @@ -97,17 +90,12 @@ private: int m_multiscrn_hack; required_device m_gfxdecode; - required_device m_palette; - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_tx_tile_info); + template TILE_GET_INFO_MEMBER(get_bg_tile_info); + template TILE_GET_INFO_MEMBER(get_tx_tile_info); - void common_get_tile_info(tile_data &tileinfo, int tile_index, u16 *ram, int colbank); - - void tilemap_draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u32 priority, u8 pmask = 0xff); + void tilemap_draw_fg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, tilemap_t* tmap, int flags, u8 priority, u8 pmask = 0xff); void set_layer_ptrs(); - void dirty_tilemaps(); void restore_scroll(); }; -- cgit v1.2.3