Previous 15994 Revisions Next

r4737 Monday 18th May, 2009 at 10:12:21 UTC by Fabio Priuli
[CBM] Refactored code to reduce cross-references between c64, c65 and c128 (part 2 - CIA intf)
[src/mess/drivers]c128.c c65.c
[src/mess/includes]c128.h c64.h c65.h cbm.h
[src/mess/machine]c128.c c64.c c65.c cbm.c cbmipt.c cbmipt.h

src/mess/includes/cbm.h
r4736r4737
1515
1616/*----------- defined in machine/cbm.c -----------*/
1717
18/*---------- needed for keyboard reading ---------*/
19
20/* keyboard lines */
21extern UINT8 c64_keyline[10];
22void cbm_common_interrupt( const device_config *device );
23
24UINT8 common_cia0_port_a_r( const device_config *device, UINT8 output_b );
25UINT8 common_cia0_port_b_r( const device_config *device, UINT8 output_a );
26
27
1828/***********************************************
1929
2030   CBM Quickloads
src/mess/includes/c65.h
r4736r4737
77#ifndef C65_H_
88#define C65_H_
99
10#include "machine/6526cia.h"
1011
1112/*----------- defined in machine/c65.c -----------*/
1213
r4736r4737
2728MACHINE_START( c65 );
2829INTERRUPT_GEN( c65_frame_interrupt );
2930
31extern const cia6526_interface c65_ntsc_cia0, c65_pal_cia0;
32extern const cia6526_interface c65_ntsc_cia1, c65_pal_cia1;
3033
3134#endif /* C65_H_ */
src/mess/includes/c128.h
r4736r4737
1414#ifndef C128_H_
1515#define C128_H_
1616
17#include "machine/6526cia.h"
1718
1819/*----------- defined in machine/c128.c -----------*/
1920
r4736r4737
5859
5960void c128_bankswitch_64 (running_machine *machine, int reset);
6061
62extern const cia6526_interface c128_ntsc_cia0, c128_pal_cia0;
63extern const cia6526_interface c128_ntsc_cia1, c128_pal_cia1;
6164
6265#endif /* C128_H_ */
src/mess/includes/c64.h
r4736r4737
1919/*----------- defined in machine/c64.c -----------*/
2020
2121/* private area */
22extern UINT8 c65_6511_port;
23
2422extern UINT8 *c64_colorram;
2523extern UINT8 *c64_basic;
2624extern UINT8 *c64_kernal;
r4736r4737
5755extern int c64_tape_on;
5856extern UINT8 *c64_roml;
5957extern UINT8 *c64_romh;
60extern int c128_va1617;
6158extern UINT8 *c64_vicaddr, *c128_vicaddr;
6259extern UINT8 c64_game, c64_exrom;
6360extern const cia6526_interface c64_ntsc_cia0, c64_pal_cia0;
src/mess/machine/c65.c
r4736r4737
1212#include "machine/6526cia.h"
1313#include "video/vic4567.h"
1414
15#include "includes/cbm.h"
1516#include "includes/cbmserb.h"
1617#include "includes/cbmdrive.h"
17#include "cbmipt.h"            /* we need cbm_common_interrupt & c64_keyline for input reading */
1818
1919#include "includes/c65.h"
2020#include "includes/c64.h"
r4736r4737
3434
3535static int c64mode = 0;
3636
37static UINT8 c65_6511_port = 0xff;
3738static UINT8 c65_keyline = { 0xff };
3839
40static UINT8 serial_clock, serial_data, serial_atn;
41static UINT8 vicirq = 0;
3942
4043/*UINT8 *c65_basic; */
4144/*UINT8 *c65_kernal; */
r4736r4737
4548UINT8 *c65_interface;
4649/*UINT8 *c65_graphics; */
4750
51
52static void c65_nmi(running_machine *machine)
53{
54   static int nmilevel = 0;
55   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
56   int cia1irq = cia_get_irq(cia_1);
57
58   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
59   {
60      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
61
62      nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq;
63   }
64}
65
66
67/***********************************************
68
69   CIA Interfaces
70
71***********************************************/
72
73/*
74 *   CIA 0 - Port A keyboard line select
75 *   CIA 0 - Port B keyboard line read
76 *
77 *   flag cassette read input, serial request in
78 *   irq to irq connected
79 *
80 *   see machine/cbm.c
81 */
82
83static READ8_DEVICE_HANDLER( c65_cia0_port_a_r )
84{
85   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
86
87   return common_cia0_port_a_r(device, cia0portb);
88}
89
90static READ8_DEVICE_HANDLER( c65_cia0_port_b_r )
91{
92    UINT8 value = 0xff;
93   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
94
95   value &= common_cia0_port_b_r(device, cia0porta);
96
97   if (!(c65_6511_port & 0x02))
98      value &= c65_keyline;
99
100    return value;
101}
102
103static WRITE8_DEVICE_HANDLER( c65_cia0_port_b_w )
104{
105//   was there lightpen support in c65 video chip?
106//   vic2_lightpen_write(data & 0x10);
107}
108
109static void c65_irq (running_machine *machine, int level)
110{
111   static int old_level = 0;
112
113   if (level != old_level)
114   {
115      DBG_LOG (3, "mos6510", ("irq %s\n", level ? "start" : "end"));
116      cputag_set_input_line(machine, "maincpu", M6510_IRQ_LINE, level);
117      old_level = level;
118   }
119}
120
121static void c65_cia0_interrupt (const device_config *device, int level)
122{
123   c65_irq (device->machine, level || vicirq);
124}
125
126void c65_vic_interrupt (running_machine *machine, int level)
127{
128   const device_config *cia_0 = devtag_get_device(machine, "cia_0");
129#if 1
130   if (level != vicirq)
131   {
132      c65_irq (machine, level || cia_get_irq(cia_0));
133      vicirq = level;
134   }
135#endif
136}
137
138const cia6526_interface c65_ntsc_cia0 =
139{
140   DEVCB_LINE(c65_cia0_interrupt),
141   DEVCB_NULL,   /* pc_func */
142   60,
143
144   {
145      { DEVCB_HANDLER(c65_cia0_port_a_r), DEVCB_NULL },
146      { DEVCB_HANDLER(c65_cia0_port_b_r), DEVCB_HANDLER(c65_cia0_port_b_w) }
147   }
148};
149
150const cia6526_interface c65_pal_cia0 =
151{
152   DEVCB_LINE(c65_cia0_interrupt),
153   DEVCB_NULL,   /* pc_func */
154   50,
155
156   {
157      { DEVCB_HANDLER(c65_cia0_port_a_r), DEVCB_NULL },
158      { DEVCB_HANDLER(c65_cia0_port_b_r), DEVCB_HANDLER(c65_cia0_port_b_w) }
159   }
160};
161
162/*
163 * CIA 1 - Port A
164 * bit 7 serial bus data input
165 * bit 6 serial bus clock input
166 * bit 5 serial bus data output
167 * bit 4 serial bus clock output
168 * bit 3 serial bus atn output
169 * bit 2 rs232 data output
170 * bits 1-0 vic-chip system memory bank select
171 *
172 * CIA 1 - Port B
173 * bit 7 user rs232 data set ready
174 * bit 6 user rs232 clear to send
175 * bit 5 user
176 * bit 4 user rs232 carrier detect
177 * bit 3 user rs232 ring indicator
178 * bit 2 user rs232 data terminal ready
179 * bit 1 user rs232 request to send
180 * bit 0 user rs232 received data
181 *
182 * flag restore key or rs232 received data input
183 * irq to nmi connected ?
184 */
185static READ8_DEVICE_HANDLER( c65_cia1_port_a_r )
186{
187   UINT8 value = 0xff;
188
189   if (!serial_clock || !cbm_serial_clock_read (device->machine))
190      value &= ~0x40;
191
192   if (!serial_data || !cbm_serial_data_read (device->machine))
193      value &= ~0x80;
194
195   return value;
196}
197
198static WRITE8_DEVICE_HANDLER( c65_cia1_port_a_w )
199{
200   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
201
202   cbm_serial_clock_write (device->machine, serial_clock = !(data & 0x10));
203   cbm_serial_data_write (device->machine, serial_data = !(data & 0x20));
204   cbm_serial_atn_write (device->machine, serial_atn = !(data & 0x08));
205   c64_vicaddr = c64_memory + helper[data & 0x03];
206}
207
208static void c65_cia1_interrupt (const device_config *device, int level)
209{
210   c65_nmi(device->machine);
211}
212
213
214const cia6526_interface c65_ntsc_cia1 =
215{
216   DEVCB_LINE(c65_cia1_interrupt),
217   DEVCB_NULL,   /* pc_func */
218   60,
219
220   {
221      { DEVCB_HANDLER(c65_cia1_port_a_r), DEVCB_HANDLER(c65_cia1_port_a_w) },
222      { DEVCB_NULL, DEVCB_NULL }
223   }
224};
225
226const cia6526_interface c65_pal_cia1 =
227{
228   DEVCB_LINE(c65_cia1_interrupt),
229   DEVCB_NULL,   /* pc_func */
230   50,
231
232   {
233      { DEVCB_HANDLER(c65_cia1_port_a_r), DEVCB_HANDLER(c65_cia1_port_a_w) },
234      { DEVCB_NULL, DEVCB_NULL }
235   }
236};
237
238/***********************************************
239
240   Memory Handlers
241
242***********************************************/
243
48244/* processor has only 1 mega address space !? */
49245/* and system 8 megabyte */
50246/* dma controller and bankswitch hardware ?*/
r4736r4737
8201016
8211017   /*memset(c64_memory+0x40000, 0, 0x800000-0x40000); */
8221018
823   vic4567_init(machine, c64_pal, c65_dma_read, c65_dma_read_color,
824              c64_vic_interrupt, c65_bankswitch_interface);
1019   vic4567_init(machine, c64_pal, c65_dma_read, c65_dma_read_color, c65_vic_interrupt, c65_bankswitch_interface);
8251020}
8261021
8271022DRIVER_INIT( c65 )
r4736r4737
8561051}
8571052
8581053
859static void c65_nmi(running_machine *machine)
860{
861   static int nmilevel = 0;
862   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
863   int cia1irq = cia_get_irq(cia_1);
864
865   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
866   {
867      cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
868
869      nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq;
870   }
871}
872
873
8741054INTERRUPT_GEN( c65_frame_interrupt )
8751055{
8761056   int value;
src/mess/machine/c128.c
r4736r4737
1515#include "sound/sid6581.h"
1616#include "machine/6526cia.h"
1717
18#include "includes/cbm.h"
1819#include "includes/cbmserb.h"
1920#include "includes/vc1541.h"
2021#include "video/vic6567.h"
2122#include "video/vdc8563.h"
2223
23#include "cbmipt.h"            /* we need cbm_common_interrupt & c64_keyline for input reading */
2424
2525#include "includes/c128.h"
2626#include "includes/c64.h"
r4736r4737
7474
7575static UINT8 c128_keyline[3] = {0xff, 0xff, 0xff};
7676
77static int c128_va1617;
78static UINT8 serial_clock, serial_data, serial_atn;
79static UINT8 vicirq = 0;
80
81static void c128_nmi(running_machine *machine)
82{
83   static int nmilevel = 0;
84   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
85   int cia1irq = cia_get_irq(cia_1);
86
87   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
88   {
89      if (1) // this was never valid, there is no active CPU during a timer firing!  cpu_getactivecpu() == 0)
90      {
91         /* z80 */
92         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
93      }
94      else
95      {
96         cputag_set_input_line(machine, "m8502", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
97      }
98
99      nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq;
100   }
101}
102
103/***********************************************
104
105   CIA Interfaces
106
107***********************************************/
108
109/*
110 *   CIA 0 - Port A keyboard line select
111 *   CIA 0 - Port B keyboard line read
112 *
113 *   flag cassette read input, serial request in
114 *   irq to irq connected
115 *
116 *   see machine/cbm.c
117 */
118
119static READ8_DEVICE_HANDLER( c128_cia0_port_a_r )
120{
121   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
122
123   return common_cia0_port_a_r(device, cia0portb);
124}
125
126static READ8_DEVICE_HANDLER( c128_cia0_port_b_r )
127{
128    UINT8 value = 0xff;
129   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
130
131   value &= common_cia0_port_b_r(device, cia0porta);
132
133   if (!vic2e_k0_r())
134      value &= c128_keyline[0];
135   if (!vic2e_k1_r())
136      value &= c128_keyline[1];
137   if (!vic2e_k2_r())
138      value &= c128_keyline[2];
139
140    return value;
141}
142
143static WRITE8_DEVICE_HANDLER( c128_cia0_port_b_w )
144{
145    vic2_lightpen_write(data & 0x10);
146}
147
148static void c128_irq (running_machine *machine, int level)
149{
150   static int old_level = 0;
151
152   if (level != old_level)
153   {
154      DBG_LOG (3, "mos6510", ("irq %s\n", level ? "start" : "end"));
155
156      if (0) // && (cpu_getactivecpu() == 0))
157      {
158         cputag_set_input_line(machine, "maincpu", 0, level);
159      }
160      else
161      {
162         cputag_set_input_line(machine, "m8502", M6510_IRQ_LINE, level);
163      }
164
165      old_level = level;
166   }
167}
168
169static void c128_cia0_interrupt (const device_config *device, int level)
170{
171   c128_irq (device->machine, level || vicirq);
172}
173
174void c128_vic_interrupt (running_machine *machine, int level)
175{
176   const device_config *cia_0 = devtag_get_device(machine, "cia_0");
177#if 1
178   if (level != vicirq)
179   {
180      c128_irq (machine, level || cia_get_irq(cia_0));
181      vicirq = level;
182   }
183#endif
184}
185
186const cia6526_interface c128_ntsc_cia0 =
187{
188   DEVCB_LINE(c128_cia0_interrupt),
189   DEVCB_NULL,   /* pc_func */
190   60,
191
192   {
193      { DEVCB_HANDLER(c128_cia0_port_a_r), DEVCB_NULL },
194      { DEVCB_HANDLER(c128_cia0_port_b_r), DEVCB_HANDLER(c128_cia0_port_b_w) }
195   }
196};
197
198const cia6526_interface c128_pal_cia0 =
199{
200   DEVCB_LINE(c128_cia0_interrupt),
201   DEVCB_NULL,   /* pc_func */
202   50,
203
204   {
205      { DEVCB_HANDLER(c128_cia0_port_a_r), DEVCB_NULL },
206      { DEVCB_HANDLER(c128_cia0_port_b_r), DEVCB_HANDLER(c128_cia0_port_b_w) }
207   }
208};
209
210
211/*
212 * CIA 1 - Port A
213 * bit 7 serial bus data input
214 * bit 6 serial bus clock input
215 * bit 5 serial bus data output
216 * bit 4 serial bus clock output
217 * bit 3 serial bus atn output
218 * bit 2 rs232 data output
219 * bits 1-0 vic-chip system memory bank select
220 *
221 * CIA 1 - Port B
222 * bit 7 user rs232 data set ready
223 * bit 6 user rs232 clear to send
224 * bit 5 user
225 * bit 4 user rs232 carrier detect
226 * bit 3 user rs232 ring indicator
227 * bit 2 user rs232 data terminal ready
228 * bit 1 user rs232 request to send
229 * bit 0 user rs232 received data
230 *
231 * flag restore key or rs232 received data input
232 * irq to nmi connected ?
233 */
234static READ8_DEVICE_HANDLER( c128_cia1_port_a_r )
235{
236   UINT8 value = 0xff;
237
238   if (!serial_clock || !cbm_serial_clock_read (device->machine))
239      value &= ~0x40;
240
241   if (!serial_data || !cbm_serial_data_read (device->machine))
242      value &= ~0x80;
243
244   return value;
245}
246
247static WRITE8_DEVICE_HANDLER( c128_cia1_port_a_w )
248{
249   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
250
251   cbm_serial_clock_write (device->machine, serial_clock = !(data & 0x10));
252   cbm_serial_data_write (device->machine, serial_data = !(data & 0x20));
253   cbm_serial_atn_write (device->machine, serial_atn = !(data & 0x08));
254   c64_vicaddr = c64_memory + helper[data & 0x03];
255   c128_vicaddr = c64_memory + helper[data & 0x03] + c128_va1617;
256}
257
258static void c128_cia1_interrupt (const device_config *device, int level)
259{
260   c128_nmi(device->machine);
261}
262
263const cia6526_interface c128_ntsc_cia1 =
264{
265   DEVCB_LINE(c128_cia1_interrupt),
266   DEVCB_NULL,   /* pc_func */
267   60,
268
269   {
270      { DEVCB_HANDLER(c128_cia1_port_a_r), DEVCB_HANDLER(c128_cia1_port_a_w) },
271      { DEVCB_NULL, DEVCB_NULL }
272   }
273};
274
275const cia6526_interface c128_pal_cia1 =
276{
277   DEVCB_LINE(c128_cia1_interrupt),
278   DEVCB_NULL,   /* pc_func */
279   50,
280
281   {
282      { DEVCB_HANDLER(c128_cia1_port_a_r), DEVCB_HANDLER(c128_cia1_port_a_w) },
283      { DEVCB_NULL, DEVCB_NULL }
284   }
285};
286
287/***********************************************
288
289   Memory Handlers
290
291***********************************************/
292
77293static void c128_set_m8502_read_handler(running_machine *machine, UINT16 start, UINT16 end, read8_space_func rh)
78294{
79295   const device_config *cpu;
r4736r4737
8801096      data |=  0x10;
8811097
8821098   if (input_port_read(device->machine, "SPECIAL") & 0x20)      /* Check Caps Lock */
883   {
8841099      data &= ~0x40;
885   } else {
1100   else
8861101      data |=  0x40;
887   }
8881102
8891103   return data;
8901104}
r4736r4737
9211135{
9221136   c64_tape_on = 1;
9231137   c128_common_driver_init(machine);
924   vic6567_init (1, c64_pal,
925              c128_dma_read, c128_dma_read_color, c64_vic_interrupt);
1138   vic6567_init (1, c64_pal, c128_dma_read, c128_dma_read_color, c128_vic_interrupt);
9261139   vic2_set_rastering(0);
9271140   vdc8563_init(0);
9281141   vdc8563_set_rastering(1);
r4736r4737
9331146   c64_tape_on = 1;
9341147   c64_pal = 1;
9351148   c128_common_driver_init(machine);
936   vic6567_init (1, c64_pal,
937              c128_dma_read, c128_dma_read_color, c64_vic_interrupt);
1149   vic6567_init (1, c64_pal, c128_dma_read, c128_dma_read_color, c128_vic_interrupt);
9381150   vic2_set_rastering(1);
9391151   vdc8563_init(0);
9401152   vdc8563_set_rastering(0);
r4736r4737
9521164//   drive_config (machine, type_1541, 0, 0, 1, 8);
9531165}
9541166
1167#if 0
1168// This was in MACHINE_START( c64 ), but never called
1169// TO DO: find its correct use, when fixing c64 mode
1170MACHINE_START( c128 )
1171{
1172   if (c64mode)
1173      c128_bankswitch_64(machine, 1);
1174}
1175#endif
9551176
9561177MACHINE_RESET( c128 )
9571178{
r4736r4737
9641185}
9651186
9661187
967static void c128_nmi(running_machine *machine)
968{
969   static int nmilevel = 0;
970   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
971   int cia1irq = cia_get_irq(cia_1);
972
973   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
974   {
975      if (1) // this was never valid, there is no active CPU during a timer firing!  cpu_getactivecpu() == 0)
976      {
977         /* z80 */
978         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
979      }
980      else
981      {
982         cputag_set_input_line(machine, "m8502", INPUT_LINE_NMI, (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq);
983      }
984
985      nmilevel = (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq;
986   }
987}
988
9891188INTERRUPT_GEN( c128_frame_interrupt )
9901189{
9911190   static int monitor = -1;
src/mess/machine/cbmipt.c
r4736r4737
2020#include "machine/cbmipt.h"
2121
2222
23
24
25/***********************************************
26
27   Input Reading - Common Components
28
29***********************************************/
30
31/* These are needed by c64, c65 and c128, each machine has also additional specific
32components in its INTERRUPT_GEN */
33
34/* keyboard lines */
35UINT8 c64_keyline[10] =
36{
37   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
38};
39
40
41static TIMER_CALLBACK( lightpen_tick )
42{
43   if ((input_port_read(machine, "CTRLSEL") & 0x07) == 0x04)
44   {
45      /* enable lightpen crosshair */
46      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL);
47   }
48   else
49   {
50      /* disable lightpen crosshair */
51      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE);
52   }
53}
54
55void cbm_common_interrupt( const device_config *device )
56{
57   int value, i;
58   int controller1 = input_port_read(device->machine, "CTRLSEL") & 0x07;
59   int controller2 = input_port_read(device->machine, "CTRLSEL") & 0x70;
60   static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" };
61
62   /* Lines 0-7 : common keyboard */
63   for (i = 0; i < 8; i++)
64   {
65      value = 0xff;
66      value &= ~input_port_read(device->machine, c64ports[i]);
67
68      /* Shift Lock is mapped on Left Shift */
69      if ((i == 1) && (input_port_read(device->machine, "SPECIAL") & 0x40))
70         value &= ~0x80;
71
72      c64_keyline[i] = value;
73   }
74
75
76   value = 0xff;
77   switch(controller1)
78   {
79      case 0x00:
80         value &= ~input_port_read(device->machine, "JOY1_1B");         /* Joy1 Directions + Button 1 */
81         break;
82
83      case 0x01:
84         if (input_port_read(device->machine, "OTHER") & 0x40)         /* Paddle2 Button */
85            value &= ~0x08;
86         if (input_port_read(device->machine, "OTHER") & 0x80)         /* Paddle1 Button */
87            value &= ~0x04;
88         break;
89
90      case 0x02:
91         if (input_port_read(device->machine, "OTHER") & 0x02)         /* Mouse Button Left */
92            value &= ~0x10;
93         if (input_port_read(device->machine, "OTHER") & 0x01)         /* Mouse Button Right */
94            value &= ~0x01;
95         break;
96
97      case 0x03:
98         value &= ~(input_port_read(device->machine, "JOY1_2B") & 0x1f);   /* Joy1 Directions + Button 1 */
99         break;
100
101      case 0x04:
102/* was there any input on the lightpen? where is it mapped? */
103//         if (input_port_read(device->machine, "OTHER") & 0x04)         /* Lightpen Signal */
104//            value &= ?? ;
105         break;
106
107      case 0x07:
108         break;
109
110      default:
111         logerror("Invalid Controller 1 Setting %d\n", controller1);
112         break;
113   }
114
115   c64_keyline[8] = value;
116
117
118   value = 0xff;
119   switch(controller2)
120   {
121      case 0x00:
122         value &= ~input_port_read(device->machine, "JOY2_1B");         /* Joy2 Directions + Button 1 */
123         break;
124
125      case 0x10:
126         if (input_port_read(device->machine, "OTHER") & 0x10)         /* Paddle4 Button */
127            value &= ~0x08;
128         if (input_port_read(device->machine, "OTHER") & 0x20)         /* Paddle3 Button */
129            value &= ~0x04;
130         break;
131
132      case 0x20:
133         if (input_port_read(device->machine, "OTHER") & 0x02)         /* Mouse Button Left */
134            value &= ~0x10;
135         if (input_port_read(device->machine, "OTHER") & 0x01)         /* Mouse Button Right */
136            value &= ~0x01;
137         break;
138
139      case 0x30:
140         value &= ~(input_port_read(device->machine, "JOY2_2B") & 0x1f);   /* Joy2 Directions + Button 1 */
141         break;
142
143      case 0x40:
144/* was there any input on the lightpen? where is it mapped? */
145//         if (input_port_read(device->machine, "OTHER") & 0x04)         /* Lightpen Signal */
146//            value &= ?? ;
147         break;
148
149      case 0x70:
150         break;
151
152      default:
153         logerror("Invalid Controller 2 Setting %d\n", controller2);
154         break;
155   }
156
157   c64_keyline[9] = value;
158
159//   vic2_frame_interrupt does nothing so this is not necessary
160//   vic2_frame_interrupt (device);
161
162   /* check if lightpen has been chosen as input: if so, enable crosshair */
163   timer_set(device->machine, attotime_zero, NULL, 0, lightpen_tick);
164
165   set_led_status (1, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0);      /* Shift Lock */
166   set_led_status (0, input_port_read(device->machine, "CTRLSEL") & 0x80 ? 1 : 0);      /* Joystick Swap */
167}
168
169
170
171
172/***********************************************
173
174   Input Ports
175
176***********************************************/
177
17823/***************************** Commodore 64 ****************************************
17924 *
18025 *   - common_cbm_keyboard: C64 keyboard; used by C16, C65 and C128 as well
r4736r4737
19035-------------------
19136
19237                                                                           CLR    INST
193    <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL           f 1
38    <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL           f 1
19439
19540 
19641    CTRL   Q    W    E    R    T     Y    U    I    O    P    @    *     UP    RESTORE          f 3
r4736r4737
20550                                 SPACEBAR
20651
20752
208Notes: “C=� is a key with the Commodore logo, “UP� is an arrow pointing up, the “CRSR� keys at the
53Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the
20954bottom-right corner are used to move the cursor on screen (Up/Down and Left/Right resp.).
21055*/
21156
r4736r4737
278123   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift (Right)") PORT_CODE(KEYCODE_RSHIFT)   PORT_CHAR(UCHAR_SHIFT_1)
279124   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Home  Clr") PORT_CODE(KEYCODE_INSERT)      PORT_CHAR(UCHAR_MAMEKEY(HOME))
280125   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE)                        PORT_CHAR(';') PORT_CHAR(']')
281    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)                  PORT_CHAR('*')
126   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE)                  PORT_CHAR('*')
282127   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH2)                  PORT_CHAR('\xA3')
283128
284129   PORT_START( "ROW7" )
r4736r4737
295140
296141INPUT_PORTS_START( c64_special )
297142   PORT_START( "SPECIAL" )  /* special keys */   
298    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)
143   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)
299144   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
300145   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )                                       
301146   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )   
r4736r4737
319164//   PORT_CATEGORY_ITEM( 0x30, "Mouse (Non Proportional) 1350", 23 )
320165   PORT_CATEGORY_ITEM( 0x70, "No Device Connected", 27 )
321166   PORT_CONFNAME( 0x80, 0x00, "Swap Gameport A and B") PORT_CODE(KEYCODE_F1) PORT_TOGGLE
322   PORT_CONFSETTING(    0x00, DEF_STR( No ) )     
323   PORT_CONFSETTING(    0x80, DEF_STR( Yes ) )
167   PORT_CONFSETTING(   0x00, DEF_STR( No ) )     
168   PORT_CONFSETTING(   0x80, DEF_STR( Yes ) )
324169
325170   PORT_START("JOY1_1B")
326171   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10)
r4736r4737
328173   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10)
329174   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_CATEGORY(10)
330175   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_CATEGORY(10)
331    PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
176   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
332177
333178   PORT_START("JOY2_1B")
334179   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH)
r4736r4737
336181   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH)
337182   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH)
338183   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_CATEGORY(20) PORT_CODE(KEYCODE_INSERT) PORT_CODE(JOYCODE_BUTTON1)
339    PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
184   PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
340185
341186   /* Mouse Commodore 1350 was basically working as a Joystick */
342187   PORT_START("JOY1_2B")
r4736r4737
346191   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Mouse 1350 Right") PORT_CATEGORY(13)
347192   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 1") PORT_CATEGORY(13)
348193   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Mouse 1350 Button 2") PORT_CATEGORY(13)
349    PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
194   PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNUSED )
350195
351196   /* Still to verify how many mices you were able to plug into a c64 */
352197   /* Only one, for now */
353198   PORT_START("JOY2_2B")
354    PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
199   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
355200/*   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH)
356201   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH)
357202   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(23) PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH)
r4736r4737
421266  STOP  LOCK   A    S    D    F     G     H    J    K    L   :[   ;]    *      RETURN             f 5
422267 
423268 
424  C=    SHIFT     Z    X    C    V    B     N    M    ,<   .>   /?   SHIFT     Â£     =           HELP
269  C=    SHIFT     Z    X    C    V    B     N    M    ,<   .>   /?   SHIFT     £     =            HELP
425270 
426271 
427272                                 SPACEBAR
r4736r4737
459304     ESC   1!   2"   3#   4$   5%   6&   7'   8(   9)   0^   +    -     =    HOME    DEL        ||      @  +  -  =
460305                                                                                                ||
461306                                                                                                ||
462   CONTROL   Q    W    E    R    T     Y    U    I    O    P    @    £     *    CONTROL         ||      7  8  9  *
307   CONTROL   Q    W    E    R    T     Y    U    I    O    P    @    £     *    CONTROL         ||      7  8  9  *
463308                                                                                                ||
464309  RUN   SHIFT                                                                                   ||
465310  STOP  LOCK   A    S    D    F     G     H    J    K    L   :[   ;]    RETURN                  ||      4  5  6  /
r4736r4737
544389     ESC  TAB  ALT  LOCK           HELP  FEED  DISPLAY SCROLL      UP  DOWN  LEFT  RIGHT          F1  F3  F5  F7
545390 
546391                                                                             CLR    INST
547      <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL          7   8   9   +
392      <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL           7   8   9   +
548393 
549394   
550395   CONTROL   Q    W    E    R    T     Y    U    I    O    P    @    *     UP    RESTORE          4   5   6   -
r4736r4737
565410
566411INPUT_PORTS_START( c128_special )
567412   PORT_START( "SPECIAL" )  /* special keys */   
568    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
413   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
569414   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
570415   PORT_DIPNAME( 0x20, 0x00, "Caps Lock (switch)")                                       
571416   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )                                         
r4736r4737
619464*/
620465INPUT_PORTS_START( c65_special )
621466   PORT_START( "SPECIAL" )  /* special keys */   
622    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
467   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
623468   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
624469   PORT_DIPNAME( 0x20, 0x00, "(C65) Caps Lock (switch)") PORT_CODE(KEYCODE_F3)                 
625470   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )                                         
r4736r4737
899744
900745
901746INPUT_PORTS_START( pet_config )
902    PORT_START("CFG")
747   PORT_START("CFG")
903748   PORT_DIPNAME( 0x180, 0x180, "Memory")               
904749   PORT_DIPSETTING(   0x000, "4 KByte" )               
905750   PORT_DIPSETTING(   0x080, "8 KByte" )               
r4736r4737
933778     F1    F2   F3   F4   F5   F6   F7   F8   F9  F10      DOWN  UP  LEFT  RIGHT     HOME/CLEAR   DEL/INST
934779 
935780                                                                            INS 
936     ESC   1!   2"   3#   4$   5%   6^   7&   8*   9(   0)   -   =+   <-£   DEL          ?   CE    .    /
781     ESC   1!   2"   3#   4$   5%   6^   7&   8*   9(   0)   -   =+   <-£   DEL          ?   CE    .    /
937782 
938783                                                                         ________   
939784     TAB     Q    W    E    R    T     Y    U    I    O    P    [    ]  | RETURN |       7    8    9    -
r4736r4737
948793              CTRL               SPACEBAR                                              0      .    00   r
949794
950795
951Notes: "C=" is a key with the Commodore logo, Shift+6 produces an arrow pointing up (''^'' above).
796Notes: "C=" is a key with the Commodore logo, Shift+6 produces an arrow pointing up ("^" above).
952797
953798
954799*/
r4736r4737
1103948---------------------
1104949
1105950                                                                           CLR    INST
1106    <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL           f 1
951    <-   1!   2"   3#   4$   5%   6&   7'   8(   9)   0     +    -    £    HOME   DEL           f 1
1107952
1108953 
1109954    CTRL   Q    W    E    R    T     Y    U    I    O    P    @    *     UP    RESTORE          f 3
r4736r4737
1118963                                 SPACEBAR
1119964
1120965
1121Notes: “C=� is a key with the Commodore logo, “UP� is an arrow pointing up, the “CRSR� keys at the
966Notes: "C=" is a key with the Commodore logo, "UP" is an arrow pointing up, the "CRSR" keys at the
1122967bottom-right corner are used to move the cursor on screen (Up/Down and Left/Right respectively).
1123968Notice that this is exactly the same layout of C64 keyboard.
1124969 
r4736r4737
12091054
12101055INPUT_PORTS_START( vic_special )
12111056   PORT_START( "SPECIAL" )  /* special keys */   
1212    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
1057   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Restore") PORT_CODE(KEYCODE_PRTSCR)   
12131058   PORT_DIPNAME( 0x01, 0x00, "Shift Lock (switch)") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE     
12141059   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )                                         
12151060   PORT_DIPSETTING(   0x01, DEF_STR( On ) )
src/mess/machine/cbmipt.h
r4736r4737
22#define CBMIPT_H_
33
44
5/*---------- needed for keyboard reading ---------*/
6
7/* keyboard lines */
8extern UINT8 c64_keyline[10];
9void cbm_common_interrupt( const device_config *device );
10
11
12/*------------------ input ports -----------------*/
13
145/* Commodore 64 */
156
167INPUT_PORTS_EXTERN( common_cbm_keyboard );   /* shared with c16, c65, c128 */
src/mess/machine/cbm.c
r4736r4737
88
99/***********************************************
1010
11   Input Reading - Common Components
12
13***********************************************/
14
15/* These are needed by c64, c65 and c128, each machine has also additional specific
16components in its INTERRUPT_GEN */
17
18/* keyboard lines */
19UINT8 c64_keyline[10] =
20{
21   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
22};
23
24
25static TIMER_CALLBACK( lightpen_tick )
26{
27   if ((input_port_read(machine, "CTRLSEL") & 0x07) == 0x04)
28   {
29      /* enable lightpen crosshair */
30      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_ALL);
31   }
32   else
33   {
34      /* disable lightpen crosshair */
35      crosshair_set_screen(machine, 0, CROSSHAIR_SCREEN_NONE);
36   }
37}
38
39void cbm_common_interrupt( const device_config *device )
40{
41   int value, i;
42   int controller1 = input_port_read(device->machine, "CTRLSEL") & 0x07;
43   int controller2 = input_port_read(device->machine, "CTRLSEL") & 0x70;
44   static const char *const c64ports[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" };
45
46   /* Lines 0-7 : common keyboard */
47   for (i = 0; i < 8; i++)
48   {
49      value = 0xff;
50      value &= ~input_port_read(device->machine, c64ports[i]);
51
52      /* Shift Lock is mapped on Left Shift */
53      if ((i == 1) && (input_port_read(device->machine, "SPECIAL") & 0x40))
54         value &= ~0x80;
55
56      c64_keyline[i] = value;
57   }
58
59
60   value = 0xff;
61   switch(controller1)
62   {
63      case 0x00:
64         value &= ~input_port_read(device->machine, "JOY1_1B");         /* Joy1 Directions + Button 1 */
65         break;
66
67      case 0x01:
68         if (input_port_read(device->machine, "OTHER") & 0x40)         /* Paddle2 Button */
69            value &= ~0x08;
70         if (input_port_read(device->machine, "OTHER") & 0x80)         /* Paddle1 Button */
71            value &= ~0x04;
72         break;
73
74      case 0x02:
75         if (input_port_read(device->machine, "OTHER") & 0x02)         /* Mouse Button Left */
76            value &= ~0x10;
77         if (input_port_read(device->machine, "OTHER") & 0x01)         /* Mouse Button Right */
78            value &= ~0x01;
79         break;
80
81      case 0x03:
82         value &= ~(input_port_read(device->machine, "JOY1_2B") & 0x1f);   /* Joy1 Directions + Button 1 */
83         break;
84
85      case 0x04:
86/* was there any input on the lightpen? where is it mapped? */
87//         if (input_port_read(device->machine, "OTHER") & 0x04)         /* Lightpen Signal */
88//            value &= ?? ;
89         break;
90
91      case 0x07:
92         break;
93
94      default:
95         logerror("Invalid Controller 1 Setting %d\n", controller1);
96         break;
97   }
98
99   c64_keyline[8] = value;
100
101
102   value = 0xff;
103   switch(controller2)
104   {
105      case 0x00:
106         value &= ~input_port_read(device->machine, "JOY2_1B");         /* Joy2 Directions + Button 1 */
107         break;
108
109      case 0x10:
110         if (input_port_read(device->machine, "OTHER") & 0x10)         /* Paddle4 Button */
111            value &= ~0x08;
112         if (input_port_read(device->machine, "OTHER") & 0x20)         /* Paddle3 Button */
113            value &= ~0x04;
114         break;
115
116      case 0x20:
117         if (input_port_read(device->machine, "OTHER") & 0x02)         /* Mouse Button Left */
118            value &= ~0x10;
119         if (input_port_read(device->machine, "OTHER") & 0x01)         /* Mouse Button Right */
120            value &= ~0x01;
121         break;
122
123      case 0x30:
124         value &= ~(input_port_read(device->machine, "JOY2_2B") & 0x1f);   /* Joy2 Directions + Button 1 */
125         break;
126
127      case 0x40:
128/* was there any input on the lightpen? where is it mapped? */
129//         if (input_port_read(device->machine, "OTHER") & 0x04)         /* Lightpen Signal */
130//            value &= ?? ;
131         break;
132
133      case 0x70:
134         break;
135
136      default:
137         logerror("Invalid Controller 2 Setting %d\n", controller2);
138         break;
139   }
140
141   c64_keyline[9] = value;
142
143//   vic2_frame_interrupt does nothing so this is not necessary
144//   vic2_frame_interrupt (device);
145
146   /* check if lightpen has been chosen as input: if so, enable crosshair */
147   timer_set(device->machine, attotime_zero, NULL, 0, lightpen_tick);
148
149   set_led_status (1, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0);      /* Shift Lock */
150   set_led_status (0, input_port_read(device->machine, "CTRLSEL") & 0x80 ? 1 : 0);      /* Joystick Swap */
151}
152
153
154/***********************************************
155
156   CIA Common Handlers
157
158***********************************************/
159
160/* These are shared by c64, c65 and c128. c65 and c128 also have additional specific
161components (to select/read additional keyboard lines) */
162
163/*
164 *   CIA 0 - Port A
165 * bits 7-0 keyboard line select
166 * bits 7,6: paddle select( 01 port a, 10 port b)
167 * bit 4: joystick a fire button
168 * bits 3,2: Paddles port a fire button
169 * bits 3-0: joystick a direction
170 *
171 *   CIA 0 - Port B
172 * bits 7-0: keyboard raw values
173 * bit 4: joystick b fire button, lightpen select
174 * bits 3,2: paddle b fire buttons (left,right)
175 * bits 3-0: joystick b direction
176 *
177 * flag cassette read input, serial request in
178 * irq to irq connected
179 */
180
181UINT8 common_cia0_port_a_r( const device_config *device, UINT8 output_b )
182{
183   UINT8 value = 0xff;
184
185   if (!(output_b & 0x80))
186   {
187      UINT8 t = 0xff;
188      if (!(c64_keyline[7] & 0x80)) t &= ~0x80;
189      if (!(c64_keyline[6] & 0x80)) t &= ~0x40;
190      if (!(c64_keyline[5] & 0x80)) t &= ~0x20;
191      if (!(c64_keyline[4] & 0x80)) t &= ~0x10;
192      if (!(c64_keyline[3] & 0x80)) t &= ~0x08;
193      if (!(c64_keyline[2] & 0x80)) t &= ~0x04;
194      if (!(c64_keyline[1] & 0x80)) t &= ~0x02;
195      if (!(c64_keyline[0] & 0x80)) t &= ~0x01;
196      value &= t;
197   }
198
199   if (!(output_b & 0x40))
200   {
201      UINT8 t = 0xff;
202      if (!(c64_keyline[7] & 0x40)) t &= ~0x80;
203      if (!(c64_keyline[6] & 0x40)) t &= ~0x40;
204      if (!(c64_keyline[5] & 0x40)) t &= ~0x20;
205      if (!(c64_keyline[4] & 0x40)) t &= ~0x10;
206      if (!(c64_keyline[3] & 0x40)) t &= ~0x08;
207      if (!(c64_keyline[2] & 0x40)) t &= ~0x04;
208      if (!(c64_keyline[1] & 0x40)) t &= ~0x02;
209      if (!(c64_keyline[0] & 0x40)) t &= ~0x01;
210      value &= t;
211   }
212
213   if (!(output_b & 0x20))
214   {
215      UINT8 t = 0xff;
216      if (!(c64_keyline[7] & 0x20)) t &= ~0x80;
217      if (!(c64_keyline[6] & 0x20)) t &= ~0x40;
218      if (!(c64_keyline[5] & 0x20)) t &= ~0x20;
219      if (!(c64_keyline[4] & 0x20)) t &= ~0x10;
220      if (!(c64_keyline[3] & 0x20)) t &= ~0x08;
221      if (!(c64_keyline[2] & 0x20)) t &= ~0x04;
222      if (!(c64_keyline[1] & 0x20)) t &= ~0x02;
223      if (!(c64_keyline[0] & 0x20)) t &= ~0x01;
224      value &= t;
225   }
226
227   if (!(output_b & 0x10))
228   {
229      UINT8 t = 0xff;
230      if (!(c64_keyline[7] & 0x10)) t &= ~0x80;
231      if (!(c64_keyline[6] & 0x10)) t &= ~0x40;
232      if (!(c64_keyline[5] & 0x10)) t &= ~0x20;
233      if (!(c64_keyline[4] & 0x10)) t &= ~0x10;
234      if (!(c64_keyline[3] & 0x10)) t &= ~0x08;
235      if (!(c64_keyline[2] & 0x10)) t &= ~0x04;
236      if (!(c64_keyline[1] & 0x10)) t &= ~0x02;
237      if (!(c64_keyline[0] & 0x10)) t &= ~0x01;
238      value &= t;
239   }
240
241   if (!(output_b & 0x08))
242   {
243      UINT8 t = 0xff;
244      if (!(c64_keyline[7] & 0x08)) t &= ~0x80;
245      if (!(c64_keyline[6] & 0x08)) t &= ~0x40;
246      if (!(c64_keyline[5] & 0x08)) t &= ~0x20;
247      if (!(c64_keyline[4] & 0x08)) t &= ~0x10;
248      if (!(c64_keyline[3] & 0x08)) t &= ~0x08;
249      if (!(c64_keyline[2] & 0x08)) t &= ~0x04;
250      if (!(c64_keyline[1] & 0x08)) t &= ~0x02;
251      if (!(c64_keyline[0] & 0x08)) t &= ~0x01;
252      value &= t;
253   }
254
255   if (!(output_b & 0x04))
256   {
257      UINT8 t = 0xff;
258      if (!(c64_keyline[7] & 0x04)) t &= ~0x80;
259      if (!(c64_keyline[6] & 0x04)) t &= ~0x40;
260      if (!(c64_keyline[5] & 0x04)) t &= ~0x20;
261      if (!(c64_keyline[4] & 0x04)) t &= ~0x10;
262      if (!(c64_keyline[3] & 0x04)) t &= ~0x08;
263      if (!(c64_keyline[2] & 0x04)) t &= ~0x04;
264      if (!(c64_keyline[1] & 0x04)) t &= ~0x02;
265      if (!(c64_keyline[0] & 0x04)) t &= ~0x01;
266      value &= t;
267   }
268
269   if (!(output_b & 0x02))
270   {
271      UINT8 t = 0xff;
272      if (!(c64_keyline[7] & 0x02)) t &= ~0x80;
273      if (!(c64_keyline[6] & 0x02)) t &= ~0x40;
274      if (!(c64_keyline[5] & 0x02)) t &= ~0x20;
275      if (!(c64_keyline[4] & 0x02)) t &= ~0x10;
276      if (!(c64_keyline[3] & 0x02)) t &= ~0x08;
277      if (!(c64_keyline[2] & 0x02)) t &= ~0x04;
278      if (!(c64_keyline[1] & 0x02)) t &= ~0x02;
279      if (!(c64_keyline[0] & 0x02)) t &= ~0x01;
280      value &= t;
281   }
282
283   if (!(output_b & 0x01))
284   {
285      UINT8 t = 0xff;
286      if (!(c64_keyline[7] & 0x01)) t &= ~0x80;
287      if (!(c64_keyline[6] & 0x01)) t &= ~0x40;
288      if (!(c64_keyline[5] & 0x01)) t &= ~0x20;
289      if (!(c64_keyline[4] & 0x01)) t &= ~0x10;
290      if (!(c64_keyline[3] & 0x01)) t &= ~0x08;
291      if (!(c64_keyline[2] & 0x01)) t &= ~0x04;
292      if (!(c64_keyline[1] & 0x01)) t &= ~0x02;
293      if (!(c64_keyline[0] & 0x01)) t &= ~0x01;
294      value &= t;
295   }
296
297   if ( input_port_read(device->machine, "CTRLSEL") & 0x80 )
298      value &= c64_keyline[8];
299   else
300      value &= c64_keyline[9];
301
302   return value;
303}
304
305UINT8 common_cia0_port_b_r( const device_config *device, UINT8 output_a )
306{
307   UINT8 value = 0xff;
308
309   if (!(output_a & 0x80)) value &= c64_keyline[7];
310   if (!(output_a & 0x40)) value &= c64_keyline[6];
311   if (!(output_a & 0x20)) value &= c64_keyline[5];
312   if (!(output_a & 0x10)) value &= c64_keyline[4];
313   if (!(output_a & 0x08)) value &= c64_keyline[3];
314   if (!(output_a & 0x04)) value &= c64_keyline[2];
315   if (!(output_a & 0x02)) value &= c64_keyline[1];
316   if (!(output_a & 0x01)) value &= c64_keyline[0];
317
318   if ( input_port_read(device->machine, "CTRLSEL") & 0x80 )
319      value &= c64_keyline[9];
320   else
321      value &= c64_keyline[8];
322
323   return value;
324}
325
326
327/***********************************************
328
11329   CBM Quickloads
12330
13331***********************************************/
src/mess/machine/c64.c
r4736r4737
2626#include "includes/cbmserb.h"
2727#include "includes/cbmdrive.h"
2828#include "includes/vc1541.h"
29#include "cbmipt.h"            /* we need cbm_common_interrupt & c64_keyline for input reading */
3029
3130#include "includes/c64.h"
32#include "includes/c128.h"      /* we need c128_bankswitch_64 in MACHINE_START */
3331
3432#include "devices/cassette.h"
3533#include "devices/cartslot.h"
r4736r4737
4543      } \
4644   } while (0)
4745
48/* still needed for CIA interfaces, will be factored out soon... */
49UINT8 c65_6511_port = 0xff;
50static UINT8 c65_keyline = { 0xff };
51static UINT8 c128_keyline[3] = {0xff, 0xff, 0xff};
5246
5347/* expansion port lines input */
5448int c64_pal = 0;
5549UINT8 c64_game = 1, c64_exrom = 1;
5650
5751/* cpu port */
58int c128_va1617;
5952UINT8 *c64_vicaddr, *c128_vicaddr;
6053UINT8 *c64_memory;
6154UINT8 *c64_colorram;
r4736r4737
8376   return !strncmp(machine->gamedrv->name, "c65", 3);
8477}
8578
86static int is_c128(running_machine *machine)
87{
88   return !strncmp(machine->gamedrv->name, "c128", 4);
89}
90
91/* Needed to initialize correctly the floppy drive emulation */
92/*static int is_c128d(running_machine *machine)
93{
94   return !strncmp(machine->gamedrv->name, "c128d", 5);
95}*/
96
9779static void c64_nmi(running_machine *machine)
9880{
9981   static int nmilevel = 0;
r4736r4737
10991}
11092
11193
94/***********************************************
95
96   CIA Interfaces
97
98***********************************************/
99
112100/*
113 * cia 0
114 * port a
115 * 7-0 keyboard line select
116 * 7,6: paddle select( 01 port a, 10 port b)
117 * 4: joystick a fire button
118 * 3,2: Paddles port a fire button
119 * 3-0: joystick a direction
120 * port b
121 * 7-0: keyboard raw values
122 * 4: joystick b fire button, lightpen select
123 * 3,2: paddle b fire buttons (left,right)
124 * 3-0: joystick b direction
125 * flag cassette read input, serial request in
126 * irq to irq connected
101 *   CIA 0 - Port A keyboard line select
102 *   CIA 0 - Port B keyboard line read
103 *
104 *   flag cassette read input, serial request in
105 *   irq to irq connected
106 *
107 *   see machine/cbm.c
127108 */
109
128110static READ8_DEVICE_HANDLER( c64_cia0_port_a_r )
129111{
130   UINT8 value = 0xff;
131112   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
132113
133   if (!(cia0portb & 0x80))
134   {
135      UINT8 t = 0xff;
136      if (!(c64_keyline[7] & 0x80)) t &= ~0x80;
137      if (!(c64_keyline[6] & 0x80)) t &= ~0x40;
138      if (!(c64_keyline[5] & 0x80)) t &= ~0x20;
139      if (!(c64_keyline[4] & 0x80)) t &= ~0x10;
140      if (!(c64_keyline[3] & 0x80)) t &= ~0x08;
141      if (!(c64_keyline[2] & 0x80)) t &= ~0x04;
142      if (!(c64_keyline[1] & 0x80)) t &= ~0x02;
143      if (!(c64_keyline[0] & 0x80)) t &= ~0x01;
144      value &= t;
145   }
146
147   if (!(cia0portb & 0x40))
148   {
149      UINT8 t = 0xff;
150      if (!(c64_keyline[7] & 0x40)) t &= ~0x80;
151      if (!(c64_keyline[6] & 0x40)) t &= ~0x40;
152      if (!(c64_keyline[5] & 0x40)) t &= ~0x20;
153      if (!(c64_keyline[4] & 0x40)) t &= ~0x10;
154      if (!(c64_keyline[3] & 0x40)) t &= ~0x08;
155      if (!(c64_keyline[2] & 0x40)) t &= ~0x04;
156      if (!(c64_keyline[1] & 0x40)) t &= ~0x02;
157      if (!(c64_keyline[0] & 0x40)) t &= ~0x01;
158      value &= t;
159   }
160
161   if (!(cia0portb & 0x20))
162   {
163      UINT8 t = 0xff;
164      if (!(c64_keyline[7] & 0x20)) t &= ~0x80;
165      if (!(c64_keyline[6] & 0x20)) t &= ~0x40;
166      if (!(c64_keyline[5] & 0x20)) t &= ~0x20;
167      if (!(c64_keyline[4] & 0x20)) t &= ~0x10;
168      if (!(c64_keyline[3] & 0x20)) t &= ~0x08;
169      if (!(c64_keyline[2] & 0x20)) t &= ~0x04;
170      if (!(c64_keyline[1] & 0x20)) t &= ~0x02;
171      if (!(c64_keyline[0] & 0x20)) t &= ~0x01;
172      value &= t;
173   }
174
175   if (!(cia0portb & 0x10))
176   {
177      UINT8 t = 0xff;
178      if (!(c64_keyline[7] & 0x10)) t &= ~0x80;
179      if (!(c64_keyline[6] & 0x10)) t &= ~0x40;
180      if (!(c64_keyline[5] & 0x10)) t &= ~0x20;
181      if (!(c64_keyline[4] & 0x10)) t &= ~0x10;
182      if (!(c64_keyline[3] & 0x10)) t &= ~0x08;
183      if (!(c64_keyline[2] & 0x10)) t &= ~0x04;
184      if (!(c64_keyline[1] & 0x10)) t &= ~0x02;
185      if (!(c64_keyline[0] & 0x10)) t &= ~0x01;
186      value &= t;
187   }
188
189   if (!(cia0portb & 0x08))
190   {
191      UINT8 t = 0xff;
192      if (!(c64_keyline[7] & 0x08)) t &= ~0x80;
193      if (!(c64_keyline[6] & 0x08)) t &= ~0x40;
194      if (!(c64_keyline[5] & 0x08)) t &= ~0x20;
195      if (!(c64_keyline[4] & 0x08)) t &= ~0x10;
196      if (!(c64_keyline[3] & 0x08)) t &= ~0x08;
197      if (!(c64_keyline[2] & 0x08)) t &= ~0x04;
198      if (!(c64_keyline[1] & 0x08)) t &= ~0x02;
199      if (!(c64_keyline[0] & 0x08)) t &= ~0x01;
200      value &= t;
201   }
202
203   if (!(cia0portb & 0x04))
204   {
205      UINT8 t = 0xff;
206      if (!(c64_keyline[7] & 0x04)) t &= ~0x80;
207      if (!(c64_keyline[6] & 0x04)) t &= ~0x40;
208      if (!(c64_keyline[5] & 0x04)) t &= ~0x20;
209      if (!(c64_keyline[4] & 0x04)) t &= ~0x10;
210      if (!(c64_keyline[3] & 0x04)) t &= ~0x08;
211      if (!(c64_keyline[2] & 0x04)) t &= ~0x04;
212      if (!(c64_keyline[1] & 0x04)) t &= ~0x02;
213      if (!(c64_keyline[0] & 0x04)) t &= ~0x01;
214      value &= t;
215   }
216
217   if (!(cia0portb & 0x02))
218   {
219      UINT8 t = 0xff;
220      if (!(c64_keyline[7] & 0x02)) t &= ~0x80;
221      if (!(c64_keyline[6] & 0x02)) t &= ~0x40;
222      if (!(c64_keyline[5] & 0x02)) t &= ~0x20;
223      if (!(c64_keyline[4] & 0x02)) t &= ~0x10;
224      if (!(c64_keyline[3] & 0x02)) t &= ~0x08;
225      if (!(c64_keyline[2] & 0x02)) t &= ~0x04;
226      if (!(c64_keyline[1] & 0x02)) t &= ~0x02;
227      if (!(c64_keyline[0] & 0x02)) t &= ~0x01;
228      value &= t;
229   }
230
231   if (!(cia0portb & 0x01))
232   {
233      UINT8 t = 0xff;
234      if (!(c64_keyline[7] & 0x01)) t &= ~0x80;
235      if (!(c64_keyline[6] & 0x01)) t &= ~0x40;
236      if (!(c64_keyline[5] & 0x01)) t &= ~0x20;
237      if (!(c64_keyline[4] & 0x01)) t &= ~0x10;
238      if (!(c64_keyline[3] & 0x01)) t &= ~0x08;
239      if (!(c64_keyline[2] & 0x01)) t &= ~0x04;
240      if (!(c64_keyline[1] & 0x01)) t &= ~0x02;
241      if (!(c64_keyline[0] & 0x01)) t &= ~0x01;
242      value &= t;
243   }
244
245   if ( input_port_read(device->machine, "CTRLSEL") & 0x80 )
246      value &= c64_keyline[8];
247   else
248      value &= c64_keyline[9];
249
250   return value;
114   return common_cia0_port_a_r(device, cia0portb);
251115}
252116
253117static READ8_DEVICE_HANDLER( c64_cia0_port_b_r )
254118{
255    UINT8 value = 0xff;
256119   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
257120
258    if (!(cia0porta & 0x80)) value &= c64_keyline[7];
259    if (!(cia0porta & 0x40)) value &= c64_keyline[6];
260    if (!(cia0porta & 0x20)) value &= c64_keyline[5];
261    if (!(cia0porta & 0x10)) value &= c64_keyline[4];
262    if (!(cia0porta & 0x08)) value &= c64_keyline[3];
263    if (!(cia0porta & 0x04)) value &= c64_keyline[2];
264    if (!(cia0porta & 0x02)) value &= c64_keyline[1];
265    if (!(cia0porta & 0x01)) value &= c64_keyline[0];
266
267   if ( input_port_read(device->machine, "CTRLSEL") & 0x80 )
268      value &= c64_keyline[9];
269    else
270      value &= c64_keyline[8];
271
272    if (is_c128(device->machine))
273    {
274      if (!vic2e_k0_r ())
275         value &= c128_keyline[0];
276      if (!vic2e_k1_r ())
277         value &= c128_keyline[1];
278      if (!vic2e_k2_r ())
279         value &= c128_keyline[2];
280    }
281    if (is_c65(device->machine))
282   {
283      if (!(c65_6511_port & 0x02))
284         value &= c65_keyline;
285    }
286
287    return value;
121   return common_cia0_port_b_r(device, cia0porta);
288122}
289123
290124static WRITE8_DEVICE_HANDLER( c64_cia0_port_b_w )
291125{
292    vic2_lightpen_write (data & 0x10);
126    vic2_lightpen_write(data & 0x10);
293127}
294128
295129static void c64_irq (running_machine *machine, int level)
r4736r4737
299133   if (level != old_level)
300134   {
301135      DBG_LOG (3, "mos6510", ("irq %s\n", level ? "start" : "end"));
302      if (is_c128(machine))
303      {
304         if (0) // && (cpu_getactivecpu() == 0))
305         {
306            cputag_set_input_line(machine, "maincpu", 0, level);
307         }
308         else
309         {
310            cputag_set_input_line(machine, "m8502", M6510_IRQ_LINE, level);
311         }
312      }
313      else
314      {
315         cputag_set_input_line(machine, "maincpu", M6510_IRQ_LINE, level);
316      }
136      cputag_set_input_line(machine, "maincpu", M6510_IRQ_LINE, level);
317137      old_level = level;
318138   }
319139}
r4736r4737
335155#endif
336156}
337157
158const cia6526_interface c64_ntsc_cia0 =
159{
160   DEVCB_LINE(c64_cia0_interrupt),
161   DEVCB_NULL,   /* pc_func */
162   60,
163
164   {
165      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
166      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
167   }
168};
169
170const cia6526_interface c64_pal_cia0 =
171{
172   DEVCB_LINE(c64_cia0_interrupt),
173   DEVCB_NULL,   /* pc_func */
174   50,
175
176   {
177      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
178      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
179   }
180};
181
182
338183/*
339 * cia 1
340 * port a
341 * 7 serial bus data input
342 * 6 serial bus clock input
343 * 5 serial bus data output
344 * 4 serial bus clock output
345 * 3 serial bus atn output
346 * 2 rs232 data output
347 * 1-0 vic-chip system memory bank select
184 * CIA 1 - Port A
185 * bit 7 serial bus data input
186 * bit 6 serial bus clock input
187 * bit 5 serial bus data output
188 * bit 4 serial bus clock output
189 * bit 3 serial bus atn output
190 * bit 2 rs232 data output
191 * bits 1-0 vic-chip system memory bank select
348192 *
349 * port b
350 * 7 user rs232 data set ready
351 * 6 user rs232 clear to send
352 * 5 user
353 * 4 user rs232 carrier detect
354 * 3 user rs232 ring indicator
355 * 2 user rs232 data terminal ready
356 * 1 user rs232 request to send
357 * 0 user rs232 received data
193 * CIA 1 - Port B
194 * bit 7 user rs232 data set ready
195 * bit 6 user rs232 clear to send
196 * bit 5 user
197 * bit 4 user rs232 carrier detect
198 * bit 3 user rs232 ring indicator
199 * bit 2 user rs232 data terminal ready
200 * bit 1 user rs232 request to send
201 * bit 0 user rs232 received data
202 *
358203 * flag restore key or rs232 received data input
359204 * irq to nmi connected ?
360205 */
r4736r4737
379224   cbm_serial_data_write (device->machine, serial_data = !(data & 0x20));
380225   cbm_serial_atn_write (device->machine, serial_atn = !(data & 0x08));
381226   c64_vicaddr = c64_memory + helper[data & 0x03];
382   if (is_c128(device->machine))
383   {
384      c128_vicaddr = c64_memory + helper[data & 0x03] + c128_va1617;
385   }
386227}
387228
388229static void c64_cia1_interrupt (const device_config *device, int level)
r4736r4737
390231   c64_nmi(device->machine);
391232}
392233
393const cia6526_interface c64_ntsc_cia0 =
394{
395   DEVCB_LINE(c64_cia0_interrupt),
396   DEVCB_NULL,   /* pc_func */
397   60,
398
399   {
400      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
401      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
402   }
403};
404
405const cia6526_interface c64_pal_cia0 =
406{
407   DEVCB_LINE(c64_cia0_interrupt),
408   DEVCB_NULL,   /* pc_func */
409   50,
410
411   {
412      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
413      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
414   }
415};
416
417234const cia6526_interface c64_ntsc_cia1 =
418235{
419236   DEVCB_LINE(c64_cia1_interrupt),
r4736r4737
438255   }
439256};
440257
258/***********************************************
259
260   Memory Handlers
261
262***********************************************/
263
441264static UINT8 *c64_io_ram_w_ptr;
442265static UINT8 *c64_io_ram_r_ptr;
443266
r4736r4737
1052875
1053876void c64_common_init_machine (running_machine *machine)
1054877{
1055   if (is_sx64 /* || is_c128d(machine) */)
878   if (is_sx64)
1056879   {
1057880      cbm_serial_config(machine, &cbm_emu_drive_interface);
1058      drive_reset ();
881      drive_reset();
1059882   }
1060883
1061884   else if (c64_cia1_on)
r4736r4737
1078901   c64_io_mirror = auto_alloc_array(machine, UINT8, 0x1000 );
1079902   c64_common_init_machine (machine);
1080903
1081   if (is_c128(machine))
1082      c128_bankswitch_64(machine, 1);
1083
1084904   if (!ultimax)
1085905      c64_bankswitch(machine, 1);
1086906}
src/mess/drivers/c65.c
r4736r4737
240240   MDRV_QUICKLOAD_ADD("quickload", cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
241241
242242   /* cia */
243   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c64_ntsc_cia0)
244   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c64_ntsc_cia1)
243   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c65_ntsc_cia0)
244   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c65_ntsc_cia1)
245245   
246246   MDRV_IMPORT_FROM(c64_cartslot)
247247MACHINE_DRIVER_END
r4736r4737
261261   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50)
262262
263263   /* cia */
264   MDRV_DEVICE_REMOVE("cia_0")
265   MDRV_DEVICE_REMOVE("cia_1")
266   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c64_pal_cia0)
267   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c64_pal_cia1)
264   MDRV_CIA6526_REMOVE("cia_0")
265   MDRV_CIA6526_REMOVE("cia_1")
266   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c65_pal_cia0)
267   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c65_pal_cia1)
268268MACHINE_DRIVER_END
269269
270270
src/mess/drivers/c128.c
r4736r4737
631631   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
632632
633633   /* cia */
634   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6567_CLOCK, c64_ntsc_cia0)
635   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6567_CLOCK, c64_ntsc_cia1)
634   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia0)
635   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia1)
636636   
637637   MDRV_IMPORT_FROM(c64_cartslot)
638638MACHINE_DRIVER_END
r4736r4737
661661   /* cia */
662662   MDRV_CIA6526_REMOVE("cia_0")
663663   MDRV_CIA6526_REMOVE("cia_1")
664   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6569_CLOCK, c64_pal_cia0)
665   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6569_CLOCK, c64_pal_cia1)
664   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6569_CLOCK, c128_pal_cia0)
665   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6569_CLOCK, c128_pal_cia1)
666666MACHINE_DRIVER_END
667667
668668static MACHINE_DRIVER_START( c128dpal )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team