Commodore PET Joysticks and Sound Device [Ken White]

* pet_cass.xml
- Added Supermon (Toronto PET User Group) [Ken White]
- Replaced bad dump of Side B of Squiggle, Big Time / Monitor (the m command in the monitor now works correctly) [Ken White]
This commit is contained in:
smf- 2016-05-31 11:18:20 +01:00
parent be3f3c7eba
commit 65b5c2a40c
5 changed files with 262 additions and 10 deletions

View File

@ -304,11 +304,11 @@
</part>
</software>
<software name="cur11" supported="partial">
<software name="cur11">
<description>Cursor 11</description>
<year>1979</year>
<!-- pet2001n Side A: COVER, DEMON!, HI CALC, WIPEOUT, PEG, STATES -->
<!-- pet2001n 2joysnd Side A: COVER, DEMON!, HI CALC, WIPEOUT, PEG, STATES -->
<publisher>The Code Works</publisher>
<part name="cass" interface="cbm_cass">
<dataarea name="cass" size="52073122">
@ -317,11 +317,11 @@
</part>
</software>
<software name="cur12" supported="partial">
<software name="cur12">
<description>Cursor 12</description>
<year>1979</year>
<!-- pet2001n Side A: COVER12, CANYON!, GAUSS!, PICKUP, PIEGRAM, FLIGHT! -->
<!-- pet2001n 2joysnd Side A: COVER12, CANYON!, GAUSS!, PICKUP, PIEGRAM, FLIGHT! -->
<publisher>The Code Works</publisher>
<part name="cass" interface="cbm_cass">
<dataarea name="cass" size="60014980">
@ -369,11 +369,11 @@
</part>
</software>
<software name="cur16" supported="partial">
<software name="cur16">
<description>Cursor 16</description>
<year>1980</year>
<!-- pet2001n Side A: COVER16, NAB!, FIRE!, ALIENS!, BONZO!, CATCH! -->
<!-- pet2001n 2joysnd Side A: COVER16, NAB!, FIRE!, ALIENS!, BONZO!, CATCH! -->
<publisher>The Code Works</publisher>
<part name="cass" interface="cbm_cass">
<dataarea name="cass" size="45885486">
@ -2775,11 +2775,11 @@
</part>
</software>
<software name="seawolf">
<software name="seawolf" supported="partial">
<description>Seawolf</description>
<year>1978</year>
<!-- pet2001b joystick Side A: seawolf -->
<!-- pet2001b Side A: seawolf -->
<publisher>Creative Software</publisher>
<part name="cass" interface="cbm_cass">
<dataarea name="cass" size="9137146">
@ -2841,8 +2841,8 @@
<!-- pet2001 Side B: MONITOR -->
<part name="cass2" interface="cbm_cass">
<dataarea name="cass" size="2751568">
<rom name="monitor (1978)(commodore business machines).wav" size="2751568" crc="22c03872" sha1="b6dc48fcb9a82f10730dacb8da6978a419b008e0" offset="0" />
<dataarea name="cass" size="2751312">
<rom name="monitor (1978)(commodore business machines).wav" size="2751312" crc="47a31ba5" sha1="3801e52d49ee224246c6f7cbc0d9d79df181746a" offset="0" />
</dataarea>
</part>
</software>
@ -2860,6 +2860,19 @@
</part>
</software>
<software name="supermon">
<description>Supermon</description>
<year>1979</year>
<publisher>Toronto PET User Group</publisher>
<!-- pet20018 Side A: SUPERMON -->
<part name="cass" interface="cbm_cass">
<dataarea name="cass" size="6244772">
<rom name="supermon1 rel (1979)(tpug)).wav" size="6244772" crc="84cd7682" sha1="edca3f9e751439002aa5e555d3885999db7dd809" offset="0" />
</dataarea>
</part>
</software>
<software name="swchec">
<description>Soundware Checkers</description>
<year>1978</year>

View File

@ -1047,6 +1047,8 @@ if (BUSES["PET"]~=null) then
MAME_DIR .. "src/devices/bus/pet/petuja.h",
MAME_DIR .. "src/devices/bus/pet/cb2snd.cpp",
MAME_DIR .. "src/devices/bus/pet/cb2snd.h",
MAME_DIR .. "src/devices/bus/pet/2joysnd.h",
MAME_DIR .. "src/devices/bus/pet/2joysnd.cpp",
}
end

View File

