summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ville Linde <villedevs@gmail.com>2021-07-31 18:20:07 +0300
committer Ville Linde <villedevs@gmail.com>2021-07-31 18:20:07 +0300
commit367ca9e2404e56e119fa74922b316a00340f2747 (patch)
treea5c210a3d7903b9dbef13fec542fb7110db2e278
parent69ce57f251432bb86bb12f641f3b9caafc664ffe (diff)
taitopjc: Fixed lockup issues. Improved tilemap emulation.
-rw-r--r--src/mame/drivers/taitopjc.cpp95
1 files changed, 73 insertions, 22 deletions
diff --git a/src/mame/drivers/taitopjc.cpp b/src/mame/drivers/taitopjc.cpp
index a1e896bc547..47da7b718f6 100644
--- a/src/mame/drivers/taitopjc.cpp
+++ b/src/mame/drivers/taitopjc.cpp
@@ -94,8 +94,8 @@
#include "screen.h"
#include "tilemap.h"
-#define LOG_TLCS_TO_PPC_COMMANDS 1
-#define LOG_PPC_TO_TLCS_COMMANDS 1
+#define LOG_TLCS_TO_PPC_COMMANDS 0
+#define LOG_PPC_TO_TLCS_COMMANDS 0
#define LOG_DISPLAY_LIST 0
class taitopjc_state : public driver_device
@@ -110,7 +110,8 @@ public:
m_tc0780fpa(*this, "tc0780fpa"),
m_palette(*this, "palette"),
m_polyrom(*this, "poly"),
- m_gfxdecode(*this, "gfxdecode")
+ m_gfxdecode(*this, "gfxdecode"),
+ m_main_ram(*this, "main_ram")
{ }
void taitopjc(machine_config &config);
@@ -118,6 +119,7 @@ public:
void init_optiger();
protected:
+ virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
@@ -130,6 +132,7 @@ private:
required_device<palette_device> m_palette;
required_memory_region m_polyrom;
required_device<gfxdecode_device> m_gfxdecode;
+ required_shared_ptr<uint64_t> m_main_ram;
uint64_t video_r(offs_t offset, uint64_t mem_mask = ~0);
void video_w(offs_t offset, uint64_t data, uint64_t mem_mask = ~0);
@@ -168,6 +171,10 @@ private:
uint32_t m_video_address;
uint32_t m_dsp_rom_address;
+ int m_scroll_x;
+ int m_scroll_y;
+
+ uint32_t m_tlcs_sound_ptr;
void mn10200_map(address_map &map);
void ppc603e_mem(address_map &map);
@@ -228,7 +235,7 @@ TILEMAP_MAPPER_MEMBER(taitopjc_state::tile_scan_layer0)
TILEMAP_MAPPER_MEMBER(taitopjc_state::tile_scan_layer1)
{
/* logical (col,row) -> memory offset */
- return (row * 64) + col + 32;
+ return (row * 64) + col + 4096;
}
void taitopjc_state::video_start()
@@ -247,10 +254,10 @@ void taitopjc_state::video_start()
m_screen_ram = std::make_unique<uint32_t[]>(0x40000);
m_pal_ram = std::make_unique<uint32_t[]>(0x8000);
- m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer0)), 16, 16, 32, 32);
- m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer1)), 16, 16, 32, 32);
+ m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer0)), 16, 16, 64, 64);
+ m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(taitopjc_state::tile_get_info)), tilemap_mapper_delegate(*this, FUNC(taitopjc_state::tile_scan_layer1)), 16, 16, 64, 64);
m_tilemap[0]->set_transparent_pen(0);
- m_tilemap[1]->set_transparent_pen(1);
+ m_tilemap[1]->set_transparent_pen(0);
m_gfxdecode->set_gfx(0, std::make_unique<gfx_element>(m_palette, char_layout, (uint8_t*)m_screen_ram.get(), 0, m_palette->entries() / 256, 0));
@@ -263,7 +270,11 @@ uint32_t taitopjc_state::screen_update_taitopjc(screen_device &screen, bitmap_in
m_tc0780fpa->draw(bitmap, cliprect);
+ m_tilemap[0]->set_scrollx(m_scroll_x);
+ m_tilemap[0]->set_scrolly(m_scroll_y);
+
m_tilemap[0]->draw(screen, bitmap, cliprect, 0);
+ m_tilemap[1]->draw(screen, bitmap, cliprect, 0);
return 0;
}
@@ -296,17 +307,28 @@ void taitopjc_state::videochip_w(offs_t address, uint32_t data)
uint32_t addr = address - 0x10000000;
m_screen_ram[addr] = data;
- if (address >= 0x1003f000)
+ if (address >= 0x1003f000 && address < 0x1003f800)
+ {
+ uint32_t a = address - 0x1003f000;
+ m_tilemap[0]->mark_tile_dirty((a * 2));
+ m_tilemap[0]->mark_tile_dirty((a * 2) + 1);
+ }
+ else if (address >= 0x1003f800 && address < 0x10040000)
{
uint32_t a = address - 0x1003f000;
- m_tilemap[0]->mark_tile_dirty((a*2));
- m_tilemap[0]->mark_tile_dirty((a*2)+1);
+ m_tilemap[1]->mark_tile_dirty((a * 2));
+ m_tilemap[1]->mark_tile_dirty((a * 2) + 1);
}
else
{
m_gfxdecode->gfx(0)->mark_dirty(addr / 64);
}
}
+ else if (address == 0x00000006)
+ {
+ m_scroll_y = (data >> 16) & 0xffff;
+ m_scroll_x = data & 0xffff;
+ }
else
{
printf("Address %08X = %08X\n", address, data);
@@ -394,6 +416,8 @@ void taitopjc_state::ppc_common_w(offs_t offset, uint64_t data, uint64_t mem_mas
m_iocpu->set_input_line(TLCS900_INT6, ASSERT_LINE);
m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
+
+ m_maincpu->abort_timeslice();
}
}
@@ -536,7 +560,7 @@ void taitopjc_state::dsp_w(offs_t offset, uint64_t data, uint64_t mem_mask)
void taitopjc_state::ppc603e_mem(address_map &map)
{
- map(0x00000000, 0x003fffff).ram(); // Work RAM
+ map(0x00000000, 0x003fffff).ram().share(m_main_ram); // Work RAM
map(0x40000000, 0x4000000f).rw(FUNC(taitopjc_state::video_r), FUNC(taitopjc_state::video_w));
map(0x80000000, 0x80003fff).rw(FUNC(taitopjc_state::dsp_r), FUNC(taitopjc_state::dsp_w));
map(0xc0000000, 0xc0003fff).rw(FUNC(taitopjc_state::ppc_common_r), FUNC(taitopjc_state::ppc_common_w));
@@ -587,18 +611,32 @@ void taitopjc_state::tlcs_common_w(offs_t offset, uint8_t data)
}
#endif
- m_iocpu->set_input_line(TLCS900_INT1, CLEAR_LINE);
- m_iocpu->set_input_line(TLCS900_INT2, CLEAR_LINE);
- m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
+ if (m_io_share_ram[0xffe] == 0xd000)
+ m_iocpu->set_input_line(TLCS900_INT1, CLEAR_LINE);
+ if (m_io_share_ram[0xffe] == 0x7000)
+ m_iocpu->set_input_line(TLCS900_INT2, CLEAR_LINE);
+
+ if (m_io_share_ram[0xffe] != 0)
+ m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
+
+ m_iocpu->abort_timeslice();
}
}
uint8_t taitopjc_state::tlcs_sound_r(offs_t offset)
{
- if (offset == 0x17)
+ if (offset == 0x15)
+ {
+ return m_tlcs_sound_ptr & 0x7f;
+ }
+ else if (offset == 0x17)
{
return 0x55;
}
+ else if (offset >= 0x80 && offset < 0x100)
+ {
+ m_tlcs_sound_ptr++;
+ }
return 0;
}
@@ -707,6 +745,7 @@ void taitopjc_state::tms_io_map(address_map &map)
map(0x0058, 0x0058).w(m_tc0780fpa, FUNC(tc0780fpa_device::poly_fifo_w));
map(0x005a, 0x005a).w(m_tc0780fpa, FUNC(tc0780fpa_device::tex_w));
map(0x005b, 0x005b).rw(m_tc0780fpa, FUNC(tc0780fpa_device::tex_addr_r), FUNC(tc0780fpa_device::tex_addr_w));
+ map(0x005e, 0x005e).noprw(); // ?? 0x0001 written every frame
map(0x005f, 0x005f).r(FUNC(taitopjc_state::dsp_rom_r));
}
@@ -742,20 +781,32 @@ static INPUT_PORTS_START( taitopjc )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ // Actually cabinet mounted guns (basically analog sticks), but lightgun inputs are more practical in MAME.
PORT_START("ANALOG1") // Player 1 X
- PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ //PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30) PORT_REVERSE
+ PORT_BIT(0x3ff, 0x000, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, -1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE
PORT_START("ANALOG2") // Player 1 Y
- PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ //PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ PORT_BIT(0x3ff, 0x000, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("ANALOG3") // Player 2 X
- PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_PLAYER(2) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ //PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_PLAYER(2) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30) PORT_REVERSE
+ PORT_BIT(0x3ff, 0x000, IPT_LIGHTGUN_X) PORT_CROSSHAIR(X, -1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_REVERSE
PORT_START("ANALOG4") // Player 2 Y
- PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_PLAYER(2) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ //PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_PLAYER(2) PORT_MINMAX(0x000,0x3ff) PORT_SENSITIVITY(35) PORT_KEYDELTA(30)
+ PORT_BIT(0x3ff, 0x000, IPT_LIGHTGUN_Y) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
INPUT_PORTS_END
+void taitopjc_state::machine_start()
+{
+ m_maincpu->ppcdrc_set_options(PPCDRC_COMPATIBLE_OPTIONS);
+
+ m_maincpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, false, m_main_ram);
+}
+
void taitopjc_state::machine_reset()
{
// halt sound CPU since we don't emulate this yet
@@ -800,15 +851,15 @@ void taitopjc_state::taitopjc(machine_config &config)
MN1020012A(config, m_soundcpu, 10000000); /* MN1020819DA sound CPU - NOTE: May have 64kB internal ROM */
m_soundcpu->set_addrmap(AS_PROGRAM, &taitopjc_state::mn10200_map);
- config.set_maximum_quantum(attotime::from_hz(6000));
+ config.set_maximum_quantum(attotime::from_hz(200000));
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
- screen.set_size(512, 384);
- screen.set_visarea(0, 511, 0, 383);
+ screen.set_size(480, 384);
+ screen.set_visarea(0, 479, 0, 383);
screen.set_screen_update(FUNC(taitopjc_state::screen_update_taitopjc));
screen.set_palette(m_palette);