This commit is contained in:
Scott Stone 2016-02-12 10:56:23 -05:00
commit b946788c2b
17 changed files with 677 additions and 393 deletions

View File

@ -4021,6 +4021,8 @@ files {
createMAMEProjects(_target, _subtarget, "zaccaria")
files {
MAME_DIR .. "src/mame/audio/zaccaria.cpp",
MAME_DIR .. "src/mame/audio/zaccaria.h",
MAME_DIR .. "src/mame/drivers/laserbat.cpp",
MAME_DIR .. "src/mame/includes/laserbat.h",
MAME_DIR .. "src/mame/video/laserbat.cpp",

View File

@ -41,8 +41,9 @@ NETLIST_START(bjt_models)
NET_MODEL("2N5190 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)")
NET_MODEL("2SC945 NPN(IS=3.577E-14 BF=2.382E+02 NF=1.01 VAF=1.206E+02 IKF=3.332E-01 ISE=3.038E-16 NE=1.205 BR=1.289E+01 NR=1.015 VAR=1.533E+01 IKR=2.037E-01 ISC=3.972E-14 NC=1.115 RB=3.680E+01 IRB=1.004E-04 RBM=1 RE=8.338E-01 RC=1.557E+00 CJE=1.877E-11 VJE=7.211E-01 MJE=3.486E-01 TF=4.149E-10 XTF=1.000E+02 VTF=9.956 ITF=5.118E-01 PTF=0 CJC=6.876p VJC=3.645E-01 MJC=3.074E-01 TR=5.145E-08 XTB=1.5 EG=1.11 XTI=3 FC=0.5 Vceo=50 Icrating=100m MFG=NEC)")
NET_MODEL("BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45V ICRATING=100M MFG=ZETEX)")
NET_MODEL("BC237B NPN(IS=1.8E-14 ISE=5.0E-14 ISC=1.72E-13 XTI=3 BF=400 BR=35.5 IKF=0.14 IKR=0.03 XTB=1.5 VAF=80 VAR=12.5 VJE=0.58 VJC=0.54 RE=0.6 RC=0.25 RB=0.56 CJE=13E-12 CJC=4E-12 XCJC=0.75 FC=0.5 NF=0.9955 NR=1.005 NE=1.46 NC=1.27 MJE=0.33 MJC=0.33 TF=0.64E-9 TR=50.72E-9 EG=1.11 KF=0 AF=1 VCEO=45 ICRATING=100M MFG=ZETEX)")
NET_MODEL("BC556B PNP(IS=3.83E-14 NF=1.008 ISE=1.22E-14 NE=1.528 BF=344.4 IKF=0.08039 VAF=21.11 NR=1.005 ISC=2.85E-13 NC=1.28 BR=14.84 IKR=0.047 VAR=32.02 RB=1 IRB=1.00E-06 RBM=1 RE=0.6202 RC=0.5713 XTB=0 EG=1.11 XTI=3 CJE=1.23E-11 VJE=0.6106 MJE=0.378 TF=5.60E-10 XTF=3.414 VTF=5.23 ITF=0.1483 PTF=0 CJC=1.08E-11 VJC=0.1022 MJC=0.3563 XCJC=0.6288 TR=1.00E-32 CJS=0 VJS=0.75 MJS=0.333 FC=0.8027 Vceo=65 Icrating=100m mfg=Philips)")
NET_MODEL("BC548C NPN(IS=1.95E-14 ISE=1.31E-15 ISC=1.0E-13 XTI=3 BF=466 BR=2.42 IKF=0.18 IKR=1 XTB=1.5 VAF=91.7 VAR=24.7 VJE=0.632 VJC=0.339 RE=1 RC=1.73 RB=26.5 RBM=10 IRB=10 CJE=1.33E-11 CJC=5.17E-12 XCJC=1 FC=0.9 NF=0.993 NR=1.2 NE=1.32 NC=2.00 MJE=0.326 MJC=0.319 TF=6.52E-10 TR=0 PTF=0 ITF=1.03 VTF=1.65 XTF=100 EG=1.11 KF=1E-9 AF=1 VCEO=40 ICrating=800M MFG=Siemens)")
NET_MODEL("BC817-25 NPN(IS=9.198E-14 NF=1.003 ISE=4.468E-16 NE=1.65 BF=338.8 IKF=0.4913 VAF=107.9 NR=1.002 ISC=5.109E-15 NC=1.071 BR=29.48 IKR=0.193 VAR=25 RB=1 IRB=1000 RBM=1 RE=0.2126 RC=0.143 XTB=0 EG=1.11 XTI=3 CJE=3.825E-11 VJE=0.7004 MJE=0.364 TF=5.229E-10 XTF=219.7 VTF=3.502 ITF=7.257 PTF=0 CJC=1.27E-11 VJC=0.4431 MJC=0.3983 XCJC=0.4555 TR=7E-11 CJS=0 VJS=0.75 MJS=0.333 FC=0.905 Vceo=45 Icrating=500m mfg=Philips)")
NETLIST_END()

View File

@ -2107,6 +2107,7 @@ sboblbobl // bootleg
sboblbobla // bootleg
sboblboblb // bootleg
sboblboblc // bootleg
sboblbobld // bootleg
bublboblb // bootleg
bub68705 // bootleg
dland // bootleg

View File

@ -355,16 +355,6 @@ WRITE8_MEMBER(catnmous_state::pia_portb_w)
m_psg2->data_address_w(space, (data >> 2) & 0x01, m_pia->a_output());
}
WRITE_LINE_MEMBER(catnmous_state::pia_irqa)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
}
WRITE_LINE_MEMBER(catnmous_state::pia_irqb)
{
m_audiocpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE);
}
WRITE8_MEMBER(catnmous_state::psg1_porta_w)
{
// similar to zaccaria.c since we have no clue how this board really works

294
src/mame/audio/zaccaria.cpp Normal file
View File

@ -0,0 +1,294 @@
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
#include "emu.h"
#include "audio/zaccaria.h"
#include "cpu/m6800/m6800.h"
#include "machine/clock.h"
#include "sound/dac.h"
device_type const ZACCARIA_1B11142 = &device_creator<zac1b11142_audio_device>;
/*
* slave sound cpu, produces music and sound effects
* mapping:
* A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
* 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram
* 0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap ram)
* 0 0 1 x x x x x x x x x x x x x Open bus
* 0 1 0 x x x x x x x x x 0 0 x x Open bus
* 0 1 0 x x x x x x x x x 0 1 x x Open bus
* 0 1 0 x x x x x x x x x 1 0 x x Open bus
* 0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I
* 0 1 1 x x x x x x x x x x x x x Open bus
* 1 0 % % * * * * * * * * * * * * R /CS4A: Enable ROM 13
* 1 1 % % * * * * * * * * * * * * R /CS5A: Enable ROM 9
* note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms
* monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care
* hence for actual chips used, the mem map is:
* 1 0 x * * * * * * * * * * * * * R /CS4A: Enable ROM 13
* 1 1 x * * * * * * * * * * * * * R /CS5A: Enable ROM 9
*
* 6821 PIA:
* CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1)
* CB1 comes from the 6802's clock divided by 4096*2 (about 437Hz)
* CA2 and CB2 are not connected
* PA0-7 connect to the data busses of the AY-3-8910 chips
* PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G
* PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H.
*/
static ADDRESS_MAP_START(zac1b11142_melody_map, AS_PROGRAM, 8, zac1b11142_audio_device)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM
AM_RANGE(0x400c, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("pia_4i", pia6821_device, read, write)
AM_RANGE(0x8000, 0x9fff) AM_MIRROR(0x2000) AM_ROM // rom 13
AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x2000) AM_ROM // rom 9
ADDRESS_MAP_END
/*
* master sound cpu, controls speech directly
* mapping:
* A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
* 0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram
* x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here)
* x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I
* x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC
* x x 0 1 0 1 x x x x x x x x x x W Command to slave melody cpu
* x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80
* x x 0 1 1 1 x x x x x x x x x x Open bus
* % % 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8
* % % 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7
* note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms
* monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care
* hence for actual chips used, the mem map is:
* x * 1 0 * * * * * * * * * * * * R /CS1A: Enable ROM 8
* x * 1 1 * * * * * * * * * * * * R /CS0A: Enable ROM 7
*
* 6821 PIA:
* PA0-7, PB0-1, CA2 and CB1 connect to the TMS5200
* CA1 and CB2 are not connected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4)
* PB3 connects to 'ACS' which goes to the Z80
*/
static ADDRESS_MAP_START(zac1b11142_audio_map, AS_PROGRAM, 8, zac1b11142_audio_device)
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x007f) AM_RAM // 6802 internal RAM
AM_RANGE(0x0090, 0x0093) AM_MIRROR(0x8f6c) AM_DEVREADWRITE("pia_1i", pia6821_device, read, write)
AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x83ff) AM_DEVWRITE("dac_1f", dac_device, write_unsigned8) // MC1408
AM_RANGE(0x1400, 0x1400) AM_MIRROR(0xc3ff) AM_WRITE(melody_command_w)
AM_RANGE(0x1800, 0x1800) AM_MIRROR(0xc3ff) AM_READ(host_command_r)
AM_RANGE(0x2000, 0x2fff) AM_MIRROR(0x8000) AM_ROM // ROM 8 with A12 low
AM_RANGE(0x3000, 0x3fff) AM_MIRROR(0x8000) AM_ROM // ROM 7 with A12 low
AM_RANGE(0x6000, 0x6fff) AM_MIRROR(0x8000) AM_ROM // ROM 8 with A12 high
AM_RANGE(0x7000, 0x7fff) AM_MIRROR(0x8000) AM_ROM // ROM 7 with A12 high
ADDRESS_MAP_END
MACHINE_CONFIG_FRAGMENT(zac1b11142_config)
MCFG_CPU_ADD("melodycpu", M6802, XTAL_3_579545MHz) // verified on pcb
MCFG_CPU_PROGRAM_MAP(zac1b11142_melody_map)
MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) // CPU clock divided using 4040 and half of 74LS74
MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia_4i", pia6821_device, cb1_w))
MCFG_DEVICE_ADD("pia_4i", PIA6821, 0)
MCFG_PIA_READPA_HANDLER(READ8(zac1b11142_audio_device, pia_4i_porta_r))
MCFG_PIA_WRITEPA_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_porta_w))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_4i_portb_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, nmi_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("melodycpu", m6802_cpu_device, irq_line))
MCFG_SOUND_ADD("ay_4g", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4g_porta_w))
MCFG_AY8910_PORT_B_READ_CB(READ8(zac1b11142_audio_device, ay_4g_portb_r))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15)
MCFG_SOUND_ADD("ay_4h", AY8910, XTAL_3_579545MHz/2) // CPU clock divided using 4040
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_porta_w))
MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(zac1b11142_audio_device, ay_4h_portb_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.15)
MCFG_CPU_ADD("audiocpu", M6802, XTAL_3_579545MHz) // verified on pcb
MCFG_CPU_PROGRAM_MAP(zac1b11142_audio_map)
MCFG_CPU_PERIODIC_INT_DRIVER(zac1b11142_audio_device, input_poll, 60)
MCFG_DEVICE_ADD("pia_1i", PIA6821, 0)
MCFG_PIA_READPA_HANDLER(DEVREAD8("speech", tms5220_device, status_r))
MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8("speech", tms5220_device, data_w))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(zac1b11142_audio_device, pia_1i_portb_w))
MCFG_DAC_ADD("dac_1f")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80)
// There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF)
// 162kHz measured on pin 3 20 minutes after power on, clock would then be 162.3*4=649.2kHz
MCFG_SOUND_ADD("speech", TMS5200, 649200) // ROMCLK pin measured at 162.3Khz, OSC is exactly *4 of that)
MCFG_TMS52XX_IRQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, cb1_w))
MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE("pia_1i", pia6821_device, ca2_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.80)
MACHINE_CONFIG_END
INPUT_PORTS_START(zac1b11142_ioports)
PORT_START("1B11142")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("P1")
INPUT_PORTS_END
zac1b11142_audio_device::zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, ZACCARIA_1B11142, "Zaccaria 1B11142 Sound Board", tag, owner, clock, "zac1b11142", __FILE__)
, device_mixer_interface(mconfig, *this, 1)
, m_acs_cb(*this)
, m_melodycpu(*this, "melodycpu")
, m_pia_4i(*this, "pia_4i")
, m_ay_4g(*this, "ay_4g")
, m_ay_4h(*this, "ay_4h")
, m_audiocpu(*this, "audiocpu")
, m_pia_1i(*this, "pia_1i")
, m_speech(*this, "speech")
, m_inputs(*this, "1B11142")
, m_host_command(0)
, m_melody_command(0)
{
}
WRITE8_MEMBER(zac1b11142_audio_device::hs_w)
{
m_host_command = data;
m_audiocpu->set_input_line(INPUT_LINE_IRQ0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
}
READ_LINE_MEMBER(zac1b11142_audio_device::acs_r)
{
return (~m_pia_1i->b_output() >> 3) & 0x01;
}
WRITE_LINE_MEMBER(zac1b11142_audio_device::ressound_w)
{
// TODO: there is a pulse-stretching network attached that should be simulated
m_melodycpu->set_input_line(INPUT_LINE_RESET, state);
// TODO: holds the reset line of m_pia_4i - can't implement this in MAME at this time
// TODO: holds the reset line of m_ay_4g - can't implement this in MAME at this time
// TODO: holds the reset line of m_ay_4h - can't implement this in MAME at this time
m_audiocpu->set_input_line(INPUT_LINE_RESET, state);
// TODO: holds the reset line of m_pia_1i - can't implement this in MAME at this time
// TODO: does some funky stuff with the VDD and VSS lines on the speech chip
}
READ8_MEMBER(zac1b11142_audio_device::pia_4i_porta_r)
{
UINT8 const control = m_pia_4i->b_output();
UINT8 data = 0xff;
if (0x01 == (control & 0x03))
data &= m_ay_4g->data_r(space, 0);
if (0x04 == (control & 0x0c))
data &= m_ay_4h->data_r(space, 0);
return data;
}
WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_porta_w)
{
UINT8 const control = m_pia_4i->b_output();
if (control & 0x02)
m_ay_4g->data_address_w(space, (control >> 0) & 0x01, data);
if (control & 0x08)
m_ay_4h->data_address_w(space, (control >> 2) & 0x01, data);
}
WRITE8_MEMBER(zac1b11142_audio_device::pia_4i_portb_w)
{
if (data & 0x02)
m_ay_4g->data_address_w(space, (data >> 0) & 0x01, m_pia_4i->a_output());
if (data & 0x08)
m_ay_4h->data_address_w(space, (data >> 2) & 0x01, m_pia_4i->a_output());
}
WRITE8_MEMBER(zac1b11142_audio_device::ay_4g_porta_w)
{
// TODO: (data & 0x07) controls tromba mix volume
// TODO: (data & 0x08) controls cassa gate
// TODO: (data & 0x10) controls rullante gate
}
READ8_MEMBER(zac1b11142_audio_device::ay_4g_portb_r)
{
return m_melody_command;
}
WRITE8_MEMBER(zac1b11142_audio_device::ay_4h_porta_w)
{
// TODO: data & 0x01 controls LEVEL
// TODO: data & 0x02 controls LEVELT
}
WRITE8_MEMBER(zac1b11142_audio_device::ay_4h_portb_w)
{
// TODO: data & 0x01 controls ANAL3 filter
}
READ8_MEMBER(zac1b11142_audio_device::host_command_r)
{
return m_host_command;
}
WRITE8_MEMBER(zac1b11142_audio_device::melody_command_w)
{
m_melody_command = data;
m_pia_4i->ca1_w((data >> 7) & 0x01);
}
WRITE8_MEMBER(zac1b11142_audio_device::pia_1i_portb_w)
{
m_speech->rsq_w((data >> 0) & 0x01);
m_speech->wsq_w((data >> 1) & 0x01);
m_acs_cb((~data >> 3) & 0x01);
// TODO: a LED output().set_led_value(0, (data >> 4) & 0x01);
}
INTERRUPT_GEN_MEMBER(zac1b11142_audio_device::input_poll)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, (m_inputs->read() & 0x80) ? CLEAR_LINE : ASSERT_LINE);
}
machine_config_constructor zac1b11142_audio_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(zac1b11142_config);
}
ioport_constructor zac1b11142_audio_device::device_input_ports() const
{
return INPUT_PORTS_NAME(zac1b11142_ioports);
}
void zac1b11142_audio_device::device_config_complete()
{
}
void zac1b11142_audio_device::device_start()
{
m_acs_cb.resolve_safe();
save_item(NAME(m_host_command));
save_item(NAME(m_melody_command));
}
void zac1b11142_audio_device::device_reset()
{
m_host_command = 0;
m_melody_command = 0;
}