@ -0,0 +1,163 @@
// license:BSD-3-Clause
// copyright-holders: Ken White
/**********************************************************************
Commodore PET user port dual joystick and sound device emulation
BEST OF THE PET GAZETTE magazine documents attaching Atari-style joysticks
with DB-9S connectors to a DB-25P connector plugged into the user port.
page 42, PET AND THE DUAL JOYSTICKS by Chuck Johnson
page 47, STANDARD #1 (CB2 Sound)
**********************************************************************/
/*
Connections
----------
User Joysticks
Port ____
/ |
F ----- | 1 | joy 1 up
> --- | 6 | joy 1 button
E ----- | 2 | joy 1 down
| 7 |
D ----- | 3 | joy 1 left
| 8 |
C ----- | 4 | joy 1 right
| 9 |
| 5 |
\____|
____
/ |
L ----- | 1 | joy 2 up
> --- | 6 | joy 2 button
K ----- | 2 | joy 2 down
| 7 |
J ----- | 3 | joy 2 left
| 8 |
H ----- | 4 | joy 2 right
| 9 |
| 5 |
\____|
M ----- audio amplifier
*/
#include "2joysnd.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type PET_USERPORT_JOYSTICK_AND_SOUND_DEVICE = &device_creator<pet_userport_joystick_and_sound_device>;
#define DAC_TAG "dac"
MACHINE_CONFIG_FRAGMENT( 2joysnd )
MCFG_SPEAKER_STANDARD_MONO("cb2spkr")
MCFG_SOUND_ADD(DAC_TAG, DAC, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cb2spkr", 1.00)
MACHINE_CONFIG_END
//-------------------------------------------------
// INPUT_PORTS( 2joysnd )
//-------------------------------------------------
static INPUT_PORTS_START( 2joysnd )
PORT_START("JOY")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, device_pet_user_port_interface, output_c)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, device_pet_user_port_interface, output_d)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_down1)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_up1)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, device_pet_user_port_interface, output_h)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, device_pet_user_port_interface, output_j)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_down2)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_up2)
PORT_START("FIRE")
PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_fire1)
PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, pet_userport_joystick_and_sound_device, write_fire2)
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor pet_userport_joystick_and_sound_device::device_input_ports() const
{
return INPUT_PORTS_NAME( 2joysnd );
}
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor pet_userport_joystick_and_sound_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( 2joysnd );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pet_user_port_dual_joystick_and_sound_device - constructor
//-------------------------------------------------
pet_userport_joystick_and_sound_device::pet_userport_joystick_and_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PET_USERPORT_JOYSTICK_AND_SOUND_DEVICE, "Dual Joysticks and Sound", tag, owner, clock, "2joysnd", __FILE__),
device_pet_user_port_interface(mconfig, *this),
m_dac(*this, DAC_TAG),
m_up1(1),
m_down1(1),
m_fire1(1),
m_up2(1),
m_down2(1),
m_fire2(1)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void pet_userport_joystick_and_sound_device::device_start()
{
}
//-------------------------------------------------
// update_port1
//-------------------------------------------------
void pet_userport_joystick_and_sound_device::update_port1()
{
// printf( "update port1\n" );
output_f(m_up1 && m_fire1);
output_e(m_down1 && m_fire1);
}
//-------------------------------------------------
// update_port2
//-------------------------------------------------
void pet_userport_joystick_and_sound_device::update_port2()
{
// printf( "update port2\n" );
output_l(m_up2 && m_fire2);
output_k(m_down2 && m_fire2);
}
DECLARE_WRITE_LINE_MEMBER( pet_userport_joystick_and_sound_device::input_m )
{
m_dac->write_unsigned8(state ? 0xff : 0x00);
}

View File

@ -0,0 +1,72 @@
// license:BSD-3-Clause
// copyright-holders: Ken White
/**********************************************************************
Commodore PET user port dual joystick and CB2 sound emulation
**********************************************************************/
#pragma once
#ifndef __2JOYSND__
#define __2JOYSND__
#include "emu.h"
#include "user.h"
#include "sound/dac.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> pet_userport_joystick_adapter_device
class pet_userport_joystick_and_sound_device : public device_t,
public device_pet_user_port_interface
{
public:
// construction/destruction
pet_userport_joystick_and_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
// optional information overrides
virtual ioport_constructor device_input_ports() const override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual DECLARE_WRITE_LINE_MEMBER( input_m ) override;
required_device<dac_device> m_dac;
// device_pet_user_port_interface overrides
WRITE_LINE_MEMBER( write_up1 ) { m_up1 = state; update_port1(); }
WRITE_LINE_MEMBER( write_down1 ) { m_down1 = state; update_port1(); }
WRITE_LINE_MEMBER( write_fire1 ) { m_fire1 = state; update_port1(); }
WRITE_LINE_MEMBER( write_up2 ) { m_up2 = state; update_port2(); }
WRITE_LINE_MEMBER( write_down2 ) { m_down2 = state; update_port2(); }
WRITE_LINE_MEMBER( write_fire2 ) { m_fire2 = state; update_port2(); }
protected:
// device-level overrides
virtual void device_start() override;
void update_port1();
void update_port2();
int m_up1;
int m_down1;
int m_fire1;
int m_up2;
int m_down2;
int m_fire2;
};
// device type definition
extern const device_type PET_USERPORT_JOYSTICK_AND_SOUND_DEVICE;
#endif

View File

@ -122,9 +122,11 @@ device_pet_user_port_interface::~device_pet_user_port_interface()
#include "diag.h"
#include "petuja.h"
#include "cb2snd.h"
#include "2joysnd.h"
SLOT_INTERFACE_START( pet_user_port_cards )
SLOT_INTERFACE("diag", PET_USERPORT_DIAGNOSTIC_CONNECTOR)
SLOT_INTERFACE("petuja", PET_USERPORT_JOYSTICK_ADAPTER)
SLOT_INTERFACE("cb2snd", PET_USERPORT_CB2_SOUND_DEVICE)
SLOT_INTERFACE("2joysnd", PET_USERPORT_JOYSTICK_AND_SOUND_DEVICE)
SLOT_INTERFACE_END