tubep: quiet logging, improve soundlatch (nw)

This commit is contained in:
hap 2020-05-29 17:53:30 +02:00
parent 6d190ae5d4
commit 32b03817cf
2 changed files with 46 additions and 53 deletions

View File

@ -111,6 +111,13 @@ TP-S.1 TP-S.2 TP-S.3 TP-B.1 8212 TP-B.2 TP-B.3 TP-B.4
#include "sound/msm5205.h"
#include "speaker.h"
#define LOG_IRQ (1U << 0)
//#define VERBOSE (LOG_IRQ)
#include "logmacro.h"
#define LOGIRQ(...) LOGMASKED(LOG_IRQ, __VA_ARGS__)
/*************************************
*
@ -143,16 +150,11 @@ void tubep_state::tubep_main_map(address_map &map)
WRITE8_MEMBER(tubep_state::main_cpu_irq_line_clear_w)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
logerror("CPU#0 VBLANK int clear at scanline=%3i\n", m_curr_scanline);
LOGIRQ("CPU#0 VBLANK int clear at scanline=%3i\n", m_curr_scanline);
return;
}
WRITE8_MEMBER(tubep_state::tubep_soundlatch_w)
{
m_sound_latch = (data&0x7f) | 0x80;
}
void tubep_state::tubep_main_portmap(address_map &map)
{
map.global_mask(0xff);
@ -166,7 +168,7 @@ void tubep_state::tubep_main_portmap(address_map &map)
map(0x80, 0x80).w(FUNC(tubep_state::main_cpu_irq_line_clear_w));
map(0xb0, 0xb7).w("mainlatch", FUNC(ls259_device::write_d0));
map(0xd0, 0xd0).w(FUNC(tubep_state::tubep_soundlatch_w));
map(0xd0, 0xd0).w(m_soundlatch, FUNC(generic_latch_8_device::write));
}
@ -180,7 +182,7 @@ void tubep_state::tubep_main_portmap(address_map &map)
WRITE8_MEMBER(tubep_state::second_cpu_irq_line_clear_w)
{
m_slave->set_input_line(0, CLEAR_LINE);
logerror("CPU#1 VBLANK int clear at scanline=%3i\n", m_curr_scanline);
LOGIRQ("CPU#1 VBLANK int clear at scanline=%3i\n", m_curr_scanline);
return;
}
@ -201,17 +203,13 @@ void tubep_state::tubep_second_portmap(address_map &map)
{
map.global_mask(0xff);
map(0x7f, 0x7f).w(FUNC(tubep_state::second_cpu_irq_line_clear_w));
map(0xb6, 0xb6).nopw(); // ?
}
READ8_MEMBER(tubep_state::tubep_soundlatch_r)
{
int res;
res = m_sound_latch;
m_sound_latch = 0; /* "=0" ???? or "&= 0x7f" ????? works either way */
return res;
return (m_soundlatch->pending_r() << 7) | (m_soundlatch->read() & 0x7f);
}
READ8_MEMBER(tubep_state::tubep_sound_irq_ack)
@ -220,12 +218,6 @@ READ8_MEMBER(tubep_state::tubep_sound_irq_ack)
return 0;
}
WRITE8_MEMBER(tubep_state::tubep_sound_unknown)
{
/*logerror("Sound CPU writes to port 0x07 - unknown function\n");*/
return;
}
void tubep_state::tubep_sound_map(address_map &map)
{
@ -242,7 +234,7 @@ void tubep_state::tubep_sound_portmap(address_map &map)
map(0x02, 0x03).w("ay2", FUNC(ay8910_device::address_data_w));
map(0x04, 0x05).w("ay3", FUNC(ay8910_device::address_data_w));
map(0x06, 0x06).r(FUNC(tubep_state::tubep_soundlatch_r));
map(0x07, 0x07).w(FUNC(tubep_state::tubep_sound_unknown));
map(0x07, 0x07).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w));
}
@ -275,7 +267,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
/* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
if (scanline == 240)
{
logerror("VBLANK CPU#0\n");
LOGIRQ("VBLANK CPU#0\n");
m_maincpu->set_input_line(0, ASSERT_LINE);
}
@ -284,7 +276,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
if (scanline == 16)
{
logerror("/VBLANK CPU#1\n");
LOGIRQ("/VBLANK CPU#1\n");
m_slave->set_input_line(0, ASSERT_LINE);
}
@ -293,7 +285,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
if (scanline == 16)
{
logerror("/nmi CPU#3\n");
LOGIRQ("/nmi CPU#3\n");
tubep_vblank_end(); /* switch buffered sprite RAM page */
m_mcu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
@ -301,7 +293,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
/* deactivates at the start of VBLANK signal which happens at the beginning of scanline number 240*/
if (scanline == 240)
{
logerror("CPU#3 nmi clear\n");
LOGIRQ("CPU#3 nmi clear\n");
m_mcu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
@ -317,7 +309,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
m_screen->update_partial(m_screen->vpos());
//debug
logerror("scanline=%3i scrgetvpos(0)=%3i\n",scanline,m_screen->vpos());
LOGIRQ("scanline=%3i scrgetvpos(0)=%3i\n",scanline,m_screen->vpos());
scanline++;
if (scanline >= 264)
@ -337,7 +329,6 @@ TIMER_CALLBACK_MEMBER(tubep_state::tubep_scanline_callback)
void tubep_state::tubep_setup_save_state()
{
/* Set up save state */
save_item(NAME(m_sound_latch));
save_item(NAME(m_ls74));
save_item(NAME(m_ls377));
}
@ -437,7 +428,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
/* activates at the start of VBLANK signal which happens at the beginning of scaline number 240 */
if (scanline == 240)
{
logerror("VBLANK CPU#0\n");
LOGIRQ("VBLANK CPU#0\n");
m_maincpu->set_input_line(0, ASSERT_LINE);
}
@ -446,7 +437,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
if (scanline == 16)
{
logerror("/VBLANK CPU#1\n");
LOGIRQ("/VBLANK CPU#1\n");
m_slave->set_input_line(0, HOLD_LINE);
}
@ -455,7 +446,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
/* activates at the _end_ of VBLANK signal which happens at the beginning of scanline number 16 */
if (scanline == 16)
{
logerror("/nmi CPU#3\n");
LOGIRQ("/nmi CPU#3\n");
tubep_vblank_end(); /* switch buffered sprite RAM page */
m_mcu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
}
@ -463,7 +454,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
/* deactivates at the start of VBLANK signal which happens at the beginning of scanline number 240*/
if (scanline == 240)
{
logerror("CPU#3 nmi clear\n");
LOGIRQ("CPU#3 nmi clear\n");
m_mcu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
@ -478,7 +469,7 @@ TIMER_CALLBACK_MEMBER(tubep_state::rjammer_scanline_callback)
m_screen->update_partial(m_screen->vpos());
logerror("scanline=%3i scrgetvpos(0)=%3i\n", scanline, m_screen->vpos());
LOGIRQ("scanline=%3i scrgetvpos(0)=%3i\n", scanline, m_screen->vpos());
scanline++;
if (scanline >= 264)
@ -716,9 +707,7 @@ static INPUT_PORTS_START( tubep )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:2")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, "In Game Sounds" ) PORT_DIPLOCATION("SW3:1")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
@ -848,6 +837,9 @@ void tubep_state::tubep(machine_config &config)
mainlatch.q_out_cb<6>().set(FUNC(tubep_state::background_romselect_w));
mainlatch.q_out_cb<7>().set(FUNC(tubep_state::colorproms_A4_line_w));
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->set_separate_acknowledge(true);
MCFG_MACHINE_START_OVERRIDE(tubep_state,tubep)
MCFG_MACHINE_RESET_OVERRIDE(tubep_state,tubep)

View File

@ -6,6 +6,7 @@
#pragma once
#include "cpu/m6800/m6800.h"
#include "machine/gen_latch.h"
#include "sound/msm5205.h"
#include "emupal.h"
#include "screen.h"
@ -15,16 +16,17 @@ class tubep_state : public driver_device
public:
tubep_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_textram(*this, "textram"),
m_backgroundram(*this, "backgroundram"),
m_sprite_colorsharedram(*this, "sprite_color"),
m_rjammer_backgroundram(*this, "rjammer_bgram"),
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_slave(*this, "slave"),
m_mcu(*this, "mcu"),
m_soundlatch(*this, "soundlatch"),
m_msm(*this, "msm"),
m_screen(*this, "screen")
m_screen(*this, "screen"),
m_textram(*this, "textram"),
m_backgroundram(*this, "backgroundram"),
m_sprite_colorsharedram(*this, "sprite_color"),
m_rjammer_backgroundram(*this, "rjammer_bgram")
{ }
void tubepb(machine_config &config);
@ -39,16 +41,23 @@ private:
TIMER_SPRITE
};
uint8_t m_sound_latch;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<cpu_device> m_slave;
required_device<m6802_cpu_device> m_mcu;
required_device<generic_latch_8_device> m_soundlatch;
optional_device<msm5205_device> m_msm;
required_device<screen_device> m_screen;
required_shared_ptr<uint8_t> m_textram;
optional_shared_ptr<uint8_t> m_backgroundram;
required_shared_ptr<uint8_t> m_sprite_colorsharedram;
optional_shared_ptr<uint8_t> m_rjammer_backgroundram;
uint8_t m_ls74;
uint8_t m_ls377;
emu_timer *m_interrupt_timer;
emu_timer *m_sprite_timer;
int m_curr_scanline;
required_shared_ptr<uint8_t> m_textram;
optional_shared_ptr<uint8_t> m_backgroundram;
required_shared_ptr<uint8_t> m_sprite_colorsharedram;
optional_shared_ptr<uint8_t> m_rjammer_backgroundram;
std::unique_ptr<uint8_t[]> m_spritemap;
uint8_t m_prom2[32];
uint32_t m_romD_addr;
@ -76,10 +85,8 @@ private:
DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
DECLARE_WRITE8_MEMBER(main_cpu_irq_line_clear_w);
DECLARE_WRITE8_MEMBER(second_cpu_irq_line_clear_w);
DECLARE_WRITE8_MEMBER(tubep_soundlatch_w);
DECLARE_READ8_MEMBER(tubep_soundlatch_r);
DECLARE_READ8_MEMBER(tubep_sound_irq_ack);
DECLARE_WRITE8_MEMBER(tubep_sound_unknown);
DECLARE_WRITE8_MEMBER(rjammer_voice_input_w);
DECLARE_WRITE8_MEMBER(rjammer_voice_intensity_control_w);
DECLARE_WRITE8_MEMBER(tubep_textram_w);
@ -115,12 +122,6 @@ private:
void tubep_vblank_end();
void tubep_setup_save_state();
DECLARE_WRITE_LINE_MEMBER(rjammer_adpcm_vck);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<cpu_device> m_slave;
required_device<m6802_cpu_device> m_mcu;
optional_device<msm5205_device> m_msm;
required_device<screen_device> m_screen;
void nsc_map(address_map &map);
void rjammer_main_map(address_map &map);