80
src/mame/audio/zaccaria.h Normal file
View File

@ -0,0 +1,80 @@
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
#pragma once
#ifndef __AUDIO_ZACCARIA_H__
#define __AUDIO_ZACCARIA_H__
#include "emu.h"
#include "machine/6821pia.h"
#include "machine/netlist.h"
#include "sound/ay8910.h"
#include "sound/tms5220.h"
extern device_type const ZACCARIA_1B11142;
#define MCFG_ZACCARIA_1B11142(_tag) \
MCFG_DEVICE_ADD(_tag, ZACCARIA_1B11142, 0)
#define MCFG_ZACCARIA_1B11142_SET_ACS_CALLBACK(_devcb) \
devcb = &zac1b11142_audio_device::static_set_acs_cb(*device, DEVCB_##_devcb);
class zac1b11142_audio_device : public device_t, public device_mixer_interface
{
public:
template<class _Object> static devcb_base &static_set_acs_cb(device_t &device, _Object object)
{ return downcast<zac1b11142_audio_device &>(device).m_acs_cb.set_callback(object); }
zac1b11142_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock);
~zac1b11142_audio_device() { }
// host interface
DECLARE_WRITE8_MEMBER(hs_w);
DECLARE_READ_LINE_MEMBER(acs_r);
DECLARE_WRITE_LINE_MEMBER(ressound_w);
// melody section handlers
DECLARE_READ8_MEMBER(pia_4i_porta_r);
DECLARE_WRITE8_MEMBER(pia_4i_porta_w);
DECLARE_WRITE8_MEMBER(pia_4i_portb_w);
DECLARE_WRITE8_MEMBER(ay_4g_porta_w);
DECLARE_READ8_MEMBER(ay_4g_portb_r);
DECLARE_WRITE8_MEMBER(ay_4h_porta_w);
DECLARE_WRITE8_MEMBER(ay_4h_portb_w);
// master audio section handlers
DECLARE_READ8_MEMBER(host_command_r);
DECLARE_WRITE8_MEMBER(melody_command_w);
DECLARE_WRITE8_MEMBER(pia_1i_portb_w);
// input ports don't push
INTERRUPT_GEN_MEMBER(input_poll);
protected:
virtual machine_config_constructor device_mconfig_additions() const override;
virtual ioport_constructor device_input_ports() const override;
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
devcb_write_line m_acs_cb;
required_device<cpu_device> m_melodycpu;
required_device<pia6821_device> m_pia_4i;
required_device<ay8910_device> m_ay_4g;
required_device<ay8910_device> m_ay_4h;
required_device<cpu_device> m_audiocpu;
required_device<pia6821_device> m_pia_1i;
required_device<tms5220_device> m_speech;
required_ioport m_inputs;
UINT8 m_host_command;
UINT8 m_melody_command;
};
#endif // __AUDIO_ZACCARIA_H__

