mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
cop01.cpp: improved Mighty Guy sound [Angelo Salese]
This commit is contained in:
parent
6e67948975
commit
7f99ec6790
@ -173,12 +173,12 @@ ADDRESS_MAP_END
|
||||
/*
|
||||
* sound "protection" uses address/data to ports 2/3 (R/W)
|
||||
* Register map:
|
||||
* 0x32: always 5, dac transfer trigger?
|
||||
* 0x32: always 5, rom read trigger?
|
||||
* 0x33: - address 1 (source?)
|
||||
* 0x34: /
|
||||
* 0x35: - address 2 (size?)
|
||||
* 0x35: - address 2 (adjust value in rom?)
|
||||
* 0x36: /
|
||||
* 0x37: R reused for ym3526 register set
|
||||
* 0x37: R reused for ym3526 register set, read protection rom (same as amatelas)
|
||||
*
|
||||
* 0x40: counter set, always 1?
|
||||
* 0x41: R bit 0 pulse timer? W oneshot timer?
|
||||
@ -190,17 +190,61 @@ ADDRESS_MAP_END
|
||||
*/
|
||||
|
||||
/* this just gets some garbage out of the YM3526 */
|
||||
READ8_MEMBER(cop01_state::kludge)
|
||||
READ8_MEMBER(cop01_state::prot_data_r)
|
||||
{
|
||||
return m_timer++;
|
||||
if(m_prot_command == 0x41)
|
||||
return (m_audiocpu->total_cycles() / 0x34) & 1; // wrong
|
||||
|
||||
if(m_prot_command == 0x37)
|
||||
{
|
||||
uint16_t prot_offset = (m_prot_reg[1]<<8)|(m_prot_reg[2]);
|
||||
uint8_t *prot_rom = memregion("prot_data")->base();
|
||||
// 0x37c are BGMs while 0x34e are SFXs?
|
||||
uint8_t prot_adj = 0x82; //0xbd
|
||||
|
||||
//printf("%02x",(prot_rom[prot_offset] - 0x44) & 0xff);
|
||||
|
||||
return prot_rom[prot_offset & 0x1fff] - prot_adj; // minus value correct?
|
||||
}
|
||||
|
||||
if(m_prot_command == 0x92) // affects coin SFX playback
|
||||
return 1;
|
||||
|
||||
if(m_prot_command == 0x94)
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cop01_state::prot_address_w)
|
||||
{
|
||||
m_prot_command = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(cop01_state::prot_data_w)
|
||||
{
|
||||
if( m_prot_command>=0x32 && m_prot_command<=0x37 )
|
||||
{
|
||||
m_prot_reg[m_prot_command-0x32] = data;
|
||||
|
||||
#if 0
|
||||
if(m_prot_command == 0x32)
|
||||
{
|
||||
for(int i=0;i<6;i++)
|
||||
printf("%02x ",m_prot_reg[i]);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( mightguy_audio_io_map, AS_IO, 8, cop01_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x01) AM_DEVWRITE("ymsnd", ym3526_device, write)
|
||||
AM_RANGE(0x02, 0x02) AM_WRITENOP /* 1412M2 address? */
|
||||
AM_RANGE(0x03, 0x03) AM_WRITENOP /* 1412M2 data? */
|
||||
AM_RANGE(0x03, 0x03) AM_READ(kludge) /* 1412M2? */
|
||||
AM_RANGE(0x02, 0x02) AM_WRITE(prot_address_w) /* 1412M2 address? */
|
||||
AM_RANGE(0x03, 0x03) AM_WRITE(prot_data_w) /* 1412M2 data? */
|
||||
AM_RANGE(0x03, 0x03) AM_READ(prot_data_r) /* 1412M2? */
|
||||
AM_RANGE(0x06, 0x06) AM_READ(cop01_sound_command_r)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -338,9 +382,9 @@ static INPUT_PORTS_START( mightguy )
|
||||
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Bonus_Life ) )
|
||||
PORT_DIPSETTING( 0x04, "Every 200k" )
|
||||
PORT_DIPSETTING( 0x00, "500k only" )
|
||||
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) // actually reversed compared to service mode
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) )
|
||||
@ -632,7 +676,7 @@ ROM_START( mightguy )
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 code (sound cpu) */
|
||||
ROM_LOAD( "11.15b", 0x0000, 0x4000, CRC(576183ea) SHA1(e3f28e8e8c34ab396d158da122584ed226729c99) )
|
||||
|
||||
ROM_REGION( 0x8000, "user1", 0 ) /* 1412M2 protection data, z80 encrypted code presumably */
|
||||
ROM_REGION( 0x8000, "prot_data", 0 ) /* 1412M2 protection data, z80 encrypted code presumably */
|
||||
ROM_LOAD( "10.ic2", 0x0000, 0x8000, CRC(1a5d2bb1) SHA1(0fd4636133a980ba9ffa076f9010474586d37635) )
|
||||
|
||||
ROM_REGION( 0x02000, "gfx1", 0 ) /* alpha */
|
||||
@ -688,4 +732,4 @@ DRIVER_INIT_MEMBER(cop01_state,mightguy)
|
||||
|
||||
GAME( 1985, cop01, 0, cop01, cop01, cop01_state, 0, ROT0, "Nichibutsu", "Cop 01 (set 1)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1985, cop01a, cop01, cop01, cop01, cop01_state, 0, ROT0, "Nichibutsu", "Cop 01 (set 2)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1986, mightguy, 0, mightguy, mightguy, cop01_state, mightguy, ROT270, "Nichibutsu", "Mighty Guy", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1986, mightguy, 0, mightguy, mightguy, cop01_state, mightguy, ROT270, "Nichibutsu", "Mighty Guy", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -35,7 +35,9 @@ public:
|
||||
/* sound-related */
|
||||
int m_pulse;
|
||||
int m_timer; // kludge for ym3526 in mightguy
|
||||
|
||||
uint8_t m_prot_command;
|
||||
uint8_t m_prot_reg[6];
|
||||
|
||||
/* devices */
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
@ -51,6 +53,9 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(cop01_background_w);
|
||||
DECLARE_WRITE8_MEMBER(cop01_foreground_w);
|
||||
DECLARE_WRITE8_MEMBER(cop01_vreg_w);
|
||||
DECLARE_WRITE8_MEMBER(prot_address_w);
|
||||
DECLARE_WRITE8_MEMBER(prot_data_w);
|
||||
DECLARE_READ8_MEMBER(prot_data_r);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(mightguy_area_r);
|
||||
DECLARE_DRIVER_INIT(mightguy);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
|
Loading…
Reference in New Issue
Block a user