mirror of
https://github.com/holub/mame
synced 2025-06-08 22:03:55 +03:00
appoooooooooh: get rid of unsafe adpcm code
This commit is contained in:
parent
ea746999a8
commit
69c0c9de9c
@ -214,8 +214,8 @@ protected:
|
|||||||
uint16_t m_spritebase = 0U;
|
uint16_t m_spritebase = 0U;
|
||||||
|
|
||||||
// sound-related
|
// sound-related
|
||||||
uint32_t m_adpcm_data = 0U;
|
|
||||||
uint32_t m_adpcm_address = 0U;
|
uint32_t m_adpcm_address = 0U;
|
||||||
|
bool m_adpcm_playing = false;
|
||||||
|
|
||||||
// devices
|
// devices
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
@ -247,7 +247,9 @@ class appoooh_state : public base_state
|
|||||||
public:
|
public:
|
||||||
appoooh_state(const machine_config &mconfig, device_type type, const char *tag) :
|
appoooh_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||||
base_state(mconfig, type, tag)
|
base_state(mconfig, type, tag)
|
||||||
{ m_spritebase = 0; }
|
{
|
||||||
|
m_spritebase = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void appoooh(machine_config &config);
|
void appoooh(machine_config &config);
|
||||||
|
|
||||||
@ -261,7 +263,9 @@ public:
|
|||||||
robowres_state(const machine_config &mconfig, device_type type, const char *tag) :
|
robowres_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||||
base_state(mconfig, type, tag),
|
base_state(mconfig, type, tag),
|
||||||
m_decrypted_opcodes(*this, "decrypted_opcodes")
|
m_decrypted_opcodes(*this, "decrypted_opcodes")
|
||||||
{ m_spritebase = 0x200; }
|
{
|
||||||
|
m_spritebase = 0x200;
|
||||||
|
}
|
||||||
|
|
||||||
void init_robowresb();
|
void init_robowresb();
|
||||||
|
|
||||||
@ -278,8 +282,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// video
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Convert the color PROMs into a more useable format.
|
Convert the color PROMs into a more useable format.
|
||||||
@ -352,7 +354,6 @@ void robowres_state::palette(palette_device &palette) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Callbacks for the TileMap code
|
Callbacks for the TileMap code
|
||||||
@ -371,6 +372,7 @@ TILE_GET_INFO_MEMBER(base_state::get_tile_info)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Start the video hardware emulation.
|
Start the video hardware emulation.
|
||||||
@ -385,9 +387,6 @@ void base_state::video_start()
|
|||||||
m_tilemap[0]->set_transparent_pen(0);
|
m_tilemap[0]->set_transparent_pen(0);
|
||||||
m_tilemap[0]->set_scrolldy(8, 8);
|
m_tilemap[0]->set_scrolldy(8, 8);
|
||||||
m_tilemap[1]->set_scrolldy(8, 8);
|
m_tilemap[1]->set_scrolldy(8, 8);
|
||||||
|
|
||||||
save_item(NAME(m_scroll_x));
|
|
||||||
save_item(NAME(m_priority));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void base_state::scroll_w(uint8_t data)
|
void base_state::scroll_w(uint8_t data)
|
||||||
@ -493,37 +492,35 @@ uint32_t base_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// machine
|
/*************************************
|
||||||
|
*
|
||||||
|
* ADPCM sound
|
||||||
|
*
|
||||||
|
*************************************/
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(base_state::adpcm_int)
|
WRITE_LINE_MEMBER(base_state::adpcm_int)
|
||||||
{
|
{
|
||||||
if (m_adpcm_address != 0xffffffff)
|
if (!m_adpcm_playing || !state)
|
||||||
{
|
return;
|
||||||
if (m_adpcm_data == 0xffffffff)
|
|
||||||
{
|
|
||||||
m_adpcm_data = m_adpcm_rom[m_adpcm_address++];
|
|
||||||
m_msm->data_w(m_adpcm_data >> 4);
|
|
||||||
|
|
||||||
if (m_adpcm_data == 0x70)
|
uint8_t data = m_adpcm_rom[m_adpcm_address / 2];
|
||||||
|
if (data == 0x70)
|
||||||
{
|
{
|
||||||
m_adpcm_address = 0xffffffff;
|
|
||||||
m_msm->reset_w(1);
|
m_msm->reset_w(1);
|
||||||
}
|
m_adpcm_playing = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_msm->data_w(m_adpcm_data & 0x0f);
|
m_msm->data_w(m_adpcm_address & 1 ? data & 0xf : data >> 4);
|
||||||
m_adpcm_data = -1;
|
m_adpcm_address = (m_adpcm_address + 1) & 0x1ffff;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// adpcm address write
|
|
||||||
void base_state::adpcm_w(uint8_t data)
|
void base_state::adpcm_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_adpcm_address = data << 8;
|
m_adpcm_address = (data << 8) * 2;
|
||||||
m_msm->reset_w(0);
|
m_msm->reset_w(0);
|
||||||
m_adpcm_data = 0xffffffff;
|
m_adpcm_playing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -646,7 +643,6 @@ INPUT_PORTS_END
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
|
|
||||||
static const gfx_layout charlayout =
|
static const gfx_layout charlayout =
|
||||||
{
|
{
|
||||||
8,8,
|
8,8,
|
||||||
@ -690,16 +686,17 @@ void base_state::machine_start()
|
|||||||
{
|
{
|
||||||
m_mainbank->configure_entries(0, 2, memregion("maincpu")->base() + 0xa000, 0x6000);
|
m_mainbank->configure_entries(0, 2, memregion("maincpu")->base() + 0xa000, 0x6000);
|
||||||
|
|
||||||
save_item(NAME(m_adpcm_data));
|
save_item(NAME(m_scroll_x));
|
||||||
|
save_item(NAME(m_priority));
|
||||||
save_item(NAME(m_adpcm_address));
|
save_item(NAME(m_adpcm_address));
|
||||||
|
save_item(NAME(m_adpcm_playing));
|
||||||
|
save_item(NAME(m_nmi_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
void base_state::machine_reset()
|
void base_state::machine_reset()
|
||||||
{
|
{
|
||||||
m_adpcm_address = 0xffffffff;
|
m_adpcm_playing = false;
|
||||||
m_adpcm_data = 0;
|
out_w(0);
|
||||||
m_scroll_x = 0;
|
|
||||||
m_priority = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERRUPT_GEN_MEMBER(base_state::vblank_irq)
|
INTERRUPT_GEN_MEMBER(base_state::vblank_irq)
|
||||||
@ -724,7 +721,7 @@ void base_state::common(machine_config &config)
|
|||||||
SN76489(config, "sn3", 18.432_MHz_XTAL / 6).add_route(ALL_OUTPUTS, "mono", 0.30); // divider unknown
|
SN76489(config, "sn3", 18.432_MHz_XTAL / 6).add_route(ALL_OUTPUTS, "mono", 0.30); // divider unknown
|
||||||
|
|
||||||
MSM5205(config, m_msm, 384000);
|
MSM5205(config, m_msm, 384000);
|
||||||
m_msm->vck_legacy_callback().set(FUNC(base_state::adpcm_int)); // interrupt function
|
m_msm->vck_callback().set(FUNC(base_state::adpcm_int));
|
||||||
m_msm->set_prescaler_selector(msm5205_device::S64_4B); // 6KHz
|
m_msm->set_prescaler_selector(msm5205_device::S64_4B); // 6KHz
|
||||||
m_msm->add_route(ALL_OUTPUTS, "mono", 0.50);
|
m_msm->add_route(ALL_OUTPUTS, "mono", 0.50);
|
||||||
}
|
}
|
||||||
@ -811,7 +808,7 @@ ROM_START( appoooh )
|
|||||||
ROM_LOAD( "pr5922.prm", 0x0020, 0x100, CRC(85c542bf) SHA1(371d92fca2ae609a47d3a2ea349f14f30b846da8) ) // charset #1 lookup table
|
ROM_LOAD( "pr5922.prm", 0x0020, 0x100, CRC(85c542bf) SHA1(371d92fca2ae609a47d3a2ea349f14f30b846da8) ) // charset #1 lookup table
|
||||||
ROM_LOAD( "pr5923.prm", 0x0120, 0x100, CRC(16acbd53) SHA1(e5791646730c6232efa2c0327b484472c47baf21) ) // charset #2 lookup table
|
ROM_LOAD( "pr5923.prm", 0x0120, 0x100, CRC(16acbd53) SHA1(e5791646730c6232efa2c0327b484472c47baf21) ) // charset #2 lookup table
|
||||||
|
|
||||||
ROM_REGION( 0xa000, "adpcm", 0 )
|
ROM_REGION( 0x10000, "adpcm", 0 )
|
||||||
ROM_LOAD( "epr-5901.bin", 0x0000, 0x2000, CRC(170a10a4) SHA1(7b0c8427c69525cbcbe9f88b22b12aafb6949bfd) )
|
ROM_LOAD( "epr-5901.bin", 0x0000, 0x2000, CRC(170a10a4) SHA1(7b0c8427c69525cbcbe9f88b22b12aafb6949bfd) )
|
||||||
ROM_LOAD( "epr-5902.bin", 0x2000, 0x2000, CRC(f6981640) SHA1(1a93913ecb64d1c459e5bbcc28c4ca3ea90f21e1) )
|
ROM_LOAD( "epr-5902.bin", 0x2000, 0x2000, CRC(f6981640) SHA1(1a93913ecb64d1c459e5bbcc28c4ca3ea90f21e1) )
|
||||||
ROM_LOAD( "epr-5903.bin", 0x4000, 0x2000, CRC(0439df50) SHA1(1f981c1867366fa57de25ff8f421c121d82d7321) )
|
ROM_LOAD( "epr-5903.bin", 0x4000, 0x2000, CRC(0439df50) SHA1(1f981c1867366fa57de25ff8f421c121d82d7321) )
|
||||||
@ -842,7 +839,7 @@ ROM_START( robowres )
|
|||||||
ROM_LOAD( "pr7572.7f", 0x00020, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
ROM_LOAD( "pr7572.7f", 0x00020, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
||||||
ROM_LOAD( "pr7573.7g", 0x00120, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
ROM_LOAD( "pr7573.7g", 0x00120, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
||||||
|
|
||||||
ROM_REGION( 0x8000, "adpcm", 0 )
|
ROM_REGION( 0x10000, "adpcm", 0 )
|
||||||
ROM_LOAD( "epr-7543.12b", 0x00000, 0x8000, CRC(4d108c49) SHA1(a7c3c5a5ad36917ea7f6d917377c2392fa9beea3) )
|
ROM_LOAD( "epr-7543.12b", 0x00000, 0x8000, CRC(4d108c49) SHA1(a7c3c5a5ad36917ea7f6d917377c2392fa9beea3) )
|
||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
@ -870,7 +867,7 @@ ROM_START( robowresb )
|
|||||||
ROM_LOAD( "pr7572.7f", 0x00020, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
ROM_LOAD( "pr7572.7f", 0x00020, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
||||||
ROM_LOAD( "pr7573.7g", 0x00120, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
ROM_LOAD( "pr7573.7g", 0x00120, 0x0100, CRC(2b083d0c) SHA1(5b39bd4297bec788caac9e9de5128d43932a24e2) )
|
||||||
|
|
||||||
ROM_REGION( 0x8000, "adpcm", 0 )
|
ROM_REGION( 0x10000, "adpcm", 0 )
|
||||||
ROM_LOAD( "epr-7543.12b", 0x00000, 0x8000, CRC(4d108c49) SHA1(a7c3c5a5ad36917ea7f6d917377c2392fa9beea3) )
|
ROM_LOAD( "epr-7543.12b", 0x00000, 0x8000, CRC(4d108c49) SHA1(a7c3c5a5ad36917ea7f6d917377c2392fa9beea3) )
|
||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
@ -882,7 +879,6 @@ ROM_END
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
|
|
||||||
void robowres_state::init_robowresb()
|
void robowres_state::init_robowresb()
|
||||||
{
|
{
|
||||||
memcpy(m_decrypted_opcodes, memregion("maincpu")->base() + 0x1c000, 0x8000);
|
memcpy(m_decrypted_opcodes, memregion("maincpu")->base() + 0x1c000, 0x8000);
|
||||||
|
@ -386,7 +386,8 @@ void renegade_state::adpcm_stop_w(uint8_t data)
|
|||||||
|
|
||||||
WRITE_LINE_MEMBER(renegade_state::adpcm_int)
|
WRITE_LINE_MEMBER(renegade_state::adpcm_int)
|
||||||
{
|
{
|
||||||
if (!m_adpcm_playing || !state) return;
|
if (!m_adpcm_playing || !state)
|
||||||
|
return;
|
||||||
|
|
||||||
if (m_adpcm_pos >= m_adpcm_end)
|
if (m_adpcm_pos >= m_adpcm_end)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user