View File

@ -1550,6 +1550,42 @@ ROM_START( sboblboblc )
ROM_END
ROM_START( sboblbobld )
ROM_REGION( 0x30000, "maincpu", 0 )
ROM_LOAD( "3.bin", 0x00000, 0x08000, CRC(524cdc4f) SHA1(f778e53f664e911a5b992a4f85bcad1097eaa36f) )
/* ROMs banked at 8000-bfff */
ROM_LOAD( "5.bin", 0x10000, 0x08000, CRC(13118eb1) SHA1(5a5da40c2cc82420f70bc58ffa32de1088c6c82f) )
ROM_LOAD( "4.bin", 0x18000, 0x08000, CRC(13fe9baa) SHA1(ca1ca240d755621e533d9bbbdd8d953154670499) )
/* 20000-2ffff empty */
ROM_REGION( 0x10000, "slave", 0 ) /* 64k for the second CPU */
ROM_LOAD( "1.bin", 0x0000, 0x08000, CRC(ae11a07b) SHA1(af7a335c8da637103103cc274e077f123908ebb7) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the third CPU */
ROM_LOAD( "2.bin", 0x0000, 0x08000, CRC(4f9a26e8) SHA1(3105b34b88a7134493c2b3f584729f8b0407a011) )
ROM_REGION( 0x80000, "gfx1", ROMREGION_INVERT )
ROM_LOAD( "12", 0x00000, 0x8000, CRC(20358c22) SHA1(2297af6c53d5807bf90a8e081075b8c72a994fc5) ) /* 1st plane */
ROM_LOAD( "13", 0x08000, 0x8000, CRC(930168a9) SHA1(fd358c3c3b424bca285f67a1589eb98a345ff670) )
ROM_LOAD( "14", 0x10000, 0x8000, CRC(9773e512) SHA1(33c1687ee575d66bf0e98add45d06da827813765) )
ROM_LOAD( "15", 0x18000, 0x8000, CRC(d045549b) SHA1(0c12077d3ddc2ce6aa45a0224ad5540f3f218446) )
ROM_LOAD( "16", 0x20000, 0x8000, CRC(d0af35c5) SHA1(c5a89f4d73acc0db86654540b3abfd77b3757db5) )
ROM_LOAD( "17", 0x28000, 0x8000, CRC(7b5369a8) SHA1(1307b26d80e6f36ebe6c442bebec41d20066eaf9) )
/* 0x30000-0x3ffff empty */
ROM_LOAD( "6", 0x40000, 0x8000, CRC(6b61a413) SHA1(44eddf12fb46fceca2addbe6da929aaea7636b13) ) /* 2nd plane */
ROM_LOAD( "7", 0x48000, 0x8000, CRC(b5492d97) SHA1(d5b045e3ebaa44809757a4220cefb3c6815470da) )
ROM_LOAD( "8", 0x50000, 0x8000, CRC(d69762d5) SHA1(3326fef4e0bd86681a3047dc11886bb171ecb609) )
ROM_LOAD( "9", 0x58000, 0x8000, CRC(9f243b68) SHA1(32dce8d311a4be003693182a999e4053baa6bb0a) )
ROM_LOAD( "10", 0x60000, 0x8000, CRC(66e9438c) SHA1(b94e62b6fbe7f4e08086d0365afc5cff6e0ccafd) )
ROM_LOAD( "11", 0x68000, 0x8000, CRC(9ef863ad) SHA1(29f91b5a3765e4d6e6c3382db1d8d8297b6e56c8) )
/* 0x70000-0x7ffff empty */
ROM_REGION( 0x0100, "proms", 0 )
ROM_LOAD( "a71-25.41", 0x0000, 0x0100, CRC(2d0f8545) SHA1(089c31e2f614145ef2743164f7b52ae35bc06808) ) /* video timing */
ROM_END
ROM_START( bub68705 )
ROM_REGION( 0x30000, "maincpu", 0 ) /* Program roms match Bubble Bobble (older) */
ROM_LOAD( "2.bin", 0x00000, 0x08000, CRC(32c8305b) SHA1(6bf69b3edfbefd33cd670a762b4bf0b39629a220) )
@ -1861,6 +1897,7 @@ GAME( 1986, boblbobl, bublbobl, boblbobl, boblbobl, bublbobl_state, bublbobl
GAME( 1986, sboblbobl, bublbobl, boblbobl, sboblbobl, bublbobl_state, bublbobl, ROT0, "bootleg (Datsu)", "Super Bobble Bobble (bootleg, set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, sboblbobla, bublbobl, boblbobl, boblbobl, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, sboblboblb, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 3)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, sboblbobld, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bobble Bobble (bootleg, set 4)", MACHINE_SUPPORTS_SAVE )
GAME( 1986, sboblboblc, bublbobl, boblbobl, sboblboblb, bublbobl_state, bublbobl, ROT0, "bootleg", "Super Bubble Bobble (bootleg)", MACHINE_SUPPORTS_SAVE ) // the title screen on this one isn't hacked
GAME( 1986, bub68705, bublbobl, bub68705, bublbobl, bublbobl_state, bublbobl, ROT0, "bootleg", "Bubble Bobble (bootleg with 68705)", MACHINE_SUPPORTS_SAVE )

View File

@ -1046,9 +1046,6 @@ ROM_START( snowboara )
ROM_LOAD( "sb44", 0x0000000, 0x0400000, CRC(1bbe88bc) SHA1(15bce9ada2b742ba4d537fa8efc0f29f661bff00) ) /* GFX only */
ROM_LOAD( "sb45", 0x0400000, 0x0400000, CRC(373983d9) SHA1(05e35a8b27cab469885f0ec2a5df200a366b50a1) ) /* Sound only */
ROM_LOAD( "sb46", 0x0800000, 0x0400000, CRC(22e7c648) SHA1(baddb9bc13accd83bea61533d7286cf61cd89279) ) /* GFX only */
DISK_REGION( "decrypt" )
DISK_IMAGE( "snowboar", 0, SHA1(fecf611bd9289d24a0b1cabaaf030e2cee322cfa) )
ROM_END
ROM_START( snowboar )
@ -1086,9 +1083,6 @@ ROM_START( snowboar )
ROM_LOAD( "sb.e2", 0x1100000, 0x0080000, CRC(f5948c6c) SHA1(91bba817ced194b02885ce84b7a8132ef5ca631a) ) /* GFX only */
ROM_LOAD( "sb.e3", 0x1180000, 0x0080000, CRC(4baa678f) SHA1(a7fbbd687e2d8d7e96207c8ace0799a3cc9c3272) ) /* GFX only */
ROM_FILL( 0x1200000, 0x0200000, 0x00 ) /* Empty */
DISK_REGION( "decrypt" )
DISK_IMAGE( "snowboar", 0, SHA1(fecf611bd9289d24a0b1cabaaf030e2cee322cfa) )
ROM_END

View File

@ -555,8 +555,8 @@ static MACHINE_CONFIG_DERIVED_CLASS( catnmous, laserbat_base, catnmous_state )
MCFG_PIA_READPA_HANDLER(READ8(catnmous_state, pia_porta_r))
MCFG_PIA_WRITEPA_HANDLER(WRITE8(catnmous_state, pia_porta_w))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(catnmous_state, pia_portb_w))
MCFG_PIA_IRQA_HANDLER(WRITELINE(catnmous_state, pia_irqa))
MCFG_PIA_IRQB_HANDLER(WRITELINE(catnmous_state, pia_irqb))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, nmi_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, irq_line))
MCFG_SPEAKER_STANDARD_MONO("mono")

View File

@ -41,29 +41,19 @@ Notes:
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/m6800/m6800.h"
#include "machine/i8255.h"
#include "sound/dac.h"
#include "includes/zaccaria.h"
void zaccaria_state::machine_start()
{
save_item(NAME(m_dsw_sel));
save_item(NAME(m_active_8910));
save_item(NAME(m_port0a));
save_item(NAME(m_acs));
save_item(NAME(m_last_port0b));
save_item(NAME(m_nmi_mask));
}
void zaccaria_state::machine_reset()
{
m_dsw_sel = 0;
m_active_8910 = 0;
m_port0a = 0;
m_acs = 0;
m_last_port0b = 0;
m_nmi_mask = 0;
}
@ -71,21 +61,21 @@ WRITE8_MEMBER(zaccaria_state::dsw_sel_w)
{
switch (data & 0xf0)
{
case 0xe0:
m_dsw_sel = 0;
break;
case 0xe0:
m_dsw_sel = 0;
break;
case 0xd0:
m_dsw_sel = 1;
break;
case 0xd0:
m_dsw_sel = 1;
break;
case 0xb0:
m_dsw_sel = 2;
break;
case 0xb0:
m_dsw_sel = 2;
break;
default:
logerror("%s: portsel = %02x\n", machine().describe_context(), data);
break;
default:
logerror("%s: portsel = %02x\n", machine().describe_context(), data);
break;
}
}
@ -95,94 +85,6 @@ READ8_MEMBER(zaccaria_state::dsw_r)
}
WRITE8_MEMBER(zaccaria_state::ay8910_port0a_w)
{
/* bits 0-2 go to a 74LS156 with open collector outputs
* one out of 8 Resitors is than used to form a resistor
* divider with Analog input 5 (tromba)
*/
// bits 3-4 control the analog drum emulation on 8910 #0 ch. A
static const int table[8] = { 8200, 5600, 3300, 1500, 820, 390, 150, 47 };
int b0, b1, b2, ba, v;
b0 = data & 0x01;
b1 = (data & 0x02) >> 1;
b2 = (data & 0x04) >> 2;
ba = (b0<<2) | (b1<<1) | b2;
/* 150 below to scale to volume 100 */
v = (150 * table[ba]) / (4700 + table[ba]);
//printf("dac1w %02d %04d\n", ba, v);
m_ay2->set_volume(1, v);
}
READ8_MEMBER(zaccaria_state::port0a_r)
{
return (m_active_8910 == 0) ? m_ay1->data_r(space, 0) : m_ay2->data_r(space, 0);
}
WRITE8_MEMBER(zaccaria_state::port0a_w)
{
m_port0a = data;
}
WRITE8_MEMBER(zaccaria_state::port0b_w)
{
/* bit 1 goes to 8910 #0 BDIR pin */
if ((m_last_port0b & 0x02) == 0x02 && (data & 0x02) == 0x00)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
m_ay1->data_address_w(space, m_last_port0b, m_port0a);
}
else if ((m_last_port0b & 0x02) == 0x00 && (data & 0x02) == 0x02)
{
/* bit 0 goes to the 8910 #0 BC1 pin */
if (m_last_port0b & 0x01)
m_active_8910 = 0;
}
/* bit 3 goes to 8910 #1 BDIR pin */
if ((m_last_port0b & 0x08) == 0x08 && (data & 0x08) == 0x00)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
m_ay2->data_address_w(space, m_last_port0b >> 2, m_port0a);
}
else if ((m_last_port0b & 0x08) == 0x00 && (data & 0x08) == 0x08)
{
/* bit 2 goes to the 8910 #1 BC1 pin */
if (m_last_port0b & 0x04)
m_active_8910 = 1;
}
m_last_port0b = data;
}
WRITE8_MEMBER(zaccaria_state::port1b_w)
{
// bit 0 = /RS
m_tms->rsq_w((data >> 0) & 0x01);
// bit 1 = /WS
m_tms->wsq_w((data >> 1) & 0x01);
// bit 3 = "ACS" (goes, inverted, to input port 6 bit 3)
m_acs = ~data & 0x08;
// bit 4 = led (for testing?)
output().set_led_value(0,~data & 0x10);
}
WRITE8_MEMBER(zaccaria_state::sound_command_w)
{
soundlatch_byte_w(space, 0, data);
m_audio2->set_input_line(0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
}
WRITE8_MEMBER(zaccaria_state::sound1_command_w)
{
m_pia0->ca1_w(data & 0x80);
soundlatch2_byte_w(space, 0, data);
}
GAME_EXTERN(monymony);
READ8_MEMBER(zaccaria_state::prot1_r)
@ -245,83 +147,23 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, zaccaria_state )
AM_RANGE(0x6800, 0x683f) AM_WRITE(attributes_w) AM_SHARE("attributesram")
AM_RANGE(0x6840, 0x685f) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x6881, 0x68c0) AM_RAM AM_SHARE("spriteram2")
AM_RANGE(0x6c00, 0x6c00) AM_WRITE(flip_screen_x_w)
AM_RANGE(0x6c01, 0x6c01) AM_WRITE(flip_screen_y_w)
AM_RANGE(0x6c02, 0x6c02) AM_WRITENOP /* sound reset */
AM_RANGE(0x6c06, 0x6c06) AM_WRITE(coin_w)
AM_RANGE(0x6c07, 0x6c07) AM_WRITE(nmi_mask_w)
AM_RANGE(0x6c00, 0x6c07) AM_READ(prot2_r)
AM_RANGE(0x6e00, 0x6e00) AM_READWRITE(dsw_r, sound_command_w)
AM_RANGE(0x6c00, 0x6c00) AM_MIRROR(0x81f8) AM_WRITE(flip_screen_x_w)
AM_RANGE(0x6c01, 0x6c01) AM_MIRROR(0x81f8) AM_WRITE(flip_screen_y_w)
AM_RANGE(0x6c02, 0x6c02) AM_MIRROR(0x81f8) AM_WRITE(ressound_w)
AM_RANGE(0x6c06, 0x6c06) AM_MIRROR(0x81f8) AM_WRITE(coin_w)
AM_RANGE(0x6c07, 0x6c07) AM_MIRROR(0x81f8) AM_WRITE(nmi_mask_w)
AM_RANGE(0x6c00, 0x6c07) AM_MIRROR(0x81f8) AM_READ(prot2_r)
AM_RANGE(0x6e00, 0x6e00) AM_MIRROR(0x81f8) AM_READ(dsw_r) AM_DEVWRITE("audiopcb", zac1b11142_audio_device, hs_w)
AM_RANGE(0x7000, 0x77ff) AM_RAM
AM_RANGE(0x7800, 0x7803) AM_DEVREADWRITE("ppi8255", i8255_device, read, write)
AM_RANGE(0x7c00, 0x7c00) AM_READ(watchdog_reset_r)
AM_RANGE(0x8000, 0xdfff) AM_ROM
ADDRESS_MAP_END
/* slave sound cpu, produces music and sound effects */
/* mapping:
A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram
0 0 0 x x x x x x x x x x x x x Open bus (for area that doesn't overlap ram)
0 0 1 x x x x x x x x x x x x x Open bus
0 1 0 x x x x x x x x x 0 0 x x Open bus
0 1 0 x x x x x x x x x 0 1 x x Open bus
0 1 0 x x x x x x x x x 1 0 x x Open bus
0 1 0 x x x x x x x x x 1 1 * * RW 6821 PIA @ 4I
0 1 1 x x x x x x x x x x x x x Open bus
1 0 % % * * * * * * * * * * * * R /CS4A: Enable Rom 13
1 1 % % * * * * * * * * * * * * R /CS5A: Enable Rom 9
note that the % bits go to pins 2 (6802 A12) and 26 (6802 A13) of the roms
monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care
hence for actual chips used, the mem map is:
1 0 x * * * * * * * * * * * * * R /CS4A: Enable Rom 13
1 1 x * * * * * * * * * * * * * R /CS5A: Enable Rom 9
6821 PIA: CA1 comes from the master sound cpu's latch bit 7 (which is also connected to the AY chip at 4G's IOB1); CB1 comes from a periodic counter clocked by the 6802's clock, divided by 4096. CA2 and CB2 are disconnected. PA0-7 connect to the data busses of the AY-3-8910 chips; PB0 and PB1 connect to the BC1 and BDIR pins of the AY chip at 4G; PB2 and PB3 connect to the BC1 and BDIR pins of the AY chip at 4H.
*/
static ADDRESS_MAP_START( sound_map_1, AS_PROGRAM, 8, zaccaria_state )
AM_RANGE(0x0000, 0x007f) AM_RAM
AM_RANGE(0x500c, 0x500f) AM_DEVREADWRITE("pia0", pia6821_device, read, write) AM_MIRROR(0x1ff0)
AM_RANGE(0x8000, 0x9fff) AM_ROM AM_MIRROR(0x2000) // rom 13
AM_RANGE(0xc000, 0xdfff) AM_ROM AM_MIRROR(0x2000) // rom 9
ADDRESS_MAP_END
/* master sound cpu, controls speech directly */
/* mapping:
A15 A14 A13 A12 A11 A10 A09 A08 A07 A06 A05 A04 A03 A02 A01 A00
0 0 0 0 0 0 0 0 0 * * * * * * * RW 6802 internal ram
**** x 0 0 0 x x x x 1 x x 0 x x * * Open bus (test mode writes as if there was another PIA here)
x 0 0 0 x x x x 1 x x 1 x x * * RW 6821 PIA @ 1I
x 0 0 1 0 0 x x x x x x x x x x W MC1408 DAC
x x 0 1 0 1 x x x x x x x x x x W Command to slave sound1 cpu
x x 0 1 1 0 x x x x x x x x x x R Command read latch from z80
x x 0 1 1 1 x x x x x x x x x x Open bus
% % 1 0 * * * * * * * * * * * * R /CS1A: Enable Rom 8
% % 1 1 * * * * * * * * * * * * R /CS0A: Enable Rom 7
note that the % bits go to pins 2 (6802 A14) and 26 (6802 A15) of the roms
monymony and jackrabt both use 2764 roms, which use pin 2 as A12 and pin 26 as N/C don't care
hence for actual chips used, the mem map is:
x * 1 0 * * * * * * * * * * * * R /CS1A: Enable Rom 8
x * 1 1 * * * * * * * * * * * * R /CS0A: Enable Rom 7
6821 PIA: PA0-7, CA2 and CB1 connect to the TMS5200; CA1 and CB2 are disconnected, though the test mode assumes there's something connected to CB2 (possibly another LED like the one connected to PB4); PB3 connects to 'ACS' which goes to the z80.
*/
static ADDRESS_MAP_START( sound_map_2, AS_PROGRAM, 8, zaccaria_state )
AM_RANGE(0x0000, 0x007f) AM_RAM /* 6802 internal ram */
AM_RANGE(0x0090, 0x0093) AM_DEVREADWRITE("pia1", pia6821_device, read, write) AM_MIRROR(0x8F6C)
AM_RANGE(0x1000, 0x1000) AM_DEVWRITE("mc1408", dac_device, write_unsigned8) AM_MIRROR(0x83FF) /* MC1408 */
AM_RANGE(0x1400, 0x1400) AM_WRITE(sound1_command_w) AM_MIRROR(0xC3FF)
AM_RANGE(0x1800, 0x1800) AM_READ(soundlatch_byte_r) AM_MIRROR(0xC3FF)
AM_RANGE(0x2000, 0x2fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 low
AM_RANGE(0x3000, 0x3fff) AM_ROM AM_MIRROR(0x8000) // rom 7 with A12 low
AM_RANGE(0x6000, 0x6fff) AM_ROM AM_MIRROR(0x8000) // rom 8 with A12 high
AM_RANGE(0x7000, 0x7fff) AM_ROM AM_MIRROR(0x8000) // rom 7 with A12 high
ADDRESS_MAP_END
CUSTOM_INPUT_MEMBER(zaccaria_state::acs_r)
WRITE8_MEMBER(zaccaria_state::ressound_w)
{
return (m_acs & 0x08) ? 1 : 0;
m_audiopcb->ressound_w(data & 0x01);
}
static INPUT_PORTS_START( monymony )
@ -429,7 +271,7 @@ static INPUT_PORTS_START( monymony )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, zaccaria_state,acs_r, NULL) /* "ACS" - from pin 13 of a PIA on the sound board */
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("audiopcb", zac1b11142_audio_device, acs_r)
/* other bits come from a protection device */
INPUT_PORTS_END
@ -500,36 +342,12 @@ static MACHINE_CONFIG_START( zaccaria, zaccaria_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", zaccaria_state, vblank_irq)
// MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
MCFG_CPU_ADD("audiocpu", M6802,XTAL_3_579545MHz) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(sound_map_1)
MCFG_DEVICE_ADD("timebase", CLOCK, XTAL_3_579545MHz/4096/2) /* verified on pcb */
MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("pia0", pia6821_device, cb1_w))
// MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
MCFG_CPU_ADD("audio2", M6802,XTAL_3_579545MHz) /* verified on pcb */
MCFG_CPU_PROGRAM_MAP(sound_map_2)
// MCFG_QUANTUM_TIME(attotime::from_hz(1000000))
MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
MCFG_I8255_IN_PORTA_CB(IOPORT("P1"))
MCFG_I8255_IN_PORTB_CB(IOPORT("P2"))
MCFG_I8255_IN_PORTC_CB(IOPORT("SYSTEM"))
MCFG_I8255_OUT_PORTC_CB(WRITE8(zaccaria_state, dsw_sel_w))
MCFG_DEVICE_ADD( "pia0", PIA6821, 0)
MCFG_PIA_READPA_HANDLER(READ8(zaccaria_state, port0a_r))
MCFG_PIA_WRITEPA_HANDLER(WRITE8(zaccaria_state, port0a_w))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(zaccaria_state, port0b_w))
MCFG_PIA_IRQA_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, nmi_line))
MCFG_PIA_IRQB_HANDLER(DEVWRITELINE("audiocpu", m6802_cpu_device, irq_line))
MCFG_DEVICE_ADD( "pia1", PIA6821, 0)
MCFG_PIA_READPA_HANDLER(DEVREAD8("tms", tms5220_device, status_r))
MCFG_PIA_WRITEPA_HANDLER(DEVWRITE8("tms", tms5220_device, data_w))
MCFG_PIA_WRITEPB_HANDLER(WRITE8(zaccaria_state,port1b_w))
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60.57) /* verified on pcb */
@ -546,24 +364,8 @@ static MACHINE_CONFIG_START( zaccaria, zaccaria_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD("ay1", AY8910, XTAL_3_579545MHz/2) /* verified on pcb */
MCFG_AY8910_PORT_B_READ_CB(READ8(driver_device, soundlatch2_byte_r))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(zaccaria_state, ay8910_port0a_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
MCFG_SOUND_ADD("ay2", AY8910, XTAL_3_579545MHz/2) /* verified on pcb */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
MCFG_DAC_ADD("mc1408")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
/* There is no xtal, the clock is obtained from a RC oscillator as shown in the TMS5220 datasheet (R=100kOhm C=22pF) */
/* 162kHz measured on pin 3 20 minutesa fter power on. Clock would then be 162*4=648kHz. */
MCFG_SOUND_ADD("tms", TMS5200, 649200) /* ROMCLK pin measured at 162.3Khz, OSC is exactly *4 of that) */
MCFG_TMS52XX_IRQ_HANDLER(DEVWRITELINE("pia1", pia6821_device, cb1_w))
MCFG_TMS52XX_READYQ_HANDLER(DEVWRITELINE("pia1", pia6821_device, ca2_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
MCFG_ZACCARIA_1B11142("audiopcb")
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MACHINE_CONFIG_END
@ -589,11 +391,11 @@ ROM_START( monymony )
ROM_LOAD( "cpu6.2c", 0x5000, 0x1000, CRC(31da62b1) SHA1(486f07087244f8537510afacb64ddd59eb512a4d) )
ROM_CONTINUE( 0xd000, 0x1000 )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */
ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */
ROM_LOAD( "snd13.2g", 0x8000, 0x2000, CRC(78b01b98) SHA1(2aabed56cdae9463deb513c0c5021f6c8dfd271e) )
ROM_LOAD( "snd9.1i", 0xc000, 0x2000, CRC(94e3858b) SHA1(04961f67b95798b530bd83355dec612389f22255) )
ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */
ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */
ROM_LOAD( "snd8.1h", 0x2000, 0x1000, CRC(aad76193) SHA1(e08fc184efced392ee902c4cc9daaaf3310cdfe2) )
ROM_CONTINUE( 0x6000, 0x1000 )
ROM_LOAD( "snd7.1g", 0x3000, 0x1000, CRC(1e8ffe3e) SHA1(858ee7abe88d5801237e519cae2b50ae4bf33a58) )
@ -624,11 +426,11 @@ ROM_START( jackrabt )
ROM_LOAD( "cpu-01.5h", 0xc000, 0x1000, CRC(785e1a01) SHA1(a748d300be9455cad4f912e01c2279bb8465edfe) )
ROM_LOAD( "cpu-01.6h", 0xd000, 0x1000, CRC(dd5979cf) SHA1(e9afe7002b2258a1c3132bdd951c6e20d473fb6a) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */
ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */
ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) )
ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) )
ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */
ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */
ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) )
ROM_CONTINUE( 0x6000, 0x1000 )
ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) )
@ -663,11 +465,11 @@ ROM_START( jackrabt2 )
ROM_LOAD( "6cpu2.2c", 0x5000, 0x1000, CRC(404496eb) SHA1(44381e27e540fe9d8cacab4c3b1fe9a4f20d26a8) )
ROM_CONTINUE( 0xd000, 0x1000 )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */
ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */
ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) )
ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) )
ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */
ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */
ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) )
ROM_CONTINUE( 0x6000, 0x1000 )
ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) )
@ -704,11 +506,11 @@ ROM_START( jackrabts )
ROM_LOAD( "6cpu.2c", 0x5000, 0x1000, CRC(f53d6356) SHA1(9b167edca59cf81a2468368a372bab132f15e2ea) )
ROM_CONTINUE( 0xd000, 0x1000 )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for first 6802 */
ROM_REGION( 0x10000, "audiopcb:melodycpu", 0 ) /* 64k for first 6802 */
ROM_LOAD( "13snd.2g", 0x8000, 0x2000, CRC(fc05654e) SHA1(ed9c66672fe89c41e320e1d27b53f5efa92dce9c) )
ROM_LOAD( "9snd.1i", 0xc000, 0x2000, CRC(3dab977f) SHA1(3e79c06d2e70b050f01b7ac58be5127ba87904b0) )
ROM_REGION( 0x10000, "audio2", 0 ) /* 64k for second 6802 */
ROM_REGION( 0x10000, "audiopcb:audiocpu", 0 ) /* 64k for second 6802 */
ROM_LOAD( "8snd.1h", 0x2000, 0x1000, CRC(f4507111) SHA1(0513f0831b94aeda84aa4f3b4a7c60dfc5113b2d) )
ROM_CONTINUE( 0x6000, 0x1000 )
ROM_LOAD( "7snd.1g", 0x3000, 0x1000, CRC(c722eff8) SHA1(d8d1c091ab80ea2d6616e4dc030adc9905c0a496) )

