diff options
author | 2020-09-08 20:49:13 -0400 | |
---|---|---|
committer | 2020-09-08 20:49:13 -0400 | |
commit | 7fb8a922d04ac65422c6ebdfeb04039c206ded4a (patch) | |
tree | 2aefcc4c192fc52fb7902fa39d5946e061de6f8b | |
parent | 2190eb1c1b31a89e8e5983c926300196eb8f37b5 (diff) |
unk6502_st2xxx.cpp: Load internal ROM at the correct offset
* st2205u: Temporary kludge
-rw-r--r-- | src/devices/cpu/m6502/st2205u.cpp | 70 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2205u.h | 4 | ||||
-rw-r--r-- | src/mame/drivers/unk6502_st2xxx.cpp | 22 |
3 files changed, 61 insertions, 35 deletions
diff --git a/src/devices/cpu/m6502/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp index 5ebf6236f28..54a678c47fc 100644 --- a/src/devices/cpu/m6502/st2205u.cpp +++ b/src/devices/cpu/m6502/st2205u.cpp @@ -64,6 +64,7 @@ st2205u_device::st2205u_device(const machine_config &mconfig, const char *tag, d , m_dmod{0} , m_rctr(0) , m_lvctr(0) + , m_alt_map(false) { } @@ -819,11 +820,21 @@ void st2205u_device::int_map(address_map &map) map(0x0008, 0x000d).rw(FUNC(st2205u_device::pctrl_r), FUNC(st2205u_device::pctrl_w)); map(0x000e, 0x000e).rw(FUNC(st2205u_device::pfc_r), FUNC(st2205u_device::pfc_w)); map(0x000f, 0x000f).rw(FUNC(st2205u_device::pfd_r), FUNC(st2205u_device::pfd_w)); - map(0x0010, 0x0017).rw(FUNC(st2205u_device::psg_r), FUNC(st2205u_device::psg_w)); - map(0x0018, 0x001b).rw(FUNC(st2205u_device::vol_r), FUNC(st2205u_device::vol_w)); - map(0x001c, 0x001d).rw(FUNC(st2205u_device::volm_r), FUNC(st2205u_device::volm_w)); - map(0x001e, 0x001e).rw(FUNC(st2205u_device::psgc_r), FUNC(st2205u_device::psgc_w)); - map(0x001f, 0x001f).rw(FUNC(st2205u_device::psgm_r), FUNC(st2205u_device::psgm_w)); + if (m_alt_map) + { + map(0x0012, 0x0012).rw(FUNC(st2205u_device::sctr_r), FUNC(st2205u_device::sctr_w)); + map(0x0013, 0x0013).rw(FUNC(st2205u_device::sckr_r), FUNC(st2205u_device::sckr_w)); + map(0x0014, 0x0014).rw(FUNC(st2205u_device::ssr_r), FUNC(st2205u_device::ssr_w)); + map(0x0015, 0x0015).rw(FUNC(st2205u_device::smod_r), FUNC(st2205u_device::smod_w)); + } + else + { + map(0x0010, 0x0017).rw(FUNC(st2205u_device::psg_r), FUNC(st2205u_device::psg_w)); + map(0x0018, 0x001b).rw(FUNC(st2205u_device::vol_r), FUNC(st2205u_device::vol_w)); + map(0x001c, 0x001d).rw(FUNC(st2205u_device::volm_r), FUNC(st2205u_device::volm_w)); + map(0x001e, 0x001e).rw(FUNC(st2205u_device::psgc_r), FUNC(st2205u_device::psgc_w)); + map(0x001f, 0x001f).rw(FUNC(st2205u_device::psgm_r), FUNC(st2205u_device::psgm_w)); + } map(0x0020, 0x0027).rw(FUNC(st2205u_device::tc_12bit_r), FUNC(st2205u_device::tc_12bit_w)); map(0x0028, 0x0028).rw(FUNC(st2205u_device::tien_r), FUNC(st2205u_device::tien_w)); map(0x0029, 0x0029).rw(FUNC(st2205u_device::prs_r), FUNC(st2205u_device::prs_w)); @@ -847,25 +858,36 @@ void st2205u_device::int_map(address_map &map) map(0x003d, 0x003d).rw(FUNC(st2205u_device::ireqh_r), FUNC(st2205u_device::ireqh_w)); map(0x003e, 0x003e).rw(FUNC(st2205u_device::ienal_r), FUNC(st2205u_device::ienal_w)); map(0x003f, 0x003f).rw(FUNC(st2205u_device::ienah_r), FUNC(st2205u_device::ienah_w)); - map(0x0040, 0x0040).w(FUNC(st2205u_device::lssal_w)); - map(0x0041, 0x0041).w(FUNC(st2205u_device::lssah_w)); - map(0x0042, 0x0042).w(FUNC(st2205u_device::lvpw_w)); - map(0x0043, 0x0043).rw(FUNC(st2205u_device::lxmax_r), FUNC(st2205u_device::lxmax_w)); - map(0x0044, 0x0044).rw(FUNC(st2205u_device::lymax_r), FUNC(st2205u_device::lymax_w)); - map(0x0045, 0x0045).rw(FUNC(st2205u_device::lpan_r), FUNC(st2205u_device::lpan_w)); - map(0x0046, 0x0046).rw(FUNC(st2205u_device::lbuf_r), FUNC(st2205u_device::lbuf_w)); - map(0x0047, 0x0047).rw(FUNC(st2205u_device::lctr_r), FUNC(st2205u_device::lctr_w)); - map(0x0048, 0x0048).w(FUNC(st2205u_device::lckr_w)); - map(0x0049, 0x0049).w(FUNC(st2205u_device::lfra_w)); - map(0x004a, 0x004a).rw(FUNC(st2205u_device::lac_r), FUNC(st2205u_device::lac_w)); - map(0x004b, 0x004b).rw(FUNC(st2205u_device::lpwm_r), FUNC(st2205u_device::lpwm_w)); - map(0x004c, 0x004c).w(FUNC(st2205u_device::lpal_w)); - map(0x004e, 0x004e).rw(FUNC(st2205u_device::pl_r), FUNC(st2205u_device::pl_w)); - map(0x004f, 0x004f).rw(FUNC(st2205u_device::pcl_r), FUNC(st2205u_device::pcl_w)); - map(0x0052, 0x0052).rw(FUNC(st2205u_device::sctr_r), FUNC(st2205u_device::sctr_w)); - map(0x0053, 0x0053).rw(FUNC(st2205u_device::sckr_r), FUNC(st2205u_device::sckr_w)); - map(0x0054, 0x0054).rw(FUNC(st2205u_device::ssr_r), FUNC(st2205u_device::ssr_w)); - map(0x0055, 0x0055).rw(FUNC(st2205u_device::smod_r), FUNC(st2205u_device::smod_w)); + if (m_alt_map) + { + map(0x0040, 0x0047).rw(FUNC(st2205u_device::psg_r), FUNC(st2205u_device::psg_w)); + map(0x0048, 0x004b).rw(FUNC(st2205u_device::vol_r), FUNC(st2205u_device::vol_w)); + map(0x004c, 0x004d).rw(FUNC(st2205u_device::volm_r), FUNC(st2205u_device::volm_w)); + map(0x004e, 0x004e).rw(FUNC(st2205u_device::psgc_r), FUNC(st2205u_device::psgc_w)); + map(0x004f, 0x004f).rw(FUNC(st2205u_device::psgm_r), FUNC(st2205u_device::psgm_w)); + } + else + { + map(0x0040, 0x0040).w(FUNC(st2205u_device::lssal_w)); + map(0x0041, 0x0041).w(FUNC(st2205u_device::lssah_w)); + map(0x0042, 0x0042).w(FUNC(st2205u_device::lvpw_w)); + map(0x0043, 0x0043).rw(FUNC(st2205u_device::lxmax_r), FUNC(st2205u_device::lxmax_w)); + map(0x0044, 0x0044).rw(FUNC(st2205u_device::lymax_r), FUNC(st2205u_device::lymax_w)); + map(0x0045, 0x0045).rw(FUNC(st2205u_device::lpan_r), FUNC(st2205u_device::lpan_w)); + map(0x0046, 0x0046).rw(FUNC(st2205u_device::lbuf_r), FUNC(st2205u_device::lbuf_w)); + map(0x0047, 0x0047).rw(FUNC(st2205u_device::lctr_r), FUNC(st2205u_device::lctr_w)); + map(0x0048, 0x0048).w(FUNC(st2205u_device::lckr_w)); + map(0x0049, 0x0049).w(FUNC(st2205u_device::lfra_w)); + map(0x004a, 0x004a).rw(FUNC(st2205u_device::lac_r), FUNC(st2205u_device::lac_w)); + map(0x004b, 0x004b).rw(FUNC(st2205u_device::lpwm_r), FUNC(st2205u_device::lpwm_w)); + map(0x004c, 0x004c).w(FUNC(st2205u_device::lpal_w)); + map(0x004e, 0x004e).rw(FUNC(st2205u_device::pl_r), FUNC(st2205u_device::pl_w)); + map(0x004f, 0x004f).rw(FUNC(st2205u_device::pcl_r), FUNC(st2205u_device::pcl_w)); + map(0x0052, 0x0052).rw(FUNC(st2205u_device::sctr_r), FUNC(st2205u_device::sctr_w)); + map(0x0053, 0x0053).rw(FUNC(st2205u_device::sckr_r), FUNC(st2205u_device::sckr_w)); + map(0x0054, 0x0054).rw(FUNC(st2205u_device::ssr_r), FUNC(st2205u_device::ssr_w)); + map(0x0055, 0x0055).rw(FUNC(st2205u_device::smod_r), FUNC(st2205u_device::smod_w)); + } map(0x0057, 0x0057).rw(FUNC(st2205u_device::lvctr_r), FUNC(st2205u_device::lvctr_w)); map(0x0058, 0x0058).rw(FUNC(st2205u_device::dptrl_r), FUNC(st2205u_device::dptrl_w)); map(0x0059, 0x0059).rw(FUNC(st2205u_device::dptrh_r), FUNC(st2205u_device::dptrh_w)); diff --git a/src/devices/cpu/m6502/st2205u.h b/src/devices/cpu/m6502/st2205u.h index f3ce7df0f4f..3ea5c8de918 100644 --- a/src/devices/cpu/m6502/st2205u.h +++ b/src/devices/cpu/m6502/st2205u.h @@ -59,6 +59,8 @@ public: st2205u_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + void set_alt_map() { m_alt_map = true; } + protected: virtual void device_start() override; virtual void device_reset() override; @@ -204,6 +206,8 @@ private: u8 m_dmod[2]; u8 m_rctr; u8 m_lvctr; + + bool m_alt_map; // hack }; DECLARE_DEVICE_TYPE(ST2205U, st2205u_device) diff --git a/src/mame/drivers/unk6502_st2xxx.cpp b/src/mame/drivers/unk6502_st2xxx.cpp index 24ddb72fd62..bf1bbf25dca 100644 --- a/src/mame/drivers/unk6502_st2xxx.cpp +++ b/src/mame/drivers/unk6502_st2xxx.cpp @@ -8,12 +8,11 @@ // these games were ported to unSP hardware at some point, see generaplus_gpl_unknown.cpp -// BIOS calls are made very frequently to the undumped firmware. -// The most common call ($6058 in bbl380, $6062 in ragc153 & dphh8630) seems to involve downloading a snippet of code from Flash and executing it from RAM at $0300. +// BIOS calls are made very frequently to the firmware (undumped for bbl380). +// The most common call ($6058 in bbl380, $6062 in ragc153 & dphh8630) seems to involve downloading a snippet of code from SPI and executing it from RAM at $0300. // A variant of this call ($60d2 in bbl380, $60e3 in ragc153 & dphh8630) is invoked with jsr. // For these calls, a 24-bit starting address is specified in $82:$81:$80, and the length in bytes is twice the number specified in $84:$83. -// ST2205U cannot execute code directly from Flash, but has a built-in DMA-compatible NAND interface on Port F ($05). -// The XOR used on ragc153 & dphh8630 is likely performed by the DMA controller. +// There is a configurable XOR specified in $99 on ragc153 & dphh8630. // $6003 performs a table lookup, depositing a sequence of data at $008e. // $6000 is some sort of macro call with the X register as function selector // (X = $24 should display the character in $0102 on screen). @@ -51,7 +50,7 @@ private: void bbl380_map(address_map &map); - required_device<st2xxx_device> m_maincpu; + required_device<st2205u_device> m_maincpu; required_device<palette_device> m_palette; required_device<screen_device> m_screen; }; @@ -88,7 +87,7 @@ void bbl380_state::lcdc_data_w(u8 data) void bbl380_state::bbl380_map(address_map &map) { - map(0x000000, 0x3fffff).rom().region("maincpu", 0); // FIXME: probably not directly mapped (ST2205U has serial Flash interface on port F) + map(0x000000, 0x3fffff).rom().region("maincpu", 0); map(0x600000, 0x600000).w(FUNC(bbl380_state::lcdc_command_w)); map(0x604000, 0x604000).rw(FUNC(bbl380_state::lcdc_data_r), FUNC(bbl380_state::lcdc_data_w)); } @@ -98,8 +97,9 @@ INPUT_PORTS_END void bbl380_state::bbl380(machine_config &config) { - ST2205U(config, m_maincpu, 8000000); // unknown clock; type guessed + ST2205U(config, m_maincpu, 8000000); // unknown clock; type close but not quite correct? m_maincpu->set_addrmap(AS_DATA, &bbl380_state::bbl380_map); + m_maincpu->set_alt_map(); SCREEN(config, m_screen, SCREEN_TYPE_LCD); // TFT color LCD m_screen->set_refresh_hz(60); @@ -112,7 +112,7 @@ void bbl380_state::bbl380(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200); // LCD controller seems to be either Sitronix ST7735R or (if RDDID bytes match) Ilitek ILI9163C - // (unless the SoC's built-in one is used and the routines which program these are leftovers) + // (SoC's built-in LCDC is unused or nonexistent?) // Several other LCDC models are identified by ragc153 and dphh8630 } @@ -128,7 +128,7 @@ ROM_END ROM_START( ragc153 ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "st2x_internal.bin", 0x000000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range + ROM_LOAD( "st2x_internal.bin", 0x002000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) ROM_LOAD( "25q32ams.bin", 0x000000, 0x400000, CRC(de328d73) SHA1(d17b97e9057be4add68b9f5a26e04c9f0a139673) ) // first 0x100 bytes would read as 0xff at regular speed, but give valid looking consistent data at a slower rate @@ -136,7 +136,7 @@ ROM_END ROM_START( dphh8630 ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "st2x_internal.bin", 0x000000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range + ROM_LOAD( "st2x_internal.bin", 0x002000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) ROM_LOAD( "bg25q16.bin", 0x000000, 0x200000, CRC(277850d5) SHA1(740087842e1e63bf99b4ca9c1b2053361f267269) ) @@ -144,7 +144,7 @@ ROM_END ROM_START( dgun2953 ) ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASEFF ) - ROM_LOAD( "st2x_internal.bin", 0x000000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range + ROM_LOAD( "st2x_internal.bin", 0x002000, 0x002000, BAD_DUMP CRC(f4dc1fc2) SHA1(bbc11539c48eb612ebae50da45e03b6fde440941) ) // internal OTPROM BIOS, dumped from dgun2953 PCB, 6000-7fff range ROM_REGION( 0x800000, "spi", ROMREGION_ERASEFF ) ROM_LOAD( "dg160_25x32v_ef3016.bin", 0x000000, 0x400000, CRC(2e993bac) SHA1(4b310e326a47df1980aeef38aa9a59018d7fe76f) ) |