-supracan: Hooked up internal 68k boot ROM, externalized key. [Ryan Holtz, wxhsplash] (#11704)

Co-authored-by: Ryan Holtz <TheMogMiner>
This commit is contained in:
MooglyGuy 2023-11-08 15:31:46 +01:00 committed by GitHub
parent f6574f8cc7
commit 7c0909c105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,6 +126,10 @@ public:
, m_maincpu(*this, "maincpu")
, m_soundcpu(*this, "soundcpu")
, m_cart(*this, "cartslot")
, m_internal68(*this, "internal68")
, m_internal68_view(*this, "internal68")
, m_internal68_view_hi(*this, "internal68_hi")
, m_umc6650key(*this, "umc6650key")
, m_vram(*this, "vram")
, m_soundram(*this, "soundram")
, m_sound(*this, "acansnd")
@ -161,6 +165,10 @@ private:
void video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
void umc6650_addr_w(uint8_t data);
uint8_t umc6650_data_r();
void umc6650_data_w(uint8_t data);
uint8_t sound_ram_read(offs_t offset);
struct dma_regs_t
@ -184,6 +192,10 @@ private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<generic_slot_device> m_cart;
required_region_ptr<uint16_t> m_internal68;
memory_view m_internal68_view;
memory_view m_internal68_view_hi;
required_region_ptr<uint8_t> m_umc6650key;
required_shared_ptr<uint16_t> m_vram;
required_shared_ptr<uint8_t> m_soundram;
@ -197,6 +209,9 @@ private:
dma_regs_t m_dma_regs;
sprdma_regs_t m_sprdma_regs;
uint8_t m_umc6650_addr = 0;
uint8_t m_umc6650_data[0x80];
uint16_t m_sound_cpu_ctrl = 0;
uint8_t m_soundcpu_irq_enable = 0;
uint8_t m_soundcpu_irq_source = 0;
@ -1313,7 +1328,23 @@ void supracan_state::vram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
m_gfxdecode->gfx(2)->mark_dirty((offset * 2) / 16);
m_gfxdecode->gfx(3)->mark_dirty((offset * 2) / 512);
m_gfxdecode->gfx(4)->mark_dirty((offset * 2) / 8);
}
void supracan_state::umc6650_addr_w(uint8_t data)
{
m_umc6650_addr = data & 0x7f;
}
uint8_t supracan_state::umc6650_data_r()
{
if (m_umc6650_addr >= 0x20 && m_umc6650_addr < 0x2f)
return m_umc6650key[m_umc6650_addr & 0xf];
return m_umc6650_data[m_umc6650_addr];
}
void supracan_state::umc6650_data_w(uint8_t data)
{
m_umc6650_data[m_umc6650_addr] = data;
}
void supracan_state::supracan_mem(address_map &map)
@ -1324,6 +1355,9 @@ void supracan_state::supracan_mem(address_map &map)
map(0xe90020, 0xe9002f).w(FUNC(supracan_state::dma_channel0_w));
map(0xe90030, 0xe9003f).w(FUNC(supracan_state::dma_channel1_w));
map(0xeb0d00, 0xeb0d01).rw(FUNC(supracan_state::umc6650_data_r), FUNC(supracan_state::umc6650_data_w)).umask16(0x00ff);
map(0xeb0d02, 0xeb0d03).w(FUNC(supracan_state::umc6650_addr_w)).umask16(0x00ff);
map(0xf00000, 0xf001ff).rw(FUNC(supracan_state::video_r), FUNC(supracan_state::video_w));
map(0xf00200, 0xf003ff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
map(0xf40000, 0xf5ffff).ram().w(FUNC(supracan_state::vram_w)).share("vram");
@ -1600,11 +1634,21 @@ void supracan_state::sound_w(offs_t offset, uint16_t data, uint16_t mem_mask)
set_sound_irq(5, 1);
//m_soundcpu->set_input_line(0, ASSERT_LINE);
break;
case 0x001c/2: /* Sound cpu control. Bit 0 tied to sound cpu RESET line */
case 0x001c/2: /* Sound cpu control. Bit 0 tied to sound cpu RESET line, Bit 2 internal ROM lockout? */
{
const uint16_t old = m_sound_cpu_ctrl;
m_sound_cpu_ctrl = data;
const uint16_t changed = old ^ m_sound_cpu_ctrl;
if (BIT(changed, 3) && BIT(data, 3))
{
m_internal68_view_hi.select(1);
}
if (BIT(changed, 1) && BIT(data, 1))
{
m_internal68_view.select(1);
}
if (BIT(changed, 0))
{
if (BIT(m_sound_cpu_ctrl, 0))
@ -1985,18 +2029,34 @@ void supracan_state::machine_start()
save_item(NAME(m_video_regs));
save_item(NAME(m_umc6650_addr));
save_item(NAME(m_umc6650_data));
m_video_timer = timer_alloc(FUNC(supracan_state::video_callback), this);
m_hbl_timer = timer_alloc(FUNC(supracan_state::hbl_callback), this);
m_line_on_timer = timer_alloc(FUNC(supracan_state::line_on_callback), this);
m_line_off_timer = timer_alloc(FUNC(supracan_state::line_off_callback), this);
m_maincpu->space(AS_PROGRAM).install_view(0x000000, 0x3fffff, m_internal68_view);
m_maincpu->space(AS_PROGRAM).install_view(0xf80000, 0xfbffff, m_internal68_view_hi);
if (m_cart->exists())
m_maincpu->space(AS_PROGRAM).install_read_handler(0x000000, 0x3fffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
{
//m_maincpu->space(AS_PROGRAM).install_read_handler(0x000000, 0x3fffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
m_internal68_view[0].install_read_handler(0x000000, 0x3fffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
m_internal68_view[1].install_read_handler(0x000000, 0x3fffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
m_internal68_view_hi[0].install_read_handler(0xf80000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
m_internal68_view_hi[1].install_read_handler(0xf80000, 0xfbffff, read16s_delegate(*m_cart, FUNC(generic_slot_device::read16_rom)));
}
m_internal68_view[0].install_rom(0x0000, 0x0fff, m_internal68);
m_internal68_view_hi[0].install_rom(0xf80000, 0xf80fff, m_internal68);
}
void supracan_state::machine_reset()
{
m_internal68_view.select(0);
m_internal68_view_hi.select(0);
m_sprite_count = 0;
m_sprite_base_addr = 0;
m_sprite_flags = 0;
@ -2018,6 +2078,9 @@ void supracan_state::machine_reset()
m_roz_base_addr = 0;
m_roz_mode = 0;
std::fill(std::begin(m_tilemap_base_addr), std::end(m_tilemap_base_addr), 0);
m_umc6650_addr = 0;
std::fill(std::begin(m_umc6650_data), std::end(m_umc6650_data), 0);
}
/* gfxdecode is retained for reference purposes but not otherwise used by the driver */
@ -2142,8 +2205,12 @@ void supracan_state::supracan(machine_config &config)
ROM_START( supracan )
ROM_REGION16_BE(0x1000, "internal68", ROMREGION_ERASEFF)
// 68k internal ROM (security related, not currently used by driver)
ROM_LOAD( "internal_68k.bin", 0x0000, 0x1000, CRC(8d575662) SHA1(a8e75633662978d0a885f16a4ed0f898f278a10a) )
// 68k internal ROM (security related)
ROM_LOAD16_WORD_SWAP( "internal_68k.bin", 0x0000, 0x1000, CRC(8d575662) SHA1(a8e75633662978d0a885f16a4ed0f898f278a10a) )
ROM_REGION(0x10, "umc6650key", ROMREGION_ERASEFF)
// 68k internal ROM (security related)
ROM_LOAD( "umc6650.bin", 0x00, 0x10, CRC(0ba78597) SHA1(f94805457976d60b91e8df18f9f49cccec77be78) )
ROM_REGION(0x2000, "internal6502", ROMREGION_ERASEFF)
// 2 additional blocks of ROM(?) can be seen next to the 68k ROM on a die shot from Furrtek