summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar DavidHaywood <28625134+DavidHaywood@users.noreply.github.com>2019-12-10 19:07:37 +0000
committerGravatarGravatar DavidHaywood <28625134+DavidHaywood@users.noreply.github.com>2019-12-10 19:07:37 +0000
commit8412beb9a2a4c9511a67eb3d868a742baa9dab4e (patch) (github)
treea4f13b682448b1ab8ced2170a2f56ff56bcf58bd
parent0747c3ab9896726a23845f8836a852a7b89fb544 (diff)
downloadmame-8412beb9a2a4c9511a67eb3d868a742baa9dab4e.tar.bz2
mame-8412beb9a2a4c9511a67eb3d868a742baa9dab4e.zip
generalplus_gpac800 - copy some code from NAND into RAM for execution (nw)
-rw-r--r--src/devices/cpu/unsp/unsp_fxxx.cpp4
-rw-r--r--src/mame/drivers/sunplus_gcm394.cpp106
2 files changed, 99 insertions, 11 deletions
diff --git a/src/devices/cpu/unsp/unsp_fxxx.cpp b/src/devices/cpu/unsp/unsp_fxxx.cpp
index 774a726f9a6..8c926c255d5 100644
--- a/src/devices/cpu/unsp/unsp_fxxx.cpp
+++ b/src/devices/cpu/unsp/unsp_fxxx.cpp
@@ -251,8 +251,8 @@ void unsp_12_device::execute_fxxx_101_group(uint16_t op)
return;
case 0xf145: case 0xf345: case 0xf545: case 0xf745: case 0xf945: case 0xfb45: case 0xfd45: case 0xff45:
- logerror("fir_mov off\n");
- unimplemented_opcode(op);
+ logerror("unimplemented: fir_mov off\n");
+ //unimplemented_opcode(op); // generalplus_gpac800 games do this on startup
return;
case 0xf161: case 0xf361: case 0xf561: case 0xf761: case 0xf961: case 0xfb61: case 0xfd61: case 0xff61:
diff --git a/src/mame/drivers/sunplus_gcm394.cpp b/src/mame/drivers/sunplus_gcm394.cpp
index 0dfa49bc77b..cc576fff8a1 100644
--- a/src/mame/drivers/sunplus_gcm394.cpp
+++ b/src/mame/drivers/sunplus_gcm394.cpp
@@ -37,7 +37,6 @@ public:
void base(machine_config &config);
- void nand_init();
protected:
virtual void machine_start() override;
@@ -103,6 +102,33 @@ private:
virtual DECLARE_WRITE16_MEMBER(write_external_space) override;
};
+
+class generalplus_gpac800_game_state : public gcm394_game_state
+{
+public:
+ generalplus_gpac800_game_state(const machine_config& mconfig, device_type type, const char* tag) :
+ gcm394_game_state(mconfig, type, tag),
+ m_mainram(*this, "mainram")
+ {
+ }
+
+ void generalplus_gpac800(machine_config &config);
+
+ void nand_init();
+
+protected:
+ virtual void machine_reset() override;
+
+ void generalplus_gpac800_map(address_map &map);
+
+private:
+ required_shared_ptr<u16> m_mainram;
+ std::vector<uint8_t> m_strippedrom;
+};
+
+
+
+
READ16_MEMBER(gcm394_game_state::read_external_space)
{
//logerror("reading offset %04x\n", offset * 2);
@@ -245,10 +271,15 @@ void wrlshunt_game_state::wrlshunt(machine_config &config)
m_screen->set_size(320*2, 262*2);
m_screen->set_visarea(0, (320*2)-1, 0, (240*2)-1);
+}
-
+void generalplus_gpac800_game_state::generalplus_gpac800(machine_config &config)
+{
+ gcm394_game_state::base(config);
+ m_maincpu->set_addrmap(AS_PROGRAM, &generalplus_gpac800_game_state::generalplus_gpac800_map);
}
+
void gcm394_game_state::switch_bank(uint32_t bank)
{
if (!m_bank)
@@ -303,6 +334,12 @@ void wrlshunt_game_state::wrlshunt_map(address_map &map)
map(0x030000, 0x3fffff).ram().share("mainram");
}
+void generalplus_gpac800_game_state::generalplus_gpac800_map(address_map &map)
+{
+ map(0x000000, 0x3fffff).ram().share("mainram");
+}
+
+
static INPUT_PORTS_START( gcm394 )
PORT_START("P1")
// entirely non-standard mat based controller (0-11 are where your feet are placed normally, row of selection places to step above those)
@@ -526,16 +563,67 @@ CONS(2009, smartfp, 0, 0, base, gcm394, gcm394_game_state, empty_init, "Fisher-P
// Fun 2 Learn 3-in-1 SMART SPORTS ?
-void gcm394_game_state::nand_init()
+void generalplus_gpac800_game_state::machine_reset()
+{
+ address_space& mem = m_maincpu->space(AS_PROGRAM);
+
+ // copy a block of code from the NAND to RAM
+ for (int i = 0; i < 0x2000; i++)
+ {
+ uint16_t word = m_strippedrom[(i * 2) + 0] | (m_strippedrom[(i * 2) + 1] << 8);
+
+ mem.write_word(0x4000+i, word);
+ }
+
+ mem.write_word(0xfff7, 0x4020); // point boot vector at code in RAM
+ m_maincpu->reset(); // reset CPU so vector gets read etc.
+}
+
+
+void generalplus_gpac800_game_state::nand_init()
{
+ uint8_t* rom = memregion("maincpu")->base();
+ int size = memregion("maincpu")->bytes();
+
+ const int blocksize = 0x210;
+ const int blocksize_stripped = 0x200;
+
+ int numblocks = size / blocksize;
+
+ m_strippedrom.resize(numblocks * blocksize_stripped);
+
+ for (int i = 0; i < numblocks; i++)
+ {
+ const int base = i * blocksize;
+ const int basestripped = i * blocksize_stripped;
+
+ for (int j = 0; j < blocksize_stripped; j++)
+ {
+ m_strippedrom[basestripped + j] = rom[base + j];
+ }
+ }
+
+ // debug to allow for easy use of unidasm.exe
+ if (0)
+ {
+ FILE *fp;
+ char filename[256];
+ sprintf(filename,"stripped_%s", machine().system().name);
+ fp=fopen(filename, "w+b");
+ if (fp)
+ {
+ fwrite(&m_strippedrom[0], blocksize_stripped * numblocks, 1, fp);
+ fclose(fp);
+ }
+ }
}
// NAND dumps w/ internal bootstrap (and u'nSP 2.0 extended opcodes) (have gpnandnand strings)
// the JAKKS ones seem to be known as 'Generalplus GPAC800' hardware
-CONS(2010, wlsair60, 0, 0, base, gcm394, gcm394_game_state, nand_init, "Jungle Soft / Kids Station Toys Inc", "Wireless Air 60", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
-CONS(200?, jak_gtg, 0, 0, base, gcm394, gcm394_game_state, nand_init, "JAKKS Pacific Inc", "Golden Tee Golf (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
-CONS(200?, jak_car2, 0, 0, base, gcm394, gcm394_game_state, nand_init, "JAKKS Pacific Inc", "Cars 2 (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
-CONS(200?, jak_tsm , 0, 0, base, gcm394, gcm394_game_state, nand_init, "JAKKS Pacific Inc", "Toy Story Mania (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
-CONS(200?, vbaby, 0, 0, base, gcm394, gcm394_game_state, nand_init, "VTech", "V.Baby", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
-CONS(200?, beambox, 0, 0, base, gcm394, gcm394_game_state, nand_init, "Hasbro", "Playskool Heroes Transformers Rescue Bots Beam Box (Spain)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(2010, wlsair60, 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "Jungle Soft / Kids Station Toys Inc", "Wireless Air 60", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(200?, jak_gtg, 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "JAKKS Pacific Inc", "Golden Tee Golf (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(200?, jak_car2, 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "JAKKS Pacific Inc", "Cars 2 (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(200?, jak_tsm , 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "JAKKS Pacific Inc", "Toy Story Mania (JAKKS Pacific TV Game)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(200?, vbaby, 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "VTech", "V.Baby", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)
+CONS(200?, beambox, 0, 0, generalplus_gpac800, gcm394, generalplus_gpac800_game_state, nand_init, "Hasbro", "Playskool Heroes Transformers Rescue Bots Beam Box (Spain)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING)