-megaduck.xml: Added explicit info about cartridge banking.

* There are three kinds of cartridge: 32K flat, 16K fixed plus 16K
  switchable, and 32K switchable.  Cart implementation will come later.

-Various cleanups:

* gbcolor.xml: Proper Pinyin description for sqsd.
* sound/pokey.cpp: Minor cleanup, and got rid of an unnecessary member
  in channel structures (only used in inline member functions).
* nintendo/gb.cpp: Spell Mega Duck with a space consistently.
* sega/turbo_a.cpp: Use an optional device finder to get discrete sound
  device.  The function that would add this seems to have been lost.
This commit is contained in:
Vas Crabb 2022-08-26 02:20:44 +10:00
parent 278ebb10d5
commit cfa539f1ed
11 changed files with 188 additions and 136 deletions

View file

@ -27151,7 +27151,7 @@ license:CC0
</software>
<software name="sqsd">
<description>Shi Qi Shi Dai - Jing Ling Wang Dan Sheng (China)</description>
<description>Shíqì Shídài - Jīnglíng Wang Dànshēng (China)</description>
<year>20??</year>
<publisher>GOWIN</publisher>
<info name="usage" value="Enable 'Skip BIOS check' configuration setting to boot"/>

View file

@ -12,8 +12,9 @@ license:CC0
<info name="serial" value="CB028/MD028" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="131072">
<rom name="028.bin" size="131072" crc="43272949" sha1="b2b54faa87996d614941630c7f098431bf699b58" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x20000">
<rom name="028.bin" size="0x20000" crc="43272949" sha1="b2b54faa87996d614941630c7f098431bf699b58" offset="00000" />
</dataarea>
</part>
</software>
@ -25,8 +26,9 @@ license:CC0
<info name="serial" value="CB026/MD026" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="131072">
<rom name="026.bin" size="131072" crc="4907c1d8" sha1="52f087a0156c1ef42e03427b405911f5be423b16" offset="0" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x20000">
<rom name="026.bin" size="0x20000" crc="4907c1d8" sha1="52f087a0156c1ef42e03427b405911f5be423b16" offset="0" />
</dataarea>
</part>
</software>
@ -38,8 +40,8 @@ license:CC0
<info name="serial" value="CB006/MD006" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="006.bin" size="32768" crc="f88f2d25" sha1="4f3022126f33964e0fb5505fa0caeaa13b995309" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="006.bin" size="0x8000" crc="f88f2d25" sha1="4f3022126f33964e0fb5505fa0caeaa13b995309" offset="00000" />
</dataarea>
</part>
</software>
@ -51,8 +53,9 @@ license:CC0
<info name="serial" value="CB014/MD014" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="014.bin" size="65536" crc="eca6c0ad" sha1="aa2c3774eb48df0854d4b61997653f79a810f4cc" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="014.bin" size="0x10000" crc="eca6c0ad" sha1="aa2c3774eb48df0854d4b61997653f79a810f4cc" offset="00000" />
</dataarea>
</part>
</software>
@ -64,8 +67,9 @@ license:CC0
<info name="serial" value="CB021/MD021" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="131072">
<rom name="021.bin" size="131072" crc="2adb7253" sha1="9ff96b40e8636fad37b1b95f83f3a9584f3dfe3e" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x20000">
<rom name="021.bin" size="0x20000" crc="2adb7253" sha1="9ff96b40e8636fad37b1b95f83f3a9584f3dfe3e" offset="00000" />
</dataarea>
</part>
</software>
@ -75,12 +79,14 @@ license:CC0
<year>1993</year>
<publisher>Commin</publisher>
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="bftale.bin" size="65536" crc="211d268b" sha1="3d62acc2db46bb7b6a2909d640dec6ce095aeec3" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="bftale.bin" size="0x10000" crc="211d268b" sha1="3d62acc2db46bb7b6a2909d640dec6ce095aeec3" offset="00000" />
</dataarea>
</part>
</software>
<!-- Lots of reads from A000-BFFF area - bad programming, or does cartridge map something there? -->
<software name="bombdisp">
<description>Bomb Disposer</description>
<year>1993</year>
@ -88,8 +94,8 @@ license:CC0
<info name="serial" value="CB003/MD003" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="003.bin" size="32768" crc="cac582ad" sha1="ba17489d8b753d51bed183459b3de5167e514c65" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="003.bin" size="0x8000" crc="cac582ad" sha1="ba17489d8b753d51bed183459b3de5167e514c65" offset="00000" />
</dataarea>
</part>
</software>
@ -101,8 +107,8 @@ license:CC0
<info name="serial" value="CB001/MD001" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="001.bin" size="32768" crc="58efe338" sha1="9b050e41b9aa18dbf5c043f19b7c945c89811cc1" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="001.bin" size="0x8000" crc="58efe338" sha1="9b050e41b9aa18dbf5c043f19b7c945c89811cc1" offset="00000" />
</dataarea>
</part>
</software>
@ -114,8 +120,9 @@ license:CC0
<info name="serial" value="CB011/MD011" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="131072">
<rom name="011.bin" size="131072" crc="a17de1a3" sha1="3496ef24a27bbf4050783e090344b0e3275ee862" offset="0" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x20000">
<rom name="011.bin" size="0x20000" crc="a17de1a3" sha1="3496ef24a27bbf4050783e090344b0e3275ee862" offset="0" />
</dataarea>
</part>
</software>
@ -127,8 +134,9 @@ license:CC0
<info name="serial" value="CB036/MD036" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="036.bin" size="65536" crc="ff0da355" sha1="fb4ba6c9823808c2705f597294b784837342cbcb" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="036.bin" size="0x10000" crc="ff0da355" sha1="fb4ba6c9823808c2705f597294b784837342cbcb" offset="00000" />
</dataarea>
</part>
</software>
@ -141,8 +149,9 @@ license:CC0
<info name="alt_title" value="Duck Adventure (Label)" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="131072">
<rom name="031.bin" size="131072" crc="cc9c6d10" sha1="b0ddee2de1032fc21c379ada1c891543aa130860" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x20000">
<rom name="031.bin" size="0x20000" crc="cc9c6d10" sha1="b0ddee2de1032fc21c379ada1c891543aa130860" offset="00000" />
</dataarea>
</part>
</software>
@ -154,8 +163,8 @@ license:CC0
<info name="serial" value="CB007/MD007" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="007.bin" size="32768" crc="93c878be" sha1="5c765a8c5875b237a1af8f7766ca3f0defb9ce10" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="007.bin" size="0x8000" crc="93c878be" sha1="5c765a8c5875b237a1af8f7766ca3f0defb9ce10" offset="00000" />
</dataarea>
</part>
</software>
@ -167,8 +176,9 @@ license:CC0
<info name="serial" value="CB029/MD029" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="029.bin" size="65536" crc="98694021" sha1="6eefbf8742eba1279f943c321b5d55e45a727a67" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="029.bin" size="0x10000" crc="98694021" sha1="6eefbf8742eba1279f943c321b5d55e45a727a67" offset="00000" />
</dataarea>
</part>
</software>
@ -180,8 +190,9 @@ license:CC0
<info name="serial" value="CB035/MD035" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="035.bin" size="65536" crc="8046ea70" sha1="2a1c5bea602ab27ecf680c88cfe9884186b61438" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="035.bin" size="0x10000" crc="8046ea70" sha1="2a1c5bea602ab27ecf680c88cfe9884186b61438" offset="00000" />
</dataarea>
</part>
</software>
@ -193,8 +204,8 @@ license:CC0
<info name="serial" value="CB010/MD010" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="010.bin" size="32768" crc="d71f1770" sha1="69222a0c5c3920d0784d0e58c3407b74c1b2bfe8" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="010.bin" size="0x8000" crc="d71f1770" sha1="69222a0c5c3920d0784d0e58c3407b74c1b2bfe8" offset="00000" />
</dataarea>
</part>
</software>
@ -206,8 +217,8 @@ license:CC0
<info name="serial" value="CB010/MD010" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="010a.bin" size="32768" crc="61c81e06" sha1="13d8882371823e5dfb74191ef0addafc43aa1de4" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="010a.bin" size="0x8000" crc="61c81e06" sha1="13d8882371823e5dfb74191ef0addafc43aa1de4" offset="00000" />
</dataarea>
</part>
</software>
@ -219,8 +230,9 @@ license:CC0
<info name="serial" value="CB008/MD008" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="008.bin" size="65536" crc="35fb1616" sha1="4849cd6f881b5b78e1d3a08edb727e79c77f9d39" offset="00000" />
<feature name="fixedbank" value="no" />
<dataarea name="rom" size="0x10000">
<rom name="008.bin" size="0x10000" crc="35fb1616" sha1="4849cd6f881b5b78e1d3a08edb727e79c77f9d39" offset="00000" />
</dataarea>
</part>
</software>
@ -232,8 +244,9 @@ license:CC0
<info name="serial" value="CB019/MD019" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="019.bin" size="65536" crc="2bb6aeb9" sha1="f1a9a8365f1b78057ed5cc647fd68efafc0c49e8" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="019.bin" size="0x10000" crc="2bb6aeb9" sha1="f1a9a8365f1b78057ed5cc647fd68efafc0c49e8" offset="00000" />
</dataarea>
</part>
</software>
@ -245,8 +258,9 @@ license:CC0
<info name="serial" value="CB018/MD018" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="018.bin" size="65536" crc="315ef9f2" sha1="c76a57047f0f72252cddd7974a3b694392753469" offset="00000" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="018.bin" size="0x10000" crc="315ef9f2" sha1="c76a57047f0f72252cddd7974a3b694392753469" offset="00000" />
</dataarea>
</part>
</software>
@ -258,8 +272,8 @@ license:CC0
<info name="serial" value="CB002/MD002" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="002.bin" size="32768" crc="74c3377f" sha1="9b7d69f9b0a44eeaa36971aabec553ebd3bfdc0e" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="002.bin" size="0x8000" crc="74c3377f" sha1="9b7d69f9b0a44eeaa36971aabec553ebd3bfdc0e" offset="00000" />
</dataarea>
</part>
</software>
@ -271,8 +285,9 @@ license:CC0
<info name="serial" value="CB005/MD005" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="005.bin" size="65536" crc="cd2730ac" sha1="022d7e635ea64c6a525db5d31c30a7d8636f4c18" offset="00000" />
<feature name="fixedbank" value="no" />
<dataarea name="rom" size="0x10000">
<rom name="005.bin" size="0x10000" crc="cd2730ac" sha1="022d7e635ea64c6a525db5d31c30a7d8636f4c18" offset="00000" />
</dataarea>
</part>
</software>
@ -284,8 +299,8 @@ license:CC0
<info name="serial" value="CB009/MD009" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="009.bin" size="32768" crc="2b58d9a4" sha1="946e1fc387b4eb9114d82cd4471ea9064c3497ce" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="009.bin" size="0x8000" crc="2b58d9a4" sha1="946e1fc387b4eb9114d82cd4471ea9064c3497ce" offset="00000" />
</dataarea>
</part>
</software>
@ -297,8 +312,8 @@ license:CC0
<info name="serial" value="CB004/MD004" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="32768">
<rom name="004.bin" size="32768" crc="b26bb405" sha1="b750a4c303342e302e5c20556b5e1761deac7c99" offset="00000" />
<dataarea name="rom" size="0x8000">
<rom name="004.bin" size="0x8000" crc="b26bb405" sha1="b750a4c303342e302e5c20556b5e1761deac7c99" offset="00000" />
</dataarea>
</part>
</software>
@ -310,8 +325,9 @@ license:CC0
<info name="serial" value="CB030/MD030" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="030.bin" size="65536" crc="da4743e7" sha1="81d7c74f2f029a8b15c3d4fcb8567870b387c60d" offset="0" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="030.bin" size="0x10000" crc="da4743e7" sha1="81d7c74f2f029a8b15c3d4fcb8567870b387c60d" offset="0" />
</dataarea>
</part>
</software>
@ -323,8 +339,9 @@ license:CC0
<info name="serial" value="CB037/MD037" />
<part name="cart" interface="megaduck_cart">
<dataarea name="rom" size="65536">
<rom name="037.bin" size="65536" crc="2004c1fb" sha1="5a9615ace92ea7ad96a02c73dc99ebdd01cefb94" offset="0" />
<feature name="fixedbank" value="yes" />
<dataarea name="rom" size="0x10000">
<rom name="037.bin" size="0x10000" crc="2004c1fb" sha1="5a9615ace92ea7ad96a02c73dc99ebdd01cefb94" offset="0" />
</dataarea>
</part>
</software>

