~ubuntu-branches/ubuntu/quantal/vice/quantal

« back to all changes in this revision

Viewing changes to src/c64/c64cia1.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.1.7 upstream) (9.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090331003715-i5yisvcfv7mgz3eh
Tags: 2.1.dfsg-1
* New major upstream release (closes: #495937).
* Add desktop files (closes: #501181).

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
#include "rsuser.h"
46
46
#endif
47
47
 
 
48
#ifdef HAVE_MOUSE
 
49
#include "mouse.h"
 
50
#endif
48
51
 
49
52
void REGPARM2 cia1_store(WORD addr, BYTE data)
50
53
{
107
110
 
108
111
static void store_ciapa(cia_context_t *cia_context, CLOCK rclk, BYTE b)
109
112
{
110
 
 
 
113
    unsigned int i, m;
 
114
 
 
115
    for (m = 0x1, i = 0; i < 8; m <<= 1, i++) {
 
116
        if ((keyarr[i] & 0x10) && (!(b & m)))
 
117
            vicii_trigger_light_pen(maincpu_clk);
 
118
    }
 
119
 
 
120
#ifdef HAVE_MOUSE
 
121
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_NEOS) && (mouse_port == 2))
 
122
        neos_mouse_store(b);
 
123
#endif
111
124
}
112
125
 
113
126
static void undump_ciapa(cia_context_t *cia_context, CLOCK rclk, BYTE b)
120
133
    /* Falling edge triggers light pen.  */
121
134
    if ((byte ^ 0x10) & cia_context->old_pb & 0x10)
122
135
        vicii_trigger_light_pen(rclk);
 
136
 
 
137
#ifdef HAVE_MOUSE
 
138
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_NEOS) && (mouse_port == 1))
 
139
        neos_mouse_store(byte);
 
140
#endif
123
141
}
124
142
 
125
143
static void undump_ciapb(cia_context_t *cia_context, CLOCK rclk, BYTE byte)
126
144
{
127
 
 
128
145
}
129
146
 
130
147
static BYTE read_ciapa(cia_context_t *cia_context)
142
159
    byte = (val & (cia_context->c_cia[CIA_PRA]
143
160
           | ~(cia_context->c_cia[CIA_DDRA]))) & ~joystick_value[2];
144
161
 
 
162
#ifdef HAVE_MOUSE
 
163
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_NEOS) && (mouse_port == 2))
 
164
        byte &= neos_mouse_read();
 
165
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_AMIGA) && (mouse_port == 2))
 
166
        byte &= amiga_mouse_read();
 
167
#endif
 
168
 
145
169
    return byte;
146
170
}
147
171
 
160
184
    byte = (val & (cia_context->c_cia[CIA_PRB]
161
185
           | ~(cia_context->c_cia[CIA_DDRB]))) & ~joystick_value[1];
162
186
 
 
187
#ifdef HAVE_MOUSE
 
188
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_NEOS) && (mouse_port == 1))
 
189
        byte &= neos_mouse_read();
 
190
    if (_mouse_enabled && (mouse_type == MOUSE_TYPE_AMIGA) && (mouse_port == 1))
 
191
        byte &= amiga_mouse_read();
 
192
#endif
 
193
 
163
194
    return byte;
164
195
}
165
196