View File

@ -203,8 +203,6 @@ public:
DECLARE_READ8_MEMBER(pia_porta_r);
DECLARE_WRITE8_MEMBER(pia_porta_w);
DECLARE_WRITE8_MEMBER(pia_portb_w);
DECLARE_WRITE_LINE_MEMBER(pia_irqa);
DECLARE_WRITE_LINE_MEMBER(pia_irqb);
// PSG handlers
DECLARE_WRITE8_MEMBER(psg1_porta_w);

View File

@ -1,60 +1,25 @@
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
#include "machine/6821pia.h"
#include "machine/clock.h"
#include "sound/ay8910.h"
#include "sound/tms5220.h"
#include "emu.h"
#include "audio/zaccaria.h"
class zaccaria_state : public driver_device
{
public:
zaccaria_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audio2(*this, "audio2"),
m_pia0(*this, "pia0"),
m_ay1(*this, "ay1"),
m_ay2(*this, "ay2"),
m_tms(*this, "tms"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_attributesram(*this, "attributesram"),
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"),
m_dsw_port(*this, "DSW") { }
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audio2;
required_device<pia6821_device> m_pia0;
required_device<ay8910_device> m_ay1;
required_device<ay8910_device> m_ay2;
required_device<tms5220_device> m_tms;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
/* memory pointers */
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_attributesram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_spriteram2;
required_ioport_array<3> m_dsw_port;
int m_dsw_sel;
int m_active_8910;
int m_port0a;
int m_acs;
int m_last_port0b;
tilemap_t *m_bg_tilemap;
UINT8 m_nmi_mask;
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_audiopcb(*this, "audiopcb")
, m_videoram(*this, "videoram")
, m_attributesram(*this, "attributesram")
, m_spriteram(*this, "spriteram")
, m_spriteram2(*this, "spriteram2")
, m_dsw_port(*this, "DSW")
{ }
DECLARE_READ8_MEMBER(dsw_r);
DECLARE_WRITE8_MEMBER(sound_command_w);
DECLARE_WRITE8_MEMBER(sound1_command_w);
DECLARE_READ8_MEMBER(prot1_r);
DECLARE_READ8_MEMBER(prot2_r);
DECLARE_WRITE8_MEMBER(coin_w);
@ -63,13 +28,8 @@ public:
DECLARE_WRITE8_MEMBER(attributes_w);
DECLARE_WRITE8_MEMBER(flip_screen_x_w);
DECLARE_WRITE8_MEMBER(flip_screen_y_w);
DECLARE_CUSTOM_INPUT_MEMBER(acs_r);
DECLARE_WRITE8_MEMBER(ressound_w);
DECLARE_WRITE8_MEMBER(dsw_sel_w);
DECLARE_WRITE8_MEMBER(ay8910_port0a_w);
DECLARE_READ8_MEMBER(port0a_r);
DECLARE_WRITE8_MEMBER(port0a_w);
DECLARE_WRITE8_MEMBER(port0b_w);
DECLARE_WRITE8_MEMBER(port1b_w);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_start() override;
virtual void machine_reset() override;
@ -78,4 +38,21 @@ public:
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,UINT8 *spriteram,int color,int section);
protected:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<zac1b11142_audio_device> m_audiopcb;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_attributesram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_spriteram2;
required_ioport_array<3> m_dsw_port;
int m_dsw_sel;
tilemap_t *m_bg_tilemap;
UINT8 m_nmi_mask;
};

