mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
sunplus_gcm394.cpp plug & play experiments looking at wrlshunt (#5953)
* unsp : goto MR * not banked? (nw) * dma tweaks (nw) * (nw) * prep (nw) * prep (nw) * prep (nw) * prep (nw) * preparation (nw) * experimental (nw) * testing (nw) * cleaner implementation (nw) * skip over EEPROM(?) check (nw) * push forward (nw)
This commit is contained in:
parent
9f1de70a7e
commit
ceae2fdc3e
@ -142,8 +142,15 @@ inline void unsp_device::execute_fxxx_011_group(uint16_t op)
|
||||
// JMPR 1 1 1 1 1 1 1 0 1 1 - - - - - -
|
||||
if (((op & 0xffc0) == 0xfec0) && m_iso >= 12)
|
||||
{
|
||||
logerror("goto mr\n");
|
||||
unimplemented_opcode(op);
|
||||
uint32_t mr = m_core->m_r[REG_R3] | ((m_core->m_r[REG_R4]) << 16);
|
||||
|
||||
m_core->m_icount -= 5;
|
||||
m_core->m_r[REG_PC] = mr & 0xffff;
|
||||
m_core->m_r[REG_SR] &= 0xffc0;
|
||||
m_core->m_r[REG_SR] |=( mr>>16) & 0x3f;
|
||||
|
||||
logerror("goto mr %08x\n", mr);
|
||||
//unimplemented_opcode(op);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -46,36 +46,52 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_params_w)
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::system_dma_trigger_w)
|
||||
{
|
||||
uint16_t mode = m_dma_params[0];
|
||||
uint16_t sourcelow = m_dma_params[1];
|
||||
uint16_t dest = m_dma_params[2];
|
||||
uint16_t length = m_dma_params[3];
|
||||
uint16_t srchigh = m_dma_params[4];
|
||||
uint32_t source = m_dma_params[1] | (m_dma_params[4] << 16);
|
||||
uint32_t dest = m_dma_params[2] | (m_dma_params[5] << 16) ;
|
||||
uint32_t length = m_dma_params[3] | (m_dma_params[6] << 16);
|
||||
|
||||
LOGMASKED(LOG_GCM394_SYSDMA, "%s:possible DMA operation (7abf) (trigger %04x) with params mode:%04x source:%04x dest:%04x length:%04x srchigh:%04x unk:%04x unk:%04x\n", machine().describe_context(), data, mode, sourcelow, dest, length, srchigh, m_dma_params[5], m_dma_params[6]);
|
||||
LOGMASKED(LOG_GCM394_SYSDMA, "%s:possible DMA operation (7abf) (trigger %04x) with params mode:%04x source:%08x (word offset) dest:%08x (word offset) length:%08x (words)\n", machine().describe_context(), data, mode, source, dest, length );
|
||||
|
||||
uint32_t source = sourcelow | (srchigh << 16);
|
||||
if (source >= 0x20000)
|
||||
LOGMASKED(LOG_GCM394_SYSDMA, " likely transfer from ROM %08x - %08x\n", (source - 0x20000) * 2, (source - 0x20000) * 2 + (length * 2)- 1);
|
||||
|
||||
// wrlshunt uses the extra params, might be doing very large ROM -> RAM transfers with even more upper address bits?
|
||||
// wrlshunt transfers ROM to RAM, all RAM write addresses have 0x800000 in the destination set
|
||||
|
||||
if (mode == 0x0089) // no source inc, used for memory clear operations? (source usually points at stack value)
|
||||
// mode 0x0089 == no source inc, used for memory clear operations? (source usually points at stack value)
|
||||
// mode 0x0009 == regular copy? (smartfp does 2 copies like this after the initial clears, source definitely points at a correctly sized data structure)
|
||||
// what does having bit 0x4000 on mode set mean? (first transfer on wrlshunt - maybe an IRQ disable?)
|
||||
|
||||
if ((mode == 0x0089) || (mode == 0x0009) || (mode == 0x4009))
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
address_space &mem = this->space(AS_PROGRAM);
|
||||
uint16_t val = mem.read_word(source);
|
||||
mem.write_word(dest, val);
|
||||
uint16_t val = 0x0000;
|
||||
|
||||
address_space& mem = this->space(AS_PROGRAM);
|
||||
|
||||
if (source < 0x20000)
|
||||
{
|
||||
val = mem.read_word(source);
|
||||
}
|
||||
else
|
||||
{
|
||||
// maybe the -0x20000 here should be handled in external space handlers instead
|
||||
val = m_space_read_cb(space, source - 0x20000);
|
||||
}
|
||||
|
||||
if (dest < 0x20000)
|
||||
{
|
||||
mem.write_word(dest, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
// maybe the -0x20000 here should be handled in external space handlers instead
|
||||
m_space_write_cb(space, dest - 0x20000, val);
|
||||
}
|
||||
|
||||
dest += 1;
|
||||
}
|
||||
}
|
||||
else if (mode == 0x0009) // regular copy? (smartfp does 2 copies like this after the initial clears, source definitely points at a correctly sized data structure)
|
||||
{
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
address_space &mem = this->space(AS_PROGRAM);
|
||||
uint16_t val = mem.read_word(source);
|
||||
mem.write_word(dest, val);
|
||||
dest += 1;
|
||||
source += 1;
|
||||
if ((mode&0x3fff) == 0x0009)
|
||||
source += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -128,7 +144,12 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7816_w) { LOGMASKED(LOG_GCM39
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7817_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7817_w %04x\n", machine().describe_context(), data); m_7817 = data; }
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7820_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7820_w %04x\n", machine().describe_context(), data); m_7820 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7821_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7821_w %04x\n", machine().describe_context(), data); m_7821 = data; }
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7821_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7821_w %04x\n", machine().describe_context(), data); m_7821 = data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7822_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7822_w %04x\n", machine().describe_context(), data); m_7822 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7823_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7823_w %04x\n", machine().describe_context(), data); m_7823 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7824_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7824_w %04x\n", machine().describe_context(), data); m_7824 = data; }
|
||||
@ -138,7 +159,7 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7835_w) { LOGMASKED(LOG_GCM39
|
||||
// IO here?
|
||||
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::ioport_a_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioport_a_r\n", machine().describe_context()); return m_porta_in(); }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::ioport_a_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioport_a_w %04x\n", machine().describe_context(), data); m_7860 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::ioport_a_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::ioport_a_w %04x\n", machine().describe_context(), data); m_porta_out(data); }
|
||||
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_7861_r) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_7861_r\n", machine().describe_context()); return m_7861; }
|
||||
|
||||
@ -168,6 +189,12 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_7883_w) { LOGMASKED(LOG_GCM39
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a0_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a0_w %04x\n", machine().describe_context(), data); m_78a0 = data; }
|
||||
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78a1_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a1_r\n", machine().describe_context());
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a4_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a4_w %04x\n", machine().describe_context(), data); m_78a4 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a5_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a5_w %04x\n", machine().describe_context(), data); m_78a5 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a6_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78a6_w %04x\n", machine().describe_context(), data); m_78a6 = data; }
|
||||
@ -177,6 +204,13 @@ WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78a8_w) { LOGMASKED(LOG_GCM39
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b0_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b0_w %04x\n", machine().describe_context(), data); m_78b0 = data; }
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b1_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b1_w %04x\n", machine().describe_context(), data); m_78b1 = data; }
|
||||
|
||||
READ16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_r\n", machine().describe_context());
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(sunplus_gcm394_base_device::unkarea_78b2_w) { LOGMASKED(LOG_GCM394, "%s:sunplus_gcm394_base_device::unkarea_78b2_w %04x\n", machine().describe_context(), data); m_78b2 = data; }
|
||||
|
||||
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; }
|
||||
@ -268,7 +302,7 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
map(0x007042, 0x007042).w(m_spg_video, FUNC(gcm394_base_video_device::unknown_video_device2_unk2_w)); // maybe sprites? written as 7022, 702d and 7042 group
|
||||
|
||||
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(m_spg_video, FUNC(gcm394_base_video_device::video_7063_w));
|
||||
map(0x007063, 0x007063).rw(m_spg_video, FUNC(gcm394_base_video_device::video_7063_r), FUNC(gcm394_base_video_device::video_7063_w));
|
||||
|
||||
// note, 70 / 71 / 72 are the same offsets used for DMA as in spg2xx video device
|
||||
map(0x007070, 0x007070).w(m_spg_video, FUNC(gcm394_base_video_device::video_dma_source_w)); // video dma, not system dma? (sets pointers to ram buffers)
|
||||
@ -344,6 +378,8 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
|
||||
map(0x0078a0, 0x0078a0).w(FUNC(sunplus_gcm394_base_device::unkarea_78a0_w));
|
||||
|
||||
map(0x0078a1, 0x0078a1).r(FUNC(sunplus_gcm394_base_device::unkarea_78a1_r));
|
||||
|
||||
map(0x0078a4, 0x0078a4).w(FUNC(sunplus_gcm394_base_device::unkarea_78a4_w));
|
||||
map(0x0078a5, 0x0078a5).w(FUNC(sunplus_gcm394_base_device::unkarea_78a5_w));
|
||||
map(0x0078a6, 0x0078a6).w(FUNC(sunplus_gcm394_base_device::unkarea_78a6_w));
|
||||
@ -352,6 +388,8 @@ void sunplus_gcm394_base_device::internal_map(address_map &map)
|
||||
|
||||
map(0x0078b0, 0x0078b0).w(FUNC(sunplus_gcm394_base_device::unkarea_78b0_w));
|
||||
map(0x0078b1, 0x0078b1).w(FUNC(sunplus_gcm394_base_device::unkarea_78b1_w));
|
||||
|
||||
map(0x0078b2, 0x0078b2).r(FUNC(sunplus_gcm394_base_device::unkarea_78b2_r));
|
||||
map(0x0078b2, 0x0078b2).w(FUNC(sunplus_gcm394_base_device::unkarea_78b2_w));
|
||||
|
||||
map(0x0078b8, 0x0078b8).w(FUNC(sunplus_gcm394_base_device::unkarea_78b8_w));
|
||||
@ -394,6 +432,14 @@ void sunplus_gcm394_base_device::device_start()
|
||||
m_porta_in.resolve_safe(0);
|
||||
m_portb_in.resolve_safe(0);
|
||||
|
||||
m_porta_out.resolve();
|
||||
|
||||
|
||||
m_space_read_cb.resolve_safe(0);
|
||||
m_space_write_cb.resolve();
|
||||
m_bank_write_cb.resolve();
|
||||
|
||||
|
||||
m_unk_timer = timer_alloc(0);
|
||||
m_unk_timer->adjust(attotime::never);
|
||||
}
|
||||
|
@ -21,14 +21,18 @@
|
||||
class sunplus_gcm394_base_device : public unsp_20_device, public device_mixer_interface
|
||||
{
|
||||
public:
|
||||
sunplus_gcm394_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: unsp_20_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(sunplus_gcm394_base_device::internal_map), this))
|
||||
, device_mixer_interface(mconfig, *this, 2)
|
||||
, m_screen(*this, finder_base::DUMMY_TAG)
|
||||
, m_spg_video(*this, "spgvideo")
|
||||
, m_spg_audio(*this, "spgaudio")
|
||||
, m_porta_in(*this)
|
||||
, m_portb_in(*this)
|
||||
sunplus_gcm394_base_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock) :
|
||||
unsp_20_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(sunplus_gcm394_base_device::internal_map), this)),
|
||||
device_mixer_interface(mconfig, *this, 2),
|
||||
m_screen(*this, finder_base::DUMMY_TAG),
|
||||
m_spg_video(*this, "spgvideo"),
|
||||
m_spg_audio(*this, "spgaudio"),
|
||||
m_porta_in(*this),
|
||||
m_portb_in(*this),
|
||||
m_porta_out(*this),
|
||||
m_space_read_cb(*this),
|
||||
m_space_write_cb(*this),
|
||||
m_bank_write_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,6 +41,14 @@ public:
|
||||
auto porta_in() { return m_porta_in.bind(); }
|
||||
auto portb_in() { return m_portb_in.bind(); }
|
||||
|
||||
auto porta_out() { return m_porta_out.bind(); }
|
||||
|
||||
|
||||
auto space_read_callback() { return m_space_read_cb.bind(); }
|
||||
auto space_write_callback() { return m_space_write_cb.bind(); }
|
||||
auto bank_write_callback() { return m_bank_write_cb.bind(); }
|
||||
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(vblank) { m_spg_video->vblank(state); }
|
||||
|
||||
virtual void device_add_mconfig(machine_config& config) override;
|
||||
@ -55,6 +67,8 @@ protected:
|
||||
devcb_read16 m_porta_in;
|
||||
devcb_read16 m_portb_in;
|
||||
|
||||
devcb_write16 m_porta_out;
|
||||
|
||||
uint16_t m_dma_params[7];
|
||||
|
||||
// unk 78xx
|
||||
@ -124,6 +138,10 @@ protected:
|
||||
uint16_t m_7961;
|
||||
|
||||
private:
|
||||
devcb_read16 m_space_read_cb;
|
||||
devcb_write16 m_space_write_cb;
|
||||
devcb_write16 m_bank_write_cb;
|
||||
|
||||
DECLARE_READ16_MEMBER(unk_r);
|
||||
DECLARE_WRITE16_MEMBER(unk_w);
|
||||
|
||||
@ -189,6 +207,8 @@ private:
|
||||
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78a0_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(unkarea_78a1_r);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78a4_w);
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78a5_w);
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78a6_w);
|
||||
@ -197,6 +217,8 @@ private:
|
||||
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78b0_w);
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78b1_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(unkarea_78b2_r);
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78b2_w);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(unkarea_78b8_w);
|
||||
|
@ -15,7 +15,7 @@ DEFINE_DEVICE_TYPE(GCM394_VIDEO, gcm394_video_device, "gcm394_video", "SunPlus G
|
||||
#define LOG_GCM394_TMAP (1U << 2)
|
||||
#define LOG_GCM394_VIDEO (1U << 1)
|
||||
|
||||
#define VERBOSE (LOG_GCM394_VIDEO_DMA | LOG_GCM394_VIDEO)
|
||||
#define VERBOSE (LOG_GCM394_TMAP | LOG_GCM394_VIDEO_DMA | LOG_GCM394_VIDEO)
|
||||
|
||||
#include "logmacro.h"
|
||||
|
||||
@ -768,6 +768,13 @@ WRITE16_MEMBER(gcm394_base_video_device::video_703a_w) { LOGMASKED(LOG_GCM394_VI
|
||||
READ16_MEMBER(gcm394_base_video_device::video_7062_r) { LOGMASKED(LOG_GCM394_VIDEO, "%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_VIDEO, "%s:gcm394_base_video_device::video_7062_w %04x\n", machine().describe_context(), data); m_7062 = data; }
|
||||
|
||||
READ16_MEMBER(gcm394_base_video_device::video_7063_r)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7063_r\n", machine().describe_context());
|
||||
return machine().rand();
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(gcm394_base_video_device::video_7063_w)
|
||||
{
|
||||
LOGMASKED(LOG_GCM394_VIDEO, "%s:gcm394_base_video_device::video_7063_w %04x\n", machine().describe_context(), data);
|
||||
|
@ -61,6 +61,7 @@ public:
|
||||
DECLARE_READ16_MEMBER(video_7062_r);
|
||||
DECLARE_WRITE16_MEMBER(video_7062_w);
|
||||
|
||||
DECLARE_READ16_MEMBER(video_7063_r);
|
||||
DECLARE_WRITE16_MEMBER(video_7063_w);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(video_702a_w);
|
||||
|
@ -2,7 +2,7 @@
|
||||
// copyright-holders:David Haywood
|
||||
/*
|
||||
SunPlus unSP based hardware, SPG-??? (6xx?) (die is GCM394)
|
||||
|
||||
|
||||
Compared to vii.cpp this is clearly newer, has extra opcodes, different internal map etc. also scaling and higher resolutions based on Spongebob
|
||||
|
||||
Smart Fit Park
|
||||
@ -24,14 +24,16 @@
|
||||
class gcm394_game_state : public driver_device
|
||||
{
|
||||
public:
|
||||
gcm394_game_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_screen(*this, "screen")
|
||||
, m_bank(*this, "cartbank")
|
||||
, m_io_p1(*this, "P1")
|
||||
, m_io_p2(*this, "P2")
|
||||
{ }
|
||||
gcm394_game_state(const machine_config& mconfig, device_type type, const char* tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_screen(*this, "screen"),
|
||||
m_bank(*this, "cartbank"),
|
||||
m_io_p1(*this, "P1"),
|
||||
m_io_p2(*this, "P2"),
|
||||
m_romregion(*this, "maincpu")
|
||||
{
|
||||
}
|
||||
|
||||
void base(machine_config &config);
|
||||
|
||||
@ -51,13 +53,85 @@ protected:
|
||||
|
||||
virtual void mem_map_4m(address_map &map);
|
||||
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space);
|
||||
|
||||
private:
|
||||
required_region_ptr<uint16_t> m_romregion;
|
||||
|
||||
uint32_t m_current_bank;
|
||||
int m_numbanks;
|
||||
|
||||
DECLARE_READ16_MEMBER(porta_r);
|
||||
DECLARE_READ16_MEMBER(portb_r);
|
||||
|
||||
DECLARE_READ16_MEMBER(read_external_space);
|
||||
};
|
||||
|
||||
class wrlshunt_game_state : public gcm394_game_state
|
||||
{
|
||||
public:
|
||||
wrlshunt_game_state(const machine_config& mconfig, device_type type, const char* tag) :
|
||||
gcm394_game_state(mconfig, type, tag),
|
||||
m_mainram(*this, "mainram")
|
||||
{
|
||||
}
|
||||
|
||||
void wrlshunt(machine_config &config);
|
||||
|
||||
protected:
|
||||
//virtual void machine_start() override;
|
||||
//virtual void machine_reset() override;
|
||||
|
||||
void wrlshunt_map(address_map &map);
|
||||
|
||||
virtual DECLARE_WRITE16_MEMBER(write_external_space) override;
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_READ16_MEMBER(hunt_porta_r);
|
||||
DECLARE_WRITE16_MEMBER(hunt_porta_w);
|
||||
|
||||
required_shared_ptr<u16> m_mainram;
|
||||
};
|
||||
|
||||
READ16_MEMBER(gcm394_game_state::read_external_space)
|
||||
{
|
||||
//logerror("reading offset %04x\n", offset * 2);
|
||||
return m_romregion[offset];
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gcm394_game_state::write_external_space)
|
||||
{
|
||||
logerror("DMA writing to external space (RAM?) %08x %04x\n", offset, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(wrlshunt_game_state::write_external_space)
|
||||
{
|
||||
// logerror("DMA writing to external space (RAM?) %08x %04x\n", offset, data);
|
||||
|
||||
if (offset & 0x0800000)
|
||||
{
|
||||
offset &= 0x03fffff;
|
||||
|
||||
if (offset < 0x03d0000)
|
||||
{
|
||||
m_mainram[offset] = data;
|
||||
//logerror("DMA writing to external space (RAM?) %08x %04x\n", offset, data);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("DMA writing to external space (RAM?) (out of bounds) %08x %04x\n", offset, data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("DMA writing to external space (RAM?) (unknown handling) %08x %04x\n", offset, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
READ16_MEMBER(gcm394_game_state::porta_r)
|
||||
{
|
||||
uint16_t data = m_io_p1->read();
|
||||
@ -79,6 +153,8 @@ void gcm394_game_state::base(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &gcm394_game_state::mem_map_4m);
|
||||
m_maincpu->porta_in().set(FUNC(gcm394_game_state::porta_r));
|
||||
m_maincpu->portb_in().set(FUNC(gcm394_game_state::portb_r));
|
||||
m_maincpu->space_read_callback().set(FUNC(gcm394_game_state::read_external_space));
|
||||
m_maincpu->space_write_callback().set(FUNC(gcm394_game_state::write_external_space));
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_refresh_hz(60);
|
||||
@ -94,8 +170,38 @@ void gcm394_game_state::base(machine_config &config)
|
||||
|
||||
}
|
||||
|
||||
READ16_MEMBER(wrlshunt_game_state::hunt_porta_r)
|
||||
{
|
||||
uint16_t data = m_io_p1->read();
|
||||
logerror("%s: Port A Read: %04x\n", machine().describe_context(), data);
|
||||
return data;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(wrlshunt_game_state::hunt_porta_w)
|
||||
{
|
||||
logerror("%s: Port A:WRITE %04x\n", machine().describe_context(), data);
|
||||
|
||||
// skip check (EEPROM?)
|
||||
if (m_mainram[0x5b354 - 0x30000] == 0xafd0)
|
||||
m_mainram[0x5b354 - 0x30000] = 0xB403;
|
||||
}
|
||||
|
||||
|
||||
void wrlshunt_game_state::wrlshunt(machine_config &config)
|
||||
{
|
||||
gcm394_game_state::base(config);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &wrlshunt_game_state::wrlshunt_map);
|
||||
|
||||
m_maincpu->porta_in().set(FUNC(wrlshunt_game_state::hunt_porta_r));
|
||||
m_maincpu->porta_out().set(FUNC(wrlshunt_game_state::hunt_porta_w));
|
||||
|
||||
}
|
||||
|
||||
void gcm394_game_state::switch_bank(uint32_t bank)
|
||||
{
|
||||
if (!m_bank)
|
||||
return;
|
||||
|
||||
if (bank != m_current_bank)
|
||||
{
|
||||
m_current_bank = bank;
|
||||
@ -106,8 +212,22 @@ void gcm394_game_state::switch_bank(uint32_t bank)
|
||||
|
||||
void gcm394_game_state::machine_start()
|
||||
{
|
||||
m_bank->configure_entries(0, (memregion("maincpu")->bytes() + 0x7fffff) / 0x800000, memregion("maincpu")->base(), 0x800000);
|
||||
m_bank->set_entry(0);
|
||||
if (m_bank)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (m_romregion.bytes() / 0x800000); i++)
|
||||
{
|
||||
m_bank->configure_entry(i, &m_romregion[i * 0x800000]);
|
||||
}
|
||||
|
||||
m_numbanks = i;
|
||||
|
||||
m_bank->set_entry(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_numbanks = 0;
|
||||
}
|
||||
|
||||
save_item(NAME(m_current_bank));
|
||||
}
|
||||
@ -119,12 +239,18 @@ void gcm394_game_state::machine_reset()
|
||||
|
||||
void gcm394_game_state::mem_map_4m(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x01ffff).bankr("cartbank");
|
||||
map(0x000000, 0x00ffff).rom().region("maincpu", 0); // non-banked area on this SoC?
|
||||
|
||||
// smartfp really expects the ROM at 0 to map here, so maybe this is how the newer SoC works
|
||||
map(0x020000, 0x3fffff).bankr("cartbank");
|
||||
}
|
||||
|
||||
void wrlshunt_game_state::wrlshunt_map(address_map &map)
|
||||
{
|
||||
map(0x000000, 0x00ffff).rom().region("maincpu", 0); // non-banked area on this SoC?
|
||||
map(0x030000, 0x3fffff).ram().share("mainram");
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( gcm394 )
|
||||
PORT_START("P1")
|
||||
PORT_DIPNAME( 0x0001, 0x0001, "P1" )
|
||||
@ -219,6 +345,10 @@ static INPUT_PORTS_START( gcm394 )
|
||||
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( wrlshunt )
|
||||
PORT_START("P1")
|
||||
PORT_START("P2")
|
||||
INPUT_PORTS_END
|
||||
|
||||
/*
|
||||
Wireless Hunting Video Game System
|
||||
@ -326,7 +456,7 @@ GLB_GP-FS1_0405L_SPU_1.0.2.3
|
||||
SPF2ALP
|
||||
|
||||
"GPnandnand" as a required signature appears to be referenced right here, in page 19 of a GeneralPlus document;
|
||||
http://www.lcis.com.tw/paper_store/paper_store/GPL162004A-507A_162005A-707AV10_code_reference-20147131205102.pdf
|
||||
http://www.lcis.com.tw/paper_store/paper_store/GPL162004A-507A_162005A-707AV10_code_reference-20147131205102.pdf (this link is no longer valid)
|
||||
|
||||
*/
|
||||
|
||||
@ -336,7 +466,7 @@ ROM_START( wlsair60 )
|
||||
ROM_END
|
||||
|
||||
|
||||
CONS(2011, wrlshunt, 0, 0, base, gcm394, gcm394_game_state, empty_init, "Hamy / Kids Station Toys Inc", "Wireless Hunting Video Game System", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
|
||||
CONS(2011, wrlshunt, 0, 0, wrlshunt, wrlshunt, wrlshunt_game_state, empty_init, "Hamy / Kids Station Toys Inc", "Wireless Hunting Video Game System", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
|
||||
|
||||
CONS(2009, smartfp, 0, 0, base, gcm394, gcm394_game_state, empty_init, "Fisher-Price", "Fun 2 Learn Smart Fit Park (Spain)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND)
|
||||
// Fun 2 Learn 3-in-1 SMART SPORTS ?
|
||||
|
Loading…
Reference in New Issue
Block a user