summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine
diff options
context:
space:
mode:
author David Haywood <28625134+DavidHaywood@users.noreply.github.com>2019-11-27 00:21:09 +0000
committer ajrhacker <ajrhacker@users.noreply.github.com>2019-11-26 19:21:09 -0500
commit67da0956371c77ad860f06e11a2afb19cc63cfe6 (patch)
tree2ba4dd27cbac3df028d7c9651ee74676012a3e4c /src/devices/machine
parent6a42b2e1527501c042d3df62c8feb3306caaf01c (diff)
sunplus_gcm394.cpp : wrlshunt / smartfp, continued research (#5972)
* fix opcode (nw) * (nw) * allow wrlshunt to move forward (nw) * more ops (nw) * more ops (nw) * (nw) * more dma fixes (nw) * (nw) * (nw)
Diffstat (limited to 'src/devices/machine')
-rw-r--r--src/devices/machine/sunplus_gcm394.cpp55
-rw-r--r--src/devices/machine/sunplus_gcm394.h9
-rw-r--r--src/devices/machine/sunplus_gcm394_video.cpp46
-rw-r--r--src/devices/machine/sunplus_gcm394_video.h14
4 files changed, 82 insertions, 42 deletions
diff --git a/src/devices/machine/sunplus_gcm394.cpp b/src/devices/machine/sunplus_gcm394.cpp
index 7016ccfdaa6..4998bbce242 100644
--- a/src/devices/machine/sunplus_gcm394.cpp
+++ b/src/devices/machine/sunplus_gcm394.cpp
@@ -15,7 +15,7 @@
#define LOG_GCM394 (1U << 1)
#define LOG_GCM394_UNMAPPED (1U << 0)
-#define VERBOSE (LOG_GCM394_UNMAPPED | LOG_GCM394_SYSDMA)
+#define VERBOSE (LOG_GCM394 | LOG_GCM394_UNMAPPED | LOG_GCM394_SYSDMA)
#include "logmacro.h"
@@ -143,7 +143,12 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7810_w) { LOGMASKED(LOG_GCM39
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7816_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7816_w %04x\n", machine().describe_context(), data); m_7816 = data; }
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7817_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7817_w %04x\n", machine().describe_context(), data); m_7817 = data; }
-WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7820_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7820_w %04x\n", machine().describe_context(), data); m_7820 = data; }
+WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7820_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7820_w (Rom Mapping control?) %04x\n", machine().describe_context(), data);
+ m_7820 = data;
+ m_mapping_write_cb(data);
+}
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7821_w)
{
@@ -208,7 +213,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b1_w) { LOGMASKED(LOG_GCM39
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_r)
{
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_r\n", machine().describe_context());
- return machine().rand();
+ return m_78b2;
}
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_w %04x\n", machine().describe_context(), data); m_78b2 = data; }
@@ -227,7 +232,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_w)
{
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7935_w %04x\n", machine().describe_context(), data);
m_7935 &= ~data;
- checkirq6();
+ //checkirq6();
}
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7936_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7936_r\n", machine().describe_context()); return 0x0000; }
@@ -281,16 +286,16 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
map(0x007010, 0x007015).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_regs_r), FUNC(gcm394_base_video_device::tmap0_regs_w));
map(0x007016, 0x00701b).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_regs_r), FUNC(gcm394_base_video_device::tmap1_regs_w));
- map(0x007020, 0x007020).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk0_w)); // probably tilebase, written with other tmap0 regs
- map(0x007021, 0x007021).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk0_w)); // probably tilebase, written with other tmap1 regs
+ map(0x007020, 0x007020).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_w)); // probably tilebase, written with other tmap0 regs
+ map(0x007021, 0x007021).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_w)); // probably tilebase, written with other tmap1 regs
map(0x007022, 0x007022).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk0_w)); // another tilebase? maybe sprites? written as 7022, 702d and 7042 group
map(0x007023, 0x007023).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk0_w)); // written with other unknown_video_device0 regs
map(0x007024, 0x007024).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk0_w)); // written with other unknown_video_device1 regs
map(0x00702a, 0x00702a).w(m_spg_video, FUNC(gcm394_base_video_device::video_702a_w));
- map(0x00702b, 0x00702b).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk1_w)); // written with other tmap0 regs
- map(0x00702c, 0x00702c).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk1_w)); // written with other tmap1 regs
+ map(0x00702b, 0x00702b).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_msb_w)); // written with other tmap0 regs
+ map(0x00702c, 0x00702c).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_msb_w)); // written with other tmap1 regs
map(0x00702d, 0x00702d).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk1_w)); // maybe sprites? written as 7022, 702d and 7042 group
map(0x00702e, 0x00702e).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk1_w)); // written with other unknown_video_device0 regs
map(0x00702f, 0x00702f).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk1_w)); // written with other unknown_video_device1 regs
@@ -310,6 +315,7 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
map(0x007072, 0x007072).rw(m_spg_video, FUNC(gcm394_base_video_device::video_dma_size_r), FUNC(gcm394_base_video_device::video_dma_size_w)); //
map(0x00707e, 0x00707e).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_unk_w)); // written around same time as DMA, seems to select alt sprite bank
+ map(0x00707c, 0x00707c).r(m_spg_video, FUNC(gcm394_base_video_device::video_707c_r)); // wrlshunt polls this waiting for 0x8000, is this some kind of manual port based data upload?
map(0x00707f, 0x00707f).rw(m_spg_video, FUNC(gcm394_base_video_device::video_707f_r), FUNC(gcm394_base_video_device::video_707f_w));
// another set of registers for something?
@@ -327,6 +333,9 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
// 73xx-77xx = video ram
// ######################################################################################################################################################################################
+ map(0x007100, 0x0071ef).ram().share("unkram1"); // maybe a line table? (assuming DMA isn't writing to wrong place)
+ map(0x007200, 0x0072ef).ram().share("unkram2"); // ^^
+
map(0x007300, 0x0073ff).rw(m_spg_video, FUNC(gcm394_base_video_device::palette_r), FUNC(gcm394_base_video_device::palette_w));
map(0x007400, 0x0077ff).ram().share("spriteram");
@@ -348,12 +357,12 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
map(0x007816, 0x007816).w(FUNC(sunplus_gcm394_base_device::unkarea_7816_w));
map(0x007817, 0x007817).w(FUNC(sunplus_gcm394_base_device::unkarea_7817_w));
-
- map(0x007820, 0x007820).w(FUNC(sunplus_gcm394_base_device::unkarea_7820_w));
- map(0x007821, 0x007821).w(FUNC(sunplus_gcm394_base_device::unkarea_7821_w));
- map(0x007822, 0x007822).w(FUNC(sunplus_gcm394_base_device::unkarea_7822_w));
- map(0x007823, 0x007823).w(FUNC(sunplus_gcm394_base_device::unkarea_7823_w));
- map(0x007824, 0x007824).w(FUNC(sunplus_gcm394_base_device::unkarea_7824_w));
+ // wrlshunt | smartfp
+ map(0x007820, 0x007820).w(FUNC(sunplus_gcm394_base_device::unkarea_7820_w)); // 7f8a (7f8a before DMA from ROM to RAM, 008a after DMA from ROM to RAM) | 3f04
+ map(0x007821, 0x007821).w(FUNC(sunplus_gcm394_base_device::unkarea_7821_w)); // 7f47 | 0044
+ map(0x007822, 0x007822).w(FUNC(sunplus_gcm394_base_device::unkarea_7822_w)); // 0047 | 1f44
+ map(0x007823, 0x007823).w(FUNC(sunplus_gcm394_base_device::unkarea_7823_w)); // 0047 | 0044
+ map(0x007824, 0x007824).w(FUNC(sunplus_gcm394_base_device::unkarea_7824_w)); // 0047 | 0044
map(0x00782d, 0x00782d).rw(FUNC(sunplus_gcm394_base_device::unkarea_782d_r), FUNC(sunplus_gcm394_base_device::unkarea_782d_w)); // on startup
@@ -437,7 +446,7 @@ void sunplus_gcm394_base_device::device_start()
m_space_read_cb.resolve_safe(0);
m_space_write_cb.resolve();
- m_bank_write_cb.resolve();
+ m_mapping_write_cb.resolve();
m_unk_timer = timer_alloc(0);
@@ -524,12 +533,25 @@ void sunplus_gcm394_base_device::device_reset()
}
+IRQ_CALLBACK_MEMBER(sunplus_gcm394_base_device::irq_vector_cb)
+{
+ //printf("irq_vector_cb %d\n", irqline);
+
+ if (irqline == UNSP_IRQ6_LINE)
+ set_state_unsynced(UNSP_IRQ6_LINE, CLEAR_LINE);
+
+ return 0;
+}
+
+
void sunplus_gcm394_base_device::checkirq6()
{
+/*
if (m_7935 & 0x0100)
set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
else
set_state_unsynced(UNSP_IRQ6_LINE, CLEAR_LINE);
+*/
}
void sunplus_gcm394_base_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
@@ -539,7 +561,8 @@ void sunplus_gcm394_base_device::device_timer(emu_timer &timer, device_timer_id
case 0:
{
m_7935 |= 0x0100;
- checkirq6();
+ set_state_unsynced(UNSP_IRQ6_LINE, ASSERT_LINE);
+ // checkirq6();
break;
}
}
diff --git a/src/devices/machine/sunplus_gcm394.h b/src/devices/machine/sunplus_gcm394.h
index 01f2f13abca..1a6ae8f5619 100644
--- a/src/devices/machine/sunplus_gcm394.h
+++ b/src/devices/machine/sunplus_gcm394.h
@@ -32,7 +32,7 @@ public:
m_porta_out(*this),
m_space_read_cb(*this),
m_space_write_cb(*this),
- m_bank_write_cb(*this)
+ m_mapping_write_cb(*this)
{
}
@@ -43,16 +43,17 @@ public:
auto porta_out() { return m_porta_out.bind(); }
-
auto space_read_callback() { return m_space_read_cb.bind(); }
auto space_write_callback() { return m_space_write_cb.bind(); }
- auto bank_write_callback() { return m_bank_write_cb.bind(); }
+ auto mapping_write_callback() { return m_mapping_write_cb.bind(); }
DECLARE_WRITE_LINE_MEMBER(vblank) { m_spg_video->vblank(state); }
virtual void device_add_mconfig(machine_config& config) override;
+ IRQ_CALLBACK_MEMBER(irq_vector_cb);
+
protected:
virtual void device_start() override;
@@ -140,7 +141,7 @@ protected:
private:
devcb_read16 m_space_read_cb;
devcb_write16 m_space_write_cb;
- devcb_write16 m_bank_write_cb;
+ devcb_write16 m_mapping_write_cb;
DECLARE_READ16_MEMBER(unk_r);
DECLARE_WRITE16_MEMBER(unk_w);
diff --git a/src/devices/machine/sunplus_gcm394_video.cpp b/src/devices/machine/sunplus_gcm394_video.cpp
index 4a4095aa9bd..44a574e99bf 100644
--- a/src/devices/machine/sunplus_gcm394_video.cpp
+++ b/src/devices/machine/sunplus_gcm394_video.cpp
@@ -285,7 +285,7 @@ void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, ui
}
else
{
- pen = machine().rand() & 0x1f;
+ //pen = machine().rand() & 0x1f;
// 8bpp
}
@@ -518,10 +518,10 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
{
memset(&m_screenbuf[320 * cliprect.min_y], 0, 4 * 320 * ((cliprect.max_y - cliprect.min_y) + 1));
- const uint32_t page1_addr = 0x40 * m_page1_addr;
- const uint32_t page2_addr = 0x40 * m_page2_addr;
- uint16_t* page1_regs = m_tmap0_regs;
- uint16_t* page2_regs = m_tmap1_regs;
+ const uint32_t page0_addr = 0x40 * (m_page0_addr | (m_page0_addr_msb<<16));
+ const uint32_t page1_addr = 0x40 * (m_page1_addr | (m_page1_addr_msb<<16));
+ uint16_t* page0_regs = m_tmap0_regs;
+ uint16_t* page1_regs = m_tmap1_regs;
for (uint32_t scanline = (uint32_t)cliprect.min_y; scanline <= (uint32_t)cliprect.max_y; scanline++)
{
@@ -529,8 +529,8 @@ uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_r
{
if (1)
{
+ draw_page(cliprect, scanline, i, page0_addr, page0_regs);
draw_page(cliprect, scanline, i, page1_addr, page1_regs);
- draw_page(cliprect, scanline, i, page2_addr, page2_regs);
}
draw_sprites(cliprect, scanline, i);
}
@@ -595,15 +595,16 @@ WRITE16_MEMBER(gcm394_base_video_device::tmap0_regs_w)
write_tmap_regs(0, m_tmap0_regs, offset, data);
}
-WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk0_w)
+WRITE16_MEMBER(gcm394_base_video_device::tmap0_tilebase_lsb_w)
{
- LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
- m_page1_addr = data;
+ LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_tilebase_lsb_w %04x\n", machine().describe_context(), data);
+ m_page0_addr = data;
}
-WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk1_w)
+WRITE16_MEMBER(gcm394_base_video_device::tmap0_tilebase_msb_w)
{
- LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_unk1_w %04x\n", machine().describe_context(), data);
+ LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap0_tilebase_msb_w %04x\n", machine().describe_context(), data);
+ m_page0_addr_msb = data;
}
// **************************************** TILEMAP 1 *************************************************
@@ -616,15 +617,16 @@ WRITE16_MEMBER(gcm394_base_video_device::tmap1_regs_w)
write_tmap_regs(1, m_tmap1_regs, offset, data);
}
-WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk0_w)
+WRITE16_MEMBER(gcm394_base_video_device::tmap1_tilebase_lsb_w)
{
- LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_unk0_w %04x\n", machine().describe_context(), data);
- m_page2_addr = data;
+ LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_tilebase_lsb_w %04x\n", machine().describe_context(), data);
+ m_page1_addr = data;
}
-WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk1_w)
+WRITE16_MEMBER(gcm394_base_video_device::tmap1_tilebase_msb_w)
{
- LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_unk1_w %04x\n", machine().describe_context(), data);
+ LOGMASKED(LOG_GCM394_TMAP, "%s:gcm394_base_video_device::tmap1_tilebase_msb_w %04x\n", machine().describe_context(), data);
+ m_page1_addr_msb = data;
}
// **************************************** unknown video device 0 (another tilemap? sprite layer?) *************************************************
@@ -757,6 +759,11 @@ WRITE16_MEMBER(gcm394_base_video_device::video_dma_unk_w)
}
+READ16_MEMBER(gcm394_base_video_device::video_707c_r)
+{
+ LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_707c_r\n", machine().describe_context());
+ return 0x8000;
+}
READ16_MEMBER(gcm394_base_video_device::video_707f_r) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_707f_r\n", machine().describe_context()); return m_707f; }
@@ -791,7 +798,12 @@ WRITE16_MEMBER(gcm394_base_video_device::video_7063_w)
WRITE16_MEMBER(gcm394_base_video_device::video_702a_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_702a_w %04x\n", machine().describe_context(), data); m_702a = data; }
// read in IRQ
-READ16_MEMBER(gcm394_base_video_device::video_7030_r) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_r\n", machine().describe_context()); return m_7030; }
+READ16_MEMBER(gcm394_base_video_device::video_7030_r)
+{
+ LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_r\n", machine().describe_context());
+ return 0x0000; /* wrlshunt ends up doing an explicit jump to 0000 shortly after boot if you just return the value written here, what is it? do we want to be returning non-zero to continue, with the problem being elsewhere, or is this the problem? */
+}
+
WRITE16_MEMBER(gcm394_base_video_device::video_7030_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7030_w %04x\n", machine().describe_context(), data); m_7030 = data; }
WRITE16_MEMBER(gcm394_base_video_device::video_703c_w) { LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_703c_w %04x\n", machine().describe_context(), data); m_703c = data; }
diff --git a/src/devices/machine/sunplus_gcm394_video.h b/src/devices/machine/sunplus_gcm394_video.h
index 952e3bb9e46..0c4940bf53d 100644
--- a/src/devices/machine/sunplus_gcm394_video.h
+++ b/src/devices/machine/sunplus_gcm394_video.h
@@ -29,13 +29,13 @@ public:
DECLARE_READ16_MEMBER(tmap0_regs_r);
DECLARE_WRITE16_MEMBER(tmap0_regs_w);
- DECLARE_WRITE16_MEMBER(tmap0_unk0_w);
- DECLARE_WRITE16_MEMBER(tmap0_unk1_w);
+ DECLARE_WRITE16_MEMBER(tmap0_tilebase_lsb_w);
+ DECLARE_WRITE16_MEMBER(tmap0_tilebase_msb_w);
DECLARE_READ16_MEMBER(tmap1_regs_r);
DECLARE_WRITE16_MEMBER(tmap1_regs_w);
- DECLARE_WRITE16_MEMBER(tmap1_unk0_w);
- DECLARE_WRITE16_MEMBER(tmap1_unk1_w);
+ DECLARE_WRITE16_MEMBER(tmap1_tilebase_lsb_w);
+ DECLARE_WRITE16_MEMBER(tmap1_tilebase_msb_w);
DECLARE_WRITE16_MEMBER(unknown_video_device0_regs_w);
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk0_w);
@@ -69,6 +69,7 @@ public:
DECLARE_WRITE16_MEMBER(video_7030_w);
DECLARE_WRITE16_MEMBER(video_703c_w);
+ DECLARE_READ16_MEMBER(video_707c_r);
DECLARE_READ16_MEMBER(video_707f_r);
DECLARE_WRITE16_MEMBER(video_707f_w);
@@ -155,8 +156,11 @@ protected:
// required_shared_ptr<uint16_t> m_scrollram;
required_shared_ptr<uint16_t> m_spriteram;
+ uint16_t m_page0_addr;
+ uint16_t m_page0_addr_msb;
+
uint16_t m_page1_addr;
- uint16_t m_page2_addr;
+ uint16_t m_page1_addr_msb;
uint16_t m_videodma_bank;
uint16_t m_videodma_size;