mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
enigma2: increase audiocpu interrupt frequency
This commit is contained in:
parent
366aaf99a9
commit
1b9c531f20
@ -45,6 +45,9 @@ Notes:
|
||||
------------------------
|
||||
|
||||
TODO:
|
||||
- Verify what happens if you skip an enemy, on MAME the next one may appear out of
|
||||
thin air. MAME previously showed garbage sprites moving fast to the left and later
|
||||
changing into an enemy character, disable the (~attr & 0x01) check to see.
|
||||
- Verify if YM2203 RD is connected. If it is, it waits too long checking the busy flag,
|
||||
while it already does soft-delays itself. This would cause too slow BGM tempo.
|
||||
|
||||
|
@ -18,12 +18,12 @@ enigma2b (1981)
|
||||
Conversion like enigma2a, but boots with 1981 copyright and Phantoms II title
|
||||
|
||||
TODO:
|
||||
- enigma2 - Star blinking frequency
|
||||
- enigma2 - Sound is incorrectly emulated (see MT07777)
|
||||
- enigma2a + enigma2b - bad sound ROM?
|
||||
- enigma2 - Star blinking frequency
|
||||
- enigma2b - bad sound ROM?
|
||||
|
||||
|
||||
*********************************************************************
|
||||
|
||||
Enigma II, Game Plan, 1981
|
||||
PCB hardware notes by Guru
|
||||
|
||||
@ -125,9 +125,11 @@ DIP Switches
|
||||
*********************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#include "cpu/i8085/i8085.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
@ -208,6 +210,7 @@ private:
|
||||
|
||||
emu_timer *m_interrupt_clear_timer = nullptr;
|
||||
emu_timer *m_interrupt_assert_timer = nullptr;
|
||||
emu_timer *m_audio_interrupt_timer = nullptr;
|
||||
|
||||
uint8_t dip_switch_r(offs_t offset);
|
||||
void sound_data_w(uint8_t data);
|
||||
@ -218,8 +221,9 @@ private:
|
||||
uint32_t screen_update_enigma2a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(interrupt_clear_callback);
|
||||
TIMER_CALLBACK_MEMBER(interrupt_assert_callback);
|
||||
inline uint16_t vpos_to_vysnc_chain_counter( int vpos );
|
||||
inline int vysnc_chain_counter_to_vpos( uint16_t counter );
|
||||
TIMER_CALLBACK_MEMBER(audio_interrupt_callback);
|
||||
inline uint16_t vpos_to_vysnc_chain_counter(int vpos);
|
||||
inline int vysnc_chain_counter_to_vpos(uint16_t counter);
|
||||
void create_interrupt_timers();
|
||||
void start_interrupt_timers();
|
||||
|
||||
@ -236,14 +240,13 @@ private:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
|
||||
uint16_t enigma2_state::vpos_to_vysnc_chain_counter( int vpos )
|
||||
uint16_t enigma2_state::vpos_to_vysnc_chain_counter(int vpos)
|
||||
{
|
||||
return vpos + VCOUNTER_START;
|
||||
}
|
||||
|
||||
|
||||
int enigma2_state::vysnc_chain_counter_to_vpos( uint16_t counter )
|
||||
int enigma2_state::vysnc_chain_counter_to_vpos(uint16_t counter)
|
||||
{
|
||||
return counter - VCOUNTER_START;
|
||||
}
|
||||
@ -278,17 +281,27 @@ TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_assert_callback)
|
||||
}
|
||||
|
||||
|
||||
void enigma2_state::create_interrupt_timers( )
|
||||
TIMER_CALLBACK_MEMBER(enigma2_state::audio_interrupt_callback)
|
||||
{
|
||||
m_interrupt_clear_timer = timer_alloc(FUNC(enigma2_state::interrupt_clear_callback), this);
|
||||
m_interrupt_assert_timer = timer_alloc(FUNC(enigma2_state::interrupt_assert_callback), this);
|
||||
m_audiocpu->set_input_line(0, HOLD_LINE);
|
||||
int next_vpos = m_screen->vpos() + 16;
|
||||
m_audio_interrupt_timer->adjust(m_screen->time_until_pos(next_vpos > VTOTAL ? 8 : next_vpos));
|
||||
}
|
||||
|
||||
|
||||
void enigma2_state::start_interrupt_timers( )
|
||||
void enigma2_state::create_interrupt_timers()
|
||||
{
|
||||
m_interrupt_clear_timer = timer_alloc(FUNC(enigma2_state::interrupt_clear_callback), this);
|
||||
m_interrupt_assert_timer = timer_alloc(FUNC(enigma2_state::interrupt_assert_callback), this);
|
||||
m_audio_interrupt_timer = timer_alloc(FUNC(enigma2_state::audio_interrupt_callback), this);
|
||||
}
|
||||
|
||||
|
||||
void enigma2_state::start_interrupt_timers()
|
||||
{
|
||||
int vpos = vysnc_chain_counter_to_vpos(INT_TRIGGER_COUNT_1);
|
||||
m_interrupt_assert_timer->adjust(m_screen->time_until_pos(vpos));
|
||||
m_audio_interrupt_timer->adjust(m_screen->time_until_pos(8));
|
||||
}
|
||||
|
||||
|
||||
@ -384,8 +397,10 @@ uint32_t enigma2_state::screen_update_enigma2(screen_device &screen, bitmap_rgb3
|
||||
if (bit)
|
||||
color = fore_color;
|
||||
else
|
||||
{
|
||||
/* stars only appear at certain positions */
|
||||
color = ((x & y & 0x0f) == 0x0f) ? star_color : 0;
|
||||
}
|
||||
|
||||
bitmap.pix(bitmap_y, x) = m_palette->pen_color(color);
|
||||
|
||||
@ -489,10 +504,7 @@ uint8_t enigma2_state::dip_switch_r(offs_t offset)
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
if (m_maincpu->pc() == 0x07e5)
|
||||
ret = 0xaa;
|
||||
else
|
||||
ret = 0xf4;
|
||||
ret = m_protection_data & ~0x01;
|
||||
break;
|
||||
|
||||
case 0x35: ret = 0x38; break;
|
||||
@ -508,7 +520,7 @@ void enigma2_state::sound_data_w(uint8_t data)
|
||||
{
|
||||
/* clock sound latch shift register on rising edge of D2 */
|
||||
if (!(data & 0x04) && (m_last_sound_data & 0x04))
|
||||
m_sound_latch = (m_sound_latch << 1) | (~data & 0x01);
|
||||
m_sound_latch = (m_sound_latch >> 1) | (~data << 7 & 0x80);
|
||||
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, (data & 0x02) ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
@ -518,7 +530,7 @@ void enigma2_state::sound_data_w(uint8_t data)
|
||||
|
||||
uint8_t enigma2_state::sound_latch_r()
|
||||
{
|
||||
return bitswap<8>(m_sound_latch,0,1,2,3,4,5,6,7);
|
||||
return m_sound_latch;
|
||||
}
|
||||
|
||||
|
||||
@ -716,9 +728,10 @@ void enigma2_state::enigma2(machine_config &config)
|
||||
Z80(config, m_maincpu, CPU_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &enigma2_state::enigma2_main_cpu_map);
|
||||
|
||||
Z80(config, m_audiocpu, 2500000);
|
||||
Z80(config, m_audiocpu, CPU_CLOCK);
|
||||
m_audiocpu->set_addrmap(AS_PROGRAM, &enigma2_state::enigma2_audio_cpu_map);
|
||||
m_audiocpu->set_periodic_int(FUNC(enigma2_state::irq0_line_hold), attotime::from_hz(8*52));
|
||||
|
||||
config.set_maximum_quantum(attotime::from_hz(m_maincpu->clock() / 4));
|
||||
|
||||
/* video hardware */
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
@ -744,9 +757,10 @@ void enigma2_state::enigma2a(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &enigma2_state::enigma2a_main_cpu_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &enigma2_state::enigma2a_main_cpu_io_map);
|
||||
|
||||
Z80(config, m_audiocpu, 2500000);
|
||||
Z80(config, m_audiocpu, CPU_CLOCK);
|
||||
m_audiocpu->set_addrmap(AS_PROGRAM, &enigma2_state::enigma2_audio_cpu_map);
|
||||
m_audiocpu->set_periodic_int(FUNC(enigma2_state::irq0_line_hold), attotime::from_hz(8*52));
|
||||
|
||||
config.set_maximum_quantum(attotime::from_hz(m_maincpu->clock() / 4));
|
||||
|
||||
/* video hardware */
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
@ -794,7 +808,7 @@ ROM_START( enigma2a )
|
||||
ROM_LOAD( "6.13d", 0x4800, 0x0800, CRC(240a9d4b) SHA1(ca1c69fafec0471141ce1254ddfaef54fecfcbf0) )
|
||||
|
||||
ROM_REGION( 0x10000, "audiocpu", 0 )
|
||||
ROM_LOAD( "sound.bin", 0x0000, 0x0800, BAD_DUMP CRC(5f092d3c) SHA1(17c70f6af1b5560a45e6b1bdb330a98b27570fe9) )
|
||||
ROM_LOAD( "sound.bin", 0x0000, 0x0800, CRC(5f092d3c) SHA1(17c70f6af1b5560a45e6b1bdb330a98b27570fe9) )
|
||||
ROM_END
|
||||
|
||||
ROM_START( enigma2b )
|
||||
|
Loading…
Reference in New Issue
Block a user