mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
allow smartfp to show.. something (nw) (#5030)
* smartfp generate an interrupt, add a palette (nw) * video registers look a lot like the spg220 hw here (nw) * getting ready to split into video (nw) * code shuffle (nw) * shuffle (nw) * (nw) * (nw) * (nw)
This commit is contained in:
parent
a62ca583c4
commit
de235f4623
@ -2673,6 +2673,8 @@ if (MACHINES["SPG2XX"]~=null) then
|
|||||||
MAME_DIR .. "src/devices/machine/spg110_video.h",
|
MAME_DIR .. "src/devices/machine/spg110_video.h",
|
||||||
MAME_DIR .. "src/devices/machine/sunplus_gcm394.cpp",
|
MAME_DIR .. "src/devices/machine/sunplus_gcm394.cpp",
|
||||||
MAME_DIR .. "src/devices/machine/sunplus_gcm394.h",
|
MAME_DIR .. "src/devices/machine/sunplus_gcm394.h",
|
||||||
|
MAME_DIR .. "src/devices/machine/sunplus_gcm394_video.cpp",
|
||||||
|
MAME_DIR .. "src/devices/machine/sunplus_gcm394_video.h",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ void unsp_20_device::execute_extended_group(uint16_t op)
|
|||||||
// Ext Push/Pop
|
// Ext Push/Pop
|
||||||
if (ximm & 0x8000)
|
if (ximm & 0x8000)
|
||||||
{
|
{
|
||||||
|
// just skip for now, as nothing really even uses the extended registers yet
|
||||||
|
/*
|
||||||
uint8_t rb = (ximm & 0x000f) >> 0;
|
uint8_t rb = (ximm & 0x000f) >> 0;
|
||||||
uint8_t size = (ximm & 0x7000) >> 12;
|
uint8_t size = (ximm & 0x7000) >> 12;
|
||||||
uint8_t rx = (ximm & 0x0e00) >> 9;
|
uint8_t rx = (ximm & 0x0e00) >> 9;
|
||||||
@ -59,11 +61,14 @@ void unsp_20_device::execute_extended_group(uint16_t op)
|
|||||||
extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]);
|
extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]);
|
||||||
else
|
else
|
||||||
logerror("(Ext) push <BAD>\n");
|
logerror("(Ext) push <BAD>\n");
|
||||||
|
*/
|
||||||
unimplemented_opcode(op, ximm);
|
//unimplemented_opcode(op, ximm);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// just skip for now, as nothing really even uses the extended registers yet
|
||||||
|
/*
|
||||||
uint8_t rb = (ximm & 0x000f) >> 0;
|
uint8_t rb = (ximm & 0x000f) >> 0;
|
||||||
uint8_t size = (ximm & 0x7000) >> 12;
|
uint8_t size = (ximm & 0x7000) >> 12;
|
||||||
uint8_t rx = (ximm & 0x0e00) >> 9;
|
uint8_t rx = (ximm & 0x0e00) >> 9;
|
||||||
@ -71,14 +76,15 @@ void unsp_20_device::execute_extended_group(uint16_t op)
|
|||||||
if (size == 0) size = 8;
|
if (size == 0) size = 8;
|
||||||
size -= 1;
|
size -= 1;
|
||||||
|
|
||||||
|
|
||||||
if ((rx-size) >= 0)
|
if ((rx-size) >= 0)
|
||||||
logerror("(Ext) pop %s, %s from [%s]\n",
|
logerror("(Ext) pop %s, %s from [%s]\n",
|
||||||
extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]);
|
extregs[rx-size], extregs[rx], (rb & 0x8) ? extregs[rb & 0x7] : regs[rb & 0x7]);
|
||||||
else
|
else
|
||||||
logerror("(Ext) pop <BAD>\n");
|
logerror("(Ext) pop <BAD>\n");
|
||||||
|
*/
|
||||||
|
//unimplemented_opcode(op, ximm);
|
||||||
unimplemented_opcode(op, ximm);
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "sunplus_gcm394.h"
|
#include "sunplus_gcm394.h"
|
||||||
|
|
||||||
|
|
||||||
#define LOG_GCM394 (1U << 1)
|
#define LOG_GCM394 (1U << 1)
|
||||||
#define LOG_GCM394_UNMAPPED (1U << 0)
|
#define LOG_GCM394_UNMAPPED (1U << 0)
|
||||||
|
|
||||||
@ -23,133 +24,7 @@ sunplus_gcm394_device::sunplus_gcm394_device(const machine_config &mconfig, cons
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// **************************************** TILEMAP 0 *************************************************
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::tmap0_regs_r) { return tmap0_regs[offset]; }
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap0_regs_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap0_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
|
||||||
tmap0_regs[offset] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap0_unk0_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap0_unk1_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************************** TILEMAP 1 *************************************************
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::tmap1_regs_r) { return tmap1_regs[offset]; }
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap1_regs_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap1_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
|
||||||
tmap1_regs[offset] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap1_unk0_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::tmap1_unk1_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************************** unknown video device 0 (another tilemap? sprite layer?) *************************************************
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device0_regs_w)
|
|
||||||
{
|
|
||||||
// offsets 0,1,4,5,6,7 used in main IRQ code
|
|
||||||
// offsets 2,3 only cleared on startup
|
|
||||||
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device0_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device0_unk0_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device0_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device0_unk1_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device0_unk1_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************************** unknown video device 1 (another tilemap? sprite layer?) *************************************************
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device1_regs_w)
|
|
||||||
{
|
|
||||||
// offsets 0,1,4,5,6,7 used in main IRQ code
|
|
||||||
// offsets 2,3 only cleared on startup
|
|
||||||
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device1_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device1_unk0_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device1_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device1_unk1_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device1_unk1_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************************** unknown video device 2 (sprite control?) *************************************************
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device2_unk0_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device2_unk0_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device2_unk1_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device2_unk1_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unknown_video_device2_unk2_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unknown_video_device2_unk2_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **************************************** video DMA device *************************************************
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_dma_source_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_dma_source_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_dma_dest_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_dma_dest_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::video_dma_size_r)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_dma_size_r\n", machine().describe_context());
|
|
||||||
return 0x0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_dma_size_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_dma_size_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_dma_unk_w)
|
|
||||||
{
|
|
||||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_dma_unk_w %04x\n", machine().describe_context(), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ***********************************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
// **************************************** SYSTEM DMA device *************************************************
|
// **************************************** SYSTEM DMA device *************************************************
|
||||||
@ -210,33 +85,6 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_trigger_w)
|
|||||||
//machine().debug_break();
|
//machine().debug_break();
|
||||||
}
|
}
|
||||||
|
|
||||||
// single bit on/off operations?
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::video_707f_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_707f_r\n", machine().describe_context()); return m_707f; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_707f_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_707f_w %04x\n", machine().describe_context(), data); m_707f = data; }
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::video_703a_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_703a_r\n", machine().describe_context()); return m_703a; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_703a_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_703a_w %04x\n", machine().describe_context(), data); m_703a = data; }
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::video_7062_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7062_r\n", machine().describe_context()); return m_7062; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7062_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7062_w %04x\n", machine().describe_context(), data); m_7062 = data; }
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7063_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7063_w %04x\n", machine().describe_context(), data); m_7063 = data; }
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_702a_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_702a_w %04x\n", machine().describe_context(), data); m_702a = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7030_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7030_w %04x\n", machine().describe_context(), data); m_7030 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_703c_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_703c_w %04x\n", machine().describe_context(), data); m_703c = data; }
|
|
||||||
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7080_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7080_w %04x\n", machine().describe_context(), data); m_7080 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7081_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7081_w %04x\n", machine().describe_context(), data); m_7081 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7082_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7082_w %04x\n", machine().describe_context(), data); m_7082 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7083_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7083_w %04x\n", machine().describe_context(), data); m_7083 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7084_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7084_w %04x\n", machine().describe_context(), data); m_7084 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7085_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7085_w %04x\n", machine().describe_context(), data); m_7085 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7086_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7086_w %04x\n", machine().describe_context(), data); m_7086 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7087_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7087_w %04x\n", machine().describe_context(), data); m_7087 = data; }
|
|
||||||
WRITE16_MEMBER(sunplus_gcm394_base_device::video_7088_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7088_w %04x\n", machine().describe_context(), data); m_7088 = data; }
|
|
||||||
|
|
||||||
READ16_MEMBER(sunplus_gcm394_base_device::video_7083_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::video_7083_r\n", machine().describe_context()); return m_7083; }
|
|
||||||
|
|
||||||
|
|
||||||
// **************************************** 78xx region with some handling *************************************************
|
// **************************************** 78xx region with some handling *************************************************
|
||||||
@ -373,60 +221,60 @@ void sunplus_gcm394_base_device::map(address_map &map)
|
|||||||
|
|
||||||
// note, tilemaps are at the same address offsets in video device as spg2xx (but unknown devices are extra)
|
// note, tilemaps are at the same address offsets in video device as spg2xx (but unknown devices are extra)
|
||||||
|
|
||||||
map(0x007000, 0x007007).w(FUNC(sunplus_gcm394_base_device::unknown_video_device0_regs_w)); // gcm394_video_device::
|
map(0x007000, 0x007007).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_regs_w)); // gcm394_video_device::
|
||||||
map(0x007008, 0x00700f).w(FUNC(sunplus_gcm394_base_device::unknown_video_device1_regs_w)); // gcm394_video_device::
|
map(0x007008, 0x00700f).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_regs_w)); // gcm394_video_device::
|
||||||
|
|
||||||
map(0x007010, 0x007015).rw(FUNC(sunplus_gcm394_base_device::tmap0_regs_r), FUNC(sunplus_gcm394_base_device::tmap0_regs_w)); // gcm394_video_device::
|
map(0x007010, 0x007015).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap0_regs_r), FUNC(gcm394_base_video_device::tmap0_regs_w)); // gcm394_video_device::
|
||||||
map(0x007016, 0x00701b).rw(FUNC(sunplus_gcm394_base_device::tmap1_regs_r), FUNC(sunplus_gcm394_base_device::tmap1_regs_w)); // gcm394_video_device::
|
map(0x007016, 0x00701b).rw(m_spg_video, FUNC(gcm394_base_video_device::tmap1_regs_r), FUNC(gcm394_base_video_device::tmap1_regs_w)); // gcm394_video_device::
|
||||||
|
|
||||||
map(0x007020, 0x007020).w(FUNC(sunplus_gcm394_base_device::tmap0_unk0_w)); // gcm394_video_device:: probably tilebase, written with other tmap0 regs
|
map(0x007020, 0x007020).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk0_w)); // gcm394_video_device:: probably tilebase, written with other tmap0 regs
|
||||||
map(0x007021, 0x007021).w(FUNC(sunplus_gcm394_base_device::tmap1_unk0_w)); // gcm394_video_device:: probably tilebase, written with other tmap1 regs
|
map(0x007021, 0x007021).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk0_w)); // gcm394_video_device:: probably tilebase, written with other tmap1 regs
|
||||||
map(0x007022, 0x007022).w(FUNC(sunplus_gcm394_base_device::unknown_video_device2_unk0_w)); // gcm394_video_device:: another tilebase? maybe sprites? written as 7022, 702d and 7042 group
|
map(0x007022, 0x007022).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk0_w)); // gcm394_video_device:: another tilebase? maybe sprites? written as 7022, 702d and 7042 group
|
||||||
map(0x007023, 0x007023).w(FUNC(sunplus_gcm394_base_device::unknown_video_device0_unk0_w)); // gcm394_video_device:: written with other unknown_video_device0 regs
|
map(0x007023, 0x007023).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk0_w)); // gcm394_video_device:: written with other unknown_video_device0 regs
|
||||||
map(0x007024, 0x007024).w(FUNC(sunplus_gcm394_base_device::unknown_video_device1_unk0_w)); // gcm394_video_device:: written with other unknown_video_device1 regs
|
map(0x007024, 0x007024).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk0_w)); // gcm394_video_device:: written with other unknown_video_device1 regs
|
||||||
|
|
||||||
map(0x00702a, 0x00702a).w(FUNC(sunplus_gcm394_base_device::video_702a_w));
|
map(0x00702a, 0x00702a).w(m_spg_video, FUNC(gcm394_base_video_device::video_702a_w));
|
||||||
|
|
||||||
map(0x00702b, 0x00702b).w(FUNC(sunplus_gcm394_base_device::tmap0_unk1_w)); // gcm394_video_device:: written with other tmap0 regs
|
map(0x00702b, 0x00702b).w(m_spg_video, FUNC(gcm394_base_video_device::tmap0_unk1_w)); // gcm394_video_device:: written with other tmap0 regs
|
||||||
map(0x00702c, 0x00702c).w(FUNC(sunplus_gcm394_base_device::tmap1_unk1_w)); // gcm394_video_device:: written with other tmap1 regs
|
map(0x00702c, 0x00702c).w(m_spg_video, FUNC(gcm394_base_video_device::tmap1_unk1_w)); // gcm394_video_device:: written with other tmap1 regs
|
||||||
map(0x00702d, 0x00702d).w(FUNC(sunplus_gcm394_base_device::unknown_video_device2_unk1_w)); // gcm394_video_device:: maybe sprites? written as 7022, 702d and 7042 group
|
map(0x00702d, 0x00702d).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk1_w)); // gcm394_video_device:: maybe sprites? written as 7022, 702d and 7042 group
|
||||||
map(0x00702e, 0x00702e).w(FUNC(sunplus_gcm394_base_device::unknown_video_device0_unk1_w)); // gcm394_video_device:: written with other unknown_video_device0 regs
|
map(0x00702e, 0x00702e).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device0_unk1_w)); // gcm394_video_device:: written with other unknown_video_device0 regs
|
||||||
map(0x00702f, 0x00702f).w(FUNC(sunplus_gcm394_base_device::unknown_video_device1_unk1_w)); // gcm394_video_device:: written with other unknown_video_device1 regs
|
map(0x00702f, 0x00702f).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device1_unk1_w)); // gcm394_video_device:: written with other unknown_video_device1 regs
|
||||||
|
|
||||||
map(0x007030, 0x007030).w(FUNC(sunplus_gcm394_base_device::video_7030_w));
|
map(0x007030, 0x007030).rw(m_spg_video, FUNC(gcm394_base_video_device::video_7030_r), FUNC(gcm394_base_video_device::video_7030_w));
|
||||||
map(0x00703a, 0x00703a).rw(FUNC(sunplus_gcm394_base_device::video_703a_r), FUNC(sunplus_gcm394_base_device::video_703a_w));
|
map(0x00703a, 0x00703a).rw(m_spg_video, FUNC(gcm394_base_video_device::video_703a_r), FUNC(gcm394_base_video_device::video_703a_w));
|
||||||
map(0x00703c, 0x00703c).w(FUNC(sunplus_gcm394_base_device::video_703c_w));
|
map(0x00703c, 0x00703c).w(m_spg_video, FUNC(gcm394_base_video_device::video_703c_w));
|
||||||
|
|
||||||
map(0x007042, 0x007042).w(FUNC(sunplus_gcm394_base_device::unknown_video_device2_unk2_w)); // gcm394_video_device:: maybe sprites? written as 7022, 702d and 7042 group
|
map(0x007042, 0x007042).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk2_w)); // gcm394_video_device:: maybe sprites? written as 7022, 702d and 7042 group
|
||||||
|
|
||||||
map(0x007062, 0x007062).rw(FUNC(sunplus_gcm394_base_device::video_7062_r), FUNC(sunplus_gcm394_base_device::video_7062_w));
|
map(0x007062, 0x007062).rw(m_spg_video, FUNC(gcm394_base_video_device::video_7062_r), FUNC(gcm394_base_video_device::video_7062_w));
|
||||||
map(0x007063, 0x007063).w(FUNC(sunplus_gcm394_base_device::video_7063_w));
|
map(0x007063, 0x007063).w(m_spg_video, FUNC(gcm394_base_video_device::video_7063_w));
|
||||||
|
|
||||||
// note, 70 / 71 / 72 are the same offsets used for DMA as in spg2xx video device
|
// note, 70 / 71 / 72 are the same offsets used for DMA as in spg2xx video device
|
||||||
map(0x007070, 0x007070).w(FUNC(sunplus_gcm394_base_device::video_dma_source_w)); // gcm394_video_device:: video dma, not system dma? (sets pointers to ram buffers)
|
map(0x007070, 0x007070).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_source_w)); // gcm394_video_device:: video dma, not system dma? (sets pointers to ram buffers)
|
||||||
map(0x007071, 0x007071).w(FUNC(sunplus_gcm394_base_device::video_dma_dest_w)); // gcm394_video_device:: sets pointers to 7300, 7400 ram areas below
|
map(0x007071, 0x007071).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_dest_w)); // gcm394_video_device:: sets pointers to 7300, 7400 ram areas below
|
||||||
map(0x007072, 0x007072).rw(FUNC(sunplus_gcm394_base_device::video_dma_size_r), FUNC(sunplus_gcm394_base_device::video_dma_size_w)); // gcm394_video_device::
|
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)); // gcm394_video_device::
|
||||||
|
|
||||||
map(0x00707e, 0x00707e).w(FUNC(sunplus_gcm394_base_device::video_dma_unk_w)); // gcm394_video_device:: written around same time as DMA, seems related
|
map(0x00707e, 0x00707e).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_unk_w)); // gcm394_video_device:: written around same time as DMA, seems related
|
||||||
|
|
||||||
map(0x00707f, 0x00707f).rw(FUNC(sunplus_gcm394_base_device::video_707f_r), FUNC(sunplus_gcm394_base_device::video_707f_w));
|
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?
|
// another set of registers for something?
|
||||||
map(0x007080, 0x007080).w(FUNC(sunplus_gcm394_base_device::video_7080_w));
|
map(0x007080, 0x007080).w(m_spg_video, FUNC(gcm394_base_video_device::video_7080_w));
|
||||||
map(0x007081, 0x007081).w(FUNC(sunplus_gcm394_base_device::video_7081_w));
|
map(0x007081, 0x007081).w(m_spg_video, FUNC(gcm394_base_video_device::video_7081_w));
|
||||||
map(0x007082, 0x007082).w(FUNC(sunplus_gcm394_base_device::video_7082_w));
|
map(0x007082, 0x007082).w(m_spg_video, FUNC(gcm394_base_video_device::video_7082_w));
|
||||||
map(0x007083, 0x007083).rw(FUNC(sunplus_gcm394_base_device::video_7083_r), FUNC(sunplus_gcm394_base_device::video_7083_w));
|
map(0x007083, 0x007083).rw(m_spg_video, FUNC(gcm394_base_video_device::video_7083_r), FUNC(gcm394_base_video_device::video_7083_w));
|
||||||
map(0x007084, 0x007084).w(FUNC(sunplus_gcm394_base_device::video_7084_w));
|
map(0x007084, 0x007084).w(m_spg_video, FUNC(gcm394_base_video_device::video_7084_w));
|
||||||
map(0x007085, 0x007085).w(FUNC(sunplus_gcm394_base_device::video_7085_w));
|
map(0x007085, 0x007085).w(m_spg_video, FUNC(gcm394_base_video_device::video_7085_w));
|
||||||
map(0x007086, 0x007086).w(FUNC(sunplus_gcm394_base_device::video_7086_w));
|
map(0x007086, 0x007086).w(m_spg_video, FUNC(gcm394_base_video_device::video_7086_w));
|
||||||
map(0x007087, 0x007087).w(FUNC(sunplus_gcm394_base_device::video_7087_w));
|
map(0x007087, 0x007087).w(m_spg_video, FUNC(gcm394_base_video_device::video_7087_w));
|
||||||
map(0x007088, 0x007088).w(FUNC(sunplus_gcm394_base_device::video_7088_w));
|
map(0x007088, 0x007088).w(m_spg_video, FUNC(gcm394_base_video_device::video_7088_w));
|
||||||
|
|
||||||
// ######################################################################################################################################################################################
|
// ######################################################################################################################################################################################
|
||||||
// 73xx-77xx = ram areas?
|
// 73xx-77xx = ram areas?
|
||||||
// ######################################################################################################################################################################################
|
// ######################################################################################################################################################################################
|
||||||
|
|
||||||
map(0x007300, 0x0073ff).ram();
|
map(0x007300, 0x0073ff).ram().share("spgvideo:paletteram");
|
||||||
map(0x007400, 0x0074ff).ram();
|
map(0x007400, 0x0074ff).ram();
|
||||||
map(0x007500, 0x0075ff).ram();
|
map(0x007500, 0x0075ff).ram();
|
||||||
map(0x007600, 0x0076ff).ram();
|
map(0x007600, 0x0076ff).ram();
|
||||||
@ -525,39 +373,11 @@ void sunplus_gcm394_base_device::device_start()
|
|||||||
|
|
||||||
void sunplus_gcm394_base_device::device_reset()
|
void sunplus_gcm394_base_device::device_reset()
|
||||||
{
|
{
|
||||||
// 70xx video
|
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
m_dma_params[i] = 0x0000;
|
m_dma_params[i] = 0x0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
tmap0_regs[i] = 0x0000;
|
|
||||||
tmap1_regs[i] = 0x0000;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_707f = 0x0000;
|
|
||||||
m_703a = 0x0000;
|
|
||||||
m_7062 = 0x0000;
|
|
||||||
m_7063 = 0x0000;
|
|
||||||
|
|
||||||
m_702a = 0x0000;
|
|
||||||
m_7030 = 0x0000;
|
|
||||||
m_703c = 0x0000;
|
|
||||||
|
|
||||||
|
|
||||||
m_7080 = 0x0000;
|
|
||||||
m_7081 = 0x0000;
|
|
||||||
m_7082 = 0x0000;
|
|
||||||
m_7083 = 0x0000;
|
|
||||||
m_7084 = 0x0000;
|
|
||||||
m_7085 = 0x0000;
|
|
||||||
m_7086 = 0x0000;
|
|
||||||
m_7087 = 0x0000;
|
|
||||||
m_7088 = 0x0000;
|
|
||||||
|
|
||||||
// 78xx unknown
|
// 78xx unknown
|
||||||
|
|
||||||
m_78fb = 0x0000;
|
m_78fb = 0x0000;
|
||||||
@ -619,9 +439,21 @@ void sunplus_gcm394_base_device::device_reset()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sunplus_gcm394_device::device_add_mconfig(machine_config &config)
|
WRITE_LINE_MEMBER(sunplus_gcm394_base_device::videoirq_w)
|
||||||
|
{
|
||||||
|
m_cpu->set_state_unsynced(UNSP_IRQ5_LINE, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sunplus_gcm394_base_device::device_add_mconfig(machine_config &config)
|
||||||
{
|
{
|
||||||
//SUNPLUS_GCM394_AUDIO(config, m_spg_audio, DERIVED_CLOCK(1, 1));
|
//SUNPLUS_GCM394_AUDIO(config, m_spg_audio, DERIVED_CLOCK(1, 1));
|
||||||
//m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
|
//m_spg_audio->add_route(0, *this, 1.0, AUTO_ALLOC_INPUT, 0);
|
||||||
//m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
|
//m_spg_audio->add_route(1, *this, 1.0, AUTO_ALLOC_INPUT, 1);
|
||||||
|
|
||||||
|
GCM394_VIDEO(config, m_spg_video, DERIVED_CLOCK(1, 1), m_cpu, m_screen);
|
||||||
|
m_spg_video->write_video_irq_callback().set(FUNC(sunplus_gcm394_base_device::videoirq_w));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "cpu/unsp/unsp.h"
|
#include "cpu/unsp/unsp.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
#include "emupal.h"
|
||||||
|
#include "sunplus_gcm394_video.h"
|
||||||
|
|
||||||
class sunplus_gcm394_base_device : public device_t, public device_mixer_interface
|
class sunplus_gcm394_base_device : public device_t, public device_mixer_interface
|
||||||
{
|
{
|
||||||
@ -22,13 +24,18 @@ public:
|
|||||||
, device_mixer_interface(mconfig, *this, 2)
|
, device_mixer_interface(mconfig, *this, 2)
|
||||||
, m_cpu(*this, finder_base::DUMMY_TAG)
|
, m_cpu(*this, finder_base::DUMMY_TAG)
|
||||||
, m_screen(*this, finder_base::DUMMY_TAG)
|
, m_screen(*this, finder_base::DUMMY_TAG)
|
||||||
|
//, m_palette(*this, "palette")
|
||||||
|
, m_spg_video(*this, "spgvideo")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void map(address_map &map);
|
void map(address_map &map);
|
||||||
|
|
||||||
DECLARE_WRITE_LINE_MEMBER(vblank) { /*m_spg_video->vblank(state);*/ }
|
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { return m_spg_video->screen_update(screen, bitmap, cliprect); }
|
||||||
uint32_t screen_update(screen_device& screen, bitmap_rgb32& bitmap, const rectangle& cliprect) { return 0; /* m_spg_video->screen_update(screen, bitmap, cliprect);*/ }
|
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(vblank) { m_spg_video->vblank(state); }
|
||||||
|
|
||||||
|
virtual void device_add_mconfig(machine_config& config) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -37,31 +44,10 @@ protected:
|
|||||||
|
|
||||||
required_device<unsp_device> m_cpu;
|
required_device<unsp_device> m_cpu;
|
||||||
required_device<screen_device> m_screen;
|
required_device<screen_device> m_screen;
|
||||||
|
//required_device<palette_device> m_palette;
|
||||||
// video 70xx
|
required_device<gcm394_video_device> m_spg_video;
|
||||||
uint16_t tmap0_regs[0x6];
|
|
||||||
uint16_t tmap1_regs[0x6];
|
|
||||||
|
|
||||||
uint16_t m_dma_params[7];
|
uint16_t m_dma_params[7];
|
||||||
uint16_t m_707f;
|
|
||||||
uint16_t m_703a;
|
|
||||||
uint16_t m_7062;
|
|
||||||
uint16_t m_7063;
|
|
||||||
|
|
||||||
uint16_t m_702a;
|
|
||||||
uint16_t m_7030;
|
|
||||||
uint16_t m_703c;
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t m_7080;
|
|
||||||
uint16_t m_7081;
|
|
||||||
uint16_t m_7082;
|
|
||||||
uint16_t m_7083;
|
|
||||||
uint16_t m_7084;
|
|
||||||
uint16_t m_7085;
|
|
||||||
uint16_t m_7086;
|
|
||||||
uint16_t m_7087;
|
|
||||||
uint16_t m_7088;
|
|
||||||
|
|
||||||
// unk 78xx
|
// unk 78xx
|
||||||
uint16_t m_7803;
|
uint16_t m_7803;
|
||||||
@ -130,60 +116,6 @@ private:
|
|||||||
DECLARE_READ16_MEMBER(unk_r);
|
DECLARE_READ16_MEMBER(unk_r);
|
||||||
DECLARE_WRITE16_MEMBER(unk_w);
|
DECLARE_WRITE16_MEMBER(unk_w);
|
||||||
|
|
||||||
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_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(unknown_video_device0_regs_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk0_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk1_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device1_regs_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device1_unk0_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device1_unk1_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk0_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk1_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk2_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(video_dma_source_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_dma_dest_w);
|
|
||||||
DECLARE_READ16_MEMBER(video_dma_size_r);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_dma_size_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_dma_unk_w);
|
|
||||||
|
|
||||||
DECLARE_READ16_MEMBER(video_703a_r);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_703a_w);
|
|
||||||
|
|
||||||
DECLARE_READ16_MEMBER(video_7062_r);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7062_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7063_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(video_702a_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7030_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_703c_w);
|
|
||||||
|
|
||||||
DECLARE_READ16_MEMBER(video_707f_r);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_707f_w);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7080_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7081_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7082_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7083_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7084_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7085_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7086_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7087_w);
|
|
||||||
DECLARE_WRITE16_MEMBER(video_7088_w);
|
|
||||||
|
|
||||||
DECLARE_READ16_MEMBER(video_7083_r);
|
|
||||||
|
|
||||||
DECLARE_WRITE16_MEMBER(system_dma_params_w);
|
DECLARE_WRITE16_MEMBER(system_dma_params_w);
|
||||||
DECLARE_WRITE16_MEMBER(system_dma_trigger_w);
|
DECLARE_WRITE16_MEMBER(system_dma_trigger_w);
|
||||||
@ -265,8 +197,7 @@ private:
|
|||||||
DECLARE_READ16_MEMBER(unkarea_7936_r);
|
DECLARE_READ16_MEMBER(unkarea_7936_r);
|
||||||
DECLARE_WRITE16_MEMBER(unkarea_7936_w);
|
DECLARE_WRITE16_MEMBER(unkarea_7936_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(videoirq_w);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class sunplus_gcm394_device : public sunplus_gcm394_base_device
|
class sunplus_gcm394_device : public sunplus_gcm394_base_device
|
||||||
@ -281,8 +212,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
sunplus_gcm394_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock);
|
sunplus_gcm394_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock);
|
||||||
|
|
||||||
virtual void device_add_mconfig(machine_config& config) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
522
src/devices/machine/sunplus_gcm394_video.cpp
Normal file
522
src/devices/machine/sunplus_gcm394_video.cpp
Normal file
@ -0,0 +1,522 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:Ryan Holtz, David Haywood
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
SunPlus GCM394-series SoC peripheral emulation (Video)
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#include "emu.h"
|
||||||
|
#include "sunplus_gcm394_video.h"
|
||||||
|
|
||||||
|
DEFINE_DEVICE_TYPE(GCM394_VIDEO, gcm394_video_device, "gcm394_video", "GCM394-series System-on-a-Chip (Video)")
|
||||||
|
|
||||||
|
#define LOG_GCM394_TMAP (1U << 2)
|
||||||
|
#define LOG_GCM394 (1U << 1)
|
||||||
|
|
||||||
|
#define VERBOSE (LOG_GCM394_TMAP)
|
||||||
|
|
||||||
|
#include "logmacro.h"
|
||||||
|
|
||||||
|
|
||||||
|
gcm394_base_video_device::gcm394_base_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
|
: device_t(mconfig, type, tag, owner, clock)
|
||||||
|
, m_cpu(*this, finder_base::DUMMY_TAG)
|
||||||
|
, m_screen(*this, finder_base::DUMMY_TAG)
|
||||||
|
// , m_scrollram(*this, "scrollram")
|
||||||
|
, m_paletteram(*this, "paletteram")
|
||||||
|
// , m_spriteram(*this, "spriteram")
|
||||||
|
, m_video_irq_cb(*this)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
gcm394_video_device::gcm394_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
|
: gcm394_base_video_device(mconfig, GCM394_VIDEO, tag, owner, clock)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void gcm394_base_video_device::device_start()
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
m_rgb5_to_rgb8[i] = (i << 3) | (i >> 2);
|
||||||
|
}
|
||||||
|
for (uint16_t i = 0; i < 0x8000; i++)
|
||||||
|
{
|
||||||
|
m_rgb555_to_rgb888[i] = (m_rgb5_to_rgb8[(i >> 10) & 0x1f] << 16) |
|
||||||
|
(m_rgb5_to_rgb8[(i >> 5) & 0x1f] << 8) |
|
||||||
|
(m_rgb5_to_rgb8[(i >> 0) & 0x1f] << 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_video_irq_cb.resolve();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void gcm394_base_video_device::device_reset()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
m_tmap0_regs[i] = 0x0000;
|
||||||
|
m_tmap1_regs[i] = 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_707f = 0x0000;
|
||||||
|
m_703a = 0x0000;
|
||||||
|
m_7062 = 0x0000;
|
||||||
|
m_7063 = 0x0000;
|
||||||
|
|
||||||
|
m_702a = 0x0000;
|
||||||
|
m_7030 = 0x0000;
|
||||||
|
m_703c = 0x0000;
|
||||||
|
|
||||||
|
|
||||||
|
m_7080 = 0x0000;
|
||||||
|
m_7081 = 0x0000;
|
||||||
|
m_7082 = 0x0000;
|
||||||
|
m_7083 = 0x0000;
|
||||||
|
m_7084 = 0x0000;
|
||||||
|
m_7085 = 0x0000;
|
||||||
|
m_7086 = 0x0000;
|
||||||
|
m_7087 = 0x0000;
|
||||||
|
m_7088 = 0x0000;
|
||||||
|
|
||||||
|
m_video_irq_status = 0x0000;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************
|
||||||
|
* Video Hardware *
|
||||||
|
*************************/
|
||||||
|
|
||||||
|
inline uint16_t gcm394_base_video_device::read_data(uint32_t offset)
|
||||||
|
{
|
||||||
|
address_space &space = m_cpu->space(AS_PROGRAM);
|
||||||
|
uint16_t b = space.read_word(offset);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<gcm394_base_video_device::blend_enable_t Blend, gcm394_base_video_device::rowscroll_enable_t RowScroll, gcm394_base_video_device::flipx_t FlipX>
|
||||||
|
void gcm394_base_video_device::draw(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t bitmap_addr, uint16_t tile, int32_t h, int32_t w, uint8_t bpp, uint32_t yflipmask, uint32_t palette_offset)
|
||||||
|
{
|
||||||
|
uint32_t nc_bpp = ((bpp) + 1) << 1;
|
||||||
|
|
||||||
|
palette_offset >>= nc_bpp;
|
||||||
|
palette_offset <<= nc_bpp;
|
||||||
|
|
||||||
|
uint32_t bits_per_row = nc_bpp * w / 16;
|
||||||
|
uint32_t words_per_tile = bits_per_row * h;
|
||||||
|
uint32_t m = bitmap_addr + words_per_tile * tile + bits_per_row * (line ^ yflipmask);
|
||||||
|
uint32_t bits = 0;
|
||||||
|
uint32_t nbits = 0;
|
||||||
|
uint32_t y = line;
|
||||||
|
|
||||||
|
int yy = (yoff + y) & 0x1ff;
|
||||||
|
if (yy >= 0x01c0)
|
||||||
|
yy -= 0x0200;
|
||||||
|
|
||||||
|
if (yy > 240 || yy < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int y_index = yy * 320;
|
||||||
|
|
||||||
|
for (int32_t x = FlipX ? (w - 1) : 0; FlipX ? x >= 0 : x < w; FlipX ? x-- : x++)
|
||||||
|
{
|
||||||
|
int xx = xoff + x;
|
||||||
|
|
||||||
|
bits <<= nc_bpp;
|
||||||
|
|
||||||
|
if (nbits < nc_bpp)
|
||||||
|
{
|
||||||
|
uint16_t b = read_data((m++ & 0x3fffff));
|
||||||
|
b = (b << 8) | (b >> 8);
|
||||||
|
bits |= b << (nc_bpp - nbits);
|
||||||
|
nbits += 16;
|
||||||
|
}
|
||||||
|
nbits -= nc_bpp;
|
||||||
|
|
||||||
|
uint32_t pal = palette_offset + (bits >> 16);
|
||||||
|
bits &= 0xffff;
|
||||||
|
|
||||||
|
if (RowScroll)
|
||||||
|
xx -= 0;// (int16_t)m_scrollram[yy & 0x1ff];
|
||||||
|
|
||||||
|
xx &= 0x01ff;
|
||||||
|
if (xx >= 0x01c0)
|
||||||
|
xx -= 0x0200;
|
||||||
|
|
||||||
|
if (xx >= 0 && xx < 320)
|
||||||
|
{
|
||||||
|
int pix_index = xx + y_index;
|
||||||
|
|
||||||
|
uint16_t rgb = m_paletteram[pal];
|
||||||
|
|
||||||
|
if (!(rgb & 0x8000))
|
||||||
|
{
|
||||||
|
if (Blend)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
m_screenbuf[pix_index] = (mix_channel((uint8_t)(m_screenbuf[pix_index] >> 16), m_rgb5_to_rgb8[(rgb >> 10) & 0x1f]) << 16) |
|
||||||
|
(mix_channel((uint8_t)(m_screenbuf[pix_index] >> 8), m_rgb5_to_rgb8[(rgb >> 5) & 0x1f]) << 8) |
|
||||||
|
(mix_channel((uint8_t)(m_screenbuf[pix_index] >> 0), m_rgb5_to_rgb8[rgb & 0x1f]));
|
||||||
|
*/
|
||||||
|
m_screenbuf[pix_index] = m_rgb555_to_rgb888[rgb];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_screenbuf[pix_index] = m_rgb555_to_rgb888[rgb];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gcm394_base_video_device::draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs)
|
||||||
|
{
|
||||||
|
uint32_t xscroll = regs[0];
|
||||||
|
uint32_t yscroll = regs[1];
|
||||||
|
uint32_t attr = regs[2];
|
||||||
|
uint32_t ctrl = regs[3];
|
||||||
|
uint32_t tilemap = regs[4];
|
||||||
|
uint32_t palette_map = regs[5];
|
||||||
|
address_space &space = m_cpu->space(AS_PROGRAM);
|
||||||
|
|
||||||
|
if (!(ctrl & PAGE_ENABLE_MASK))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((attr & PAGE_PRIORITY_FLAG_MASK) >> PAGE_PRIORITY_FLAG_SHIFT) != priority)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t tile_h = 8 << ((attr & PAGE_TILE_HEIGHT_MASK) >> PAGE_TILE_HEIGHT_SHIFT);
|
||||||
|
uint32_t tile_w = 8 << ((attr & PAGE_TILE_WIDTH_MASK) >> PAGE_TILE_WIDTH_SHIFT);
|
||||||
|
|
||||||
|
uint32_t tile_count_x = 512 / tile_w;
|
||||||
|
|
||||||
|
uint32_t bitmap_y = (scanline + yscroll) & 0xff;
|
||||||
|
uint32_t y0 = bitmap_y / tile_h;
|
||||||
|
uint32_t tile_scanline = bitmap_y % tile_h;
|
||||||
|
uint32_t tile_address = tile_count_x * y0;
|
||||||
|
|
||||||
|
for (uint32_t x0 = 0; x0 < tile_count_x; x0++, tile_address++)
|
||||||
|
{
|
||||||
|
uint32_t yy = ((tile_h * y0 - yscroll + 0x10) & 0xff) - 0x10;
|
||||||
|
uint32_t xx = (tile_w * x0 - xscroll) & 0x1ff;
|
||||||
|
uint16_t tile = (ctrl & PAGE_WALLPAPER_MASK) ? space.read_word(tilemap) : space.read_word(tilemap + tile_address);
|
||||||
|
uint16_t palette = 0;
|
||||||
|
|
||||||
|
if (!tile)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
palette = (ctrl & PAGE_WALLPAPER_MASK) ? space.read_word(palette_map) : space.read_word(palette_map + tile_address / 2);
|
||||||
|
if (x0 & 1)
|
||||||
|
palette >>= 8;
|
||||||
|
|
||||||
|
uint32_t tileattr = attr;
|
||||||
|
uint32_t tilectrl = ctrl;
|
||||||
|
if ((ctrl & 2) == 0)
|
||||||
|
{ // -(1) bld(1) flip(2) pal(4)
|
||||||
|
tileattr &= ~0x000c;
|
||||||
|
tileattr |= (palette >> 2) & 0x000c; // flip
|
||||||
|
|
||||||
|
tileattr &= ~0x0f00;
|
||||||
|
tileattr |= (palette << 8) & 0x0f00; // palette
|
||||||
|
|
||||||
|
tilectrl &= ~0x0100;
|
||||||
|
tilectrl |= (palette << 2) & 0x0100; // blend
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool blend = (tileattr & 0x4000 || tilectrl & 0x0100);
|
||||||
|
const bool row_scroll = (tilectrl & 0x0010);
|
||||||
|
const bool flip_x = (tileattr & TILE_X_FLIP);
|
||||||
|
const uint32_t yflipmask = tileattr & TILE_Y_FLIP ? tile_h - 1 : 0;
|
||||||
|
const uint32_t palette_offset = (tileattr & 0x0f00) >> 4;
|
||||||
|
|
||||||
|
const uint8_t bpp = tileattr & 0x0003;
|
||||||
|
|
||||||
|
if (blend)
|
||||||
|
{
|
||||||
|
if (row_scroll)
|
||||||
|
{
|
||||||
|
if (flip_x)
|
||||||
|
draw<BlendOn, RowScrollOn, FlipXOn>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
else
|
||||||
|
draw<BlendOn, RowScrollOn, FlipXOff>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flip_x)
|
||||||
|
draw<BlendOn, RowScrollOff, FlipXOn>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
else
|
||||||
|
draw<BlendOn, RowScrollOff, FlipXOff>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (row_scroll)
|
||||||
|
{
|
||||||
|
if (flip_x)
|
||||||
|
draw<BlendOff, RowScrollOn, FlipXOn>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
else
|
||||||
|
draw<BlendOff, RowScrollOn, FlipXOff>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flip_x)
|
||||||
|
draw<BlendOff, RowScrollOff, FlipXOn>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
else
|
||||||
|
draw<BlendOff, RowScrollOff, FlipXOff>(cliprect, tile_scanline, xx, yy, bitmap_addr, tile, tile_h, tile_w, bpp, yflipmask, palette_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t gcm394_base_video_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
for (uint32_t scanline = (uint32_t)cliprect.min_y; scanline <= (uint32_t)cliprect.max_y; scanline++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
draw_page(cliprect, scanline, i, page1_addr, page1_regs);
|
||||||
|
draw_page(cliprect, scanline, i, page2_addr, page2_regs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
|
||||||
|
{
|
||||||
|
uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
|
||||||
|
uint32_t *src = &m_screenbuf[cliprect.min_x + 320 * y];
|
||||||
|
memcpy(dest, src, sizeof(uint32_t) * ((cliprect.max_x - cliprect.min_x) + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void gcm394_base_video_device::write_tmap_regs(int tmap, uint16_t* regs, int offset, uint16_t data)
|
||||||
|
{
|
||||||
|
switch (offset)
|
||||||
|
{
|
||||||
|
case 0x0: // Page X scroll
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d X Scroll = %04x\n", tmap, data & 0x01ff);
|
||||||
|
regs[offset] = data & 0x01ff;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x1: // Page Y scroll
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d Y Scroll = %04x\n", tmap, data & 0x00ff);
|
||||||
|
regs[offset] = data & 0x00ff;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x2: // Page Attributes
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d Attributes = %04x (Depth:%d, Palette:%d, VSize:%d, HSize:%d, FlipY:%d, FlipX:%d, BPP:%d)\n", tmap, data
|
||||||
|
, (data >> 12) & 3, (data >> 8) & 15, 8 << ((data >> 6) & 3), 8 << ((data >> 4) & 3), BIT(data, 3), BIT(data, 2), 2 * ((data & 3) + 1));
|
||||||
|
regs[offset] = data;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x3: // Page Control
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d Control = %04x (Blend:%d, HiColor:%d, RowScroll:%d, Enable:%d, Wallpaper:%d, RegSet:%d, Bitmap:%d)\n", tmap, data
|
||||||
|
, BIT(data, 8), BIT(data, 7), BIT(data, 4), BIT(data, 3), BIT(data, 2), BIT(data, 1), BIT(data, 0));
|
||||||
|
regs[offset] = data;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x4: // Page Tile Address
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d Tile Address = %04x\n", tmap, data & 0x1fff);
|
||||||
|
regs[offset] = data;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x5: // Page Attribute write_tmap_regs
|
||||||
|
LOGMASKED(LOG_GCM394_TMAP, "write_tmap_regs: Page %d Attribute Address = %04x\n", tmap, data & 0x1fff);
|
||||||
|
regs[offset] = data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** TILEMAP 0 *************************************************
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::tmap0_regs_r) { return m_tmap0_regs[offset]; }
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap0_regs_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap1_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
||||||
|
write_tmap_regs(0, m_tmap0_regs, offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk0_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
m_page1_addr = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap0_unk1_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
m_page2_addr = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** TILEMAP 1 *************************************************
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::tmap1_regs_r) { return m_tmap1_regs[offset]; }
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap1_regs_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap1_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
||||||
|
write_tmap_regs(1, m_tmap1_regs, offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk0_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::tmap1_unk1_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::tmap0_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** unknown video device 0 (another tilemap? sprite layer?) *************************************************
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device0_regs_w)
|
||||||
|
{
|
||||||
|
// offsets 0,1,4,5,6,7 used in main IRQ code
|
||||||
|
// offsets 2,3 only cleared on startup
|
||||||
|
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device0_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device0_unk0_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device0_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device0_unk1_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device0_unk1_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** unknown video device 1 (another tilemap? sprite layer?) *************************************************
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device1_regs_w)
|
||||||
|
{
|
||||||
|
// offsets 0,1,4,5,6,7 used in main IRQ code
|
||||||
|
// offsets 2,3 only cleared on startup
|
||||||
|
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device1_regs_w %01x %04x\n", machine().describe_context(), offset, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device1_unk0_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device1_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device1_unk1_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device1_unk1_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** unknown video device 2 (sprite control?) *************************************************
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device2_unk0_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device2_unk0_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device2_unk1_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device2_unk1_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::unknown_video_device2_unk2_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::unknown_video_device2_unk2_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// **************************************** video DMA device *************************************************
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_dma_source_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_dma_source_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_dma_dest_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_dma_dest_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::video_dma_size_r)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_dma_size_r\n", machine().describe_context());
|
||||||
|
return 0x0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_dma_size_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_dma_size_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_dma_unk_w)
|
||||||
|
{
|
||||||
|
LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_dma_unk_w %04x\n", machine().describe_context(), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::video_707f_r) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_707f_r\n", machine().describe_context()); return m_707f; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_707f_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_707f_w %04x\n", machine().describe_context(), data); m_707f = data; }
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::video_703a_r) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_703a_r\n", machine().describe_context()); return m_703a; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_703a_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_703a_w %04x\n", machine().describe_context(), data); m_703a = data; }
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::video_7062_r) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7062_r\n", machine().describe_context()); return m_7062; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7062_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7062_w %04x\n", machine().describe_context(), data); m_7062 = data; }
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7063_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7063_w %04x\n", machine().describe_context(), data); m_7063 = data; }
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_702a_w) { LOGMASKED(LOG_GCM394, "%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, "%s:gcm394_base_video_device::video_7030_r\n", machine().describe_context()); return m_7030; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7030_w) { LOGMASKED(LOG_GCM394, "%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, "%s:gcm394_base_video_device::video_703c_w %04x\n", machine().describe_context(), data); m_703c = data; }
|
||||||
|
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7080_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7080_w %04x\n", machine().describe_context(), data); m_7080 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7081_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7081_w %04x\n", machine().describe_context(), data); m_7081 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7082_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7082_w %04x\n", machine().describe_context(), data); m_7082 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7083_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7083_w %04x\n", machine().describe_context(), data); m_7083 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7084_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7084_w %04x\n", machine().describe_context(), data); m_7084 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7085_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7085_w %04x\n", machine().describe_context(), data); m_7085 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7086_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7086_w %04x\n", machine().describe_context(), data); m_7086 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7087_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7087_w %04x\n", machine().describe_context(), data); m_7087 = data; }
|
||||||
|
WRITE16_MEMBER(gcm394_base_video_device::video_7088_w) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7088_w %04x\n", machine().describe_context(), data); m_7088 = data; }
|
||||||
|
|
||||||
|
READ16_MEMBER(gcm394_base_video_device::video_7083_r) { LOGMASKED(LOG_GCM394, "%s:gcm394_base_video_device::video_7083_r\n", machine().describe_context()); return m_7083; }
|
||||||
|
|
||||||
|
void gcm394_base_video_device::check_video_irq()
|
||||||
|
{
|
||||||
|
m_video_irq_cb((m_video_irq_status & 1) ? ASSERT_LINE : CLEAR_LINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE_LINE_MEMBER(gcm394_base_video_device::vblank)
|
||||||
|
{
|
||||||
|
int i = 0x0001;
|
||||||
|
|
||||||
|
if (!state)
|
||||||
|
{
|
||||||
|
m_video_irq_status &= ~i;
|
||||||
|
check_video_irq();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if (m_video_irq_enable & 1)
|
||||||
|
{
|
||||||
|
m_video_irq_status |= i;
|
||||||
|
check_video_irq();
|
||||||
|
}
|
||||||
|
}
|
201
src/devices/machine/sunplus_gcm394_video.h
Normal file
201
src/devices/machine/sunplus_gcm394_video.h
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
// license:BSD-3-Clause
|
||||||
|
// copyright-holders:Ryan Holtz, David Haywood
|
||||||
|
/*****************************************************************************
|
||||||
|
|
||||||
|
SunPlus GCM394-series SoC peripheral emulation (Video)
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifndef MAME_MACHINE_GCM394_VIDEO_H
|
||||||
|
#define MAME_MACHINE_GCM394_VIDEO_H
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cpu/unsp/unsp.h"
|
||||||
|
#include "screen.h"
|
||||||
|
|
||||||
|
class gcm394_base_video_device : public device_t
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
gcm394_base_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
|
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(vblank);
|
||||||
|
|
||||||
|
// DECLARE_READ16_MEMBER(video_r);
|
||||||
|
// DECLARE_WRITE16_MEMBER(video_w);
|
||||||
|
|
||||||
|
void write_tmap_regs(int tmap, uint16_t* regs, int offset, uint16_t data);
|
||||||
|
|
||||||
|
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_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(unknown_video_device0_regs_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk0_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device0_unk1_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device1_regs_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device1_unk0_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device1_unk1_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk0_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk1_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(unknown_video_device2_unk2_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(video_dma_source_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_dma_dest_w);
|
||||||
|
DECLARE_READ16_MEMBER(video_dma_size_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_dma_size_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_dma_unk_w);
|
||||||
|
|
||||||
|
DECLARE_READ16_MEMBER(video_703a_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_703a_w);
|
||||||
|
|
||||||
|
DECLARE_READ16_MEMBER(video_7062_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7062_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7063_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(video_702a_w);
|
||||||
|
DECLARE_READ16_MEMBER(video_7030_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7030_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_703c_w);
|
||||||
|
|
||||||
|
|
||||||
|
DECLARE_READ16_MEMBER(video_707f_r);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_707f_w);
|
||||||
|
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7080_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7081_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7082_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7083_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7084_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7085_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7086_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7087_w);
|
||||||
|
DECLARE_WRITE16_MEMBER(video_7088_w);
|
||||||
|
|
||||||
|
DECLARE_READ16_MEMBER(video_7083_r);
|
||||||
|
|
||||||
|
|
||||||
|
auto write_video_irq_callback() { return m_video_irq_cb.bind(); };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PAGE_ENABLE_MASK = 0x0008,
|
||||||
|
PAGE_WALLPAPER_MASK = 0x0004,
|
||||||
|
|
||||||
|
SPRITE_ENABLE_MASK = 0x0001,
|
||||||
|
SPRITE_COORD_TL_MASK = 0x0002,
|
||||||
|
|
||||||
|
PAGE_PRIORITY_FLAG_MASK = 0x3000,
|
||||||
|
PAGE_PRIORITY_FLAG_SHIFT = 12,
|
||||||
|
PAGE_TILE_HEIGHT_MASK = 0x00c0,
|
||||||
|
PAGE_TILE_HEIGHT_SHIFT = 6,
|
||||||
|
PAGE_TILE_WIDTH_MASK = 0x0030,
|
||||||
|
PAGE_TILE_WIDTH_SHIFT = 4,
|
||||||
|
TILE_X_FLIP = 0x0004,
|
||||||
|
TILE_Y_FLIP = 0x0008
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline void check_video_irq();
|
||||||
|
|
||||||
|
|
||||||
|
virtual void device_start() override;
|
||||||
|
virtual void device_reset() override;
|
||||||
|
|
||||||
|
enum blend_enable_t : bool
|
||||||
|
{
|
||||||
|
BlendOff = false,
|
||||||
|
BlendOn = true
|
||||||
|
};
|
||||||
|
|
||||||
|
enum rowscroll_enable_t : bool
|
||||||
|
{
|
||||||
|
RowScrollOff = false,
|
||||||
|
RowScrollOn = true
|
||||||
|
};
|
||||||
|
|
||||||
|
enum flipx_t : bool
|
||||||
|
{
|
||||||
|
FlipXOff = false,
|
||||||
|
FlipXOn = true
|
||||||
|
};
|
||||||
|
|
||||||
|
template<blend_enable_t Blend, rowscroll_enable_t RowScroll, flipx_t FlipX>
|
||||||
|
void draw(const rectangle &cliprect, uint32_t line, uint32_t xoff, uint32_t yoff, uint32_t bitmap_addr, uint16_t tile, int32_t h, int32_t w, uint8_t bpp, uint32_t yflipmask, uint32_t palette_offset);
|
||||||
|
void draw_page(const rectangle &cliprect, uint32_t scanline, int priority, uint32_t bitmap_addr, uint16_t *regs);
|
||||||
|
|
||||||
|
uint32_t m_screenbuf[320 * 240];
|
||||||
|
uint8_t m_rgb5_to_rgb8[32];
|
||||||
|
uint32_t m_rgb555_to_rgb888[0x8000];
|
||||||
|
|
||||||
|
required_device<unsp_device> m_cpu;
|
||||||
|
required_device<screen_device> m_screen;
|
||||||
|
// required_shared_ptr<uint16_t> m_scrollram;
|
||||||
|
required_shared_ptr<uint16_t> m_paletteram;
|
||||||
|
// required_shared_ptr<uint16_t> m_spriteram;
|
||||||
|
|
||||||
|
uint16_t m_page1_addr;
|
||||||
|
uint16_t m_page2_addr;
|
||||||
|
|
||||||
|
|
||||||
|
devcb_write_line m_video_irq_cb;
|
||||||
|
|
||||||
|
|
||||||
|
// video 70xx
|
||||||
|
uint16_t m_tmap0_regs[0x6];
|
||||||
|
uint16_t m_tmap1_regs[0x6];
|
||||||
|
|
||||||
|
uint16_t m_707f;
|
||||||
|
uint16_t m_703a;
|
||||||
|
uint16_t m_7062;
|
||||||
|
uint16_t m_7063;
|
||||||
|
|
||||||
|
uint16_t m_702a;
|
||||||
|
uint16_t m_7030;
|
||||||
|
uint16_t m_703c;
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t m_7080;
|
||||||
|
uint16_t m_7081;
|
||||||
|
uint16_t m_7082;
|
||||||
|
uint16_t m_7083;
|
||||||
|
uint16_t m_7084;
|
||||||
|
uint16_t m_7085;
|
||||||
|
uint16_t m_7086;
|
||||||
|
uint16_t m_7087;
|
||||||
|
uint16_t m_7088;
|
||||||
|
|
||||||
|
uint16_t m_video_irq_status;
|
||||||
|
|
||||||
|
uint16_t read_data(uint32_t offset);
|
||||||
|
};
|
||||||
|
|
||||||
|
class gcm394_video_device : public gcm394_base_video_device
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template <typename T, typename U>
|
||||||
|
gcm394_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag, U &&screen_tag)
|
||||||
|
: gcm394_video_device(mconfig, tag, owner, clock)
|
||||||
|
{
|
||||||
|
m_cpu.set_tag(std::forward<T>(cpu_tag));
|
||||||
|
m_screen.set_tag(std::forward<U>(screen_tag));
|
||||||
|
}
|
||||||
|
|
||||||
|
gcm394_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
};
|
||||||
|
|
||||||
|
DECLARE_DEVICE_TYPE(GCM394_VIDEO, gcm394_video_device)
|
||||||
|
|
||||||
|
#endif // MAME_MACHINE_GCM394_VIDEO_H
|
Loading…
Reference in New Issue
Block a user