View file

@ -52,6 +52,38 @@ public:
}
}
// TODO: find a better home for this helper
template <typename T, typename U>
static T map_non_power_of_two(T count, U &&map)
{
if (T(0) >= count)
return T(0);
T const max(count - 1);
T mask(max);
for (unsigned i = 1; (sizeof(T) * 8) > i; i <<= 1)
mask = T(std::make_unsigned_t<T>(mask) | (std::make_unsigned_t<T>(mask) >> i));
int bits(0);
while (BIT(mask, bits))
++bits;
for (T entry = T(0); mask >= entry; ++entry)
{
T mapped(entry);
int b(bits - 1);
while (max < mapped)
{
while (BIT(max, b))
--b;
assert(0 <= b);
mapped = T(std::make_unsigned_t<T>(mapped) & ~(std::make_unsigned_t<T>(1) << b--));
}
map(entry, mapped);
}
return mask;
}
// construction/destruction
virtual ~device_generic_cart_interface();

View file

@ -63,7 +63,7 @@ image_init_result vboy_flat_rom_device::load()
0,
0,
rom_base(),
[this, rom = reinterpret_cast<u32 *>(romregion->base())] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
[this, rom = &romregion->as_u32()] (offs_t begin, offs_t end, offs_t mirror, offs_t src)
{
LOG(
"Install ROM 0x%08X-0x%08X at 0x%08X-0x%08X mirror %08X\n",

View file

@ -27,6 +27,7 @@
DEFINE_DEVICE_TYPE(VBOY_CART_SLOT, vboy_cart_slot_device, "vboy_cart_slot", "Nintendo Virtual Boy Cartridge Slot")
//**************************************************************************
// vboy_cart_slot_device
//**************************************************************************
@ -129,22 +130,22 @@ std::string vboy_cart_slot_device::get_default_card_software(get_default_card_so
software_part const *const part(!image_name.empty() ? find_software_item(image_name, true) : nullptr);
if (part)
{
//printf("[%s] Found software part for image name '%s'\n", tag(), image_name.c_str());
osd_printf_verbose("[%s] Found software part for image name '%s'\n", tag(), image_name);
for (rom_entry const &entry : part->romdata())
{
if (ROMENTRY_ISREGION(entry) && (entry.name() == "sram"))
{
//printf("[%s] Found 'sram' data area, enabling cartridge backup RAM\n", tag());
osd_printf_verbose("[%s] Found 'sram' data area, enabling cartridge backup RAM\n", tag());
return "flatrom_sram";
}
}
}
else
{
//printf("[%s] No software part found for image name '%s'\n", tag(), image_name.c_str());
osd_printf_verbose("[%s] No software part found for image name '%s'\n", tag(), image_name);
}
//printf("[%s] Assuming plain ROM cartridge\n", tag());
osd_printf_verbose("[%s] Assuming plain ROM cartridge\n", tag());
return "flatrom";
}

View file

@ -64,6 +64,10 @@
#include "imagedev/cartrom.h"
#include <cassert>
#include <string>
#include <utility>
//**************************************************************************
// FORWARD DECLARATIONS
@ -140,13 +144,13 @@ public:
protected:
device_vboy_cart_interface(machine_config const &mconfig, device_t &device);
bool has_slot() const { return nullptr != m_slot; }
address_space *exp_space() { return m_slot ? m_slot->m_exp_space.target() : nullptr; }
address_space *chip_space() { return m_slot ? m_slot->m_chip_space.target() : nullptr; }
address_space *rom_space() { return m_slot ? m_slot->m_rom_space.target() : nullptr; }
offs_t exp_base() { return m_slot ? m_slot->m_exp_base : 0U; }
offs_t chip_base() { return m_slot ? m_slot->m_chip_base : 0U; }
offs_t rom_base() { return m_slot ? m_slot->m_rom_base : 0U; }
bool has_slot() const noexcept { return nullptr != m_slot; }
address_space *exp_space() noexcept { return m_slot ? m_slot->m_exp_space.target() : nullptr; }
address_space *chip_space() noexcept { return m_slot ? m_slot->m_chip_space.target() : nullptr; }
address_space *rom_space() noexcept { return m_slot ? m_slot->m_rom_space.target() : nullptr; }
offs_t exp_base() noexcept { return m_slot ? m_slot->m_exp_base : 0U; }
offs_t chip_base() noexcept { return m_slot ? m_slot->m_chip_base : 0U; }
offs_t rom_base() noexcept { return m_slot ? m_slot->m_rom_base : 0U; }
void battery_load(void *buffer, int length, int fill) { assert(m_slot); m_slot->battery_load(buffer, length, fill); }
void battery_load(void *buffer, int length, void *def_buffer) { assert(m_slot); m_slot->battery_load(buffer, length, def_buffer); }

View file

@ -189,23 +189,23 @@ DEFINE_DEVICE_TYPE(POKEY, pokey_device, "pokey", "Atari C012294 POKEY")
// pokey_device - constructor
//-------------------------------------------------
pokey_device::pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, POKEY, tag, owner, clock),
device_sound_interface(mconfig, *this),
device_execute_interface(mconfig, *this),
device_state_interface(mconfig, *this),
m_icount(0),
m_stream(nullptr),
m_pot_r_cb(*this),
m_allpot_r_cb(*this),
m_serin_r_cb(*this),
m_serout_w_cb(*this),
m_keyboard_r(*this),
m_irq_f(*this),
m_output_type(LEGACY_LINEAR),
m_serout_ready_timer(nullptr),
m_serout_complete_timer(nullptr),
m_serin_ready_timer(nullptr)
pokey_device::pokey_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, POKEY, tag, owner, clock),
device_sound_interface(mconfig, *this),
device_execute_interface(mconfig, *this),
device_state_interface(mconfig, *this),
m_icount(0),
m_stream(nullptr),
m_pot_r_cb(*this),
m_allpot_r_cb(*this),
m_serin_r_cb(*this),
m_serout_w_cb(*this),
m_keyboard_r(*this),
m_irq_f(*this),
m_output_type(LEGACY_LINEAR),
m_serout_ready_timer(nullptr),
m_serout_complete_timer(nullptr),
m_serin_ready_timer(nullptr)
{
}
@ -217,12 +217,9 @@ void pokey_device::device_start()
{
//int sample_rate = clock();
/* Setup channels */
for (int i=0; i<POKEY_CHANNELS; i++)
{
m_channel[i].m_parent = this;
m_channel[i].m_INTMask = 0;
}
// Set up channels
for (pokey_channel &chan : m_channel)
chan.m_INTMask = 0;
m_channel[CHAN1].m_INTMask = IRQ_TIMR1;
m_channel[CHAN2].m_INTMask = IRQ_TIMR2;
m_channel[CHAN4].m_INTMask = IRQ_TIMR4;
@ -249,7 +246,7 @@ void pokey_device::device_start()
vol_init();
for (int i=0; i<4; i++)
m_channel[i].m_AUDC = 0xB0;
m_channel[i].m_AUDC = 0xb0;
/* The pokey does not have a reset line. These should be initialized
* with random values.
@ -570,7 +567,7 @@ void pokey_device::step_pot()
*
*/
void pokey_device::step_one_clock(void)
void pokey_device::step_one_clock()
{
if (m_SKCTL & SK_RESET)
{
@ -604,33 +601,33 @@ void pokey_device::step_one_clock(void)
if ((m_AUDCTL & CH1_HICLK) && (clock_triggered[CLK_1]))
{
if (m_AUDCTL & CH12_JOINED)
m_channel[CHAN1].inc_chan(7);
m_channel[CHAN1].inc_chan(*this, 7);
else
m_channel[CHAN1].inc_chan(4);
m_channel[CHAN1].inc_chan(*this, 4);
}
int base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28;
if ((!(m_AUDCTL & CH1_HICLK)) && (clock_triggered[base_clock]))
m_channel[CHAN1].inc_chan(1);
m_channel[CHAN1].inc_chan(*this, 1);
if ((m_AUDCTL & CH3_HICLK) && (clock_triggered[CLK_1]))
{
if (m_AUDCTL & CH34_JOINED)
m_channel[CHAN3].inc_chan(7);
m_channel[CHAN3].inc_chan(*this, 7);
else
m_channel[CHAN3].inc_chan(4);
m_channel[CHAN3].inc_chan(*this, 4);
}
if ((!(m_AUDCTL & CH3_HICLK)) && (clock_triggered[base_clock]))
m_channel[CHAN3].inc_chan(1);
m_channel[CHAN3].inc_chan(*this, 1);
if (clock_triggered[base_clock])
{
if (!(m_AUDCTL & CH12_JOINED))
m_channel[CHAN2].inc_chan(1);
m_channel[CHAN2].inc_chan(*this, 1);
if (!(m_AUDCTL & CH34_JOINED))
m_channel[CHAN4].inc_chan(1);
m_channel[CHAN4].inc_chan(*this, 1);
}
/* Potentiometer handling */
@ -645,7 +642,7 @@ void pokey_device::step_one_clock(void)
if (m_channel[CHAN3].check_borrow())
{
if (m_AUDCTL & CH34_JOINED)
m_channel[CHAN4].inc_chan(1);
m_channel[CHAN4].inc_chan(*this, 1);
else
m_channel[CHAN3].reset_channel();
@ -677,7 +674,7 @@ void pokey_device::step_one_clock(void)
m_old_raw_inval = true;
}
if ( (m_SKCTL & SK_TWOTONE) && (m_channel[CHAN2].m_borrow_cnt == 1) )
if ((m_SKCTL & SK_TWOTONE) && (m_channel[CHAN2].m_borrow_cnt == 1))
{
m_channel[CHAN1].reset_channel();
m_old_raw_inval = true;
@ -686,7 +683,7 @@ void pokey_device::step_one_clock(void)
if (m_channel[CHAN1].check_borrow())
{
if (m_AUDCTL & CH12_JOINED)
m_channel[CHAN2].inc_chan(1);
m_channel[CHAN2].inc_chan(*this, 1);
else
m_channel[CHAN1].reset_channel();
@ -710,7 +707,7 @@ void pokey_device::step_one_clock(void)
// check if some of the requested timer interrupts are enabled
if ((m_IRQST & IRQ_TIMR2) && !m_irq_f.isnull())
m_irq_f(IRQ_TIMR2);
m_irq_f(IRQ_TIMR2);
}
if (m_old_raw_inval)
@ -1101,7 +1098,7 @@ inline void pokey_device::process_channel(int ch)
}
void pokey_device::pokey_potgo(void)
void pokey_device::pokey_potgo()
{
if (!(m_SKCTL & SK_RESET))
return;
@ -1281,12 +1278,12 @@ char *pokey_device::audctl2str(int val)
return buff;
}
pokey_device::pokey_channel::pokey_channel()
: m_AUDF(0),
m_AUDC(0),
m_borrow_cnt(0),
m_counter(0),
m_output(0),
m_filter_sample(0)
pokey_device::pokey_channel::pokey_channel() :
m_AUDF(0),
m_AUDC(0),
m_borrow_cnt(0),
m_counter(0),
m_output(0),
m_filter_sample(0)
{
}

View file

@ -206,33 +206,33 @@ private:
{
public:
pokey_channel();
pokey_device *m_parent;
uint8_t m_INTMask;
uint8_t m_AUDF; /* AUDFx (D200, D202, D204, D206) */
uint8_t m_AUDC; /* AUDCx (D201, D203, D205, D207) */
int32_t m_borrow_cnt; /* borrow counter */
int32_t m_counter; /* channel counter */
uint8_t m_output; /* channel output signal (1 active, 0 inactive) */
uint8_t m_filter_sample; /* high-pass filter sample */
uint8_t m_AUDF; // AUDFx (D200, D202, D204, D206)
uint8_t m_AUDC; // AUDCx (D201, D203, D205, D207)
int32_t m_borrow_cnt; // borrow counter
int32_t m_counter; // channel counter
uint8_t m_output; // channel output signal (1 active, 0 inactive)
uint8_t m_filter_sample; // high-pass filter sample
inline void sample(void) { m_filter_sample = m_output; }
inline void reset_channel(void) { m_counter = m_AUDF ^ 0xff; m_borrow_cnt = 0; }
void sample() { m_filter_sample = m_output; }
void reset_channel() { m_counter = m_AUDF ^ 0xff; m_borrow_cnt = 0; }
inline void inc_chan(int cycles)
void inc_chan(pokey_device &host, int cycles)
{
m_counter = (m_counter + 1) & 0xff;
if (m_counter == 0 && m_borrow_cnt == 0)
{
m_borrow_cnt = cycles;
if (m_parent->m_IRQEN & m_INTMask)
if (host.m_IRQEN & m_INTMask)
{
/* Exposed state has changed: This should only be updated after a resync ... */
m_parent->machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_set_irqst), m_parent), m_INTMask);
host.machine().scheduler().synchronize(timer_expired_delegate(FUNC(pokey_device::sync_set_irqst), &host), m_INTMask);
}
}
}
inline int check_borrow()
int check_borrow()
{
if (m_borrow_cnt > 0)
{
@ -254,7 +254,7 @@ private:
void vol_init();
inline void process_channel(int ch);
void pokey_potgo(void);
void pokey_potgo();
char *audc2str(int val);
char *audctl2str(int val);

View file

@ -892,7 +892,7 @@ uint8_t gbc_state::gbc_io2_r(offs_t offset)
Map megaduck video related area on to regular Game Boy video area
Different locations of the video registers:
Register Game Boy MegaDuck
Register Game Boy Mega Duck
LCDC FF40 FF10 (See different bit order below)
STAT FF41 FF11
SCY FF42 FF12
@ -912,7 +912,7 @@ uint8_t gbc_state::gbc_io2_r(offs_t offset)
Different LCDC register
Game Boy MegaDuck
Game Boy Mega Duck
0 6 - BG & Window Display : 0 - Off, 1 - On
1 0 - OBJ Display: 0 - Off, 1 - On
2 1 - OBJ Size: 0 - 8x8, 1 - 8x16

View file

@ -36,6 +36,7 @@ public:
, m_videoram(*this, "videoram")
, m_sprite_position(*this, "spritepos")
, m_samples(*this, "samples")
, m_discrete(*this, "discrete")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
, m_digits(*this, "digit%u", 0U)
@ -57,6 +58,7 @@ protected:
required_shared_ptr<uint8_t> m_sprite_position;
required_device<samples_device> m_samples;
optional_device<discrete_device> m_discrete;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;

View file

@ -41,22 +41,21 @@ void turbo_state::update_samples()
TIMER_CALLBACK_MEMBER(turbo_state::update_sound_a)
{
discrete_device *discrete = machine.device<discrete_device>("discrete");
int data = param;
// missing short crash sample, but I've never seen it triggered
discrete->write(0, !(data & 0x01));
discrete->write(1, (data >> 1) & 1);
discrete->write(2, (data >> 2) & 1);
discrete->write(3, (data >> 3) & 1);
discrete->write(4, (data >> 4) & 1);
discrete->write(5, !(data & 0x20));
discrete->write(6, !(data & 0x40));
m_discrete->write(0, BIT(~data, 0));
m_discrete->write(1, BIT( data, 1));
m_discrete->write(2, BIT( data, 2));
m_discrete->write(3, BIT( data, 3));
m_discrete->write(4, BIT( data, 4));
m_discrete->write(5, BIT(~data, 5));
m_discrete->write(6, BIT(~data, 6));
if (!((data >> 1) & 1)) osd_printf_debug("/TRIG1\n");
if (!((data >> 2) & 1)) osd_printf_debug("/TRIG2\n");
if (!((data >> 3) & 1)) osd_printf_debug("/TRIG3\n");
if (!((data >> 4) & 1)) osd_printf_debug("/TRIG4\n");
if (!BIT(data, 1)) osd_printf_debug("/TRIG1\n");
if (!BIT(data, 2)) osd_printf_debug("/TRIG2\n");
if (!BIT(data, 3)) osd_printf_debug("/TRIG3\n");
if (!BIT(data, 4)) osd_printf_debug("/TRIG4\n");
// osel = (osel & 6) | ((data >> 5) & 1);
// update_samples(samples);