Previous 15994 Revisions Next

r15454 Tuesday 12th June, 2012 at 20:54:20 UTC by Curt Coder
[VIC20/C64] Added a slot interface for the control ports. [Curt Coder]
[src/mess]mess.mak
[src/mess/drivers]c64.c vic20.c
[src/mess/includes]c64.h vic20.h
[src/mess/machine]cbmipt.c cbmipt.h vic20ctrl.c* vic20ctrl.h*

src/mess/machine/cbmipt.c
r15453r15454
11301130   SLOT_INTERFACE("softbox", SOFTBOX)
11311131SLOT_INTERFACE_END
11321132
1133SLOT_INTERFACE_START( vic20_control_port_devices )
1134SLOT_INTERFACE_END
1135
11331136SLOT_INTERFACE_START( vic20_expansion_cards )
11341137   SLOT_INTERFACE("exp", VIC1010)
11351138   SLOT_INTERFACE("3k", VIC1210)
src/mess/machine/cbmipt.h
r15453r15454
146146SLOT_INTERFACE_EXTERN( cbm_iec_devices );
147147SLOT_INTERFACE_EXTERN( sx1541_iec_devices );
148148SLOT_INTERFACE_EXTERN( cbm_ieee488_devices );
149SLOT_INTERFACE_EXTERN( vic20_control_port_devices );
149150SLOT_INTERFACE_EXTERN( vic20_expansion_cards );
150151SLOT_INTERFACE_EXTERN( vic20_user_port_cards );
151152SLOT_INTERFACE_EXTERN( vic10_expansion_cards );
src/mess/machine/vic20ctrl.c
r0r15454
1/**********************************************************************
2 
3    Commodore VIC-20/64 Control Port emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************/
9 
10#include "machine/vic20ctrl.h"
11 
12 
13 
14//**************************************************************************
15//  GLOBAL VARIABLES
16//**************************************************************************
17 
18const device_type VIC20_CONTROL_PORT = &device_creator<vic20_control_port_device>;
19 
20 
21 
22//**************************************************************************
23//  CARD INTERFACE
24//**************************************************************************
25 
26//-------------------------------------------------
27//  device_vic20_control_port_interface - constructor
28//-------------------------------------------------
29 
30device_vic20_control_port_interface::device_vic20_control_port_interface(const machine_config &mconfig, device_t &device)
31   : device_slot_card_interface(mconfig,device)
32{
33   m_port = dynamic_cast<vic20_control_port_device *>(device.owner());
34}
35 
36 
37//-------------------------------------------------
38//  ~device_vic20_control_port_interface - destructor
39//-------------------------------------------------
40 
41device_vic20_control_port_interface::~device_vic20_control_port_interface()
42{
43}
44 
45 
46 
47//**************************************************************************
48//  LIVE DEVICE
49//**************************************************************************
50 
51//-------------------------------------------------
52//  vic20_control_port_device - constructor
53//-------------------------------------------------
54 
55vic20_control_port_device::vic20_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
56        device_t(mconfig, VIC20_CONTROL_PORT, "VIC20 control port", tag, owner, clock),
57      device_slot_interface(mconfig, *this)
58{
59}
60 
61 
62//-------------------------------------------------
63//  vic20_control_port_device - destructor
64//-------------------------------------------------
65 
66vic20_control_port_device::~vic20_control_port_device()
67{
68}
69 
70 
71//-------------------------------------------------
72//  device_start - device-specific startup
73//-------------------------------------------------
74 
75void vic20_control_port_device::device_start()
76{
77   m_device = dynamic_cast<device_vic20_control_port_interface *>(get_card_device());
78}
79 
80 
81READ8_MEMBER( vic20_control_port_device::joy_r ) { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vic20_joy_r(); return data; }
82READ8_MEMBER( vic20_control_port_device::pot_x_r ) { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vic20_pot_x_r(); return data; }
83READ8_MEMBER( vic20_control_port_device::pot_y_r ) { UINT8 data = 0xff; if (m_device != NULL) data = m_device->vic20_pot_y_r(); return data; }
src/mess/machine/vic20ctrl.h
r0r15454
1/**********************************************************************
2 
3    Commodore VIC-20/64 Control Port emulation
4 
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7 
8**********************************************************************
9 
10 
11**********************************************************************/
12 
13#pragma once
14 
15#ifndef __VIC20_CONTROL_PORT__
16#define __VIC20_CONTROL_PORT__
17 
18#include "emu.h"
19 
20 
21 
22//**************************************************************************
23//  CONSTANTS
24//**************************************************************************
25 
26#define VIC20_CONTROL_PORT_1_TAG      "joy1"
27#define VIC20_CONTROL_PORT_2_TAG      "joy2"
28 
29 
30 
31//**************************************************************************
32//  INTERFACE CONFIGURATION MACROS
33//**************************************************************************
34 
35#define MCFG_VIC20_CONTROL_PORT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
36    MCFG_DEVICE_ADD(_tag, VIC20_CONTROL_PORT, 0) \
37   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
38 
39 
40 
41//**************************************************************************
42//  TYPE DEFINITIONS
43//**************************************************************************
44 
45// ======================> vic20_control_port_device
46 
47class device_vic20_control_port_interface;
48 
49class vic20_control_port_device : public device_t,
50                            public device_slot_interface
51{
52public:
53   // construction/destruction
54   vic20_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
55   virtual ~vic20_control_port_device();
56 
57   // computer interface
58   DECLARE_READ8_MEMBER( joy_r );
59   DECLARE_READ8_MEMBER( pot_x_r );
60   DECLARE_READ8_MEMBER( pot_y_r );
61 
62protected:
63   // device-level overrides
64   virtual void device_start();
65 
66   device_vic20_control_port_interface *m_device;
67};
68 
69 
70// ======================> device_vic20_control_port_interface
71 
72// class representing interface-specific live vic20_expansion card
73class device_vic20_control_port_interface : public device_slot_card_interface
74{
75public:
76   // construction/destruction
77   device_vic20_control_port_interface(const machine_config &mconfig, device_t &device);
78   virtual ~device_vic20_control_port_interface();
79 
80   virtual UINT8 vic20_joy_r() { return 0xff; };
81   virtual UINT8 vic20_pot_x_r() { return 0xff; };
82   virtual UINT8 vic20_pot_y_r() { return 0xff; };
83 
84protected:
85   vic20_control_port_device *m_port;
86};
87 
88 
89// device type definition
90extern const device_type VIC20_CONTROL_PORT;
91 
92 
93 
94#endif
src/mess/includes/vic20.h
r15453r15454
1414#include "machine/cbmipt.h"
1515#include "machine/ieee488.h"
1616#include "machine/ram.h"
17#include "machine/vic20ctrl.h"
1718#include "machine/vic20exp.h"
1819#include "machine/vic20user.h"
1920#include "sound/dac.h"
r15453r15454
3839        m_via1(*this, M6522_1_TAG),
3940        m_vic(*this, M6560_TAG),
4041        m_iec(*this, CBM_IEC_TAG),
42        m_joy1(*this, VIC20_CONTROL_PORT_1_TAG),
43        m_joy2(*this, VIC20_CONTROL_PORT_2_TAG),
4144        m_exp(*this, VIC20_EXPANSION_SLOT_TAG),
4245        m_user(*this, VIC20_USER_PORT_TAG),
4346        m_cassette(*this, CASSETTE_TAG),
r15453r15454
5053   required_device<via6522_device> m_via1;
5154   required_device<device_t> m_vic;
5255   required_device<cbm_iec_device> m_iec;
56   required_device<vic20_control_port_device> m_joy1;
57   required_device<vic20_control_port_device> m_joy2;
5358   required_device<vic20_expansion_slot_device> m_exp;
5459   required_device<vic20_user_port_device> m_user;
5560   required_device<cassette_image_device> m_cassette;
src/mess/includes/c64.h
r15453r15454
1414#include "machine/cbmipt.h"
1515#include "machine/pls100.h"
1616#include "machine/ram.h"
17#include "machine/vic20ctrl.h"
1718#include "sound/dac.h"
1819#include "sound/sid6581.h"
1920#include "video/mos6566.h"
r15453r15454
4041        m_cia1(*this, MOS6526_1_TAG),
4142        m_cia2(*this, MOS6526_2_TAG),
4243        m_iec(*this, CBM_IEC_TAG),
44        m_joy1(*this, VIC20_CONTROL_PORT_1_TAG),
45        m_joy2(*this, VIC20_CONTROL_PORT_2_TAG),
4346        m_exp(*this, C64_EXPANSION_SLOT_TAG),
4447        m_user(*this, C64_USER_PORT_TAG),
4548        m_ram(*this, RAM_TAG),
r15453r15454
6669   required_device<mos6526_device> m_cia1;
6770   required_device<mos6526_device> m_cia2;
6871   optional_device<cbm_iec_device> m_iec;
72   required_device<vic20_control_port_device> m_joy1;
73   required_device<vic20_control_port_device> m_joy2;
6974   required_device<c64_expansion_slot_device> m_exp;
7075   required_device<c64_user_port_device> m_user;
7176   required_device<ram_device> m_ram;
src/mess/drivers/vic20.c
r15453r15454
797797
798798   MCFG_CBM_IEC_ADD(cbm_iec_intf, "c1541")
799799
800   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
801   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
800802   MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, expansion_intf, vic20_expansion_cards, NULL, NULL)
801803   MCFG_VIC20_USER_PORT_ADD(VIC20_USER_PORT_TAG, user_intf, vic20_user_port_cards, NULL, NULL)
802804
src/mess/drivers/c64.c
r15453r15454
11001100   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
11011101   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
11021102   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1103   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1104   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
11031105   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
11041106   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
11051107
r15453r15454
11601162   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
11611163   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
11621164   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1165   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1166   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
11631167   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
11641168   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
11651169
r15453r15454
12111215   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, sx1541_iec_devices, "sx1541", NULL)
12121216   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
12131217   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1218   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1219   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
12141220   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
12151221   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
12161222
r15453r15454
12591265   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
12601266   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
12611267   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1268   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1269   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
12621270   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
12631271   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
12641272
r15453r15454
13071315   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
13081316   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
13091317   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1318   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1319   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
13101320   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
13111321   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
13121322
r15453r15454
13581368   MCFG_CBM_IEC_SLOT_ADD("iec9", 9, cbm_iec_devices, NULL, NULL)
13591369   MCFG_CBM_IEC_SLOT_ADD("iec10", 10, cbm_iec_devices, NULL, NULL)
13601370   MCFG_CBM_IEC_SLOT_ADD("iec11", 11, cbm_iec_devices, NULL, NULL)
1371   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1372   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
13611373   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
13621374   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
13631375
r15453r15454
14061418   MCFG_CASSETTE_ADD(CASSETTE_TAG, cbm_cassette_interface)
14071419   MCFG_TIMER_ADD(TIMER_C1531_TAG, cassette_tick)
14081420   MCFG_CBM_IEC_ADD(iec_intf, "c1541")
1421   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1422   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
14091423   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
14101424   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
14111425
r15453r15454
14511465   MCFG_MOS6526R1_ADD(MOS6526_1_TAG, VIC6569_CLOCK, cia1_intf)
14521466   MCFG_MOS6526R1_ADD(MOS6526_2_TAG, VIC6569_CLOCK, cia2_intf)
14531467   MCFG_CBM_IEC_BUS_ADD(iec_intf)
1468   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_1_TAG, vic20_control_port_devices, NULL, NULL)
1469   MCFG_VIC20_CONTROL_PORT_ADD(VIC20_CONTROL_PORT_2_TAG, vic20_control_port_devices, NULL, NULL)
14541470   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, expansion_intf, c64_expansion_cards, NULL, NULL)
14551471   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
14561472
src/mess/mess.mak
r15453r15454
856856   $(MESS_MACHINE)/vic10exp.o   \
857857   $(MESS_MACHINE)/vic10std.o   \
858858   $(MESS_DRIVERS)/vic20.o      \
859   $(MESS_MACHINE)/vic20ctrl.o   \
859860   $(MESS_MACHINE)/vic20exp.o   \
860861   $(MESS_MACHINE)/vic20std.o   \
861862   $(MESS_MACHINE)/vic20user.o   \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team