summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2024-12-10 15:13:20 +0100
committer hap <happppp@users.noreply.github.com>2024-12-10 15:13:34 +0100
commit9ee91f5e9120c79d72fe82ceba9ef1c2ecbb1ecd (patch)
tree94d9bdb17142e440cef543bbc38542a857575512 /src
parent9161ca9e48952dc3e082e5af08264638c41accfa (diff)
cop01: lower soundcpu clock, copy over sound timer from magmax,
misc nichibutsu: small cleanup to long comment lines
Diffstat (limited to 'src')
-rw-r--r--src/mame/homebrew/zexall.cpp22
-rw-r--r--src/mame/nichibutsu/armedf.cpp19
-rw-r--r--src/mame/nichibutsu/cop01.cpp319
-rw-r--r--src/mame/nichibutsu/galivan.cpp12
-rw-r--r--src/mame/nichibutsu/magmax.cpp149
-rw-r--r--src/mame/nichibutsu/terracre.cpp37
6 files changed, 317 insertions, 241 deletions
diff --git a/src/mame/homebrew/zexall.cpp b/src/mame/homebrew/zexall.cpp
index 996c0ebf791..862d4ecab24 100644
--- a/src/mame/homebrew/zexall.cpp
+++ b/src/mame/homebrew/zexall.cpp
@@ -14,17 +14,22 @@
Ram 0000-FFFF (preloaded with binary)
Special calls take place for three ram values (this interface was designed by kevtris):
- FFFD - 'ack' - shared ram with output device; z80 reads from here and considers the byte at FFFF read if this value incremented
- FFFE - 'req' - shared ram with output device; z80 writes an incrementing value to FFFE to indicate that there is a byte waiting at FFFF
- and hence requesting the output device on the other end do something about it, until FFFD is incremented by the
- output device to acknowledge receipt
+ FFFD - 'ack' - shared ram with output device; z80 reads from here and considers
+ the byte at FFFF read if this value incremented
+ FFFE - 'req' - shared ram with output device; z80 writes an incrementing value
+ to FFFE to indicate that there is a byte waiting at FFFF and hence
+ requesting the output device on the other end do something about it,
+ until FFFD is incremented by the output device to acknowledge receipt
FFFF - 'data' - shared ram with output device; z80 writes the data to be sent to output device here
+
One i/o port is used, but left unemulated:
- 0001 - bit 0 controls whether interrupt timer is enabled (1) or not (0), this is a holdover from a project of kevtris' and can be ignored.
+ 0001 - bit 0 controls whether interrupt timer is enabled (1) or not (0),
+ this is a holdover from a project of kevtris' and can be ignored.
******************************************************************************/
#include "emu.h"
+
#include "cpu/z80/z80.h"
#include "machine/terminal.h"
@@ -43,6 +48,10 @@ public:
void zexall(machine_config &config);
+protected:
+ virtual void machine_start() override ATTR_COLD;
+ virtual void machine_reset() override ATTR_COLD;
+
private:
uint8_t output_ack_r();
uint8_t output_req_r();
@@ -60,9 +69,6 @@ private:
uint8_t m_out_req = 0U; // byte written to 0xFFFE
uint8_t m_out_req_last = 0U; // old value at 0xFFFE before the most recent write
uint8_t m_out_ack = 0U; // byte written to 0xFFFC
-
- virtual void machine_start() override ATTR_COLD;
- virtual void machine_reset() override ATTR_COLD;
};
diff --git a/src/mame/nichibutsu/armedf.cpp b/src/mame/nichibutsu/armedf.cpp
index dd6dca1f18c..fb703fd7ae1 100644
--- a/src/mame/nichibutsu/armedf.cpp
+++ b/src/mame/nichibutsu/armedf.cpp
@@ -311,7 +311,6 @@ Notes:
LM324 - Texas Instruments LM324 Quad Operational Amplifier with True Differential Inputs
MB3730 - Fujitsu MB3730 12W BTL Single Channel Amplifier
-
***********************************************************************/
#include "emu.h"
@@ -641,13 +640,15 @@ void bigfghtr_state::bigfghtr_mcu_io_map(address_map &map)
map(0x00600, 0x03fff).ram().share("sharedram");
}
-void armedf_state::sound_map(address_map &map) // common sound map for the terra force bottom pcb, also used on armed f, tatakae big fighter, etc
+// common sound map for the terra force bottom pcb, also used on armed f, tatakae big fighter, etc
+void armedf_state::sound_map(address_map &map)
{
map(0x0000, 0xf7ff).rom();
map(0xf800, 0xffff).ram();
}
-void armedf_state::cclimbr2_soundmap(address_map &map) // common sound map for the crazy climber 2 and legion bottom pcbs
+// common sound map for the crazy climber 2 and legion bottom pcbs
+void armedf_state::cclimbr2_soundmap(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xc000, 0xffff).ram();
@@ -1134,11 +1135,17 @@ void armedf_state::sound_config_common(machine_config &config) // common amongst
// Sum: 0.83325
// Multiply all 3 values by 1 / 0.83325 (i.e. 1.20012):
// Final values are: ym: 0.2; dac1: 0.4; dac2: 0.4
- FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0)); // R17, R16, nothing(infinite resistance), wire(short), C82, C68
+
+ // R17, R16, nothing(infinite resistance), wire(short), C82, C68
+ FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0));
m_ymfilter->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R15, R10, nothing(infinite resistance), wire(short), C81, C60
+
+ // R15, R10, nothing(infinite resistance), wire(short), C81, C60
+ FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter1->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R13, R9, nothing(infinite resistance), wire(short), C66, C61
+
+ // R13, R9, nothing(infinite resistance), wire(short), C66, C61
+ FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter2->add_route(ALL_OUTPUTS, "speaker", 1.0);
DAC_8BIT_R2R(config, "dac1", 0).add_route(ALL_OUTPUTS, m_dacfilter1, 0.4); // SIP R2R DAC @ G11-1 with 74HC374P latch
diff --git a/src/mame/nichibutsu/cop01.cpp b/src/mame/nichibutsu/cop01.cpp
index 0d443b535ab..f58c4585ff9 100644
--- a/src/mame/nichibutsu/cop01.cpp
+++ b/src/mame/nichibutsu/cop01.cpp
@@ -9,11 +9,12 @@ Mighty Guy (c) 1986 Nichibutsu
driver by Carlos A. Lozano <calb@gsyc.inf.uc3m.es>
TODO:
-- Fix priority kludge
+- fix priority kludge
- Inaccurate 1412M2 protection chip emulation in mightguy, used by the sound CPU.
This is probably an extra CPU (program ROM is the ic2 one), presumably
- with data / address line scrambling
-- Some sound problems remaining, not just 1412M2, but see also MT7949
+ with data / address line scrambling.
+- cop01 AY8910 filters, see MT7949 (I locally tried blindly copy-pasting the one
+ from magmax, but voice volume was too low)
Mighty Guy board layout:
@@ -60,6 +61,7 @@ Mighty Guy board layout:
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
+#include "machine/timer.h"
#include "sound/ay8910.h"
#include "sound/dac.h"
#include "sound/ymopl.h"
@@ -74,35 +76,26 @@ namespace {
#define MIGHTGUY_HACK 0
-class cop01_state : public driver_device
+class cop01_base_state : public driver_device
{
public:
- cop01_state(const machine_config &mconfig, device_type type, const char *tag) :
+ cop01_base_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
- m_audiocpu(*this, "audiocpu"),
m_bgvideoram(*this, "bgvideoram"),
m_spriteram(*this, "spriteram"),
m_fgvideoram(*this, "fgvideoram"),
m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
{ }
- void cop01(machine_config &config);
-
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
virtual void video_start() override ATTR_COLD;
- uint8_t sound_command_r();
-
- void cop01_base(machine_config &config);
-
- required_device<cpu_device> m_audiocpu;
-
-private:
// memory pointers
required_shared_ptr<uint8_t> m_bgvideoram;
required_shared_ptr<uint8_t> m_spriteram;
@@ -113,37 +106,65 @@ private:
tilemap_t *m_fg_tilemap = nullptr;
uint8_t m_vreg[4]{};
- // sound-related
- uint8_t m_pulse = 0;
- static constexpr int TIMER_RATE = 11475; // unknown, hand-tuned to match audio reference
-
// devices
required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
- void irq_ack_w(uint8_t data);
- uint8_t sound_irq_ack_w();
- void background_w(offs_t offset, uint8_t data);
- void foreground_w(offs_t offset, uint8_t data);
- void vreg_w(offs_t offset, uint8_t data);
+ void palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- void palette(palette_device &palette) const;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void audio_io_map(address_map &map) ATTR_COLD;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void background_w(offs_t offset, uint8_t data);
+ void foreground_w(offs_t offset, uint8_t data);
+ void vreg_w(offs_t offset, uint8_t data);
+ void irq_ack_w(uint8_t data);
+
void main_map(address_map &map) ATTR_COLD;
void io_map(address_map &map) ATTR_COLD;
void sound_map(address_map &map) ATTR_COLD;
+
+ void cop01_base(machine_config &config);
+};
+
+class cop01_state : public cop01_base_state
+{
+public:
+ cop01_state(const machine_config &mconfig, device_type type, const char *tag) :
+ cop01_base_state(mconfig, type, tag),
+ m_ay(*this, "ay%u", 0U)
+ { }
+
+ void cop01(machine_config &config);
+
+protected:
+ virtual void machine_start() override ATTR_COLD;
+
+private:
+ required_device_array<ay8910_device, 3> m_ay;
+
+ uint8_t m_ls74_q = 0;
+ uint8_t m_ls74_clr = 0;
+
+ uint8_t sound_command_r();
+
+ TIMER_DEVICE_CALLBACK_MEMBER(sound_timer);
+
+ void ay8910_portb_0_w(uint8_t data);
+ void ay8910_porta_0_w(uint8_t data);
+
+ void audio_io_map(address_map &map) ATTR_COLD;
};
-class mightguy_state : public cop01_state
+class mightguy_state : public cop01_base_state
{
public:
mightguy_state(const machine_config &mconfig, device_type type, const char *tag) :
- cop01_state(mconfig, type, tag),
+ cop01_base_state(mconfig, type, tag),
m_prot(*this, "prot_chip"),
m_fake(*this, "FAKE")
{ }
@@ -155,15 +176,22 @@ public:
void init_mightguy();
private:
- void audio_io_map(address_map &map) ATTR_COLD;
-
required_device<nb1412m2_device> m_prot;
-
required_ioport m_fake;
+
+ uint8_t sound_command_r();
+
+ void audio_io_map(address_map &map) ATTR_COLD;
};
-void cop01_state::palette(palette_device &palette) const
+/***************************************************************************
+
+ Palette
+
+***************************************************************************/
+
+void cop01_base_state::palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -209,7 +237,7 @@ void cop01_state::palette(palette_device &palette) const
***************************************************************************/
-TILE_GET_INFO_MEMBER(cop01_state::get_bg_tile_info)
+TILE_GET_INFO_MEMBER(cop01_base_state::get_bg_tile_info)
{
int const tile = m_bgvideoram[tile_index];
int const attr = m_bgvideoram[tile_index + 0x800];
@@ -232,7 +260,7 @@ TILE_GET_INFO_MEMBER(cop01_state::get_bg_tile_info)
tileinfo.group = pri;
}
-TILE_GET_INFO_MEMBER(cop01_state::get_fg_tile_info)
+TILE_GET_INFO_MEMBER(cop01_base_state::get_fg_tile_info)
{
int const tile = m_fgvideoram[tile_index];
tileinfo.set(0, tile, 0, 0);
@@ -246,10 +274,10 @@ TILE_GET_INFO_MEMBER(cop01_state::get_fg_tile_info)
***************************************************************************/
-void cop01_state::video_start()
+void cop01_base_state::video_start()
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cop01_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cop01_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cop01_base_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(cop01_base_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fg_tilemap->set_transparent_pen(15);
@@ -262,54 +290,11 @@ void cop01_state::video_start()
/***************************************************************************
- Memory handlers
-
-***************************************************************************/
-
-void cop01_state::background_w(offs_t offset, uint8_t data)
-{
- m_bgvideoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset & 0x7ff);
-}
-
-void cop01_state::foreground_w(offs_t offset, uint8_t data)
-{
- m_fgvideoram[offset] = data;
- m_fg_tilemap->mark_tile_dirty(offset);
-}
-
-void cop01_state::vreg_w(offs_t offset, uint8_t data)
-{
- /* 0x40: --xx---- sprite bank, coin counters, flip screen
- * -----x-- flip screen
- * ------xx coin counters
- * 0x41: xxxxxxxx xscroll
- * 0x42: ---xx--- ? matches the bg tile color most of the time, but not
- * during level transitions. Maybe sprite palette bank?
- * (the four banks in the PROM are identical)
- * ------x- unused (xscroll overflow)
- * -------x msb xscroll
- * 0x43: xxxxxxxx yscroll
- */
- m_vreg[offset] = data;
-
- if (offset == 0)
- {
- machine().bookkeeping().coin_counter_w(0, data & 1);
- machine().bookkeeping().coin_counter_w(1, data & 2);
- flip_screen_set(data & 4);
- }
-}
-
-
-
-/***************************************************************************
-
Display refresh
***************************************************************************/
-void cop01_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
+void cop01_base_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
@@ -347,7 +332,7 @@ void cop01_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
}
-uint32_t cop01_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t cop01_base_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->set_scrollx(0, m_vreg[1] + 256 * (m_vreg[2] & 1));
m_bg_tilemap->set_scrolly(0, m_vreg[3]);
@@ -356,34 +341,88 @@ uint32_t cop01_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+
return 0;
}
+
/*************************************
*
- * Memory handlers
+ * Sound
*
*************************************/
+void cop01_state::ay8910_porta_0_w(uint8_t data)
+{
+}
+
+void cop01_state::ay8910_portb_0_w(uint8_t data)
+{
+ // bit 0 is input to CLR line of the LS74
+ m_ls74_clr = data & 1;
+ m_ls74_q &= m_ls74_clr;
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER(cop01_state::sound_timer)
+{
+ // assume timing is the same as magmax.cpp
+ m_ls74_q = m_ls74_clr;
+}
+
uint8_t cop01_state::sound_command_r()
{
- int res = (m_soundlatch->read() & 0x7f) << 1;
+ return (m_soundlatch->read() << 1) | m_ls74_q;
+}
- // bit 0 seems to be a timer
- if ((m_audiocpu->total_cycles() / TIMER_RATE) & 1)
- {
- if (m_pulse == 0)
- res |= 1;
+uint8_t mightguy_state::sound_command_r()
+{
+ // does not have the sound timer
+ return m_soundlatch->read() << 1;
+}
- m_pulse = 1;
- }
- else
- m_pulse = 0;
- return res;
+
+/*************************************
+ *
+ * Memory handlers
+ *
+ *************************************/
+
+void cop01_base_state::background_w(offs_t offset, uint8_t data)
+{
+ m_bgvideoram[offset] = data;
+ m_bg_tilemap->mark_tile_dirty(offset & 0x7ff);
}
+void cop01_base_state::foreground_w(offs_t offset, uint8_t data)
+{
+ m_fgvideoram[offset] = data;
+ m_fg_tilemap->mark_tile_dirty(offset);
+}
+
+void cop01_base_state::vreg_w(offs_t offset, uint8_t data)
+{
+ /* 0x40: --xx---- sprite bank, coin counters, flip screen
+ * -----x-- flip screen
+ * ------xx coin counters
+ * 0x41: xxxxxxxx xscroll
+ * 0x42: ---xx--- ? matches the bg tile color most of the time, but not
+ * during level transitions. Maybe sprite palette bank?
+ * (the four banks in the PROM are identical)
+ * ------x- unused (xscroll overflow)
+ * -------x msb xscroll
+ * 0x43: xxxxxxxx yscroll
+ */
+ m_vreg[offset] = data;
+
+ if (offset == 0)
+ {
+ machine().bookkeeping().coin_counter_w(0, data & 1);
+ machine().bookkeeping().coin_counter_w(1, data & 2);
+ flip_screen_set(data & 4);
+ }
+}
template <int Mask>
int mightguy_state::area_r()
@@ -391,16 +430,12 @@ int mightguy_state::area_r()
return (m_fake->read() & Mask) ? 1 : 0;
}
-void cop01_state::irq_ack_w(uint8_t data)
+void cop01_base_state::irq_ack_w(uint8_t data)
{
m_maincpu->set_input_line(0, CLEAR_LINE);
}
-uint8_t cop01_state::sound_irq_ack_w()
-{
- m_audiocpu->set_input_line(0, CLEAR_LINE);
- return 0;
-}
+
/*************************************
*
@@ -408,16 +443,16 @@ uint8_t cop01_state::sound_irq_ack_w()
*
*************************************/
-void cop01_state::main_map(address_map &map)
+void cop01_base_state::main_map(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xc000, 0xcfff).ram(); // c000-c7ff in cop01
- map(0xd000, 0xdfff).ram().w(FUNC(cop01_state::background_w)).share(m_bgvideoram);
+ map(0xd000, 0xdfff).ram().w(FUNC(cop01_base_state::background_w)).share(m_bgvideoram);
map(0xe000, 0xe0ff).writeonly().share(m_spriteram);
- map(0xf000, 0xf3ff).w(FUNC(cop01_state::foreground_w)).share(m_fgvideoram);
+ map(0xf000, 0xf3ff).w(FUNC(cop01_base_state::foreground_w)).share(m_fgvideoram);
}
-void cop01_state::io_map(address_map &map)
+void cop01_base_state::io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).portr("P1");
@@ -425,24 +460,24 @@ void cop01_state::io_map(address_map &map)
map(0x02, 0x02).portr("SYSTEM");
map(0x03, 0x03).portr("DSW1");
map(0x04, 0x04).portr("DSW2");
- map(0x40, 0x43).w(FUNC(cop01_state::vreg_w));
+ map(0x40, 0x43).w(FUNC(cop01_base_state::vreg_w));
map(0x44, 0x44).w(m_soundlatch, FUNC(generic_latch_8_device::write));
- map(0x45, 0x45).w(FUNC(cop01_state::irq_ack_w)); // ?
+ map(0x45, 0x45).w(FUNC(cop01_base_state::irq_ack_w)); // ?
}
-void cop01_state::sound_map(address_map &map)
+void cop01_base_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
- map(0x8000, 0x8000).r(FUNC(cop01_state::sound_irq_ack_w));
+ map(0x8000, 0x8000).rw(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_r), FUNC(generic_latch_8_device::acknowledge_w));
map(0xc000, 0xc7ff).ram();
}
void cop01_state::audio_io_map(address_map &map)
{
map.global_mask(0xff);
- map(0x00, 0x01).w("ay1", FUNC(ay8910_device::address_data_w));
- map(0x02, 0x03).w("ay2", FUNC(ay8910_device::address_data_w));
- map(0x04, 0x05).w("ay3", FUNC(ay8910_device::address_data_w));
+ map(0x00, 0x01).w(m_ay[0], FUNC(ay8910_device::address_data_w));
+ map(0x02, 0x03).w(m_ay[1], FUNC(ay8910_device::address_data_w));
+ map(0x04, 0x05).w(m_ay[2], FUNC(ay8910_device::address_data_w));
map(0x06, 0x06).r(FUNC(cop01_state::sound_command_r));
}
@@ -680,15 +715,21 @@ GFXDECODE_END
*
*************************************/
-void cop01_state::machine_start()
+void cop01_base_state::machine_start()
{
- save_item(NAME(m_pulse));
save_item(NAME(m_vreg));
}
-void cop01_state::machine_reset()
+void cop01_state::machine_start()
+{
+ cop01_base_state::machine_start();
+
+ save_item(NAME(m_ls74_q));
+ save_item(NAME(m_ls74_clr));
+}
+
+void cop01_base_state::machine_reset()
{
- m_pulse = 0;
m_vreg[0] = 0;
m_vreg[1] = 0;
m_vreg[2] = 0;
@@ -696,19 +737,18 @@ void cop01_state::machine_reset()
}
-void cop01_state::cop01_base(machine_config &config)
+void cop01_base_state::cop01_base(machine_config &config)
{
- constexpr XTAL MAINCPU_CLOCK = XTAL(12'000'000);
-
// basic machine hardware
- Z80(config, m_maincpu, MAINCPU_CLOCK / 2); // unknown clock / divider
- m_maincpu->set_addrmap(AS_PROGRAM, &cop01_state::main_map);
- m_maincpu->set_addrmap(AS_IO, &cop01_state::io_map);
- m_maincpu->set_vblank_int("screen", FUNC(cop01_state::irq0_line_assert));
+ Z80(config, m_maincpu, 12_MHz_XTAL / 2); // unknown divider
+ m_maincpu->set_addrmap(AS_PROGRAM, &cop01_base_state::main_map);
+ m_maincpu->set_addrmap(AS_IO, &cop01_base_state::io_map);
+ m_maincpu->set_vblank_int("screen", FUNC(cop01_base_state::irq0_line_assert));
- Z80(config, m_audiocpu, XTAL(3'000'000)); // unknown clock / divider, hand-tuned to match audio reference
- m_audiocpu->set_addrmap(AS_PROGRAM, &cop01_state::sound_map);
- m_audiocpu->set_addrmap(AS_IO, &cop01_state::audio_io_map);
+ Z80(config, m_audiocpu, 20_MHz_XTAL / 8); // matches audio reference
+ m_audiocpu->set_addrmap(AS_PROGRAM, &cop01_base_state::sound_map);
+
+ config.set_maximum_quantum(attotime::from_hz(600));
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@@ -716,40 +756,47 @@ void cop01_state::cop01_base(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(32*8, 32*8);
screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
- screen.set_screen_update(FUNC(cop01_state::screen_update));
+ screen.set_screen_update(FUNC(cop01_base_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cop01);
- PALETTE(config, m_palette, FUNC(cop01_state::palette), 16+8*16+16*16, 256);
+ PALETTE(config, m_palette, FUNC(cop01_base_state::palette), 16+8*16+16*16, 256);
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_audiocpu, 0);
+ m_soundlatch->set_separate_acknowledge(true);
}
void cop01_state::cop01(machine_config &config)
{
cop01_base(config);
- AY8910(config, "ay1", 1250000).add_route(ALL_OUTPUTS, "mono", 0.50); // unknown clock / divider, hand-tuned to match audio reference
- AY8910(config, "ay2", 1250000).add_route(ALL_OUTPUTS, "mono", 0.25); // "
- AY8910(config, "ay3", 1250000).add_route(ALL_OUTPUTS, "mono", 0.25); // "
+ // sound hardware
+ m_audiocpu->set_addrmap(AS_IO, &cop01_state::audio_io_map);
+
+ AY8910(config, m_ay[0], 20_MHz_XTAL / 16).add_route(ALL_OUTPUTS, "mono", 0.25);
+ m_ay[0]->port_a_write_callback().set(FUNC(cop01_state::ay8910_porta_0_w));
+ m_ay[0]->port_b_write_callback().set(FUNC(cop01_state::ay8910_portb_0_w));
+
+ AY8910(config, m_ay[1], 20_MHz_XTAL / 16).add_route(ALL_OUTPUTS, "mono", 0.25);
+ AY8910(config, m_ay[2], 20_MHz_XTAL / 16).add_route(ALL_OUTPUTS, "mono", 0.25);
+
+ TIMER(config, "sound_timer").configure_scanline(FUNC(cop01_state::sound_timer), "screen", 64, 128);
}
void mightguy_state::mightguy(machine_config &config)
{
cop01_base(config);
- constexpr XTAL AUDIOCPU_CLOCK = XTAL(8'000'000);
-
- m_audiocpu->set_clock(AUDIOCPU_CLOCK / 2); // unknown divider
+ // sound hardware
m_audiocpu->set_addrmap(AS_IO, &mightguy_state::audio_io_map);
- NB1412M2(config, m_prot, XTAL(8'000'000) / 2); // divided by 2 maybe
+ NB1412M2(config, m_prot, 8_MHz_XTAL / 2); // divided by 2 maybe
m_prot->dac_callback().set("dac", FUNC(dac_byte_interface::data_w));
- YM3526(config, "ymsnd", AUDIOCPU_CLOCK / 2).add_route(ALL_OUTPUTS, "mono", 1.0); // unknown divider
+ YM3526(config, "ymsnd", 8_MHz_XTAL / 2).add_route(ALL_OUTPUTS, "mono", 1.0);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "mono", 0.5); // unknown DAC
}
diff --git a/src/mame/nichibutsu/galivan.cpp b/src/mame/nichibutsu/galivan.cpp
index 319b2414004..9b296f4330c 100644
--- a/src/mame/nichibutsu/galivan.cpp
+++ b/src/mame/nichibutsu/galivan.cpp
@@ -1197,11 +1197,17 @@ void galivan_state::common(machine_config &config)
Sum: 0.67015
Multiply all 3 values by 1 / 0.67015 (i.e. 1.492203):
Final values are: ym: 0.492203; dac1: 0.209505; dac2: 0.298291 */
- FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0)); // R15, R14, nothing(infinite resistance), wire(short), C9, C11
+
+ // R15, R14, nothing(infinite resistance), wire(short), C9, C11
+ FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0));
m_ymfilter->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R11, R10, nothing(infinite resistance), wire(short), C7, C17
+
+ // R11, R10, nothing(infinite resistance), wire(short), C7, C17
+ FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter1->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R13, R12, nothing(infinite resistance), wire(short), C8, C18
+
+ // R13, R12, nothing(infinite resistance), wire(short), C8, C18
+ FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter2->add_route(ALL_OUTPUTS, "speaker", 1.0);
YM3526(config, "ymsnd", XTAL(8'000'000) / 2).add_route(ALL_OUTPUTS, m_ymfilter, 0.4922);
diff --git a/src/mame/nichibutsu/magmax.cpp b/src/mame/nichibutsu/magmax.cpp
index 72f78b7bc0f..d9e9827e1e9 100644
--- a/src/mame/nichibutsu/magmax.cpp
+++ b/src/mame/nichibutsu/magmax.cpp
@@ -32,6 +32,7 @@ Stephh's notes (based on the game M68000 code and some tests) :
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/rescap.h"
+#include "machine/timer.h"
#include "sound/ay8910.h"
#include "sound/flt_biquad.h"
#include "sound/mixer.h"
@@ -79,7 +80,6 @@ public:
protected:
virtual void machine_start() override ATTR_COLD;
- virtual void machine_reset() override ATTR_COLD;
virtual void video_start() override ATTR_COLD;
private:
@@ -102,7 +102,6 @@ private:
uint8_t m_ls74_clr = 0;
uint8_t m_ls74_q = 0;
uint8_t m_gain_control = 0;
- emu_timer *m_interrupt_timer = nullptr;
uint8_t m_flipscreen = 0;
std::unique_ptr<uint32_t[]> m_prom_tab;
bitmap_ind16 m_bitmap;
@@ -115,7 +114,7 @@ private:
void palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_CALLBACK_MEMBER(scanline_callback);
+ TIMER_DEVICE_CALLBACK_MEMBER(sound_timer);
void main_map(address_map &map) ATTR_COLD;
void sound_io_map(address_map &map) ATTR_COLD;
@@ -136,6 +135,7 @@ private:
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
+
void magmax_state::palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -233,10 +233,10 @@ uint32_t magmax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
uint32_t const prom_data = m_prom_tab[(ls283 >> 6) & 0xff];
rom18d_addr &= 0x20f8;
- rom18d_addr += (prom_data & 0x1f00) + ((ls283 & 0x38) >>3);
+ rom18d_addr += (prom_data & 0x1f00) + ((ls283 & 0x38) >> 3);
rom15f_addr &= 0x201c;
- rom15f_addr += (m_rom18b[0x4000 + rom18d_addr]<<5) + ((ls283 & 0x6)>>1);
+ rom15f_addr += (m_rom18b[0x4000 + rom18d_addr] << 5) + ((ls283 & 0x6) >> 1);
rom15f_addr += (prom_data & 0x4000);
uint32_t const graph_color = (prom_data & 0x0070);
@@ -249,7 +249,7 @@ uint32_t magmax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
line_data[h] = pen_base + graph_color + graph_data;
// priority: background over sprites
- if (map_v_scr_100 && ((graph_data & 0x0c)==0x0c))
+ if (map_v_scr_100 && ((graph_data & 0x0c) == 0x0c))
m_bitmap.pix(v, h) = line_data[h];
}
@@ -346,88 +346,71 @@ void magmax_state::ay8910_portb_0_w(uint8_t data)
{
// bit 0 is input to CLR line of the LS74
m_ls74_clr = data & 1;
- if (m_ls74_clr == 0)
- m_ls74_q = 0;
+ m_ls74_q &= m_ls74_clr;
}
-TIMER_CALLBACK_MEMBER(magmax_state::scanline_callback)
+TIMER_DEVICE_CALLBACK_MEMBER(magmax_state::sound_timer)
{
- int scanline = param;
-
/* bit 0 goes hi whenever line V6 from video part goes lo->hi
that is when scanline is 64 and 192 accordingly */
- if (m_ls74_clr != 0)
- m_ls74_q = 1;
-
- scanline += 128;
- scanline &= 255;
-
- m_interrupt_timer->adjust(m_screen->time_until_pos(scanline), scanline);
+ m_ls74_q = m_ls74_clr;
}
void magmax_state::machine_start()
{
- // Create interrupt timer
- m_interrupt_timer = timer_alloc(FUNC(magmax_state::scanline_callback), this);
-
// Set up save state
save_item(NAME(m_ls74_clr));
save_item(NAME(m_ls74_q));
save_item(NAME(m_gain_control));
}
-void magmax_state::machine_reset()
-{
- m_interrupt_timer->adjust(m_screen->time_until_pos(64), 64);
-}
-
void magmax_state::ay8910_porta_0_w(uint8_t data)
{
-/*There are three AY8910 chips and four(!) separate amplifiers on the board
-* Each of AY channels is hardware mapped in following way:
-* amplifier 0 gain x 1.00 <- AY0 CHA
-* amplifier 1 gain x 1.00 <- AY0 CHB + AY0 CHC + AY1 CHA + AY1 CHB
-* amplifier 2 gain x 4.54 (150K/33K) <- AY1 CHC + AY2 CHA
-* amplifier 3 gain x 4.54 (150K/33K) <- AY2 CHB + AY2 CHC
-*
-* Each of the amps has its own analog circuit:
-* amp0, amp1 and amp2 are different from each other; amp3 is the same as amp2
-*
-* Outputs of those amps are inputs to post amps, each having own circuit
-* that is partially controlled by AY #0 port A.
-* PORT A BIT 0 - control postamp 0 (gain x10.0 | gain x 5.00)
-* PORT A BIT 1 - control postamp 1 (gain x4.54 | gain x 2.27)
-* PORT A BIT 2 - control postamp 2 (gain x1.00 | gain x 0.50)
-* PORT A BIT 3 - control postamp 3 (gain x1.00 | gain x 0.50)
-*
-* The "control" means assert/clear input pins on chip called 4066 (it is analog switch)
-* which results in volume gain (exactly 2 times).
-* I use set_output_gain() to emulate the effect.
-
-gain summary:
-port A control ON OFF
-amp0 = *1*10.0=10.0 *1*5.0 = 5.0
-amp1 = *1*4.54=4.54 *1*2.27 = 2.27
-amp2 = *4.54*1=4.54 *4.54*0.5= 2.27
-amp3 = *4.54*1=4.54 *4.54*0.5= 2.27
-*/
-
-/*
-bit0 - SOUND Chan#0 name=AY-3-8910 #0 Ch A
-
-bit1 - SOUND Chan#1 name=AY-3-8910 #0 Ch B
-bit1 - SOUND Chan#2 name=AY-3-8910 #0 Ch C
-bit1 - SOUND Chan#3 name=AY-3-8910 #1 Ch A
-bit1 - SOUND Chan#4 name=AY-3-8910 #1 Ch B
-
-bit2 - SOUND Chan#5 name=AY-3-8910 #1 Ch C
-bit2 - SOUND Chan#6 name=AY-3-8910 #2 Ch A
-
-bit3 - SOUND Chan#7 name=AY-3-8910 #2 Ch B
-bit3 - SOUND Chan#8 name=AY-3-8910 #2 Ch C
-*/
+ /* There are three AY8910 chips and four(!) separate amplifiers on the board
+ * Each of AY channels is hardware mapped in following way:
+ * amplifier 0 gain x 1.00 <- AY0 CHA
+ * amplifier 1 gain x 1.00 <- AY0 CHB + AY0 CHC + AY1 CHA + AY1 CHB
+ * amplifier 2 gain x 4.54 (150K/33K) <- AY1 CHC + AY2 CHA
+ * amplifier 3 gain x 4.54 (150K/33K) <- AY2 CHB + AY2 CHC
+ *
+ * Each of the amps has its own analog circuit:
+ * amp0, amp1 and amp2 are different from each other; amp3 is the same as amp2
+ *
+ * Outputs of those amps are inputs to post amps, each having own circuit
+ * that is partially controlled by AY #0 port A.
+ * PORT A BIT 0 - control postamp 0 (gain x10.0 | gain x 5.00)
+ * PORT A BIT 1 - control postamp 1 (gain x4.54 | gain x 2.27)
+ * PORT A BIT 2 - control postamp 2 (gain x1.00 | gain x 0.50)
+ * PORT A BIT 3 - control postamp 3 (gain x1.00 | gain x 0.50)
+ *
+ * The "control" means assert/clear input pins on chip called 4066 (it is analog switch)
+ * which results in volume gain (exactly 2 times).
+ * I use set_output_gain() to emulate the effect.
+
+ gain summary:
+ port A control ON OFF
+ amp0 = *1*10.0=10.0 *1*5.0 = 5.0
+ amp1 = *1*4.54=4.54 *1*2.27 = 2.27
+ amp2 = *4.54*1=4.54 *4.54*0.5= 2.27
+ amp3 = *4.54*1=4.54 *4.54*0.5= 2.27
+ */
+
+ /*
+ bit0 - SOUND Chan#0 name=AY-3-8910 #0 Ch A
+
+ bit1 - SOUND Chan#1 name=AY-3-8910 #0 Ch B
+ bit1 - SOUND Chan#2 name=AY-3-8910 #0 Ch C
+ bit1 - SOUND Chan#3 name=AY-3-8910 #1 Ch A
+ bit1 - SOUND Chan#4 name=AY-3-8910 #1 Ch B
+
+ bit2 - SOUND Chan#5 name=AY-3-8910 #1 Ch C
+ bit2 - SOUND Chan#6 name=AY-3-8910 #2 Ch A
+
+ bit3 - SOUND Chan#7 name=AY-3-8910 #2 Ch B
+ bit3 - SOUND Chan#8 name=AY-3-8910 #2 Ch C
+ */
if (m_gain_control == (data & 0x0f))
return;
@@ -436,11 +419,13 @@ bit3 - SOUND Chan#8 name=AY-3-8910 #2 Ch C
LOGGAINCTRL("gain_ctrl = %2x", data & 0x0f);
- const double mix_resistors[4] = { RES_K(1.0), RES_K(2.2), RES_K(10.0), RES_K(10.0) }; // R35, R33, R32, R34
for (int i = 0; i < 4; i++)
{
- // RES_K(5) == (1.0 / ((1.0 / RES_K(10)) + (1.0 / RES_K(10)))) because of the optional extra 10k in parallel in each inverting amplifier circuit
- // the total max number of output gain 'units' of all 4 inputs is 10 + 10/2.2 + 1 + 1 = 16.545454, so we divide the gain amount by this number so we don't clip
+ const double mix_resistors[4] = { RES_K(1.0), RES_K(2.2), RES_K(10.0), RES_K(10.0) }; // R35, R33, R32, R34
+
+ // RES_K(5) == (1.0 / ((1.0 / RES_K(10)) + (1.0 / RES_K(10)))) because of the optional extra 10k in parallel in each inverting amplifier circuit.
+ // The total max number of output gain 'units' of all 4 inputs is 10 + 10/2.2 + 1 + 1 = 16.545454,
+ // so we divide the gain amount by this number so we don't clip.
m_ayfilter[i]->set_output_gain(0, (-1.0 * (((m_gain_control & (1 << i)) ? RES_K(10) : RES_K(5)) / mix_resistors[i] )) / 16.545454);
//m_ayfilter[i]->set_output_gain(0, (m_gain_control & (1 << i)) ? 1.0 : 0.5);
}
@@ -595,7 +580,7 @@ GFXDECODE_END
void magmax_state::magmax(machine_config &config)
{
// basic machine hardware
- M68000(config, m_maincpu, XTAL(16'000'000) / 2); // verified on PCB
+ M68000(config, m_maincpu, XTAL(16'000'000) / 2); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &magmax_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(magmax_state::irq1_line_assert));
@@ -605,7 +590,6 @@ void magmax_state::magmax(machine_config &config)
config.set_maximum_quantum(attotime::from_hz(600));
-
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@@ -620,13 +604,20 @@ void magmax_state::magmax(machine_config &config)
// sound hardware
SPEAKER(config, "speaker").front_center();
- FILTER_BIQUAD(config, m_ayfilter[0]).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(22), CAP_N(10)); // R22, R23, nothing(infinite resistance), wire(short), C16, C19
+ // R22, R23, nothing(infinite resistance), wire(short), C16, C19
+ FILTER_BIQUAD(config, m_ayfilter[0]).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(22), CAP_N(10));
m_ayfilter[0]->add_route(ALL_OUTPUTS, "speaker", 1.0); // <- gain here is controlled by m_ay[0] IOA0 and resistor R35
- FILTER_BIQUAD(config, m_ayfilter[1]).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R26, R27, nothing(infinite resistance), wire(short), C18, C14
+
+ // R26, R27, nothing(infinite resistance), wire(short), C18, C14
+ FILTER_BIQUAD(config, m_ayfilter[1]).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_ayfilter[1]->add_route(ALL_OUTPUTS, "speaker", 1.0); // <- gain here is controlled by m_ay[0] IOA1 and resistor R33
- FILTER_BIQUAD(config, m_ayfilter[2]).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_P(330)); // R24, wire(short), R28, wire(short), C22
+
+ // R24, wire(short), R28, wire(short), C22
+ FILTER_BIQUAD(config, m_ayfilter[2]).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_P(330));
m_ayfilter[2]->add_route(ALL_OUTPUTS, "speaker", 1.0); // <- gain here is controlled by m_ay[0] IOA2 and resistor R32
- FILTER_BIQUAD(config, m_ayfilter[3]).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_P(330)); // R25, wire(short), R31, wire(short), C23
+
+ // R25, wire(short), R31, wire(short), C23
+ FILTER_BIQUAD(config, m_ayfilter[3]).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_P(330));
m_ayfilter[3]->add_route(ALL_OUTPUTS, "speaker", 1.0); // <- gain here is controlled by m_ay[0] IOA3 and resistor R34
MIXER(config, m_aymixer[0]).add_route(0, m_ayfilter[1], 1.0);
@@ -653,6 +644,8 @@ void magmax_state::magmax(machine_config &config)
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
m_soundlatch->set_separate_acknowledge(true);
+
+ TIMER(config, "sound_timer").configure_scanline(FUNC(magmax_state::sound_timer), "screen", 64, 128);
}
diff --git a/src/mame/nichibutsu/terracre.cpp b/src/mame/nichibutsu/terracre.cpp
index 463d71312d2..fd7e4d275f4 100644
--- a/src/mame/nichibutsu/terracre.cpp
+++ b/src/mame/nichibutsu/terracre.cpp
@@ -2,6 +2,7 @@
// copyright-holders: Carlos A. Lozano
/******************************************************************
+
Terra Cresta (preliminary)
Nichibutsu 1985
68000 + Z80
@@ -79,6 +80,7 @@ AT-2
2148 2148 2148 2148
1 2 3 6116
22MHz
+
*/
#include "emu.h"
@@ -784,14 +786,20 @@ void terracre_state::ym3526(machine_config &config)
// Sum: 0.796296
// Multiply all 3 values by 1 / 0.796296 (i.e. 1.255814):
// Final values are: ym: 0.255814; dac1: 0.232558; dac2: 0.511628)
- FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0)); // R10, R11, nothing(infinite resistance), wire(short), C11, C12
+
+ // R10, R11, nothing(infinite resistance), wire(short), C11, C12
+ FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0));
m_ymfilter->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R17, R18, nothing(infinite resistance), wire(short), C19, C17
+
+ // R17, R18, nothing(infinite resistance), wire(short), C19, C17
+ FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter1->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R16, R15, nothing(infinite resistance), wire(short), C18, C21
+
+ // R16, R15, nothing(infinite resistance), wire(short), C18, C21
+ FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter2->add_route(ALL_OUTPUTS, "speaker", 1.0);
- YM3526(config, "ymsnd", XTAL(16'000'000) / 4).add_route(ALL_OUTPUTS, m_ymfilter, 0.2558); // 4MHz verified on PCB
+ YM3526(config, "ymsnd", XTAL(16'000'000) / 4).add_route(ALL_OUTPUTS, m_ymfilter, 0.2558); // 4MHz verified on PCB
DAC_8BIT_R2R(config, "dac1", 0).add_route(ALL_OUTPUTS, m_dacfilter1, 0.2326); // SIP R2R DAC @ RA-1 with 74HC374P latch
DAC_8BIT_R2R(config, "dac2", 0).add_route(ALL_OUTPUTS, m_dacfilter2, 0.5116); // SIP R2R DAC @ RA-2 with 74HC374P latch
@@ -830,11 +838,17 @@ void terracre_state::ym2203(machine_config &config)
// Sum: 0.7245
// Multiply all 5 values by 1 / 0.7245 (i.e. 1.380):
// ym: 0.2415; dac1: 0.2196; dac2: 0.4830, ssgA+B: 0.0222; ssgC: 0.0337
- FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0)); // R10, R11, nothing(infinite resistance), wire(short), C11, C12
+
+ // R10, R11, nothing(infinite resistance), wire(short), C11, C12
+ FILTER_BIQUAD(config, m_ymfilter).opamp_sk_lowpass_setup(RES_K(4.7), RES_K(4.7), RES_M(999.99), RES_R(0.001), CAP_N(3.3), CAP_N(1.0));
m_ymfilter->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R17, R18, nothing(infinite resistance), wire(short), C19, C17
+
+ // R17, R18, nothing(infinite resistance), wire(short), C19, C17
+ FILTER_BIQUAD(config, m_dacfilter1).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter1->add_route(ALL_OUTPUTS, "speaker", 1.0);
- FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7)); // R16, R15, nothing(infinite resistance), wire(short), C18, C21
+
+ // R16, R15, nothing(infinite resistance), wire(short), C18, C21
+ FILTER_BIQUAD(config, m_dacfilter2).opamp_sk_lowpass_setup(RES_K(22), RES_K(22), RES_M(999.99), RES_R(0.001), CAP_N(10), CAP_N(4.7));
m_dacfilter2->add_route(ALL_OUTPUTS, "speaker", 1.0);
//TODO: the ym2203 sub-board has a complicated and convoluted enough set of analog
@@ -847,17 +861,20 @@ void terracre_state::ym2203(machine_config &config)
// unconventional way.
// This filter is a differential amplifier, with no real cutoff, and a gain of -2.127
- FILTER_BIQUAD(config, m_ssgfilter_cgain).opamp_mfb_lowpass_setup(RES_K(4.7), 0.0, RES_K(10), 0.0, CAP_N(22)/100.0); // YR12, N/A(short), YR15, N/A(unpopulated), (parasitic capacitance from YC3)
+ // YR12, N/A(short), YR15, N/A(unpopulated), (parasitic capacitance from YC3)
+ FILTER_BIQUAD(config, m_ssgfilter_cgain).opamp_mfb_lowpass_setup(RES_K(4.7), 0.0, RES_K(10), 0.0, CAP_N(22)/100.0);
m_ssgfilter_cgain->add_route(ALL_OUTPUTS, "speaker", 1.0);
// This filter is a 2nd order sallen-key lowpass, unity gain.
- FILTER_BIQUAD(config, m_ssgfilter_cfilt).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(22), CAP_N(10)); // YR3, YR5, nothing(infinite resistance), wire(short), YC3, YC6
+ // YR3, YR5, nothing(infinite resistance), wire(short), YC3, YC6
+ FILTER_BIQUAD(config, m_ssgfilter_cfilt).opamp_sk_lowpass_setup(RES_K(10), RES_K(10), RES_M(999.99), RES_R(0.001), CAP_N(22), CAP_N(10));
m_ssgfilter_cfilt->add_route(ALL_OUTPUTS, m_ssgfilter_cgain, 1.0);
// This filter is a differential amplifier, with no real cutoff, and a gain of -4.5454
// Technically it was probably intended as first order MFB lowpass, but the cap ("YC0")
// near/bypassing YR7 was left unpopulated.
- FILTER_BIQUAD(config, m_ssgfilter_abgain).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_N(100)/10000.0); // YR8, N/A(short), YR7, N/A(unpopulated), (parasitic capacitance from YC1)
+ // YR8, N/A(short), YR7, N/A(unpopulated), (parasitic capacitance from YC1)
+ FILTER_BIQUAD(config, m_ssgfilter_abgain).opamp_mfb_lowpass_setup(RES_K(33), 0.0, RES_K(150), 0.0, CAP_N(100)/10000.0);
m_ssgfilter_abgain->add_route(ALL_OUTPUTS, "speaker", 1.0);
MIXER(config, m_ssgmixer);