tehkan: add shared addressmap, remove soundcpu reset timer hack
This commit is contained in:
parent
506409dabb
commit
d8d3890672
@ -92,8 +92,6 @@ TO DO :
|
||||
|
||||
void tehkanwc_state::machine_start()
|
||||
{
|
||||
m_reset_timer = timer_alloc(FUNC(tehkanwc_state::reset_audiocpu), this);
|
||||
|
||||
save_item(NAME(m_track0));
|
||||
save_item(NAME(m_track1));
|
||||
save_item(NAME(m_msm_data_offs));
|
||||
@ -102,12 +100,20 @@ void tehkanwc_state::machine_start()
|
||||
m_digits.resolve();
|
||||
}
|
||||
|
||||
void tehkanwc_state::sub_cpu_halt_w(uint8_t data)
|
||||
void tehkanwc_state::sub_cpu_reset_w(uint8_t data)
|
||||
{
|
||||
if (data)
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
|
||||
else
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
void tehkanwc_state::sound_cpu_reset_w(uint8_t data)
|
||||
{
|
||||
m_audiocpu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
void tehkanwc_state::sound_command_w(uint8_t data)
|
||||
{
|
||||
m_soundlatch->write(data);
|
||||
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
|
||||
}
|
||||
|
||||
|
||||
@ -134,31 +140,15 @@ void tehkanwc_state::track_1_reset_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tehkanwc_state::sound_command_w(uint8_t data)
|
||||
uint8_t tehkanwc_state::teedoff_unk_r()
|
||||
{
|
||||
m_soundlatch->write(data);
|
||||
m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(tehkanwc_state::reset_audiocpu)
|
||||
{
|
||||
m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
|
||||
}
|
||||
|
||||
void tehkanwc_state::sound_answer_w(uint8_t data)
|
||||
{
|
||||
m_soundlatch2->write(data);
|
||||
|
||||
/* in Gridiron, the sound CPU goes in a tight loop after the self test, */
|
||||
/* probably waiting to be reset by a watchdog */
|
||||
if (m_audiocpu->pc() == 0x08bc) m_reset_timer->adjust(attotime::from_seconds(1));
|
||||
logerror("%s: teedoff_unk_r\n", machine().describe_context());
|
||||
return 0x80;
|
||||
}
|
||||
|
||||
|
||||
/* Emulate MSM sound samples with counters */
|
||||
|
||||
|
||||
uint8_t tehkanwc_state::portA_r()
|
||||
{
|
||||
return m_msm_data_offs & 0xff;
|
||||
@ -200,55 +190,45 @@ WRITE_LINE_MEMBER(tehkanwc_state::adpcm_int)
|
||||
m_toggle ^= 1;
|
||||
}
|
||||
|
||||
/* End of MSM with counters emulation */
|
||||
|
||||
uint8_t tehkanwc_state::teedoff_unk_r()
|
||||
void tehkanwc_state::shared_mem(address_map &map)
|
||||
{
|
||||
logerror("%s: teedoff_unk_r\n", machine().describe_context());
|
||||
return 0x80;
|
||||
map(0xc800, 0xcfff).ram().share("shareram");
|
||||
map(0xd000, 0xd3ff).ram().w(FUNC(tehkanwc_state::videoram_w)).share("videoram");
|
||||
map(0xd400, 0xd7ff).ram().w(FUNC(tehkanwc_state::colorram_w)).share("colorram");
|
||||
map(0xd800, 0xddff).writeonly().w(m_palette, FUNC(palette_device::write8)).share("palette");
|
||||
map(0xde00, 0xdfff).nopw(); // unused part of the palette RAM, I think? Gridiron uses it
|
||||
map(0xe000, 0xe7ff).ram().w(FUNC(tehkanwc_state::videoram2_w)).share("videoram2");
|
||||
map(0xe800, 0xebff).ram().share("spriteram");
|
||||
map(0xec00, 0xec01).w(FUNC(tehkanwc_state::scroll_x_w));
|
||||
map(0xec02, 0xec02).w(FUNC(tehkanwc_state::scroll_y_w));
|
||||
}
|
||||
|
||||
void tehkanwc_state::main_mem(address_map &map)
|
||||
{
|
||||
shared_mem(map);
|
||||
map(0x0000, 0xbfff).rom();
|
||||
map(0xc000, 0xc7ff).ram();
|
||||
map(0xc800, 0xcfff).ram().share("share1");
|
||||
map(0xd000, 0xd3ff).ram().w(FUNC(tehkanwc_state::videoram_w)).share("videoram");
|
||||
map(0xd400, 0xd7ff).ram().w(FUNC(tehkanwc_state::colorram_w)).share("colorram");
|
||||
map(0xd800, 0xddff).writeonly().w(m_palette, FUNC(palette_device::write8)).share("palette");
|
||||
map(0xda00, 0xda00).r(FUNC(tehkanwc_state::teedoff_unk_r));
|
||||
map(0xde00, 0xdfff).writeonly().share("share5"); /* unused part of the palette RAM, I think? Gridiron uses it */
|
||||
map(0xe000, 0xe7ff).ram().w(FUNC(tehkanwc_state::videoram2_w)).share("videoram2");
|
||||
map(0xe800, 0xebff).ram().share("spriteram"); /* sprites */
|
||||
map(0xec00, 0xec01).ram().w(FUNC(tehkanwc_state::scroll_x_w));
|
||||
map(0xec02, 0xec02).ram().w(FUNC(tehkanwc_state::scroll_y_w));
|
||||
map(0xf800, 0xf801).rw(FUNC(tehkanwc_state::track_0_r), FUNC(tehkanwc_state::track_0_reset_w)); /* track 0 x/y */
|
||||
map(0xf800, 0xf801).rw(FUNC(tehkanwc_state::track_0_r), FUNC(tehkanwc_state::track_0_reset_w)); // track 0 x/y
|
||||
map(0xf802, 0xf802).portr("SYSTEM").w(FUNC(tehkanwc_state::gridiron_led0_w));
|
||||
map(0xf803, 0xf803).portr("P1BUT");
|
||||
map(0xf806, 0xf806).portr("SYSTEM");
|
||||
map(0xf810, 0xf811).rw(FUNC(tehkanwc_state::track_1_r), FUNC(tehkanwc_state::track_1_reset_w)); /* track 1 x/y */
|
||||
map(0xf810, 0xf811).rw(FUNC(tehkanwc_state::track_1_r), FUNC(tehkanwc_state::track_1_reset_w)); // track 1 x/y
|
||||
map(0xf812, 0xf812).w(FUNC(tehkanwc_state::gridiron_led1_w));
|
||||
map(0xf813, 0xf813).portr("P2BUT");
|
||||
map(0xf820, 0xf820).r(m_soundlatch2, FUNC(generic_latch_8_device::read)).w(FUNC(tehkanwc_state::sound_command_w)); /* answer from the sound CPU */
|
||||
map(0xf840, 0xf840).portr("DSW2").w(FUNC(tehkanwc_state::sub_cpu_halt_w));
|
||||
map(0xf850, 0xf850).portr("DSW3").nopw(); // teedoff: written in tandem with $f840, busreq or busack?
|
||||
map(0xf820, 0xf820).r(m_soundlatch2, FUNC(generic_latch_8_device::read)).w(FUNC(tehkanwc_state::sound_command_w)); // answer from the sound CPU
|
||||
map(0xf840, 0xf840).portr("DSW2").w(FUNC(tehkanwc_state::sub_cpu_reset_w));
|
||||
map(0xf850, 0xf850).portr("DSW3").w(FUNC(tehkanwc_state::sound_cpu_reset_w));
|
||||
map(0xf860, 0xf860).r("watchdog", FUNC(watchdog_timer_device::reset_r)).w(FUNC(tehkanwc_state::flipscreen_x_w));
|
||||
map(0xf870, 0xf870).portr("DSW1").w(FUNC(tehkanwc_state::flipscreen_y_w));
|
||||
}
|
||||
|
||||
void tehkanwc_state::sub_mem(address_map &map)
|
||||
{
|
||||
shared_mem(map);
|
||||
map(0x0000, 0x7fff).rom();
|
||||
map(0x8000, 0xc7ff).ram();
|
||||
map(0xc800, 0xcfff).ram().share("share1");
|
||||
map(0xd000, 0xd3ff).ram().w(FUNC(tehkanwc_state::videoram_w)).share("videoram");
|
||||
map(0xd400, 0xd7ff).ram().w(FUNC(tehkanwc_state::colorram_w)).share("colorram");
|
||||
map(0xd800, 0xddff).writeonly().w(m_palette, FUNC(palette_device::write8)).share("palette");
|
||||
map(0xde00, 0xdfff).writeonly().share("share5"); /* unused part of the palette RAM, I think? Gridiron uses it */
|
||||
map(0xe000, 0xe7ff).ram().w(FUNC(tehkanwc_state::videoram2_w)).share("videoram2");
|
||||
map(0xe800, 0xebff).ram().share("spriteram"); /* sprites */
|
||||
map(0xec00, 0xec01).ram().w(FUNC(tehkanwc_state::scroll_x_w));
|
||||
map(0xec02, 0xec02).ram().w(FUNC(tehkanwc_state::scroll_y_w));
|
||||
map(0xf860, 0xf860).r("watchdog", FUNC(watchdog_timer_device::reset_r));
|
||||
}
|
||||
|
||||
@ -256,10 +236,10 @@ void tehkanwc_state::sound_mem(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x3fff).rom();
|
||||
map(0x4000, 0x47ff).ram();
|
||||
map(0x8001, 0x8001).w(FUNC(tehkanwc_state::msm_reset_w));/* MSM51xx reset */
|
||||
map(0x8002, 0x8002).nopw(); /* ?? written in the IRQ handler */
|
||||
map(0x8003, 0x8003).nopw(); /* ?? written in the NMI handler */
|
||||
map(0xc000, 0xc000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(FUNC(tehkanwc_state::sound_answer_w));
|
||||
map(0x8001, 0x8001).w(FUNC(tehkanwc_state::msm_reset_w)); // MSM51xx reset
|
||||
map(0x8002, 0x8002).nopw(); // ?? written in the IRQ handler
|
||||
map(0x8003, 0x8003).nopw(); // ?? written in the NMI handler
|
||||
map(0xc000, 0xc000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(m_soundlatch2, FUNC(generic_latch_8_device::write));
|
||||
}
|
||||
|
||||
void tehkanwc_state::sound_port(address_map &map)
|
||||
|
@ -37,8 +37,6 @@ protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(reset_audiocpu);
|
||||
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
@ -65,15 +63,14 @@ private:
|
||||
uint8_t m_led1 = 0;
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
tilemap_t *m_fg_tilemap = nullptr;
|
||||
emu_timer *m_reset_timer = nullptr;
|
||||
|
||||
void sub_cpu_halt_w(uint8_t data);
|
||||
void sub_cpu_reset_w(uint8_t data);
|
||||
void sound_cpu_reset_w(uint8_t data);
|
||||
uint8_t track_0_r(offs_t offset);
|
||||
uint8_t track_1_r(offs_t offset);
|
||||
void track_0_reset_w(offs_t offset, uint8_t data);
|
||||
void track_1_reset_w(offs_t offset, uint8_t data);
|
||||
void sound_command_w(uint8_t data);
|
||||
void sound_answer_w(uint8_t data);
|
||||
void videoram_w(offs_t offset, uint8_t data);
|
||||
void colorram_w(offs_t offset, uint8_t data);
|
||||
void videoram2_w(offs_t offset, uint8_t data);
|
||||
@ -98,6 +95,7 @@ private:
|
||||
void gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t led,int player);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void shared_mem(address_map &map);
|
||||
void main_mem(address_map &map);
|
||||
void sound_mem(address_map &map);
|
||||
void sound_port(address_map &map);
|
||||
|
Loading…
Reference in New Issue
Block a user