1
//============================================================================
5
// SS tttttt eeee ll ll aaaa
6
// SSSS tt ee ee ll ll aa
7
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8
// SS SS tt ee ll ll aa aa
9
// SSSS ttt eeeee llll llll aaaaa
11
// Copyright (c) 1995-1998 by Bradford W. Mott
13
// See the file "license" for information on usage and redistribution of
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
// $Id: Control.hxx,v 1.2 1998/07/15 20:51:07 bwmott Exp $
17
//============================================================================
19
#ifndef CONTROLLER_HXX
20
#define CONTROLLER_HXX
28
A controller is a device that plugs into either the left or right
29
controller jack of the Video Computer System (VCS). The pins of
30
the controller jacks are mapped as follows:
37
Left Controller Right Controller
39
pin 1 D4 PIA SWCHA D0 PIA SWCHA
40
pin 2 D5 PIA SWCHA D1 PIA SWCHA
41
pin 3 D6 PIA SWCHA D2 PIA SWCHA
42
pin 4 D7 PIA SWCHA D3 PIA SWCHA
43
pin 5 D7 TIA INPT1 (Dumped) D7 TIA INPT3 (Dumped)
44
pin 6 D7 TIA INPT4 (Latched) D7 TIA INPT5 (Latched)
47
pin 9 D7 TIA INPT0 (Dumped) D7 TIA INPT2 (Dumped)
49
Each of the pins connected to the PIA can be configured as an
50
input or output pin. The "dumped" TIA pins are used to charge
51
a capacitor. A potentiometer is sometimes connected to these
52
pins for analog input.
54
This is a base class for all controllers. It provides a view
55
of the controller from the prespective of the controller's jack.
57
@author Bradford W. Mott
58
@version $Id: Control.hxx,v 1.2 1998/07/15 20:51:07 bwmott Exp $
64
Enumeration of the controller jacks
73
Create a new controller plugged into the specified jack
75
@param jack The jack the controller is plugged into
76
@param event The event object to use for events
78
Controller(Jack jack, const Event& event);
83
virtual ~Controller();
87
Enumeration of the digital pins of a controller port
91
One, Two, Three, Four, Six
95
Enumeration of the analog pins of a controller port
104
Read the value of the specified digital pin for this controller.
106
@param pin The pin of the controller jack to read
107
@return The state of the pin
109
virtual bool read(DigitalPin pin) = 0;
112
Read the resistance at the specified analog pin for this controller.
113
The returned value is the resistance measured in ohms.
115
@param pin The pin of the controller jack to read
116
@return The resistance at the specified pin
118
virtual Int32 read(AnalogPin pin) = 0;
121
Write the given value to the specified digital pin for this
122
controller. Writing is only allowed to the pins associated
123
with the PIA. Therefore you cannot write to pin six.
125
@param pin The pin of the controller jack to write to
126
@param value The value to write to the pin
128
virtual void write(DigitalPin pin, bool value) = 0;
131
/// Constant which represents maximum resistance for analog pins
132
static const Int32 maximumResistance;
134
/// Constant which represents minimum resistance for analog pins
135
static const Int32 minimumResistance;
138
/// Specifies which jack the controller is plugged in
141
/// Reference to the event object this controller uses
142
const Event& myEvent;
145
// Copy constructor isn't supported by controllers so make it private
146
Controller(const Controller&);
148
// Assignment operator isn't supported by controllers so make it private
149
Controller& operator = (const Controller&);