View File

@ -287,19 +287,75 @@ WRITE16_MEMBER(gaelco2_state::gaelco2_eeprom_data_w)
***************************************************************************/
static UINT32 rol(UINT32 x, unsigned int c)
{
return (x << c) | (x >> (32 - c));
}
static UINT16 get_lo(UINT32 x)
{
return ((x & 0x00000010) << 1) |
((x & 0x00000800) << 3) |
((x & 0x40000000) >> 27) |
((x & 0x00000005) << 6) |
((x & 0x00000008) << 8) |
rol(x & 0x00800040, 9) |
((x & 0x04000000) >> 16) |
((x & 0x00008000) >> 14) |
((x & 0x00002000) >> 11) |
((x & 0x00020000) >> 10) |
((x & 0x00100000) >> 8) |
((x & 0x00044000) >> 5) |
((x & 0x00000020) >> 1);
}
static UINT16 get_hi(UINT32 x)
{
return ((x & 0x00001400) >> 0) |
((x & 0x10000000) >> 26) |
((x & 0x02000000) >> 24) |
((x & 0x08000000) >> 21) |
((x & 0x00000002) << 12) |
((x & 0x01000000) >> 19) |
((x & 0x20000000) >> 18) |
((x & 0x80000000) >> 16) |
((x & 0x00200000) >> 13) |
((x & 0x00010000) >> 12) |
((x & 0x00080000) >> 10) |
((x & 0x00000200) >> 9) |
((x & 0x00400000) >> 8) |
((x & 0x00000080) >> 4) |
((x & 0x00000100) >> 1);
}
static UINT16 get_out(UINT16 x)
{
return ((x & 0xc840) << 0) |
((x & 0x0080) << 2) |
((x & 0x0004) << 3) |
((x & 0x0008) << 5) |
((x & 0x0010) << 8) |
((x & 0x0002) << 9) |
((x & 0x0001) << 13) |
((x & 0x0200) >> 9) |
((x & 0x1400) >> 8) |
((x & 0x0100) >> 7) |
((x & 0x2000) >> 6) |
((x & 0x0020) >> 2);
}
UINT16 mangle(UINT32 x)
{
UINT16 a = get_lo(x);
UINT16 b = get_hi(x);
return get_out(((a ^ 0x0010) - (b ^ 0x0024)) ^ 0x5496);
}
READ16_MEMBER(gaelco2_state::snowboar_protection_r)
{
chd_file * table = machine().rom_load().get_disk_handle(":decrypt");
UINT8 temp[1024];
table->read_hunk(snowboard_latch>>9, &temp[0]);
UINT16 data = (temp[(snowboard_latch & 0x1ff)*2]<<8) | temp[((snowboard_latch & 0x1ff)*2)+1];
// TODO: replace above lookup (8GB table) with emulation of device
logerror("%06x: protection read (input %08x output %04x)\n", space.device().safe_pc(), snowboard_latch, data);
return data;
UINT16 ret = mangle(snowboard_latch);
ret = ((ret & 0xff00) >> 8) | ((ret & 0x00ff) << 8);
return ret;
}

