summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/sunplus_gcm394.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/sunplus_gcm394.cpp')
-rw-r--r--src/mame/drivers/sunplus_gcm394.cpp133
1 files changed, 72 insertions, 61 deletions
diff --git a/src/mame/drivers/sunplus_gcm394.cpp b/src/mame/drivers/sunplus_gcm394.cpp
index e66df242f9d..6f8f1ec9575 100644
--- a/src/mame/drivers/sunplus_gcm394.cpp
+++ b/src/mame/drivers/sunplus_gcm394.cpp
@@ -236,7 +236,7 @@ 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_has_nand(false),
+ m_nandregion(*this, "nandrom"),
m_initial_copy_words(0x2000)
{
}
@@ -263,12 +263,16 @@ protected:
virtual DECLARE_READ16_MEMBER(cs1_r) override;
virtual DECLARE_WRITE16_MEMBER(cs1_w) override;
- bool m_has_nand;
private:
- void nand_init(int blocksize, int blocksize_stripped);
+ optional_region_ptr<uint8_t> m_nandregion;
+
+ void nand_create_stripped_region();
std::vector<uint8_t> m_strippedrom;
int m_strippedsize;
+ int m_size;
+ int m_nandblocksize;
+ int m_nandblocksize_stripped;
int m_initial_copy_words;
int m_vectorbase;
@@ -532,10 +536,11 @@ WRITE16_MEMBER(generalplus_gpac800_game_state::cs1_w)
READ8_MEMBER(generalplus_gpac800_game_state::read_nand)
{
- if (!m_has_nand)
+ if (!m_nandregion)
return 0x0000;
- return m_strippedrom[offset & (m_strippedsize - 1)];
+ return (offset < m_size) ? m_nandregion[offset] : 0xFF;
+ //return m_strippedrom[offset & (m_strippedsize - 1)];
}
READ16_MEMBER(gcm394_game_state::read_external_space)
@@ -1456,48 +1461,48 @@ ROM_START( wlsair60 )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x8400000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "wlsair60.nand", 0x0000, 0x8400000, CRC(eec23b97) SHA1(1bb88290cf54579a5bb51c08a02d793cd4d79f7a) )
+ ROM_REGION( 0x8400000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "wlsair60.nand", 0x0000, 0x8400000, CRC(eec23b97) SHA1(1bb88290cf54579a5bb51c08a02d793cd4d79f7a) )
ROM_END
ROM_START( jak_gtg )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x4200000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "goldentee.bin", 0x0000, 0x4200000, CRC(87d5e815) SHA1(5dc46cd753b791449cc41d5eff4928c0dcaf35c0) )
+ ROM_REGION( 0x4200000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "goldentee.bin", 0x0000, 0x4200000, CRC(87d5e815) SHA1(5dc46cd753b791449cc41d5eff4928c0dcaf35c0) )
ROM_END
ROM_START( jak_car2 )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x4200000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "cars2.bin", 0x0000, 0x4200000, CRC(4d610e09) SHA1(bc59f5f7f676a8f2a78dfda7fb62c804bbf850b6) )
+ ROM_REGION( 0x4200000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "cars2.bin", 0x0000, 0x4200000, CRC(4d610e09) SHA1(bc59f5f7f676a8f2a78dfda7fb62c804bbf850b6) )
ROM_END
ROM_START( jak_tsm )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x4200000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "toystorymania.bin", 0x0000, 0x4200000, CRC(183b20a5) SHA1(eb4fa5ee9dfac58f5244d00d4e833b1e461cc52c) )
+ ROM_REGION( 0x4200000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "toystorymania.bin", 0x0000, 0x4200000, CRC(183b20a5) SHA1(eb4fa5ee9dfac58f5244d00d4e833b1e461cc52c) )
ROM_END
ROM_START( vbaby )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x8400000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "vbaby.bin", 0x0000, 0x8400000, CRC(d904441b) SHA1(3742bc4e1e403f061ce2813ecfafc6f30a44d287) )
+ ROM_REGION( 0x8400000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "vbaby.bin", 0x0000, 0x8400000, CRC(d904441b) SHA1(3742bc4e1e403f061ce2813ecfafc6f30a44d287) )
ROM_END
ROM_START( beambox )
ROM_REGION16_BE( 0x40000, "maincpu:internal", ROMREGION_ERASE00 )
ROM_LOAD16_WORD_SWAP( "internal.rom", 0x00000, 0x40000, NO_DUMP ) // used as bootstrap only
- ROM_REGION16_BE( 0x4200000, "nandrom", ROMREGION_ERASE00 )
- ROM_LOAD16_WORD_SWAP( "beambox.bin", 0x0000, 0x4200000, CRC(a486f04e) SHA1(73c7d99d8922eba58d94e955e254b9c3baa4443e) )
+ ROM_REGION( 0x4200000, "nandrom", ROMREGION_ERASE00 )
+ ROM_LOAD( "beambox.bin", 0x0000, 0x4200000, CRC(a486f04e) SHA1(73c7d99d8922eba58d94e955e254b9c3baa4443e) )
ROM_END
// the JAKKS ones of these seem to be known as 'Generalplus GPAC500' hardware?
@@ -1514,6 +1519,42 @@ void generalplus_gpac800_game_state::machine_start()
save_item(NAME(m_sdram));
}
+void generalplus_gpac800_game_state::nand_create_stripped_region()
+{
+ uint8_t* rom = m_nandregion;
+ int size = memregion("nandrom")->bytes();
+ m_size = size;
+
+ int numblocks = size / m_nandblocksize;
+ m_strippedsize = numblocks * m_nandblocksize_stripped;
+ m_strippedrom.resize(m_strippedsize);
+
+ for (int i = 0; i < numblocks; i++)
+ {
+ const int base = i * m_nandblocksize;
+ const int basestripped = i * m_nandblocksize_stripped;
+
+ for (int j = 0; j < m_nandblocksize_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], m_nandblocksize_stripped * numblocks, 1, fp);
+ fclose(fp);
+ }
+ }
+}
+
void generalplus_gpac800_game_state::machine_reset()
{
// configure CS defaults
@@ -1524,11 +1565,12 @@ void generalplus_gpac800_game_state::machine_reset()
mem.write_word(0x007823, 0x0047);
mem.write_word(0x007824, 0x0047);
-
m_maincpu->set_cs_space(m_memory->get_program());
- if (m_has_nand)
+ if (m_nandregion)
{
+ nand_create_stripped_region();
+
// up to 256 pages (16384kw) for each space
// (size of cs0 + cs1 + cs2 + cs3 + cs4) <= 81920kwords
@@ -1581,55 +1623,26 @@ void generalplus_gpac800_game_state::machine_reset()
}
-void generalplus_gpac800_game_state::nand_init(int blocksize, int blocksize_stripped)
+void generalplus_gpac800_game_state::nand_init210()
{
- m_sdram.resize(0x400000); // 0x400000 bytes, 0x800000 words
+ m_sdram.resize(0x400000); // 0x400000 words (0x800000 bytes)
m_sdram2.resize(0x10000);
- uint8_t* rom = memregion("nandrom")->base();
- int size = memregion("nandrom")->bytes();
+ m_nandblocksize = 0x210;
+ m_nandblocksize_stripped = 0x200;
- int numblocks = size / blocksize;
- m_strippedsize = numblocks * blocksize_stripped;
- m_strippedrom.resize(m_strippedsize);
-
- 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);
- }
- }
-
- m_has_nand = true;
m_vectorbase = 0x6fe0;
}
-void generalplus_gpac800_game_state::nand_init210()
-{
- nand_init(0x210, 0x200);
-}
-
void generalplus_gpac800_game_state::nand_init840()
{
- nand_init(0x840, 0x800);
+ m_sdram.resize(0x400000); // 0x400000 words (0x800000 bytes)
+ m_sdram2.resize(0x10000);
+
+ m_nandblocksize = 0x840;
+ m_nandblocksize_stripped = 0x800;
+
+ m_vectorbase = 0x6fe0;
}
void generalplus_gpac800_game_state::nand_wlsair60()
@@ -1720,8 +1733,6 @@ void generalplus_gpspispi_game_state::init_spi()
// these vectors must either directly point to RAM, or at least redirect there after some code
uint16_t* internal = (uint16_t*)memregion("maincpu:internal")->base();
- internal[0x0000] = 0xb00b;
-
internal[0x7ff5] = vectorbase + 0x0a;
internal[0x7ff6] = vectorbase + 0x0c;
internal[0x7ff7] = dest + 0x20; // point boot vector at code in RAM (probably in reality points to internal code that copies the first block)