summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/sunplus_gcm394.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/sunplus_gcm394.cpp')
-rw-r--r--src/devices/machine/sunplus_gcm394.cpp299
1 files changed, 219 insertions, 80 deletions
diff --git a/src/devices/machine/sunplus_gcm394.cpp b/src/devices/machine/sunplus_gcm394.cpp
index 05e74a259a4..501147b5eba 100644
--- a/src/devices/machine/sunplus_gcm394.cpp
+++ b/src/devices/machine/sunplus_gcm394.cpp
@@ -85,6 +85,17 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_params_channel1_w)
write_dma_params(1, offset, data);
}
+READ16_MEMBER(sunplus_gcm394_base_device::system_dma_params_channel2_r)
+{
+ return read_dma_params(2, offset);
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_params_channel2_w)
+{
+ write_dma_params(2, offset, data);
+}
+
+
READ16_MEMBER(sunplus_gcm394_base_device::system_dma_status_r)
@@ -174,8 +185,15 @@ void sunplus_gcm394_base_device::trigger_systemm_dma(address_space &space, int c
WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_trigger_w)
{
- if (data & 0x01) trigger_systemm_dma(space, 0, data);
- if (data & 0x02) trigger_systemm_dma(space, 1, data);
+ // trigger is value based, not bit based, how many channels are there?
+
+ if (data == 1) trigger_systemm_dma(space, 0, data);
+ else if (data == 2) trigger_systemm_dma(space, 1, data);
+ else if (data == 3) trigger_systemm_dma(space, 2, data);
+ else
+ {
+ fatalerror("unknown DMA trigger type\n");
+ }
}
READ16_MEMBER(sunplus_gcm394_base_device::system_dma_memtype_r)
@@ -186,10 +204,40 @@ READ16_MEMBER(sunplus_gcm394_base_device::system_dma_memtype_r)
WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_memtype_w)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::system_dma_memtype_w %04x\n", machine().describe_context(), data);
+ static char const* const types[16] =
+ {
+ "Unused / USB",
+ "DAC CHA",
+ "UART TX",
+ "UART RX",
+ "SD/MMC",
+ "NAND Flash",
+ "Serial Interface",
+ "DAC CHB",
+ "ADC Audo Sample Full",
+ "SPI TX",
+ "SPI RX",
+ "RESERVED (c)",
+ "RESERVED (d)",
+ "RESERVED (e)",
+ "RESERVED (f)"
+ };
+
m_system_dma_memtype = data;
+
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::system_dma_memtype_w %04x (CH3: %s | CH2: %s | CH1: %s | CH0: %s )\n", machine().describe_context(), data,
+ types[((m_system_dma_memtype>>12)&0xf)],
+ types[((m_system_dma_memtype>>8)&0xf)],
+ types[((m_system_dma_memtype>>4)&0xf)],
+ types[((m_system_dma_memtype)&0xf)]);
+
}
+READ16_MEMBER(sunplus_gcm394_base_device::system_7a3a_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::system_7a3a_r\n", machine().describe_context());
+ return machine().rand();
+}
// **************************************** 78xx region with some handling *************************************************
@@ -212,9 +260,6 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7819_w) { LOGMASKED(LOG_GCM39
// **************************************** 78xx region stubs *************************************************
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7868_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7868_r\n", machine().describe_context()); return machine().rand(); }
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7869_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7869_r\n", machine().describe_context()); return machine().rand(); }
-
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_782d_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_782d_r\n", machine().describe_context()); return m_782d; }
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_782d_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_782d_w %04x\n", machine().describe_context(), data); m_782d = data; }
@@ -288,6 +333,8 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7835_w) { LOGMASKED(LOG_GCM39
// IO here?
+// Port A
+
READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7860_porta_r)
{
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7860_porta_r\n", machine().describe_context());
@@ -300,59 +347,123 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7860_porta_w)
m_porta_out(data);
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7861_r)
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7861_porta_buffer_r)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7861_r\n", machine().describe_context());
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7861_porta_buffer_r\n", machine().describe_context());
return 0x0000;// 0xffff;// m_7861;
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7862_r)
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7862_porta_direction_r)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7862_r\n", machine().describe_context());
- return 0x0000;// m_7862;
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7862_porta_direction_r\n", machine().describe_context());
+ return m_7862_porta_direction;
}
-WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7862_w)
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7862_porta_direction_w)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7862_w %04x\n", machine().describe_context(), data);
- m_7862 = data;
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7862_porta_direction_w %04x\n", machine().describe_context(), data);
+ m_7862_porta_direction = data;
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7863_r)
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7863_porta_attribute_r)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7863_r\n", machine().describe_context());
- return 0x0000; //0xffff;// m_7863;
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7863_porta_attribute_r\n", machine().describe_context());
+ return m_7863_porta_attribute;
}
-WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7863_w)
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7863_porta_attribute_w)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7863_w %04x\n", machine().describe_context(), data);
- m_7863 = data;
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7863_porta_attribute_w %04x\n", machine().describe_context(), data);
+ m_7863_porta_attribute = data;
}
-// similar read/write pattern to above, 2nd group?
+// Port B
-READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7870_portb_r)
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7868_portb_r)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7870_portb_r\n", machine().describe_context());
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7868_portb_r\n", machine().describe_context());
return m_portb_in();
}
-WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7870_portb_w)
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7869_portb_buffer_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7869_portb_buffer_r\n", machine().describe_context());
+ return machine().rand();
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7868_portb_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7868_portb_w %04x\n", machine().describe_context(), data);
+ //m_portb_out(data);
+}
+
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_786a_portb_direction_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_786a_portb_direction_r\n", machine().describe_context());
+ return m_786a_portb_direction;
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_786a_portb_direction_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_786a_portb_direction_w %04x\n", machine().describe_context(), data);
+ m_786a_portb_direction = data;
+}
+
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_786b_portb_attribute_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_786b_portb_attribute_r\n", machine().describe_context());
+ return m_786b_portb_attribute;
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_786b_portb_attribute_w)
{
- LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7870_portb_w %04x\n", machine().describe_context(), data);
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_786b_portb_attribute_w %04x\n", machine().describe_context(), data);
+ m_786b_portb_attribute = data;
+}
+
+// Port C
+
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7870_portc_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7870_portc_r\n", machine().describe_context());
+ return m_portc_in();
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7870_portc_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7870_portc_w %04x\n", machine().describe_context(), data);
m_7870 = data;
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7871_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7871_r\n", machine().describe_context()); return 0xffff;// m_7871;
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7871_portc_buffer_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7871_portc_buffer_r\n", machine().describe_context());
+ return 0xffff;// m_7871;
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7872_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7872_r\n", machine().describe_context()); return 0xffff;// m_7872;
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7872_portc_direction_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7872_portc_direction_r\n", machine().describe_context());
+ return m_7872_portc_direction;
}
-WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7872_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7872_w %04x\n", machine().describe_context(), data); m_7872 = data; }
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7873_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7873_r\n", machine().describe_context()); return 0xffff;// m_7873;
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7872_portc_direction_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7872_portc_direction_w %04x\n", machine().describe_context(), data);
+ m_7872_portc_direction = data;
+}
+
+READ16_MEMBER(sunplus_gcm394_base_device::ioarea_7873_portc_attribute_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7873_portc_attribute_r\n", machine().describe_context());
+ return m_7873_portc_attribute;
+}
+
+WRITE16_MEMBER(sunplus_gcm394_base_device::ioarea_7873_portc_attribute_w)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioarea_7873_portc_attribute_w %04x\n", machine().describe_context(), data);
+ m_7873_portc_attribute = data;
}
-WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7873_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7873_w %04x\n", machine().describe_context(), data); m_7873 = data; }
@@ -368,7 +479,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a0_w) { LOGMASKED(LOG_GCM39
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78a0_r)
{
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a0_r\n", machine().describe_context());
- return machine().rand();
+ return 0x0000;// machine().rand();
}
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78a1_r)
@@ -398,7 +509,11 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_w) { LOGMASKED(LOG_GCM39
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b8_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b8_w %04x\n", machine().describe_context(), data); m_78b8 = data; }
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78f0_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78f0_w %04x\n", machine().describe_context(), data); m_78f0 = data; }
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78d0_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78d0_r\n", machine().describe_context()); return machine().rand(); }
+READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78d0_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78d0_r\n", machine().describe_context());
+ return machine().rand();
+}
// **************************************** 79xx region stubs *************************************************
@@ -415,8 +530,18 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7935_w)
//checkirq6();
}
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7944_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7944_r\n", machine().describe_context()); return machine().rand(); }
-READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7945_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7945_r\n", machine().describe_context()); return machine().rand(); }
+// these are related to the accelerometer values on jak_g500 (8-bit signed) and also the SPI reads for bkrankp
+READ16_MEMBER(sunplus_gcm394_base_device::spi_7944_rxdata_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::spi_7944_rxdata_r\n", machine().describe_context());
+ return machine().rand();
+}
+
+READ16_MEMBER(sunplus_gcm394_base_device::spi_7945_misc_control_reg_r)
+{
+ LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::spi_7945_misc_control_reg_r\n", machine().describe_context());
+ return machine().rand();// &0x0007;
+}
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; }
@@ -470,21 +595,23 @@ void sunplus_gcm394_base_device::base_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(0x00701c, 0x00701c).w(m_spg_video, FUNC(gcm394_base_video_device::video_701c_w));
+
// tilebase LSBs
- map(0x007020, 0x007020).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_w)); // tilebase, written with other tmap0 regs
- map(0x007021, 0x007021).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_w)); // tilebase, written with other tmap1 regs
+ map(0x007020, 0x007020).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap0_tilebase_lsb_w)); // tilebase, written with other tmap0 regs
+ map(0x007021, 0x007021).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap1_tilebase_lsb_w)); // tilebase, written with other tmap1 regs
map(0x007022, 0x007022).rw(m_spg_video, FUNC(gcm394_base_video_device::sprite_7022_gfxbase_lsb_r), FUNC(gcm394_base_video_device::sprite_7022_gfxbase_lsb_w)); // sprite tilebase written as 7022, 702d and 7042 group
- map(0x007023, 0x007023).rw(m_spg_video, FUNC(gcm394_base_video_device::unk_vid1_gfxbase_lsb_r), FUNC(gcm394_base_video_device::unk_vid1_gfxbase_lsb_w)); // written with other unknown_video_device1 regs (roz layer or line layer?)
- map(0x007024, 0x007024).rw(m_spg_video, FUNC(gcm394_base_video_device::unk_vid2_gfxbase_lsb_r), FUNC(gcm394_base_video_device::unk_vid2_gfxbase_lsb_w)); // written with other unknown_video_device2 regs (roz layer or line layer?)
+ map(0x007023, 0x007023).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap2_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap2_tilebase_lsb_w)); // written with other tmap2 regs (roz layer or line layer?)
+ map(0x007024, 0x007024).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap3_tilebase_lsb_r), FUNC(gcm394_base_video_device::tmap3_tilebase_lsb_w)); // written with other tmap3 regs (roz layer or line layer?)
map(0x00702a, 0x00702a).w(m_spg_video, FUNC(gcm394_base_video_device::video_702a_w)); // blend level control
// tilebase MSBs
- map(0x00702b, 0x00702b).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap0_tilebase_msb_w)); // written with other tmap0 regs
- map(0x00702c, 0x00702c).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap1_tilebase_msb_w)); // written with other tmap1 regs
+ map(0x00702b, 0x00702b).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap0_tilebase_msb_w)); // written with other tmap0 regs
+ map(0x00702c, 0x00702c).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap1_tilebase_msb_w)); // written with other tmap1 regs
map(0x00702d, 0x00702d).rw(m_spg_video, FUNC(gcm394_base_video_device::sprite_702d_gfxbase_msb_r), FUNC(gcm394_base_video_device::sprite_702d_gfxbase_msb_w)); // sprites, written as 7022, 702d and 7042 group
- map(0x00702e, 0x00702e).rw(m_spg_video, FUNC(gcm394_base_video_device::unk_vid1_gfxbase_msb_r), FUNC(gcm394_base_video_device::unk_vid1_gfxbase_msb_w)); // written with other unknown_video_device1 regs (roz layer or line layer?)
- map(0x00702f, 0x00702f).rw(m_spg_video, FUNC(gcm394_base_video_device::unk_vid2_gfxbase_msb_r), FUNC(gcm394_base_video_device::unk_vid2_gfxbase_msb_w)); // written with other unknown_video_device2 regs (roz layer or line layer?)
+ map(0x00702e, 0x00702e).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap2_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap2_tilebase_msb_w)); // written with other tmap2 regs (roz layer or line layer?)
+ map(0x00702f, 0x00702f).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap3_tilebase_msb_r), FUNC(gcm394_base_video_device::tmap3_tilebase_msb_w)); // written with other tmap3 regs (roz layer or line layer?)
map(0x007030, 0x007030).rw(m_spg_video, FUNC(gcm394_base_video_device::video_7030_brightness_r), FUNC(gcm394_base_video_device::video_7030_brightness_w));
map(0x007038, 0x007038).r(m_spg_video, FUNC(gcm394_base_video_device::video_curline_r));
@@ -504,7 +631,7 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
map(0x007072, 0x007072).rw(m_spg_video, FUNC(gcm394_base_video_device::video_dma_size_busy_r), FUNC(gcm394_base_video_device::video_dma_size_trigger_w)); //
// these don't exist on older SPG
- 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(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(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(0x00707f, 0x00707f).rw(m_spg_video, FUNC(gcm394_base_video_device::video_707f_r), FUNC(gcm394_base_video_device::video_707f_w));
@@ -524,8 +651,8 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
// 73xx-77xx = video ram
// ######################################################################################################################################################################################
- map(0x007100, 0x0071ff).ram().share("unkram1"); // maybe a line table? (assuming DMA isn't writing to wrong place)
- map(0x007200, 0x0072ff).ram().share("unkram2"); // ^^
+ map(0x007100, 0x0071ff).ram().share("rowscroll"); // based on jak_s500
+ map(0x007200, 0x0072ff).ram().share("rowzoom"); // ^^
map(0x007300, 0x0073ff).rw(m_spg_video, FUNC(gcm394_base_video_device::palette_r), FUNC(gcm394_base_video_device::palette_w));
@@ -581,40 +708,36 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
// ######################################################################################################################################################################################
map(0x007860, 0x007860).rw(FUNC(sunplus_gcm394_base_device::ioarea_7860_porta_r), FUNC(sunplus_gcm394_base_device::ioarea_7860_porta_w)); // 7860 I/O PortA Data Register
- map(0x007861, 0x007861).r(FUNC(sunplus_gcm394_base_device::unkarea_7861_r)); // 7861 I/O PortA Buffer Register
- map(0x007862, 0x007862).rw(FUNC(sunplus_gcm394_base_device::unkarea_7862_r), FUNC(sunplus_gcm394_base_device::unkarea_7862_w)); // 7862 I/O PortA Direction Register
- map(0x007863, 0x007863).rw(FUNC(sunplus_gcm394_base_device::unkarea_7863_r), FUNC(sunplus_gcm394_base_device::unkarea_7863_w)); // 7863 I/O PortA Attribute Register
-
- map(0x007868, 0x007868).r(FUNC(sunplus_gcm394_base_device::unkarea_7868_r)); // on startup // 7868 I/O PortB Data Register
- map(0x007869, 0x007869).r(FUNC(sunplus_gcm394_base_device::unkarea_7869_r)); // 7869 I/O PortB Buffer Register // jak_s500
- // 786a I/O PortB Direction Register
- // 786b I/O PortB Attribute Register
- // 786a I/O PortB Direction Register
+ map(0x007861, 0x007861).r(FUNC(sunplus_gcm394_base_device::ioarea_7861_porta_buffer_r)); // 7861 I/O PortA Buffer Register
+ map(0x007862, 0x007862).rw(FUNC(sunplus_gcm394_base_device::ioarea_7862_porta_direction_r), FUNC(sunplus_gcm394_base_device::ioarea_7862_porta_direction_w)); // 7862 I/O PortA Direction Register
+ map(0x007863, 0x007863).rw(FUNC(sunplus_gcm394_base_device::ioarea_7863_porta_attribute_r), FUNC(sunplus_gcm394_base_device::ioarea_7863_porta_attribute_w)); // 7863 I/O PortA Attribute Register
+
+ map(0x007868, 0x007868).rw(FUNC(sunplus_gcm394_base_device::ioarea_7868_portb_r), FUNC(sunplus_gcm394_base_device::ioarea_7868_portb_w)); // on startup // 7868 I/O PortB Data Register
+ map(0x007869, 0x007869).r(FUNC(sunplus_gcm394_base_device::ioarea_7869_portb_buffer_r)); // 7869 I/O PortB Buffer Register // jak_s500
+ map(0x00786a, 0x00786a).rw(FUNC(sunplus_gcm394_base_device::ioarea_786a_portb_direction_r), FUNC(sunplus_gcm394_base_device::ioarea_786a_portb_direction_w)); // 786a I/O PortB Direction Register
+ map(0x00786b, 0x00786b).rw(FUNC(sunplus_gcm394_base_device::ioarea_786b_portb_attribute_r), FUNC(sunplus_gcm394_base_device::ioarea_786b_portb_attribute_w)); // 786b I/O PortB Attribute Register
// 786c I/O PortB Latch / Wakeup
- map(0x007870, 0x007870).rw(FUNC(sunplus_gcm394_base_device::ioarea_7870_portb_r) ,FUNC(sunplus_gcm394_base_device::ioarea_7870_portb_w)); // 7870 I/O PortC Data Register
- map(0x007871, 0x007871).r(FUNC(sunplus_gcm394_base_device::unkarea_7871_r)); // 7871 I/O PortC Buffer Register
- map(0x007872, 0x007872).rw(FUNC(sunplus_gcm394_base_device::unkarea_7872_r), FUNC(sunplus_gcm394_base_device::unkarea_7872_w)); // 7872 I/O PortC Direction Register
- map(0x007873, 0x007873).rw(FUNC(sunplus_gcm394_base_device::unkarea_7873_r), FUNC(sunplus_gcm394_base_device::unkarea_7873_w)); // 7873 I/O PortC Attribute Register
- // 7874 (data 0x1249)
- // 787c (data 0x1249)
- // 787e (data 0x1249)
+ map(0x007870, 0x007870).rw(FUNC(sunplus_gcm394_base_device::ioarea_7870_portc_r) ,FUNC(sunplus_gcm394_base_device::ioarea_7870_portc_w)); // 7870 I/O PortC Data Register
+ map(0x007871, 0x007871).r(FUNC(sunplus_gcm394_base_device::ioarea_7871_portc_buffer_r)); // 7871 I/O PortC Buffer Register
+ map(0x007872, 0x007872).rw(FUNC(sunplus_gcm394_base_device::ioarea_7872_portc_direction_r), FUNC(sunplus_gcm394_base_device::ioarea_7872_portc_direction_w)); // 7872 I/O PortC Direction Register
+ map(0x007873, 0x007873).rw(FUNC(sunplus_gcm394_base_device::ioarea_7873_portc_attribute_r), FUNC(sunplus_gcm394_base_device::ioarea_7873_portc_attribute_w)); // 7873 I/O PortC Attribute Register
+
+ // 7874 (data 0x1249) (bkrankp data 0x36db)
+ // 787c (data 0x1249) (bkrankp data 0x36db)
+ // 787e (data 0x1249) (bkrankp data 0x36db)
// 7878 I/O PortD Data Register
// 7879 I/O PortD Buffer Register
// 787a I/O PortD Direction Register
// 787b I/O PortD Attribute Register
- // ######################################################################################################################################################################################
- // 788x - more IO?
- // ######################################################################################################################################################################################
-
// 7880
map(0x007882, 0x007882).rw(FUNC(sunplus_gcm394_base_device::unkarea_7882_r), FUNC(sunplus_gcm394_base_device::unkarea_7882_w));
map(0x007883, 0x007883).rw(FUNC(sunplus_gcm394_base_device::unkarea_7883_r), FUNC(sunplus_gcm394_base_device::unkarea_7883_w));
- // 0x7888 (data 0x1249)
+ // 0x7888 (data 0x1249) (bkrankp data 0x36db), written with 7874 / 787c / 787e above
// ######################################################################################################################################################################################
// 78ax - interrupt controller?
@@ -659,8 +782,12 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
map(0x007935, 0x007935).rw(FUNC(sunplus_gcm394_base_device::unkarea_7935_r), FUNC(sunplus_gcm394_base_device::unkarea_7935_w));
map(0x007936, 0x007936).rw(FUNC(sunplus_gcm394_base_device::unkarea_7936_r), FUNC(sunplus_gcm394_base_device::unkarea_7936_w));
- map(0x007944, 0x007944).r(FUNC(sunplus_gcm394_base_device::unkarea_7945_r)); // jak_s500
- map(0x007945, 0x007945).r(FUNC(sunplus_gcm394_base_device::unkarea_7945_r)); // jak_s500
+ //7940 P_SPI_Ctrl - SPI Control Register
+ //7941 P_SPI_TXStatus - SPI Transmit Status Register
+ //7942 P_SPI_TXData - SPI Transmit FIFO Register
+ //7943 P_SPI_RXStatus - SPI Receive Status Register
+ map(0x007944, 0x007944).r(FUNC(sunplus_gcm394_base_device::spi_7944_rxdata_r)); // 7944 P_SPI_RXData - SPI Receive FIFO Register (jak_s500 accelerometer) (also the SPI ROM DMA input port for bkrankp?)
+ map(0x007945, 0x007945).r(FUNC(sunplus_gcm394_base_device::spi_7945_misc_control_reg_r)); // 7945 P_SPI_Misc - SPI Misc Control Register (jak_s500 accelerometer)
// possible adc?
map(0x007960, 0x007960).w(FUNC(sunplus_gcm394_base_device::unkarea_7960_w));
@@ -670,9 +797,13 @@ void sunplus_gcm394_base_device::base_internal_map(address_map &map)
// 7axx region = system (including dma)
// ######################################################################################################################################################################################
- map(0x007a3a, 0x007a3a).r(FUNC(sunplus_gcm394_base_device::system_7a3a_r));
+ map(0x007a3a, 0x007a3a).r(FUNC(sunplus_gcm394_base_device::system_7a3a_r)); // ?
+
map(0x007a80, 0x007a86).rw(FUNC(sunplus_gcm394_base_device::system_dma_params_channel0_r), FUNC(sunplus_gcm394_base_device::system_dma_params_channel0_w));
map(0x007a88, 0x007a8e).rw(FUNC(sunplus_gcm394_base_device::system_dma_params_channel1_r), FUNC(sunplus_gcm394_base_device::system_dma_params_channel1_w)); // jak_tsm writes here
+ map(0x007a90, 0x007a96).rw(FUNC(sunplus_gcm394_base_device::system_dma_params_channel2_r), FUNC(sunplus_gcm394_base_device::system_dma_params_channel2_w)); // bkrankp writes here (is this on all types or just SPI?)
+ //map(0x007a98, 0x007a9e).rw(FUNC(sunplus_gcm394_base_device::system_dma_params_channel3_r), FUNC(sunplus_gcm394_base_device::system_dma_params_channel3_w)); // not seen, but probably
+
map(0x007abe, 0x007abe).rw(FUNC(sunplus_gcm394_base_device::system_dma_memtype_r), FUNC(sunplus_gcm394_base_device::system_dma_memtype_w)); // 7abe - written with DMA stuff (source type for each channel so that device handles timings properly?)
map(0x007abf, 0x007abf).rw(FUNC(sunplus_gcm394_base_device::system_dma_status_r), FUNC(sunplus_gcm394_base_device::system_dma_trigger_w));
@@ -1062,6 +1193,7 @@ void sunplus_gcm394_base_device::device_start()
m_porta_in.resolve_safe(0);
m_portb_in.resolve_safe(0);
+ m_portc_in.resolve_safe(0);
m_porta_out.resolve();
@@ -1087,12 +1219,16 @@ void sunplus_gcm394_base_device::device_start()
save_item(NAME(m_7835));
save_item(NAME(m_7860));
save_item(NAME(m_7861));
- save_item(NAME(m_7862));
- save_item(NAME(m_7863));
+ save_item(NAME(m_7862_porta_direction));
+ save_item(NAME(m_7863_porta_attribute));
+
+ save_item(NAME(m_786a_portb_direction));
+ save_item(NAME(m_786b_portb_attribute));
+
save_item(NAME(m_7870));
- save_item(NAME(m_7871));
- save_item(NAME(m_7872));
- save_item(NAME(m_7873));
+ //save_item(NAME(m_7871));
+ save_item(NAME(m_7872_portc_direction));
+ save_item(NAME(m_7873_portc_attribute));
save_item(NAME(m_7882));
save_item(NAME(m_7883));
save_item(NAME(m_78a0));
@@ -1120,7 +1256,7 @@ void sunplus_gcm394_base_device::device_reset()
{
unsp_20_device::device_reset();
- for (int j = 0; j < 2; j++)
+ for (int j = 0; j < 3; j++)
{
for (int i = 0; i < 7; i++)
{
@@ -1154,15 +1290,18 @@ void sunplus_gcm394_base_device::device_reset()
m_7861 = 0x0000;
- m_7862 = 0x0000;
- m_7863 = 0x0000;
+ m_7862_porta_direction = 0x0000;
+ m_7863_porta_attribute = 0x0000;
+
+ m_786a_portb_direction = 0x0000;
+ m_786b_portb_attribute = 0x0000;
m_7870 = 0x0000;
- m_7871 = 0x0000;
+ //m_7871 = 0x0000;
- m_7872 = 0x0000;
- m_7873 = 0x0000;
+ m_7872_portc_direction = 0x0000;
+ m_7873_portc_attribute = 0x0000;
m_7882 = 0x0000;
m_7883 = 0x0000;