View File

@ -37,8 +37,9 @@ public:
#else
m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0),
#endif
m_primlist(NULL),
m_primlist(nullptr),
m_index(0),
m_main(nullptr),
m_prescale(1)
{}
virtual ~osd_window() { }
@ -80,6 +81,7 @@ public:
render_primitive_list *m_primlist;
osd_window_config m_win_config;
int m_index;
osd_window *m_main;
protected:
int m_prescale;
};

View File

@ -60,10 +60,8 @@ class renderer_bgfx : public osd_renderer
{
public:
renderer_bgfx(osd_window *w)
: osd_renderer(w, FLAG_NONE), m_blittimer(0),
m_blit_dim(0, 0),
m_last_hofs(0), m_last_vofs(0),
m_last_blit_time(0), m_last_blit_pixels(0)
: osd_renderer(w, FLAG_NONE),
m_dimensions(0,0)
{}
virtual int create() override;
@ -78,41 +76,18 @@ public:
virtual void destroy() override;
virtual render_primitive_list *get_primitives() override
{
#ifdef OSD_WINDOWS
RECT client;
GetClientRect(window().m_hwnd, &client);
window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect());
return &window().target()->get_primitives();
#else
osd_dim wdim = window().get_size();
window().target()->set_bounds(wdim.width(), wdim.height(), window().aspect());
return &window().target()->get_primitives();
#endif
}
// void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
//texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
//texture_info *texture_update(const render_primitive &prim);
INT32 m_blittimer;
//simple_list<texture_info> m_texlist; // list of active textures
osd_dim m_blit_dim;
float m_last_hofs;
float m_last_vofs;
// Stats
INT64 m_last_blit_time;
INT64 m_last_blit_pixels;
bgfx::ProgramHandle m_progQuad;
bgfx::ProgramHandle m_progQuadTexture;
bgfx::ProgramHandle m_progLine;
bgfx::UniformHandle m_s_texColor;
bgfx::FrameBufferHandle fbh;
// Original display_mode
osd_dim m_dimensions;
};
@ -152,39 +127,68 @@ int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks)
static void drawbgfx_exit(void)
{
// Shutdown bgfx.
bgfx::shutdown();
}
//============================================================
// renderer_bgfx::create
//============================================================
bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName);
#ifdef OSD_SDL
static void* sdlNativeWindowHandle(SDL_Window* _window)
{
SDL_SysWMinfo wmi;
SDL_VERSION(&wmi.version);
if (!SDL_GetWindowWMInfo(_window, &wmi))
{
return NULL;
}
# if BX_PLATFORM_LINUX || BX_PLATFORM_BSD
return (void*)wmi.info.x11.window;
# elif BX_PLATFORM_OSX
return wmi.info.cocoa.window;
# elif BX_PLATFORM_WINDOWS
return wmi.info.win.window;
# endif // BX_PLATFORM_
}
#endif
int renderer_bgfx::create()
{
// create renderer
#ifdef OSD_WINDOWS
RECT client;
GetClientRect(window().m_hwnd, &client);
bgfx::winSetHwnd(window().m_hwnd);
bgfx::init();
bgfx::reset(rect_width(&client), rect_height(&client), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
#else
osd_dim wdim = window().get_size();
bgfx::sdlSetWindow(window().sdl_window());
bgfx::init();
bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
if (window().m_index == 0)
{
#ifdef OSD_WINDOWS
bgfx::winSetHwnd(window().m_hwnd);
#else
bgfx::sdlSetWindow(window().sdl_window());
#endif
// Enable debug text.
bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS
bgfx::init();
bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
// Enable debug text.
bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS
m_dimensions = osd_dim(wdim.width(), wdim.height());
}
else {
#ifdef OSD_WINDOWS
fbh = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height());
#else
fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height());
#endif
bgfx::touch(window().m_index);
}
// Create program from shaders.
m_progQuad = loadProgram("vs_quad", "fs_quad");
m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture");
m_progLine = loadProgram("vs_line", "fs_line");
m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1);
osd_printf_verbose("Leave drawsdl2_window_create\n");
return 0;
}
@ -194,18 +198,15 @@ int renderer_bgfx::create()
void renderer_bgfx::destroy()
{
// free the memory in the window
// destroy_all_textures();
//
if (window().m_index > 0)
{
bgfx::destroyFrameBuffer(fbh);
}
bgfx::destroyUniform(m_s_texColor);
// Cleanup.
bgfx::destroyProgram(m_progQuad);
bgfx::destroyProgram(m_progQuadTexture);
bgfx::destroyProgram(m_progLine);
// Shutdown bgfx.
bgfx::shutdown();
}
@ -216,11 +217,11 @@ void renderer_bgfx::destroy()
#ifdef OSD_SDL
int renderer_bgfx::xy_to_render_target(int x, int y, int *xt, int *yt)
{
*xt = x - m_last_hofs;
*yt = y - m_last_vofs;
if (*xt<0 || *xt >= m_blit_dim.width())
*xt = x;
*yt = y;
if (*xt<0 || *xt >= m_dimensions.width())
return 0;
if (*yt<0 || *yt >= m_blit_dim.height())
if (*yt<0 || *yt >= m_dimensions.height())
return 0;
return 1;
}
@ -738,23 +739,48 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi
}
int renderer_bgfx::draw(int update)
{
initVertexDecls();
initVertexDecls();
int index = window().m_index;
// Set view 0 default viewport.
int width, height;
#ifdef OSD_WINDOWS
RECT client;
GetClientRect(window().m_hwnd, &client);
width = rect_width(&client);
height = rect_height(&client);
#else
osd_dim wdim = window().get_size();
width = wdim.width();
height = wdim.height();
int width = wdim.width();
int height = wdim.height();
if (index == 0)
{
if ((m_dimensions != osd_dim(width, height))) {
bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
m_dimensions = osd_dim(width, height);
}
}
else {
if ((m_dimensions != osd_dim(width, height))) {
bgfx::reset(window().m_main->get_size().width(), window().m_main->get_size().height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
if (bgfx::isValid(fbh))
{
bgfx::destroyFrameBuffer(fbh);
}
#ifdef OSD_WINDOWS
fbh = bgfx::createFrameBuffer(window().m_hwnd, width, height);
#else
fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), width, height);
#endif
bgfx::setViewSeq(0, true);
bgfx::setViewRect(0, 0, 0, width, height);
bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE);
bgfx::setViewFrameBuffer(index, fbh);
m_dimensions = osd_dim(width, height);
bgfx::setViewClear(index
, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH
, 0x000000ff
, 1.0f
, 0
);
bgfx::touch(index);
bgfx::frame();
return 0;
}
}
if (index != 0) bgfx::setViewFrameBuffer(index, fbh);
bgfx::setViewSeq(index, true);
bgfx::setViewRect(index, 0, 0, width, height);
// Setup view transform.
{
float view[16];
@ -766,9 +792,9 @@ int renderer_bgfx::draw(int update)
float bottom = height;
float proj[16];
bx::mtxOrtho(proj, left, right, bottom, top, 0.0f, 100.0f);
bgfx::setViewTransform(0, view, proj);
bgfx::setViewTransform(index, view, proj);
}
bgfx::setViewClear(0
bgfx::setViewClear(index
, BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH
, 0x000000ff
, 1.0f
@ -777,7 +803,7 @@ int renderer_bgfx::draw(int update)
// This dummy draw call is here to make sure that view 0 is cleared
// if no other draw calls are submitted to view 0.
bgfx::touch(0);
bgfx::touch(index);
window().m_primlist->acquire_lock();
// Draw quad.
@ -815,7 +841,7 @@ int renderer_bgfx::draw(int update)
u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255),
1.0f);
bgfx::setState(flags);
bgfx::submit(0, m_progLine);
bgfx::submit(index, m_progLine);
break;
case render_primitive::QUAD:
@ -826,7 +852,7 @@ int renderer_bgfx::draw(int update)
screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1,
u32Color(prim->color.r * 255, prim->color.g * 255, prim->color.b * 255, prim->color.a * 255), uv);
bgfx::setState(flags);
bgfx::submit(0, m_progQuad);
bgfx::submit(index, m_progQuad);
}
else {
screenQuad(prim->bounds.x0, prim->bounds.y0, prim->bounds.x1, prim->bounds.y1,
@ -926,7 +952,7 @@ int renderer_bgfx::draw(int update)
}
bgfx::setTexture(0, m_s_texColor, m_texture);
bgfx::setState(flags);
bgfx::submit(0, m_progQuadTexture);
bgfx::submit(index, m_progQuadTexture);
bgfx::destroyTexture(m_texture);
}
break;
@ -939,7 +965,7 @@ int renderer_bgfx::draw(int update)
window().m_primlist->release_lock();
// Advance to next frame. Rendering thread will be kicked to
// process submitted rendering primitives.
bgfx::frame();
if (index==0) bgfx::frame();
return 0;
}

View File

@ -1269,6 +1269,18 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt )
SDL_WM_SetCaption(window->m_title, "SDLMAME");
#endif
// set main window
if (window->m_index > 0)
{
for (auto w = sdl_window_list; w != NULL; w = w->m_next)
{
if (w->m_index == 0)
{
window->m_main = w;
break;
}
}
}
window->monitor()->refresh();
// initialize the drawing backend
if (window->renderer().create())

View File

@ -661,6 +661,18 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in
window->m_fullscreen = !video_config.windowed;
window->m_index = index;
// set main window
if (index > 0)
{
for (auto w = win_window_list; w != NULL; w = w->m_next)
{
if (w->m_index == 0)
{
window->m_main = w;
break;
}
}
}
// see if we are safe for fullscreen
window->m_fullscreen_safe = TRUE;
for (win = win_window_list; win != NULL; win = win->m_next)