Previous 15994 Revisions Next

r7067 Tuesday 19th January, 2010 at 12:54:11 UTC by Curt Coder
[CIA6526] Refactored interface, and added SP/CNT callbacks.
[C1571,C1581] Added fast serial interface.
[docs]messnew.txt
[src/emu/machine]6526cia.c 6526cia.h
[src/mame/machine]amiga.c
[src/mess/drivers]ami1200.c amiga.c c128.c c64.c c65.c cbmb.c primo.c sbc6510.c
[src/mess/includes]c128.h c64.h c65.h cbmb.h
[src/mess/machine]amigafdc.c amigakbd.c c128.c c1571.c c1571.h c1581.c c1581.h c64.c c65.c cbmb.c primo.c

src/mame/machine/amiga.c
r7066r7067
351351      amiga_custom_w(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), REG_INTREQ, 0x8000 | INTENA_VERTB, 0xffff);
352352
353353      /* clock the first CIA TOD */
354      cia_clock_tod(cia_0);
354      mos6526_tod_w(cia_0, 1);
355355
356356      /* call the system-specific callback */
357357      if (amiga_intf->scanline0_callback != NULL)
r7066r7067
359359   }
360360
361361   /* on every scanline, clock the second CIA TOD */
362   cia_clock_tod(cia_1);
362   mos6526_tod_w(cia_1, 1);
363363
364364   /* render up to this scanline */
365365   if (!video_screen_update_partial(machine->primary_screen, scanline))
r7066r7067
10581058   }
10591059
10601060   /* handle the reads */
1061   data = cia_r(cia, offset >> 7);
1061   data = mos6526_r(cia, offset >> 7);
10621062
10631063   if (LOG_CIA)
10641064      logerror("%06x:cia_%c_read(%03x) = %04x & %04x\n", cpu_get_pc(space->cpu), 'A' + ((~offset & 0x0800) >> 11), offset * 2, data << shift, mem_mask);
r7066r7067
11001100   }
11011101
11021102   /* handle the writes */
1103   cia_w(cia, offset >> 7, (UINT8) data);
1103   mos6526_w(cia, offset >> 7, (UINT8) data);
11041104}
11051105
11061106
r7066r7067
14461446         data = (data & 0x8000) ? (CUSTOM_REG(offset) | (data & 0x7fff)) : (CUSTOM_REG(offset) & ~(data & 0x7fff));
14471447         cia_0 = devtag_get_device(space->machine, "cia_0");
14481448         cia_1 = devtag_get_device(space->machine, "cia_1");
1449         if ( cia_get_irq( cia_0 ) ) data |= INTENA_PORTS;
1450         if ( cia_get_irq( cia_1 ) )   data |= INTENA_EXTER;
1449         if ( mos6526_irq_r( cia_0 ) ) data |= INTENA_PORTS;
1450         if ( mos6526_irq_r( cia_1 ) ) data |= INTENA_EXTER;
14511451         CUSTOM_REG(offset) = data;
14521452
14531453         if ( temp & 0x8000  ) /* if we're generating irq's, delay a bit */
src/emu/machine/6526cia.c
r7066r7067
1010#include "driver.h"
1111#include "6526cia.h"
1212
13
1413/***************************************************************************
1514    CONSTANTS
1615***************************************************************************/
r7066r7067
3332#define CIA_CRA         14
3433#define CIA_CRB         15
3534
36
3735/***************************************************************************
3836    TYPE DEFINITIONS
3937***************************************************************************/
r7066r7067
6664struct _cia_state
6765{
6866   const device_config *device;
69   devcb_resolved_write_line irq_func;
70   devcb_resolved_write_line pc_func;
67   devcb_resolved_write_line out_irq_func;
68   devcb_resolved_write_line out_pc_func;
69   devcb_resolved_write_line out_cnt_func;
70   devcb_resolved_write_line out_sp_func;
7171
7272   cia_port      port[2];
7373   cia_timer      timer[2];
r7066r7067
9494   UINT8         serial;
9595};
9696
97
9897/***************************************************************************
9998    PROTOTYPES
10099***************************************************************************/
r7066r7067
103102static void cia_timer_underflow(const device_config *device, int timer);
104103static TIMER_CALLBACK( cia_clock_tod_callback );
105104
106
107
108105/***************************************************************************
109106    INLINE FUNCTIONS
110107***************************************************************************/
r7066r7067
112109INLINE cia_state *get_token(const device_config *device)
113110{
114111   assert(device != NULL);
115   assert((device->type == CIA6526R1) || (device->type == CIA6526R2) || (device->type == CIA8520));
112   assert((device->type == MOS6526R1) || (device->type == MOS6526R2) || (device->type == MOS8520));
116113   return (cia_state *) device->token;
117114}
118115
119
120INLINE const cia6526_interface *get_interface(const device_config *device)
116INLINE const mos6526_interface *get_interface(const device_config *device)
121117{
122118   assert(device != NULL);
123   assert((device->type == CIA6526R1) || (device->type == CIA6526R2) || (device->type == CIA8520));
124   return (cia6526_interface *) device->static_config;
119   assert((device->type == MOS6526R1) || (device->type == MOS6526R2) || (device->type == MOS8520));
120   return (mos6526_interface *) device->static_config;
125121}
126122
127
128123/***************************************************************************
129124    IMPLEMENTATION
130125***************************************************************************/
131126
132127/*-------------------------------------------------
133    DEVICE_START( cia )
134-------------------------------------------------*/
135
136static DEVICE_START( cia )
137{
138   int t, p;
139   cia_state *cia = get_token(device);
140   const cia6526_interface *intf = get_interface(device);
141
142   /* clear out CIA structure, and copy the interface */
143   memset(cia, 0, sizeof(*cia));
144   cia->device = device;
145   devcb_resolve_write_line(&cia->irq_func, &intf->irq_func, device);
146   devcb_resolve_write_line(&cia->pc_func, &intf->pc_func, device);
147   cia->flag = 1;
148
149   /* setup ports */
150   for (p = 0; p < (sizeof(cia->port) / sizeof(cia->port[0])); p++)
151   {
152      devcb_resolve_read8(&cia->port[p].read, &intf->port[p].read, device);
153      devcb_resolve_write8(&cia->port[p].write, &intf->port[p].write, device);
154      cia->port[p].mask_value = 0xff;
155   }
156
157   /* setup timers */
158   for (t = 0; t < (sizeof(cia->timer) / sizeof(cia->timer[0])); t++)
159   {
160      cia_timer *timer = &cia->timer[t];
161      timer->timer = timer_alloc(device->machine, cia_timer_proc, timer);
162      timer->cia = cia;
163      timer->irq = 0x01 << t;
164   }
165
166   /* setup TOD timer, if appropriate */
167   if (intf->tod_clock != 0)
168      timer_pulse(device->machine, ATTOTIME_IN_HZ(intf->tod_clock), (void *) device, 0, cia_clock_tod_callback);
169
170   /* state save support */
171   state_save_register_device_item(device, 0, cia->port[0].ddr);
172   state_save_register_device_item(device, 0, cia->port[0].latch);
173   state_save_register_device_item(device, 0, cia->port[0].in);
174   state_save_register_device_item(device, 0, cia->port[0].out);
175   state_save_register_device_item(device, 0, cia->port[0].mask_value);
176   state_save_register_device_item(device, 0, cia->port[1].ddr);
177   state_save_register_device_item(device, 0, cia->port[1].latch);
178   state_save_register_device_item(device, 0, cia->port[1].in);
179   state_save_register_device_item(device, 0, cia->port[1].out);
180   state_save_register_device_item(device, 0, cia->port[1].mask_value);
181   state_save_register_device_item(device, 0, cia->timer[0].latch);
182   state_save_register_device_item(device, 0, cia->timer[0].count);
183   state_save_register_device_item(device, 0, cia->timer[0].mode);
184   state_save_register_device_item(device, 0, cia->timer[0].irq);
185   state_save_register_device_item(device, 0, cia->timer[1].latch);
186   state_save_register_device_item(device, 0, cia->timer[1].count);
187   state_save_register_device_item(device, 0, cia->timer[1].mode);
188   state_save_register_device_item(device, 0, cia->timer[1].irq);
189   state_save_register_device_item(device, 0, cia->tod);
190   state_save_register_device_item(device, 0, cia->tod_latch);
191   state_save_register_device_item(device, 0, cia->tod_latched);
192   state_save_register_device_item(device, 0, cia->tod_running);
193   state_save_register_device_item(device, 0, cia->alarm);
194   state_save_register_device_item(device, 0, cia->icr);
195   state_save_register_device_item(device, 0, cia->ics);
196   state_save_register_device_item(device, 0, cia->irq);
197   state_save_register_device_item(device, 0, cia->flag);
198   state_save_register_device_item(device, 0, cia->loaded);
199   state_save_register_device_item(device, 0, cia->sdr);
200   state_save_register_device_item(device, 0, cia->sp);
201   state_save_register_device_item(device, 0, cia->cnt);
202   state_save_register_device_item(device, 0, cia->shift);
203   state_save_register_device_item(device, 0, cia->serial);
204}
205
206
207/*-------------------------------------------------
208128    cia_set_port_mask_value
209129-------------------------------------------------*/
210130
r7066r7067
214134   cia->port[port].mask_value = data;
215135}
216136
217
218137/*-------------------------------------------------
219138    DEVICE_RESET( cia )
220139-------------------------------------------------*/
r7066r7067
258177   }
259178}
260179
261
262180/*-------------------------------------------------
263181    DEVICE_VALIDITY_CHECK( cia )
264182-------------------------------------------------*/
r7066r7067
276194   return error;
277195}
278196
279
280197/*-------------------------------------------------
281198    cia_update_pc - pulse /pc output
282199-------------------------------------------------*/
r7066r7067
286203   cia_state *cia = get_token(device);
287204
288205   /* this should really be one cycle long */
289   devcb_call_write_line(&cia->pc_func, 0);
290   devcb_call_write_line(&cia->pc_func, 1);
206   devcb_call_write_line(&cia->out_pc_func, 0);
207   devcb_call_write_line(&cia->out_pc_func, 1);
291208}
292209
293
294210/*-------------------------------------------------
295211    cia_update_interrupts
296212-------------------------------------------------*/
r7066r7067
311227   if (cia->irq != new_irq)
312228   {
313229      cia->irq = new_irq;
314      devcb_call_write_line(&cia->irq_func, cia->irq);
230      devcb_call_write_line(&cia->out_irq_func, cia->irq);
315231   }
316232}
317233
318
319234/*-------------------------------------------------
320235    is_timer_active
321236-------------------------------------------------*/
r7066r7067
326241   return attotime_compare(t, attotime_never) != 0;
327242}
328243
329
330244/*-------------------------------------------------
331245    cia_timer_update - updates the count and
332246    emu_timer for a given CIA timer
r7066r7067
400314      cia_timer_update(&cia->timer[timer], cia->timer[timer].count - 1);
401315}
402316
403
404317/*-------------------------------------------------
405318    cia_timer_underflow
406319-------------------------------------------------*/
r7066r7067
448361               cia->shift++;
449362               cia->serial <<= 1;
450363               cia->cnt = 0;
364
365               devcb_call_write_line(&cia->out_cnt_func, cia->cnt);
366               devcb_call_write_line(&cia->out_sp_func, cia->sp);
451367            }
452368            else
453369            {
454370               cia->cnt = 1;
371
372               devcb_call_write_line(&cia->out_cnt_func, cia->cnt);
373
455374               if (cia->shift == 8)
456375               {
457376                  cia->ics |= 0x08;
r7066r7067
463382   }
464383}
465384
466
467385/*-------------------------------------------------
468386    TIMER_CALLBACK( cia_timer_proc )
469387-------------------------------------------------*/
r7066r7067
476394   cia_timer_underflow(cia->device, timer - cia->timer);
477395}
478396
479
480397/*-------------------------------------------------
481398    bcd_increment
482399-------------------------------------------------*/
r7066r7067
489406   return value;
490407}
491408
492
493409/*-------------------------------------------------
494410    cia6526_increment
495411-------------------------------------------------*/
r7066r7067
535451          | (((UINT32) hour)         << 24);
536452}
537453
538
539454/*-------------------------------------------------
540455    cia_clock_tod - Update TOD on CIA A
541456-------------------------------------------------*/
542457
543void cia_clock_tod(const device_config *device)
458static void cia_clock_tod(const device_config *device)
544459{
545460   cia_state *cia;
546461
r7066r7067
548463
549464   if (cia->tod_running)
550465   {
551      if ((device->type == CIA6526R1) || (device->type == CIA6526R2))
466      if ((device->type == MOS6526R1) || (device->type == MOS6526R2))
552467      {
553468         /* The 6526 split the value into hours, minutes, seconds and
554469             * subseconds */
555470         cia6526_increment(cia);
556471      }
557      else if (device->type == CIA8520)
472      else if (device->type == MOS8520)
558473      {
559474         /* the 8520 has a straight 24-bit counter */
560475         cia->tod++;
r7066r7067
569484   }
570485}
571486
572
573487/*-------------------------------------------------
574488    cia_clock_tod_callback
575489-------------------------------------------------*/
r7066r7067
580494   cia_clock_tod(device);
581495}
582496
583
584497/*-------------------------------------------------
585498    cia_issue_index
586499-------------------------------------------------*/
587500
588void cia_issue_index(const device_config *device)
501static void cia_issue_index(const device_config *device)
589502{
590503   cia_state *cia = get_token(device);
591504   cia->ics |= 0x10;
592505   cia_update_interrupts(device);
593506}
594507
595
596508/*-------------------------------------------------
597509    cia_set_input_sp
598510-------------------------------------------------*/
599511
600void cia_set_input_sp(const device_config *device, int data)
512static void cia_set_input_sp(const device_config *device, int data)
601513{
602514   cia_state *cia = get_token(device);
603515   cia->sp = data;
604516}
605517
606
607518/*-------------------------------------------------
608519    cia_set_input_cnt
609520-------------------------------------------------*/
610521
611void cia_set_input_cnt(const device_config *device, int data)
522static void cia_set_input_cnt(const device_config *device, int data)
612523{
613524   cia_state *cia = get_token(device);
614525
r7066r7067
643554   cia->cnt = data ? 1 : 0;
644555}
645556
557READ8_DEVICE_HANDLER( mos6526_pa_r )
558{
559   return (get_token(device)->port[0].latch | ~get_token(device)->port[0].ddr);
560}
561
562READ8_DEVICE_HANDLER( mos6526_pb_r )
563{
564   return (get_token(device)->port[1].latch | ~get_token(device)->port[1].ddr);
565}
566
567READ_LINE_DEVICE_HANDLER( mos6526_irq_r )
568{
569   cia_state *cia = get_token(device);
570
571   return cia->irq;
572}
573
646574WRITE_LINE_DEVICE_HANDLER( mos6526_tod_w )
647575{
648576   if (state) cia_clock_tod(device);
649577}
650578
579READ_LINE_DEVICE_HANDLER( mos6526_cnt_r )
580{
581   cia_state *cia = get_token(device);
582
583   return cia->cnt;
584}
585
651586WRITE_LINE_DEVICE_HANDLER( mos6526_cnt_w )
652587{
653588   cia_set_input_cnt(device, state);
654589}
655590
591READ_LINE_DEVICE_HANDLER( mos6526_sp_r )
592{
593   cia_state *cia = get_token(device);
594
595   return cia->sp;
596}
597
656598WRITE_LINE_DEVICE_HANDLER( mos6526_sp_w )
657599{
658600   cia_set_input_sp(device, state);
r7066r7067
671613}
672614
673615/*-------------------------------------------------
674    cia_r
616    mos6526_r
675617-------------------------------------------------*/
676618
677READ8_DEVICE_HANDLER( cia_r )
619READ8_DEVICE_HANDLER( mos6526_r )
678620{
679621   cia_timer *timer;
680622   cia_state *cia;
r7066r7067
748690      case CIA_TOD1:
749691      case CIA_TOD2:
750692      case CIA_TOD3:
751         if (device->type == CIA8520)
693         if (device->type == MOS8520)
752694         {
753695            if (offset == CIA_TOD2)
754696            {
r7066r7067
796738   return data;
797739}
798740
799
800741/*-------------------------------------------------
801    cia_w
742    mos6526_w
802743-------------------------------------------------*/
803744
804WRITE8_DEVICE_HANDLER( cia_w )
745WRITE8_DEVICE_HANDLER( mos6526_w )
805746{
806747   cia_timer *timer;
807748   cia_state *cia;
r7066r7067
875816         else
876817            cia->tod = (cia->tod & ~(0xff << shift)) | (data << shift);
877818
878         if (device->type == CIA8520)
819         if (device->type == MOS8520)
879820         {
880821            if (offset == CIA_TOD2)
881822               cia->tod_running = FALSE;
r7066r7067
920861   }
921862}
922863
864/*-------------------------------------------------
865    DEVICE_START( cia )
866-------------------------------------------------*/
923867
868static DEVICE_START( cia )
869{
870   int t, p;
871   cia_state *cia = get_token(device);
872   const mos6526_interface *intf = get_interface(device);
924873
925UINT8 cia_get_output_a(const device_config *device)   { return (get_token(device)->port[0].latch | ~get_token(device)->port[0].ddr); }
926UINT8 cia_get_output_b(const device_config *device)   { return (get_token(device)->port[1].latch | ~get_token(device)->port[1].ddr); }
927int cia_get_irq(const device_config *device)      { return get_token(device)->irq; }
874   /* clear out CIA structure, and copy the interface */
875   memset(cia, 0, sizeof(*cia));
876   cia->device = device;
877   devcb_resolve_write_line(&cia->out_irq_func, &intf->out_irq_func, device);
878   devcb_resolve_write_line(&cia->out_pc_func, &intf->out_pc_func, device);
879   devcb_resolve_write_line(&cia->out_cnt_func, &intf->out_cnt_func, device);
880   devcb_resolve_write_line(&cia->out_sp_func, &intf->out_sp_func, device);
881   cia->flag = 1;
928882
883   /* setup ports */
884   devcb_resolve_read8(&cia->port[0].read, &intf->in_pa_func, device);
885   devcb_resolve_write8(&cia->port[0].write, &intf->out_pa_func, device);
886   devcb_resolve_read8(&cia->port[1].read, &intf->in_pb_func, device);
887   devcb_resolve_write8(&cia->port[1].write, &intf->out_pb_func, device);
929888
889   for (p = 0; p < (sizeof(cia->port) / sizeof(cia->port[0])); p++)
890   {
891      cia->port[p].mask_value = 0xff;
892   }
893
894   /* setup timers */
895   for (t = 0; t < (sizeof(cia->timer) / sizeof(cia->timer[0])); t++)
896   {
897      cia_timer *timer = &cia->timer[t];
898      timer->timer = timer_alloc(device->machine, cia_timer_proc, timer);
899      timer->cia = cia;
900      timer->irq = 0x01 << t;
901   }
902
903   /* setup TOD timer, if appropriate */
904   if (intf->tod_clock != 0)
905      timer_pulse(device->machine, ATTOTIME_IN_HZ(intf->tod_clock), (void *) device, 0, cia_clock_tod_callback);
906
907   /* state save support */
908   state_save_register_device_item(device, 0, cia->port[0].ddr);
909   state_save_register_device_item(device, 0, cia->port[0].latch);
910   state_save_register_device_item(device, 0, cia->port[0].in);
911   state_save_register_device_item(device, 0, cia->port[0].out);
912   state_save_register_device_item(device, 0, cia->port[0].mask_value);
913   state_save_register_device_item(device, 0, cia->port[1].ddr);
914   state_save_register_device_item(device, 0, cia->port[1].latch);
915   state_save_register_device_item(device, 0, cia->port[1].in);
916   state_save_register_device_item(device, 0, cia->port[1].out);
917   state_save_register_device_item(device, 0, cia->port[1].mask_value);
918   state_save_register_device_item(device, 0, cia->timer[0].latch);
919   state_save_register_device_item(device, 0, cia->timer[0].count);
920   state_save_register_device_item(device, 0, cia->timer[0].mode);
921   state_save_register_device_item(device, 0, cia->timer[0].irq);
922   state_save_register_device_item(device, 0, cia->timer[1].latch);
923   state_save_register_device_item(device, 0, cia->timer[1].count);
924   state_save_register_device_item(device, 0, cia->timer[1].mode);
925   state_save_register_device_item(device, 0, cia->timer[1].irq);
926   state_save_register_device_item(device, 0, cia->tod);
927   state_save_register_device_item(device, 0, cia->tod_latch);
928   state_save_register_device_item(device, 0, cia->tod_latched);
929   state_save_register_device_item(device, 0, cia->tod_running);
930   state_save_register_device_item(device, 0, cia->alarm);
931   state_save_register_device_item(device, 0, cia->icr);
932   state_save_register_device_item(device, 0, cia->ics);
933   state_save_register_device_item(device, 0, cia->irq);
934   state_save_register_device_item(device, 0, cia->flag);
935   state_save_register_device_item(device, 0, cia->loaded);
936   state_save_register_device_item(device, 0, cia->sdr);
937   state_save_register_device_item(device, 0, cia->sp);
938   state_save_register_device_item(device, 0, cia->cnt);
939   state_save_register_device_item(device, 0, cia->shift);
940   state_save_register_device_item(device, 0, cia->serial);
941}
942
930943/*-------------------------------------------------
931944    DEVICE_GET_INFO( cia6526r1 )
932945-------------------------------------------------*/
r7066r7067
947960      case DEVINFO_FCT_VALIDITY_CHECK:            info->validity_check = DEVICE_VALIDITY_CHECK_NAME(cia); break;
948961
949962      /* --- the following bits of info are returned as NULL-terminated strings --- */
950      case DEVINFO_STR_NAME:                     strcpy(info->s, "6526 CIA rev1");         break;
951      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "6526 CIA");            break;
963      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS6526 rev1");         break;
964      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "MOS6526");               break;
952965      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                  break;
953966      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);               break;
954967      case DEVINFO_STR_CREDITS:                  /* Nothing */                        break;
955968   }
956969}
957970
958
959971/*-------------------------------------------------
960972    DEVICE_GET_INFO( cia8520 )
961973-------------------------------------------------*/
r7066r7067
965977   switch (state)
966978   {
967979      /* --- the following bits of info are returned as NULL-terminated strings --- */
968      case DEVINFO_STR_NAME:                     strcpy(info->s, "6526 CIA rev2");         break;
980      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS6526 rev2");         break;
969981      default:   DEVICE_GET_INFO_CALL(cia6526r1);   break;
970982   }
971983}
972984
973
974985/*-------------------------------------------------
975986    DEVICE_GET_INFO( cia8520 )
976987-------------------------------------------------*/
r7066r7067
980991   switch (state)
981992   {
982993      /* --- the following bits of info are returned as NULL-terminated strings --- */
983      case DEVINFO_STR_NAME:                     strcpy(info->s, "8520 CIA");            break;
994      case DEVINFO_STR_NAME:                     strcpy(info->s, "MOS8520");            break;
984995      default:   DEVICE_GET_INFO_CALL(cia6526r1);   break;
985996   }
986997}
987
988
src/emu/machine/6526cia.h
r7066r7067
11/**********************************************************************
22
3    MOS 6526/8520 CIA interface and emulation
3    MOS 6526/8520 Complex Interface Adapter emulation
44
5    This function emulates all the functionality of up to 2 MOS6526 or
6    MOS8520 complex interface adapters.
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
77
8**********************************************************************
9                            _____   _____
10                   Vss   1 |*    \_/     | 40  CNT
11                   PA0   2 |             | 39  SP
12                   PA1   3 |             | 38  RS0
13                   PA2   4 |             | 37  RS1
14                   PA3   5 |             | 36  RS2
15                   PA4   6 |             | 35  RS3
16                   PA5   7 |             | 34  _RES
17                   PA6   8 |             | 33  DB0
18                   PA7   9 |             | 32  DB1
19                   PB0  10 |   MOS6526   | 31  DB2
20                   PB1  11 |   MOS8520   | 30  DB3
21                   PB2  12 |             | 29  DB4
22                   PB3  13 |             | 28  DB5
23                   PB4  14 |             | 27  DB6
24                   PB5  15 |             | 26  DB7
25                   PB6  16 |             | 25  phi2
26                   PB7  17 |             | 24  _FLAG
27                   _PC  18 |             | 23  _CS
28                   TOD  19 |             | 22  R/W
29                   Vcc  20 |_____________| 21  _IRQ
30
831**********************************************************************/
932
1033#ifndef __6526CIA_H__
r7066r7067
1235
1336#include "devcb.h"
1437
15
1638/***************************************************************************
1739    MACROS
1840***************************************************************************/
1941
20#define CIA6526R1      DEVICE_GET_INFO_NAME(cia6526r1)
21#define CIA6526R2      DEVICE_GET_INFO_NAME(cia6526r1)
22#define CIA8520         DEVICE_GET_INFO_NAME(cia8520)
42#define MOS6526R1      DEVICE_GET_INFO_NAME(cia6526r1)
43#define MOS6526R2      DEVICE_GET_INFO_NAME(cia6526r1)
44#define MOS8520         DEVICE_GET_INFO_NAME(cia8520)
2345
24#define MDRV_CIA6526_ADD(_tag, _variant, _clock, _config) \
25   MDRV_DEVICE_ADD(_tag, _variant, _clock) \
46#define MDRV_MOS6526R1_ADD(_tag, _clock, _config) \
47   MDRV_DEVICE_ADD(_tag, MOS6526R1, _clock) \
2648   MDRV_DEVICE_CONFIG(_config)
2749
28#define MDRV_CIA8520_ADD(_tag, _clock, _config) \
29   MDRV_DEVICE_ADD(_tag, CIA8520, _clock) \
50#define MDRV_MOS6526R2_ADD(_tag, _clock, _config) \
51   MDRV_DEVICE_ADD(_tag, MOS6526R2, _clock) \
3052   MDRV_DEVICE_CONFIG(_config)
3153
54#define MDRV_MOS8520_ADD(_tag, _clock, _config) \
55   MDRV_DEVICE_ADD(_tag, MOS8520, _clock) \
56   MDRV_DEVICE_CONFIG(_config)
3257
58#define MOS6526_INTERFACE(name) \
59   const mos6526_interface (name)=
3360
61#define MOS8520_INTERFACE(name) \
62   const mos6526_interface (name)=
63
3464/***************************************************************************
3565    TYPE DEFINITIONS
3666***************************************************************************/
3767
38typedef struct _cia6526_interface cia6526_interface;
39struct _cia6526_interface
68typedef struct _mos6526_interface mos6526_interface;
69struct _mos6526_interface
4070{
41   devcb_write_line irq_func;
42   devcb_write_line pc_func;
43
4471   int tod_clock;
4572
46   struct
47   {
48      devcb_read8 read;
49      devcb_write8 write;
50   } port[2];
73   devcb_write_line   out_irq_func;
74   devcb_write_line   out_pc_func;
75   devcb_write_line   out_cnt_func;
76   devcb_write_line   out_sp_func;
77
78   devcb_read8         in_pa_func;
79   devcb_write8      out_pa_func;
80
81   devcb_read8         in_pb_func;
82   devcb_write8      out_pb_func;
5183};
5284
53
5485/***************************************************************************
5586    FUNCTION PROTOTYPES
5687***************************************************************************/
r7066r7067
5990DEVICE_GET_INFO(cia6526r2);
6091DEVICE_GET_INFO(cia8520);
6192
62/* configuration */
63void cia_set_port_mask_value(const device_config *device, int port, int data);
93/* register access */
94READ8_DEVICE_HANDLER( mos6526_r );
95WRITE8_DEVICE_HANDLER( mos6526_w );
6496
65/* reading and writing */
66READ8_DEVICE_HANDLER( cia_r );
67WRITE8_DEVICE_HANDLER( cia_w );
68void cia_clock_tod(const device_config *device);
69void cia_issue_index(const device_config *device);
70void cia_set_input_cnt(const device_config *device, int data);
71void cia_set_input_sp(const device_config *device, int data);
97/* port access */
98READ8_DEVICE_HANDLER( mos6526_pa_r );
99READ8_DEVICE_HANDLER( mos6526_pb_r );
72100
101/* interrupt request */
102READ_LINE_DEVICE_HANDLER( mos6526_irq_r );
103
104/* time of day clock */
73105WRITE_LINE_DEVICE_HANDLER( mos6526_tod_w );
106
107/* serial counter */
108READ_LINE_DEVICE_HANDLER( mos6526_cnt_r );
74109WRITE_LINE_DEVICE_HANDLER( mos6526_cnt_w );
110
111/* serial port */
112READ_LINE_DEVICE_HANDLER( mos6526_sp_r );
75113WRITE_LINE_DEVICE_HANDLER( mos6526_sp_w );
114
115/* flag */
76116WRITE_LINE_DEVICE_HANDLER( mos6526_flag_w );
77117
78/* accessors */
79UINT8 cia_get_output_a(const device_config *device);
80UINT8 cia_get_output_b(const device_config *device);
81int cia_get_irq(const device_config *device);
118/* port mask */
119void cia_set_port_mask_value(const device_config *device, int port, int data);
82120
83121#endif /* __6526CIA_H__ */
src/mess/includes/c65.h
r7066r7067
2828MACHINE_START( c65 );
2929INTERRUPT_GEN( c65_frame_interrupt );
3030
31extern const cia6526_interface c65_ntsc_cia0, c65_pal_cia0;
32extern const cia6526_interface c65_ntsc_cia1, c65_pal_cia1;
31extern const mos6526_interface c65_ntsc_cia0, c65_pal_cia0;
32extern const mos6526_interface c65_ntsc_cia1, c65_pal_cia1;
3333
3434#endif /* C65_H_ */
src/mess/includes/cbmb.h
r7066r7067
3737extern UINT8 *cbmb_videoram;
3838extern UINT8 *cbmb_colorram;
3939
40extern const cia6526_interface cbmb_cia;
40extern const mos6526_interface cbmb_cia;
4141
4242WRITE8_HANDLER ( cbmb_colorram_w );
4343
src/mess/includes/c128.h
r7066r7067
6262UINT8 c128_m6510_port_read(const device_config *device, UINT8 direction);
6363void c128_m6510_port_write(const device_config *device, UINT8 direction, UINT8 data);
6464
65extern const cia6526_interface c128_ntsc_cia0, c128_pal_cia0;
66extern const cia6526_interface c128_ntsc_cia1, c128_pal_cia1;
65extern const mos6526_interface c128_ntsc_cia0, c128_pal_cia0;
66extern const mos6526_interface c128_ntsc_cia1, c128_pal_cia1;
6767
6868
6969#endif /* C128_H_ */
src/mess/includes/c64.h
r7066r7067
5757extern UINT8 *c64_romh;
5858extern UINT8 *c64_vicaddr, *c128_vicaddr;
5959extern UINT8 c64_game, c64_exrom;
60extern const cia6526_interface c64_ntsc_cia0, c64_pal_cia0;
61extern const cia6526_interface c64_ntsc_cia1, c64_pal_cia1;
60extern const mos6526_interface c64_ntsc_cia0, c64_pal_cia0;
61extern const mos6526_interface c64_ntsc_cia1, c64_pal_cia1;
6262
6363MACHINE_DRIVER_EXTERN( c64_cartslot );
6464MACHINE_DRIVER_EXTERN( ultimax_cartslot );
src/mess/machine/c65.c
r7066r7067
77
88#include "driver.h"
99
10#include "includes/cbm.h"
11#include "includes/c65.h"
12#include "includes/c64.h"
1013#include "cpu/m6502/m6502.h"
1114#include "sound/sid6581.h"
1215#include "machine/6526cia.h"
16#include "machine/cbmiec.h"
1317#include "video/vic4567.h"
14
15#include "includes/cbm.h"
16#include "includes/cbmserb.h"
17
18#include "includes/c65.h"
19#include "includes/c64.h"
20
2118#include "devices/messram.h"
2219
2320#define VERBOSE_LEVEL 0
r7066r7067
3835static UINT8 c65_6511_port;
3936static UINT8 c65_keyline = { 0xff };
4037
41static UINT8 serial_clock, serial_data, serial_atn;
4238static UINT8 vicirq;
4339
4440/*UINT8 *c65_basic; */
r7066r7067
5450{
5551   static int nmilevel = 0;
5652   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
57   int cia1irq = cia_get_irq(cia_1);
53   int cia1irq = mos6526_irq_r(cia_1);
5854
5955   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
6056   {
r7066r7067
8379
8480static READ8_DEVICE_HANDLER( c65_cia0_port_a_r )
8581{
86   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
82   UINT8 cia0portb = mos6526_pb_r(devtag_get_device(device->machine, "cia_0"), 0);
8783
8884   return cbm_common_cia0_port_a_r(device, cia0portb);
8985}
r7066r7067
9187static READ8_DEVICE_HANDLER( c65_cia0_port_b_r )
9288{
9389    UINT8 value = 0xff;
94   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
90   UINT8 cia0porta = mos6526_pa_r(devtag_get_device(device->machine, "cia_0"), 0);
9591
9692   value &= cbm_common_cia0_port_b_r(device, cia0porta);
9793
r7066r7067
132128#if 1
133129   if (level != vicirq)
134130   {
135      c65_irq (machine, level || cia_get_irq(cia_0));
131      c65_irq (machine, level || mos6526_irq_r(cia_0));
136132      vicirq = level;
137133   }
138134#endif
139135}
140136
141const cia6526_interface c65_ntsc_cia0 =
137const mos6526_interface c65_ntsc_cia0 =
142138{
139   60,
143140   DEVCB_LINE(c65_cia0_interrupt),
144141   DEVCB_NULL,   /* pc_func */
145   60,
146
147   {
148      { DEVCB_HANDLER(c65_cia0_port_a_r), DEVCB_NULL },
149      { DEVCB_HANDLER(c65_cia0_port_b_r), DEVCB_HANDLER(c65_cia0_port_b_w) }
150   }
142   DEVCB_NULL,
143   DEVCB_NULL,
144   DEVCB_HANDLER(c65_cia0_port_a_r),
145   DEVCB_NULL,
146   DEVCB_HANDLER(c65_cia0_port_b_r),
147   DEVCB_HANDLER(c65_cia0_port_b_w)
151148};
152149
153const cia6526_interface c65_pal_cia0 =
150const mos6526_interface c65_pal_cia0 =
154151{
152   50,
155153   DEVCB_LINE(c65_cia0_interrupt),
156154   DEVCB_NULL,   /* pc_func */
157   50,
158
159   {
160      { DEVCB_HANDLER(c65_cia0_port_a_r), DEVCB_NULL },
161      { DEVCB_HANDLER(c65_cia0_port_b_r), DEVCB_HANDLER(c65_cia0_port_b_w) }
162   }
155   DEVCB_NULL,
156   DEVCB_NULL,
157   DEVCB_HANDLER(c65_cia0_port_a_r),
158   DEVCB_NULL,
159   DEVCB_HANDLER(c65_cia0_port_b_r),
160   DEVCB_HANDLER(c65_cia0_port_b_w)
163161};
164162
165163/*
r7066r7067
190188   UINT8 value = 0xff;
191189   const device_config *serbus = devtag_get_device(device->machine, "serial_bus");
192190
193   if (!serial_clock || !cbm_serial_clock_read(serbus, 0))
191   if (!cbm_iec_clk_r(serbus))
194192      value &= ~0x40;
195193
196   if (!serial_data || !cbm_serial_data_read(serbus, 0))
194   if (!cbm_iec_data_r(serbus))
197195      value &= ~0x80;
198196
199197   return value;
r7066r7067
204202   static const int helper[4] = {0xc000, 0x8000, 0x4000, 0x0000};
205203   const device_config *serbus = devtag_get_device(device->machine, "serial_bus");
206204
207   cbm_serial_clock_write(serbus, 0, serial_clock = !(data & 0x10));
208   cbm_serial_data_write(serbus, 0, serial_data = !(data & 0x20));
209   cbm_serial_atn_write(serbus, 0, serial_atn = !(data & 0x08));
205   cbm_iec_atn_w(serbus, device, !BIT(data, 3));
206   cbm_iec_clk_w(serbus, device, !BIT(data, 4));
207   cbm_iec_data_w(serbus, device, !BIT(data, 5));
208
210209   c64_vicaddr = c64_memory + helper[data & 0x03];
211210}
212211
213static void c65_cia1_interrupt( const device_config *device, int level )
212static WRITE_LINE_DEVICE_HANDLER( c65_cia1_interrupt )
214213{
215214   c65_nmi(device->machine);
216215}
217216
218
219const cia6526_interface c65_ntsc_cia1 =
217const mos6526_interface c65_ntsc_cia1 =
220218{
219   60,
221220   DEVCB_LINE(c65_cia1_interrupt),
222221   DEVCB_NULL,   /* pc_func */
223   60,
224
225   {
226      { DEVCB_HANDLER(c65_cia1_port_a_r), DEVCB_HANDLER(c65_cia1_port_a_w) },
227      { DEVCB_NULL, DEVCB_NULL }
228   }
222   DEVCB_NULL,
223   DEVCB_NULL,
224   DEVCB_HANDLER(c65_cia1_port_a_r),
225   DEVCB_HANDLER(c65_cia1_port_a_w),
226   DEVCB_NULL,
227   DEVCB_NULL
229228};
230229
231const cia6526_interface c65_pal_cia1 =
230const mos6526_interface c65_pal_cia1 =
232231{
232   50,
233233   DEVCB_LINE(c65_cia1_interrupt),
234234   DEVCB_NULL,   /* pc_func */
235   50,
236
237   {
238      { DEVCB_HANDLER(c65_cia1_port_a_r), DEVCB_HANDLER(c65_cia1_port_a_w) },
239      { DEVCB_NULL, DEVCB_NULL }
240   }
235   DEVCB_NULL,
236   DEVCB_NULL,
237   DEVCB_HANDLER(c65_cia1_port_a_r),
238   DEVCB_HANDLER(c65_cia1_port_a_w),
239   DEVCB_NULL,
240   DEVCB_NULL
241241};
242242
243243/***********************************************
r7066r7067
740740   switch (offset & 0xf00)
741741   {
742742   case 0x000:
743      cia_w(cia_0, offset, data);
743      mos6526_w(cia_0, offset, data);
744744      break;
745745   case 0x100:
746      cia_w(cia_1, offset, data);
746      mos6526_w(cia_1, offset, data);
747747      break;
748748   case 0x200:
749749   case 0x300:
r7066r7067
802802   switch (offset & 0x300)
803803   {
804804   case 0x000:
805      return cia_r(cia_0, offset);
805      return mos6526_r(cia_0, offset);
806806   case 0x100:
807      return cia_r(cia_1, offset);
807      return mos6526_r(cia_1, offset);
808808   case 0x200:
809809   case 0x300:
810810      DBG_LOG(space->machine, 1, "io read", ("%.3x\n", offset+0xc00));
src/mess/machine/c1581.c
r7066r7067
1515   - WD1770 MO/RDY pin confusion
1616   - ready signal polarity
1717   - floppy access
18    - fast serial
1918    - power LED
2019    - activity LED
2120
r7066r7067
9897}
9998
10099/*-------------------------------------------------
100    c1581_iec_srq_w - serial bus fast clock
101-------------------------------------------------*/
102
103WRITE_LINE_DEVICE_HANDLER( c1581_iec_srq_w )
104{
105   c1581_t *c1581 = get_safe_token(device);
106
107   mos6526_cnt_w(c1581->cia, state);
108}
109
110/*-------------------------------------------------
111    c1581_iec_data_w - serial bus fast data
112-------------------------------------------------*/
113
114WRITE_LINE_DEVICE_HANDLER( c1581_iec_data_w )
115{
116   c1581_t *c1581 = get_safe_token(device);
117
118   mos6526_sp_w(c1581->cia, state);
119}
120
121/*-------------------------------------------------
101122    c1581_iec_reset_w - serial bus reset
102123-------------------------------------------------*/
103124
r7066r7067
115136
116137static ADDRESS_MAP_START( c1581_map, ADDRESS_SPACE_PROGRAM, 8 )
117138   AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM
118   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE(M8520_TAG, cia_r, cia_w)
139   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE(M8520_TAG, mos6526_r, mos6526_w)
119140   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
120141   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1581", 0)
121142ADDRESS_MAP_END
r7066r7067
126147
127148static ADDRESS_MAP_START( c1563_map, ADDRESS_SPACE_PROGRAM, 8 )
128149   AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x2000) AM_RAM
129   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE(M8520_TAG, cia_r, cia_w)
150   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x1ff0) AM_DEVREADWRITE(M8520_TAG, mos6526_r, mos6526_w)
130151   AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
131152   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1563", 0)
132153ADDRESS_MAP_END
133154
134155/*-------------------------------------------------
135    cia6526_interface c1581_cia_intf
156    mos6526_interface cia_intf
136157-------------------------------------------------*/
137158
138static READ8_DEVICE_HANDLER( c1581_cia_pa_r )
159static READ8_DEVICE_HANDLER( cia_pa_r )
139160{
140161   /*
141162
r7066r7067
164185   return data;
165186}
166187
167static WRITE8_DEVICE_HANDLER( c1581_cia_pa_w )
188static WRITE8_DEVICE_HANDLER( cia_pa_w )
168189{
169190   /*
170191
r7066r7067
197218
198219}
199220
200static READ8_DEVICE_HANDLER( c1581_cia_pb_r )
221static READ8_DEVICE_HANDLER( cia_pb_r )
201222{
202223   /*
203224
r7066r7067
232253   return data;
233254}
234255
235static WRITE8_DEVICE_HANDLER( c1581_cia_pb_w )
256static WRITE8_DEVICE_HANDLER( cia_pb_w )
236257{
237258   /*
238259
r7066r7067
267288   c1581->atn_ack = BIT(data, 4);
268289}
269290
270static const cia6526_interface c1581_cia_intf =
291static WRITE_LINE_DEVICE_HANDLER( cia_cnt_w )
271292{
293   c1581_t *c1581 = get_safe_token(device->owner);
294
295   /* fast clock out */
296   cbm_iec_srq_w(c1581->serial_bus, device->owner, state);
297}
298
299static WRITE_LINE_DEVICE_HANDLER( cia_sp_w )
300{
301   c1581_t *c1581 = get_safe_token(device->owner);
302
303   /* fast data out */
304   cbm_iec_data_w(c1581->serial_bus, device->owner, state);
305}
306
307static MOS8520_INTERFACE( cia_intf )
308{
309   XTAL_16MHz/8,
272310   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0),
273311   DEVCB_NULL,
274   XTAL_16MHz/8,
275   {
276      { DEVCB_HANDLER(c1581_cia_pa_r), DEVCB_HANDLER(c1581_cia_pa_w) },
277      { DEVCB_HANDLER(c1581_cia_pb_r), DEVCB_HANDLER(c1581_cia_pb_w) }
278   }
312   DEVCB_LINE(cia_cnt_w),
313   DEVCB_LINE(cia_sp_w),
314   DEVCB_HANDLER(cia_pa_r),
315   DEVCB_HANDLER(cia_pa_w),
316   DEVCB_HANDLER(cia_pb_r),
317   DEVCB_HANDLER(cia_pb_w),
279318};
280319
281320/*-------------------------------------------------
282    wd17xx_interface c1581_wd1770_intf
321    wd17xx_interface wd1770_intf
283322-------------------------------------------------*/
284323
285static const wd17xx_interface c1581_wd1770_intf =
324static const wd17xx_interface wd1770_intf =
286325{
287326   DEVCB_NULL,
288327   DEVCB_NULL,
r7066r7067
326365   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/8)
327366   MDRV_CPU_PROGRAM_MAP(c1581_map)
328367
329   MDRV_CIA8520_ADD(M8520_TAG, XTAL_16MHz/8, c1581_cia_intf)
330   MDRV_WD1770_ADD(WD1770_TAG, /*XTAL_16MHz/2,*/ c1581_wd1770_intf)
368   MDRV_MOS8520_ADD(M8520_TAG, XTAL_16MHz/8, cia_intf)
369   MDRV_WD1770_ADD(WD1770_TAG, /*XTAL_16MHz/2,*/ wd1770_intf)
331370
332371   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1581_floppy_config)
333372MACHINE_DRIVER_END
r7066r7067
340379   MDRV_CPU_ADD(M6502_TAG, M6502, XTAL_16MHz/8)
341380   MDRV_CPU_PROGRAM_MAP(c1563_map)
342381
343   MDRV_CIA8520_ADD(M8520_TAG, XTAL_16MHz/8, c1581_cia_intf)
344   MDRV_WD1770_ADD(WD1770_TAG, /*XTAL_16MHz/2,*/ c1581_wd1770_intf)
382   MDRV_MOS8520_ADD(M8520_TAG, XTAL_16MHz/8, cia_intf)
383   MDRV_WD1770_ADD(WD1770_TAG, /*XTAL_16MHz/2,*/ wd1770_intf)
345384
346385   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1581_floppy_config)
347386MACHINE_DRIVER_END
src/mess/machine/cbmb.c
r7066r7067
273273   ieee488_dio_w(ieeebus, device, data);
274274}
275275
276const cia6526_interface cbmb_cia =
276const mos6526_interface cbmb_cia =
277277{
278   60,
278279   DEVCB_DEVICE_LINE("tpi6525_0", tpi6525_irq2_level),
279280   DEVCB_NULL,   /* pc_func */
280   60,
281
282   {
283      { DEVCB_HANDLER(cbmb_cia_port_a_r), DEVCB_HANDLER(cbmb_cia_port_a_w) },
284      { DEVCB_NULL, DEVCB_NULL }
285   }
281   DEVCB_NULL,
282   DEVCB_NULL,
283   DEVCB_HANDLER(cbmb_cia_port_a_r),
284   DEVCB_HANDLER(cbmb_cia_port_a_w),
285   DEVCB_NULL,
286   DEVCB_NULL
286287};
287288
288289WRITE8_HANDLER( cbmb_colorram_w )
src/mess/machine/c1581.h
r7066r7067
3030   MDRV_DEVICE_CONFIG_DATA32(c1581_config, address, _address)
3131
3232#define C1581_IEC(_tag) \
33   _tag, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1581_iec_atn_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1581_iec_reset_w)
33   _tag, DEVCB_DEVICE_LINE(_tag, c1581_iec_srq_w), DEVCB_DEVICE_LINE(_tag, c1581_iec_atn_w), DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1581_iec_data_w), DEVCB_DEVICE_LINE(_tag, c1581_iec_reset_w)
3434
3535/***************************************************************************
3636    TYPE DEFINITIONS
r7066r7067
5252DEVICE_GET_INFO( c1563 );
5353
5454/* IEC interface */
55WRITE_LINE_DEVICE_HANDLER( c1581_iec_srq_w );
5556WRITE_LINE_DEVICE_HANDLER( c1581_iec_atn_w );
57WRITE_LINE_DEVICE_HANDLER( c1581_iec_data_w );
5658WRITE_LINE_DEVICE_HANDLER( c1581_iec_reset_w );
5759
5860#endif
src/mess/machine/c128.c
r7066r7067
7575{
7676   static int nmilevel = 0;
7777   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
78   int cia1irq = cia_get_irq(cia_1);
78   int cia1irq = mos6526_irq_r(cia_1);
7979
8080   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
8181   {
r7066r7067
111111
112112static READ8_DEVICE_HANDLER( c128_cia0_port_a_r )
113113{
114   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
114   UINT8 cia0portb = mos6526_pb_r(devtag_get_device(device->machine, "cia_0"), 0);
115115
116116   return cbm_common_cia0_port_a_r(device, cia0portb);
117117}
r7066r7067
119119static READ8_DEVICE_HANDLER( c128_cia0_port_b_r )
120120{
121121   UINT8 value = 0xff;
122   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
122   UINT8 cia0porta = mos6526_pa_r(devtag_get_device(device->machine, "cia_0"), 0);
123123
124124   value &= cbm_common_cia0_port_b_r(device, cia0porta);
125125
r7066r7067
170170#if 1
171171   if (level != vicirq)
172172   {
173      c128_irq (machine, level || cia_get_irq(cia_0));
173      c128_irq (machine, level || mos6526_irq_r(cia_0));
174174      vicirq = level;
175175   }
176176#endif
177177}
178178
179const cia6526_interface c128_ntsc_cia0 =
179const mos6526_interface c128_ntsc_cia0 =
180180{
181   60,
181182   DEVCB_LINE(c128_cia0_interrupt),
182183   DEVCB_NULL,   /* pc_func */
183   60,
184
185   {
186      { DEVCB_HANDLER(c128_cia0_port_a_r), DEVCB_NULL },
187      { DEVCB_HANDLER(c128_cia0_port_b_r), DEVCB_HANDLER(c128_cia0_port_b_w) }
188   }
184   DEVCB_NULL,
185   DEVCB_NULL,
186   DEVCB_HANDLER(c128_cia0_port_a_r),
187   DEVCB_NULL,
188   DEVCB_HANDLER(c128_cia0_port_b_r),
189   DEVCB_HANDLER(c128_cia0_port_b_w)
189190};
190191
191const cia6526_interface c128_pal_cia0 =
192const mos6526_interface c128_pal_cia0 =
192193{
194   50,
193195   DEVCB_LINE(c128_cia0_interrupt),
194196   DEVCB_NULL,   /* pc_func */
195   50,
196
197   {
198      { DEVCB_HANDLER(c128_cia0_port_a_r), DEVCB_NULL },
199      { DEVCB_HANDLER(c128_cia0_port_b_r), DEVCB_HANDLER(c128_cia0_port_b_w) }
200   }
197   DEVCB_NULL,
198   DEVCB_NULL,
199   DEVCB_HANDLER(c128_cia0_port_a_r),
200   DEVCB_NULL,
201   DEVCB_HANDLER(c128_cia0_port_b_r),
202   DEVCB_HANDLER(c128_cia0_port_b_w)
201203};
202204
203205
r7066r7067
255257   c128_nmi(device->machine);
256258}
257259
258const cia6526_interface c128_ntsc_cia1 =
260const mos6526_interface c128_ntsc_cia1 =
259261{
262   60,
260263   DEVCB_LINE(c128_cia1_interrupt),
261264   DEVCB_NULL,   /* pc_func */
262   60,
263
264   {
265      { DEVCB_HANDLER(c128_cia1_port_a_r), DEVCB_HANDLER(c128_cia1_port_a_w) },
266      { DEVCB_NULL, DEVCB_NULL }
267   }
265   DEVCB_NULL,
266   DEVCB_NULL,
267   DEVCB_HANDLER(c128_cia1_port_a_r),
268   DEVCB_HANDLER(c128_cia1_port_a_w),
269   DEVCB_NULL,
270   DEVCB_NULL
268271};
269272
270const cia6526_interface c128_pal_cia1 =
273const mos6526_interface c128_pal_cia1 =
271274{
275   50,
272276   DEVCB_LINE(c128_cia1_interrupt),
273277   DEVCB_NULL,   /* pc_func */
274   50,
275
276   {
277      { DEVCB_HANDLER(c128_cia1_port_a_r), DEVCB_HANDLER(c128_cia1_port_a_w) },
278      { DEVCB_NULL, DEVCB_NULL }
279   }
278   DEVCB_NULL,
279   DEVCB_NULL,
280   DEVCB_HANDLER(c128_cia1_port_a_r),
281   DEVCB_HANDLER(c128_cia1_port_a_w),
282   DEVCB_NULL,
283   DEVCB_NULL
280284};
281285
282286/***********************************************
r7066r7067
333337            c64_colorram[(offset & 0x3ff)|((c64_port6510&3)<<10)] = data | 0xf0; // maybe all 8 bit connected!
334338          break;
335339      case 0xc:
336         cia_w(cia_0, offset, data);
340         mos6526_w(cia_0, offset, data);
337341         break;
338342      case 0xd:
339         cia_w(cia_1, offset, data);
343         mos6526_w(cia_1, offset, data);
340344         break;
341345      case 0xf:
342346         c128_dma8726_port_w(space, offset&0xff,data);
r7066r7067
369373   else if (offset == 0xc00)
370374      {
371375         cia_set_port_mask_value(cia_0, 0, input_port_read(space->machine, "CTRLSEL") & 0x80 ? c64_keyline[8] : c64_keyline[9] );
372         return cia_r(cia_0, offset);
376         return mos6526_r(cia_0, offset);
373377      }
374378   else if (offset == 0xc01)
375379      {
376380         cia_set_port_mask_value(cia_0, 1, input_port_read(space->machine, "CTRLSEL") & 0x80 ? c64_keyline[9] : c64_keyline[8] );
377         return cia_r(cia_0, offset);
381         return mos6526_r(cia_0, offset);
378382      }
379383   else if (offset < 0xd00)
380      return cia_r(cia_0, offset);
384      return mos6526_r(cia_0, offset);
381385   else if (offset < 0xe00)
382      return cia_r(cia_1, offset);
386      return mos6526_r(cia_1, offset);
383387   else if ((offset >= 0xf00) & (offset <= 0xfff))
384388      return c128_dma8726_port_r(space, offset&0xff);
385389   DBG_LOG(space->machine, 1, "io read", ("%.3x\n", offset));
src/mess/machine/amigafdc.c
r7066r7067
665665
666666   /* Issue a index pulse when a disk revolution completes */
667667   cia = devtag_get_device(machine, "cia_1");
668   cia_issue_index(cia);
668   mos6526_flag_w(cia, 0);
669   mos6526_flag_w(cia, 1);
669670
670671   timer_adjust_oneshot(fdc->fdc_status[drive].rev_timer, ATTOTIME_IN_MSEC( ONE_REV_TIME ), drive);
671672   fdc->fdc_status[drive].rev_timer_started = 1;
src/mess/machine/amigakbd.c
r7066r7067
2727   /* send over to the cia A */
2828   for( j = 0; j < 8; j++ )
2929   {
30      cia_set_input_cnt( cia, 0 );   /* lower cnt */
31      cia_set_input_sp( cia, ( scancode >> j ) & 1 ); /* set the serial data */
32      cia_set_input_cnt( cia, 1 );   /* raise cnt */
30      mos6526_cnt_w( cia, 0 );   /* lower cnt */
31      mos6526_sp_w( cia, ( scancode >> j ) & 1 ); /* set the serial data */
32      mos6526_cnt_w( cia, 1 );   /* raise cnt */
3333   }
3434}
3535
src/mess/machine/primo.c
r7066r7067
1515
1616/* Components */
1717#include "cpu/z80/z80.h"
18#include "includes/cbmserb.h"
18#include "machine/cbmiec.h"
1919#include "sound/speaker.h"
2020
2121/* Devices */
r7066r7067
2626
2727static UINT8 primo_port_FD = 0x00;
2828static int primo_nmi = 0;
29static int serial_atn = 1, serial_clock = 1, serial_data = 1;
3029
3130/*******************************************************************************
3231
r7066r7067
111110   // bit 7, 6 - not used
112111
113112   // bit 5 - SCLK
114   if (!serial_clock || !cbm_serial_clock_read(serbus, 0))
113   if (!cbm_iec_clk_r(serbus))
115114      data &= ~0x20;
116115
117116   // bit 4 - SDATA
118   if (!serial_data || !cbm_serial_data_read(serbus, 0))
117   if (!cbm_iec_data_r(serbus))
119118      data &= ~0x10;
120119
121120   // bit 3 - SRQ
122//  data &= (!cbm_serial_request_read(serbus, 0)) ? ~0x08 : ~0x00;
121   if (!cbm_iec_srq_r(serbus))
122      data &= ~0x08;
123123
124124   // bit 2 - joystic 2 (not implemeted yet)
125125
126126   // bit 1 - ATN
127   if (!serial_atn || !cbm_serial_atn_read(serbus, 0))
127   if (!cbm_iec_atn_r(serbus))
128128      data &= ~0x02;
129129
130130   // bit 0 - joystic 1 (not implemeted yet)
r7066r7067
177177   // bit 7, 6 - not used
178178
179179   // bit 5 - SCLK
180   cbm_serial_clock_write(serbus, 0, serial_clock = !(data & 0x20));
181   logerror ("W - SCLK: %d ", serial_clock ? 1 : 0);
180   cbm_iec_clk_w(serbus, NULL, !BIT(data, 5));
182181
183182   // bit 4 - SDATA
184   cbm_serial_data_write(serbus, 0, serial_data = !(data & 0x10));
185   logerror ("SDATA: %d ", serial_data ? 1 : 0);
183   cbm_iec_data_w(serbus, NULL, !BIT(data, 4));
186184
187185   // bit 3 - not used
188186
189187   // bit 2 - SRQ
190   cbm_serial_request_write(serbus, 0, !(data & 0x04));
188   cbm_iec_srq_w(serbus, NULL, !BIT(data, 2));
191189
192190   // bit 1 - ATN
193   cbm_serial_atn_write(serbus, 0, serial_atn = !(data & 0x02));
194   logerror ("ATN: %d\n", serial_atn ? 1 : 0);
191   cbm_iec_atn_w(serbus, NULL, !BIT(data, 1));
195192
196193   // bit 0 - not used
197194
198   if (data & 0x04)
199      logerror ("SRQ WRITE\n");
200195//  logerror ("IOW KI-2 data:%02x\n", data);
201196}
202197
src/mess/machine/c1571.c
r7066r7067
184184}
185185
186186/*-------------------------------------------------
187    c1571_iec_srq_w - serial bus fast clock
188-------------------------------------------------*/
189
190WRITE_LINE_DEVICE_HANDLER( c1571_iec_srq_w )
191{
192   c1571_t *c1571 = get_safe_token(device);
193
194   mos6526_cnt_w(c1571->cia, state);
195}
196
197/*-------------------------------------------------
198    c1571_iec_data_w - serial bus fast data
199-------------------------------------------------*/
200
201WRITE_LINE_DEVICE_HANDLER( c1571_iec_data_w )
202{
203   c1571_t *c1571 = get_safe_token(device);
204
205   mos6526_sp_w(c1571->cia, state);
206}
207
208/*-------------------------------------------------
187209    c1571_iec_reset_w - serial bus reset
188210-------------------------------------------------*/
189211
r7066r7067
204226   AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE(M6522_0_TAG, via_r, via_w)
205227   AM_RANGE(0x1c00, 0x1c0f) AM_DEVREADWRITE(M6522_1_TAG, via_r, via_w)
206228   AM_RANGE(0x2000, 0x2003) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
207   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(M6526_TAG, cia_r, cia_w)
229   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(M6526_TAG, mos6526_r, mos6526_w)
208230   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1570", 0)
209231ADDRESS_MAP_END
210232
r7066r7067
217239   AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE(M6522_0_TAG, via_r, via_w)
218240   AM_RANGE(0x1c00, 0x1c0f) AM_DEVREADWRITE(M6522_1_TAG, via_r, via_w)
219241   AM_RANGE(0x2000, 0x2003) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
220   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(M6526_TAG, cia_r, cia_w)
242   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(M6526_TAG, mos6526_r, mos6526_w)
221243   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1571", 0)
222244ADDRESS_MAP_END
223245
r7066r7067
577599};
578600
579601/*-------------------------------------------------
580    cia6526_interface c1571_cia_intf
602    mos6526_interface c1571_cia_intf
581603-------------------------------------------------*/
582604
583605static WRITE_LINE_DEVICE_HANDLER( cia_irq_w )
r7066r7067
589611   cpu_set_input_line(c1571->cpu, INPUT_LINE_IRQ0, (c1571->via0_irq | c1571->via1_irq | c1571->cia_irq) ? ASSERT_LINE : CLEAR_LINE);
590612}
591613
592static const cia6526_interface c1571_cia_intf =
614static WRITE_LINE_DEVICE_HANDLER( cia_cnt_w )
593615{
616   c1571_t *c1571 = get_safe_token(device->owner);
617
618   /* fast clock out */
619   cbm_iec_srq_w(c1571->serial_bus, device->owner, state);
620}
621
622static WRITE_LINE_DEVICE_HANDLER( cia_sp_w )
623{
624   c1571_t *c1571 = get_safe_token(device->owner);
625
626   /* fast data out */
627   cbm_iec_data_w(c1571->serial_bus, device->owner, state);
628}
629
630static MOS6526_INTERFACE( c1571_cia_intf )
631{
632   10,
594633   DEVCB_LINE(cia_irq_w),
595634   DEVCB_NULL,
596   10, /* 1/10 second */
597   {
598      { DEVCB_NULL, DEVCB_NULL },
599      { DEVCB_NULL, DEVCB_NULL }
600   }
635   DEVCB_LINE(cia_cnt_w),
636   DEVCB_LINE(cia_sp_w),
637   DEVCB_NULL,
638   DEVCB_NULL,
639   DEVCB_NULL,
640   DEVCB_NULL
601641};
602642
603643/*-------------------------------------------------
r7066r7067
663703
664704   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/8, c1571_via0_intf)
665705   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/8, c1571_via1_intf)
666   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/8, c1571_cia_intf)
706   MDRV_MOS6526R1_ADD(M6526_TAG, XTAL_16MHz/8, c1571_cia_intf)
667707   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
668708
669709   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1570_floppy_config)
r7066r7067
679719
680720   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/8, c1571_via0_intf)
681721   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/8, c1571_via1_intf)
682   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/8, c1571_cia_intf)
722   MDRV_MOS6526R1_ADD(M6526_TAG, XTAL_16MHz/8, c1571_cia_intf)
683723   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
684724
685725   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_config)
r7066r7067
695735
696736   MDRV_VIA6522_ADD(M6522_0_TAG, XTAL_16MHz/8, c1571_via0_intf)
697737   MDRV_VIA6522_ADD(M6522_1_TAG, XTAL_16MHz/8, c1571_via1_intf)
698   MDRV_CIA6526_ADD(M6526_TAG, CIA6526R1, XTAL_16MHz/8, c1571_cia_intf)
738   MDRV_MOS6526R1_ADD(M6526_TAG, XTAL_16MHz/8, c1571_cia_intf)
699739   MDRV_WD1770_ADD(WD1770_TAG, c1571_wd1770_intf)
700740
701741   MDRV_FLOPPY_DRIVE_ADD(FLOPPY_0, c1571_floppy_config)
src/mess/machine/c1571.h
r7066r7067
3636   MDRV_DEVICE_CONFIG_DATA32(c1571_config, address, _address)
3737
3838#define C1571_IEC(_tag) \
39   _tag, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1571_iec_atn_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1571_iec_reset_w)
39   _tag, DEVCB_DEVICE_LINE(_tag, c1571_iec_srq_w), DEVCB_DEVICE_LINE(_tag, c1571_iec_atn_w), DEVCB_NULL, DEVCB_DEVICE_LINE(_tag, c1571_iec_data_w), DEVCB_DEVICE_LINE(_tag, c1571_iec_reset_w)
4040
4141/***************************************************************************
4242    TYPE DEFINITIONS
r7066r7067
5959DEVICE_GET_INFO( c1571cr );
6060
6161/* IEC interface */
62WRITE_LINE_DEVICE_HANDLER( c1571_iec_srq_w );
6263WRITE_LINE_DEVICE_HANDLER( c1571_iec_atn_w );
64WRITE_LINE_DEVICE_HANDLER( c1571_iec_data_w );
6365WRITE_LINE_DEVICE_HANDLER( c1571_iec_reset_w );
6466
6567#endif
src/mess/machine/c64.c
r7066r7067
7373{
7474   static int nmilevel = 0;
7575   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
76   int cia1irq = cia_get_irq(cia_1);
76   int cia1irq = mos6526_irq_r(cia_1);
7777
7878   if (nmilevel != (input_port_read(machine, "SPECIAL") & 0x80) || cia1irq)   /* KEY_RESTORE */
7979   {
r7066r7067
102102
103103static READ8_DEVICE_HANDLER( c64_cia0_port_a_r )
104104{
105   UINT8 cia0portb = cia_get_output_b(devtag_get_device(device->machine, "cia_0"));
105   UINT8 cia0portb = mos6526_pb_r(devtag_get_device(device->machine, "cia_0"), 0);
106106
107107   return cbm_common_cia0_port_a_r(device, cia0portb);
108108}
109109
110110static READ8_DEVICE_HANDLER( c64_cia0_port_b_r )
111111{
112   UINT8 cia0porta = cia_get_output_a(devtag_get_device(device->machine, "cia_0"));
112   UINT8 cia0porta = mos6526_pa_r(devtag_get_device(device->machine, "cia_0"), 0);
113113
114114   return cbm_common_cia0_port_b_r(device, cia0porta);
115115}
r7066r7067
142142#if 1
143143   if (level != vicirq)
144144   {
145      c64_irq (machine, level || cia_get_irq(cia_0));
145      c64_irq (machine, level || mos6526_irq_r(cia_0));
146146      vicirq = level;
147147   }
148148#endif
149149}
150150
151const cia6526_interface c64_ntsc_cia0 =
151const mos6526_interface c64_ntsc_cia0 =
152152{
153   10, /* 1/10 second */
153154   DEVCB_LINE(c64_cia0_interrupt),
154155   DEVCB_NULL,   /* pc_func */
155   10, /* 1/10 second */
156
157   {
158      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
159      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
160   }
156   DEVCB_NULL,
157   DEVCB_NULL,
158   DEVCB_HANDLER(c64_cia0_port_a_r),
159   DEVCB_NULL,
160   DEVCB_HANDLER(c64_cia0_port_b_r),
161   DEVCB_HANDLER(c64_cia0_port_b_w)
161162};
162163
163const cia6526_interface c64_pal_cia0 =
164const mos6526_interface c64_pal_cia0 =
164165{
166   10, /* 1/10 second */
165167   DEVCB_LINE(c64_cia0_interrupt),
166168   DEVCB_NULL,   /* pc_func */
167   10, /* 1/10 second */
168
169   {
170      { DEVCB_HANDLER(c64_cia0_port_a_r), DEVCB_NULL },
171      { DEVCB_HANDLER(c64_cia0_port_b_r), DEVCB_HANDLER(c64_cia0_port_b_w) }
172   }
169   DEVCB_NULL,
170   DEVCB_NULL,
171   DEVCB_HANDLER(c64_cia0_port_a_r),
172   DEVCB_NULL,
173   DEVCB_HANDLER(c64_cia0_port_b_r),
174   DEVCB_HANDLER(c64_cia0_port_b_w)
173175};
174176
175177
r7066r7067
226228   c64_nmi(device->machine);
227229}
228230
229const cia6526_interface c64_ntsc_cia1 =
231const mos6526_interface c64_ntsc_cia1 =
230232{
233   10, /* 1/10 second */
231234   DEVCB_LINE(c64_cia1_interrupt),
232235   DEVCB_NULL,   /* pc_func */
233   10, /* 1/10 second */
234
235   {
236      { DEVCB_HANDLER(c64_cia1_port_a_r), DEVCB_HANDLER(c64_cia1_port_a_w) },
237      { DEVCB_NULL, DEVCB_NULL }
238   }
236   DEVCB_NULL,
237   DEVCB_NULL,
238   DEVCB_HANDLER(c64_cia1_port_a_r),
239   DEVCB_HANDLER(c64_cia1_port_a_w),
240   DEVCB_NULL,
241   DEVCB_NULL
239242};
240243
241const cia6526_interface c64_pal_cia1 =
244const mos6526_interface c64_pal_cia1 =
242245{
246   10, /* 1/10 second */
243247   DEVCB_LINE(c64_cia1_interrupt),
244248   DEVCB_NULL,   /* pc_func */
245   10, /* 1/10 second */
246
247   {
248      { DEVCB_HANDLER(c64_cia1_port_a_r), DEVCB_HANDLER(c64_cia1_port_a_w) },
249      { DEVCB_NULL, DEVCB_NULL }
250   }
249   DEVCB_NULL,
250   DEVCB_NULL,
251   DEVCB_HANDLER(c64_cia1_port_a_r),
252   DEVCB_HANDLER(c64_cia1_port_a_w),
253   DEVCB_NULL,
254   DEVCB_NULL
251255};
252256
253257/***********************************************
r7066r7067
273277   else if (offset < 0xc00)
274278      c64_colorram[offset & 0x3ff] = data | 0xf0;
275279   else if (offset < 0xd00)
276      cia_w(cia_0, offset, data);
280      mos6526_w(cia_0, offset, data);
277281   else if (offset < 0xe00)
278282   {
279283      if (c64_cia1_on)
280         cia_w(cia_1, offset, data);
284         mos6526_w(cia_1, offset, data);
281285      else
282286         DBG_LOG(space->machine, 1, "io write", ("%.3x %.2x\n", offset, data));
283287   }
r7066r7067
313317   else if (offset == 0xc00)
314318      {
315319         cia_set_port_mask_value(cia_0, 0, input_port_read(space->machine, "CTRLSEL") & 0x80 ? c64_keyline[8] : c64_keyline[9] );
316         return cia_r(cia_0, offset);
320         return mos6526_r(cia_0, offset);
317321      }
318322
319323   else if (offset == 0xc01)
320324      {
321325         cia_set_port_mask_value(cia_0, 1, input_port_read(space->machine, "CTRLSEL") & 0x80 ? c64_keyline[9] : c64_keyline[8] );
322         return cia_r(cia_0, offset);
326         return mos6526_r(cia_0, offset);
323327      }
324328
325329   else if (offset < 0xd00)
326      return cia_r(cia_0, offset);
330      return mos6526_r(cia_0, offset);
327331
328332   else if (c64_cia1_on && (offset < 0xe00))
329      return cia_r(cia_1, offset);
333      return mos6526_r(cia_1, offset);
330334
331335   DBG_LOG(space->machine, 1, "io read", ("%.3x\n", offset));
332336
r7066r7067
630634{
631635   running_machine *machine = device->machine;
632636   int pot1 = 0xff, pot2 = 0xff, pot3 = 0xff, pot4 = 0xff, temp;
633   UINT8 cia0porta = cia_get_output_a(devtag_get_device(machine, "cia_0"));
637   UINT8 cia0porta = mos6526_pa_r(devtag_get_device(machine, "cia_0"), 0);
634638   int controller1 = input_port_read(machine, "CTRLSEL") & 0x07;
635639   int controller2 = input_port_read(machine, "CTRLSEL") & 0x70;
636640
r7066r7067
772776   return c64_colorram[offset & 0x3ff] & 0xf;
773777}
774778
775static double last = 0;
776
777779TIMER_CALLBACK( c64_tape_timer )
778780{
779781   double tmp = cassette_input(devtag_get_device(machine, "cassette"));
780782   const device_config *cia_0 = devtag_get_device(machine, "cia_0");
781783
782   if((last > +0.0) && (tmp < +0.0))
783      cia_issue_index(cia_0);
784
785   last = tmp;
784   mos6526_flag_w(cia_0, tmp > +0.0);
786785}
787786
788787static void c64_common_driver_init( running_machine *machine )
src/mess/drivers/c65.c
r7066r7067
6565
6666#include "includes/c64.h"
6767#include "includes/c65.h"
68#include "includes/cbmserb.h"
68#include "machine/cbmiec.h"
6969#include "devices/messram.h"
7070
7171/*************************************
r7066r7067
200200   c64_paddle_read
201201};
202202
203static const cbm_serial_bus_interface c65_drive_interface =
204{
205   DEVCB_NULL,
206   DEVCB_NULL,
207   DEVCB_NULL,
208   DEVCB_NULL,
209   DEVCB_NULL,
210   DEVCB_NULL,
211   DEVCB_NULL,
212   DEVCB_NULL,
213203
214   DEVCB_NULL
204static CBM_IEC_DAISY( cbm_iec_daisy )
205{
206   { "cia_1" },
207   { NULL}
215208};
216209
217
218210/*************************************
219211 *
220212 *  Machine driver
r7066r7067
253245   MDRV_QUICKLOAD_ADD("quickload", cbm_c65, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
254246
255247   /* cia */
256   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c65_ntsc_cia0)
257   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c65_ntsc_cia1)
248   MDRV_MOS6526R1_ADD("cia_0", 3500000, c65_ntsc_cia0)
249   MDRV_MOS6526R1_ADD("cia_1", 3500000, c65_ntsc_cia1)
258250
259251   /* floppy from serial bus */
260   MDRV_CBM_SERBUS_ADD("serial_bus", c65_drive_interface)
252   MDRV_CBM_IEC_ADD("serial_bus", cbm_iec_daisy)
261253
262254   MDRV_IMPORT_FROM(c64_cartslot)
263255
r7066r7067
284276   /* cia */
285277   MDRV_DEVICE_REMOVE("cia_0")
286278   MDRV_DEVICE_REMOVE("cia_1")
287   MDRV_CIA6526_ADD("cia_0", CIA6526R1, 3500000, c65_pal_cia0)
288   MDRV_CIA6526_ADD("cia_1", CIA6526R1, 3500000, c65_pal_cia1)
279   MDRV_MOS6526R1_ADD("cia_0", 3500000, c65_pal_cia0)
280   MDRV_MOS6526R1_ADD("cia_1", 3500000, c65_pal_cia1)
289281MACHINE_DRIVER_END
290282
291283
src/mess/drivers/cbmb.c
r7066r7067
139139   /* disk units */
140140   AM_RANGE(0xfda00, 0xfdaff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
141141   /* db00 coprocessor */
142   AM_RANGE(0xfdc00, 0xfdcff) AM_DEVREADWRITE("cia", cia_r, cia_w)
142   AM_RANGE(0xfdc00, 0xfdcff) AM_DEVREADWRITE("cia", mos6526_r, mos6526_w)
143143   /* dd00 acia */
144144   AM_RANGE(0xfde00, 0xfdeff) AM_DEVREADWRITE("tpi6525_0", tpi6525_r, tpi6525_w)
145145   AM_RANGE(0xfdf00, 0xfdfff) AM_DEVREADWRITE("tpi6525_1", tpi6525_r, tpi6525_w)
r7066r7067
166166   /* disk units */
167167   AM_RANGE(0xfda00, 0xfdaff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
168168   /* db00 coprocessor */
169   AM_RANGE(0xfdc00, 0xfdcff) AM_DEVREADWRITE("cia", cia_r, cia_w)
169   AM_RANGE(0xfdc00, 0xfdcff) AM_DEVREADWRITE("cia", mos6526_r, mos6526_w)
170170   /* dd00 acia */
171171   AM_RANGE(0xfde00, 0xfdeff) AM_DEVREADWRITE("tpi6525_0", tpi6525_r, tpi6525_w)
172172   AM_RANGE(0xfdf00, 0xfdfff) AM_DEVREADWRITE("tpi6525_1", tpi6525_r, tpi6525_w)
r7066r7067
385385   MDRV_QUICKLOAD_ADD("quickload", cbmb, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
386386
387387   /* cia */
388   MDRV_CIA6526_ADD("cia", CIA6526R1, 7833600, cbmb_cia)
388   MDRV_MOS6526R1_ADD("cia", 7833600, cbmb_cia)
389389
390390   /* tpi */
391391   MDRV_TPI6525_ADD("tpi6525_0", cbmb_tpi_0_intf)
r7066r7067
458458   MDRV_QUICKLOAD_ADD("quickload", p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
459459
460460   /* cia */
461   MDRV_CIA6526_ADD("cia", CIA6526R1, VIC6567_CLOCK, cbmb_cia)
461   MDRV_MOS6526R1_ADD("cia", VIC6567_CLOCK, cbmb_cia)
462462
463463   /* tpi */
464464   MDRV_TPI6525_ADD("tpi6525_0", cbmb_tpi_0_intf)
src/mess/drivers/c128.c
r7066r7067
256256   AM_RANGE(0xd400, 0xd4ff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
257257   AM_RANGE(0xd500, 0xd5ff) AM_READWRITE(c128_mmu8722_port_r, c128_mmu8722_port_w)
258258   AM_RANGE(0xd600, 0xd7ff) AM_READWRITE(vdc8563_port_r, vdc8563_port_w)
259   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", cia_r, cia_w)
260   AM_RANGE(0xdd00, 0xddff) AM_DEVREADWRITE("cia_1", cia_r, cia_w)
259   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", mos6526_r, mos6526_w)
260   AM_RANGE(0xdd00, 0xddff) AM_DEVREADWRITE("cia_1", mos6526_r, mos6526_w)
261261/*  AM_RANGE(0xdf00, 0xdfff) AM_READWRITE(dma_port_r, dma_port_w) */
262262ADDRESS_MAP_END
263263
r7066r7067
646646   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
647647
648648   /* cia */
649   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia0)
650   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6567_CLOCK, c128_ntsc_cia1)
649   MDRV_MOS6526R1_ADD("cia_0", VIC6567_CLOCK, c128_ntsc_cia0)
650   MDRV_MOS6526R1_ADD("cia_1", VIC6567_CLOCK, c128_ntsc_cia1)
651651
652652   /* floppy from serial bus */
653653   MDRV_CBM_IEC_ADD("iec", c128_iec_bus)
r7066r7067
696696   /* cia */
697697   MDRV_DEVICE_REMOVE("cia_0")
698698   MDRV_DEVICE_REMOVE("cia_1")
699   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6569_CLOCK, c128_pal_cia0)
700   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6569_CLOCK, c128_pal_cia1)
699   MDRV_MOS6526R1_ADD("cia_0", VIC6569_CLOCK, c128_pal_cia0)
700   MDRV_MOS6526R1_ADD("cia_1", VIC6569_CLOCK, c128_pal_cia1)
701701MACHINE_DRIVER_END
702702
703703static MACHINE_DRIVER_START( c128dpal )
src/mess/drivers/amiga.c
r7066r7067
6464    CENTRONICS PORT
6565***************************************************************************/
6666
67static WRITE_LINE_DEVICE_HANDLER( amiga_centronics_ack_w )
68{
69   if (state == FALSE)
70      cia_issue_index(device);
71}
72
7367static READ8_DEVICE_HANDLER( amiga_cia_1_porta_r )
7468{
7569   UINT8 result = 0;
r7066r7067
8781static const centronics_interface amiga_centronics_config =
8882{
8983   FALSE,
90   DEVCB_DEVICE_LINE("cia_0", amiga_centronics_ack_w),
84   DEVCB_DEVICE_LINE("cia_0", mos6526_flag_w),
9185   DEVCB_NULL,
9286   DEVCB_NULL
9387};
r7066r7067
286280   MACHINE_RESET_CALL( amigacd );
287281}
288282
289static const cia6526_interface cia_0_ntsc_intf =
283static const mos6526_interface cia_0_ntsc_intf =
290284{
291   DEVCB_LINE(amiga_cia_0_irq),                           /* irq_func */
285   60,                                          /* tod_clock */
286   DEVCB_LINE(amiga_cia_0_irq),                     /* irq_func */
292287   DEVCB_DEVICE_LINE("centronics", centronics_strobe_w),   /* pc_func */
293   60,                                       /* tod_clock */
294   {
295      { DEVCB_HANDLER(amiga_cia_0_portA_r), DEVCB_HANDLER(amiga_cia_0_portA_w) },         /* port A */
296      { DEVCB_NULL, DEVCB_DEVICE_HANDLER("centronics", centronics_data_w) }   /* port B */
297   }
288   DEVCB_NULL,
289   DEVCB_NULL,
290   DEVCB_HANDLER(amiga_cia_0_portA_r),
291   DEVCB_HANDLER(amiga_cia_0_portA_w),                  /* port A */
292   DEVCB_NULL,
293   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w)   /* port B */
298294};
299295
300static const cia6526_interface cia_0_pal_intf =
296static const mos6526_interface cia_0_pal_intf =
301297{
302   DEVCB_LINE(amiga_cia_0_irq),                           /* irq_func */
298   50,                                          /* tod_clock */
299   DEVCB_LINE(amiga_cia_0_irq),                     /* irq_func */
303300   DEVCB_DEVICE_LINE("centronics", centronics_strobe_w),   /* pc_func */
304   50,                                       /* tod_clock */
305   {
306      { DEVCB_HANDLER(amiga_cia_0_portA_r), DEVCB_HANDLER(amiga_cia_0_portA_w) },         /* port A */
307      { DEVCB_NULL, DEVCB_DEVICE_HANDLER("centronics", centronics_data_w) }   /* port B */
308   }
301   DEVCB_NULL,
302   DEVCB_NULL,
303   DEVCB_HANDLER(amiga_cia_0_portA_r),
304   DEVCB_HANDLER(amiga_cia_0_portA_w),                  /* port A */
305   DEVCB_NULL,
306   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w)   /* port B */
309307};
310308
311static const cia6526_interface cia_1_intf =
309static const mos6526_interface cia_1_intf =
312310{
313   DEVCB_LINE(amiga_cia_1_irq),                           /* irq_func */
314   DEVCB_NULL,   /* pc_func */
315   0,                                       /* tod_clock */
316   {
317      { DEVCB_DEVICE_HANDLER("centronics", amiga_cia_1_porta_r), DEVCB_NULL },   /* port A */
318      { DEVCB_NULL, DEVCB_DEVICE_HANDLER("fdc", amiga_fdc_control_w) }               /* port B */
319   }
311   0,                                          /* tod_clock */
312   DEVCB_LINE(amiga_cia_1_irq),                     /* irq_func */
313   DEVCB_NULL,                                    /* pc_func */
314   DEVCB_NULL,
315   DEVCB_NULL,
316   DEVCB_DEVICE_HANDLER("centronics", amiga_cia_1_porta_r),
317   DEVCB_NULL,                                    /* port A */
318   DEVCB_NULL,
319   DEVCB_DEVICE_HANDLER("fdc", amiga_fdc_control_w)      /* port B */
320320};
321321
322static const cia6526_interface cia_0_cdtv_intf =
322static const mos6526_interface cia_0_cdtv_intf =
323323{
324   DEVCB_LINE(amiga_cia_0_irq),                           /* irq_func */
324   0,                                          /* tod_clock */
325   DEVCB_LINE(amiga_cia_0_irq),                     /* irq_func */
325326   DEVCB_DEVICE_LINE("centronics", centronics_strobe_w),   /* pc_func */
326   0,                                       /* tod_clock */
327   {
328      { DEVCB_HANDLER(amiga_cia_0_cdtv_portA_r), DEVCB_HANDLER(amiga_cia_0_portA_w) },   /* port A */
329      { DEVCB_NULL, DEVCB_DEVICE_HANDLER("centronics", centronics_data_w) }   /* port B */
330   }
327   DEVCB_NULL,
328   DEVCB_NULL,
329   DEVCB_HANDLER(amiga_cia_0_cdtv_portA_r),
330   DEVCB_HANDLER(amiga_cia_0_portA_w),                  /* port A */
331   DEVCB_NULL,
332   DEVCB_DEVICE_HANDLER("centronics", centronics_data_w)   /* port B */
331333};
332334
333static const cia6526_interface cia_1_cdtv_intf =
335static const mos6526_interface cia_1_cdtv_intf =
334336{
335   DEVCB_LINE(amiga_cia_1_irq),                           /* irq_func */
337   0,                                          /* tod_clock */
338   DEVCB_LINE(amiga_cia_1_irq),                     /* irq_func */
336339   DEVCB_NULL,   /* pc_func */
337   0,                                       /* tod_clock */
338   {
339      { DEVCB_DEVICE_HANDLER("centronics", amiga_cia_1_porta_r), DEVCB_NULL, },   /* port A */
340      { DEVCB_NULL, DEVCB_NULL }               /* port B */
341   }
340   DEVCB_NULL,
341   DEVCB_NULL,
342   DEVCB_DEVICE_HANDLER("centronics", amiga_cia_1_porta_r),
343   DEVCB_NULL,                                    /* port A */
344   DEVCB_NULL,
345   DEVCB_NULL                                    /* port B */
342346};
343347
344348static const tpi6525_interface cdtv_tpi_intf =
r7066r7067
400404   MDRV_SOUND_ROUTE(3, "lspeaker", 0.50)
401405
402406   /* cia */
403   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_ntsc_intf)
404   MDRV_CIA8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK, cia_1_intf)
407   MDRV_MOS8520_ADD("cia_0", AMIGA_68000_NTSC_CLOCK / 10, cia_0_ntsc_intf)
408   MDRV_MOS8520_ADD("cia_1", AMIGA_68000_NTSC_CLOCK, cia_1_intf)
405409   
406410   MDRV_AMIGA_FDC_ADD("fdc")
407411MACHINE_DRIVER_END
r7066r7067
447451   /* cia */
448452   MDRV_DEVICE_REMOVE("cia_0")
449453   MDRV_DEVICE_REMOVE("cia_1")
450   MDRV_CIA8520_ADD("cia_0", CDTV_CLOCK_X1 / 40, cia_0_cdtv_intf)
451   MDRV_CIA8520_ADD("cia_1", CDTV_CLOCK_X1 / 4, cia_1_cdtv_intf)
454   MDRV_MOS8520_ADD("cia_0", CDTV_CLOCK_X1 / 40, cia_0_cdtv_intf)
455   MDRV_MOS8520_ADD("cia_1", CDTV_CLOCK_X1 / 4, cia_1_cdtv_intf)
452456MACHINE_DRIVER_END
453457
454458
r7066r7067
465469
466470   /* cia */
467471   MDRV_DEVICE_REMOVE("cia_0")
468   MDRV_CIA8520_ADD("cia_0", AMIGA_68000_PAL_CLOCK / 10, cia_0_pal_intf)
472   MDRV_MOS8520_ADD("cia_0", AMIGA_68000_PAL_CLOCK / 10, cia_0_pal_intf)
469473MACHINE_DRIVER_END
470474
471475static MACHINE_DRIVER_START( a500p )
src/mess/drivers/primo.c
r7066r7067
113113#include "devices/snapquik.h"
114114#include "devices/cartslot.h"
115115#include "formats/primoptp.h"
116#include "includes/cbmserb.h"
116#include "machine/cbmiec.h"
117117
118118static ADDRESS_MAP_START( primoa_port, ADDRESS_SPACE_IO, 8 )
119119   ADDRESS_MAP_GLOBAL_MASK(0xff)
r7066r7067
245245   CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED
246246};
247247
248static const cbm_serial_bus_interface primo_drive_interface =
248static CBM_IEC_DAISY( cbm_iec_daisy )
249249{
250   DEVCB_NULL,
251   DEVCB_NULL,
252   DEVCB_NULL,
253   DEVCB_NULL,
254   DEVCB_NULL,
255   DEVCB_NULL,
256   DEVCB_NULL,
257   DEVCB_NULL,
258
259   DEVCB_NULL
250   { NULL}
260251};
261252
262253static MACHINE_DRIVER_START( primoa32 )
r7066r7067
296287   /* floppy from serial bus */
297288   /* for some reason machine/primo.c sets up the serial bus
298289    but no floppy drive has been apparently added... incomplete driver? */
299   MDRV_CBM_SERBUS_ADD("serial_bus", primo_drive_interface)
290   MDRV_CBM_IEC_ADD("serial_bus", cbm_iec_daisy)
300291
301292   /* cartridge */
302293   MDRV_CARTSLOT_ADD("cart1")
src/mess/drivers/ami1200.c
r7066r7067
9999   /* bit 2 = Power Led on Amiga */
100100   set_led_status(device->machine, 0, !BIT(data, 1));
101101
102   handle_cd32_joystick_cia(data, cia_r(device, 2));
102   handle_cd32_joystick_cia(data, mos6526_r(device, 2));
103103}
104104
105105/*************************************
r7066r7067
385385}
386386
387387
388static const cia6526_interface a1200_cia_0_intf =
388static const mos6526_interface a1200_cia_0_intf =
389389{
390   0,                                       /* tod_clock */
390391   DEVCB_LINE(amiga_cia_0_irq),                           /* irq_func */
391392   DEVCB_NULL,   /* pc_func */
392   0,                                       /* tod_clock */
393   {
394      { DEVCB_HANDLER(a1200_cia_0_portA_r), DEVCB_HANDLER(cd32_cia_0_porta_w) },      /* port A */
395      { DEVCB_HANDLER(cd32_cia_0_portb_r), DEVCB_HANDLER(cd32_cia_0_portb_w) }      /* port B */
396   }
393   DEVCB_NULL,
394   DEVCB_NULL,
395   DEVCB_HANDLER(a1200_cia_0_portA_r),
396   DEVCB_HANDLER(cd32_cia_0_porta_w),      /* port A */
397   DEVCB_HANDLER(cd32_cia_0_portb_r),
398   DEVCB_HANDLER(cd32_cia_0_portb_w)      /* port B */
397399};
398400
399static const cia6526_interface cd32_cia_0_intf =
401static const mos6526_interface cd32_cia_0_intf =
400402{
403   0,                                       /* tod_clock */
401404   DEVCB_LINE(amiga_cia_0_irq),                           /* irq_func */
402405   DEVCB_NULL,   /* pc_func */
403   0,                                       /* tod_clock */
404   {
405      { DEVCB_INPUT_PORT("CIA0PORTA"), DEVCB_HANDLER(cd32_cia_0_porta_w) },      /* port A */
406      { DEVCB_HANDLER(cd32_cia_0_portb_r), DEVCB_HANDLER(cd32_cia_0_portb_w) }      /* port B */
407   }
406   DEVCB_NULL,
407   DEVCB_NULL,
408   DEVCB_INPUT_PORT("CIA0PORTA"),
409   DEVCB_HANDLER(cd32_cia_0_porta_w),      /* port A */
410   DEVCB_HANDLER(cd32_cia_0_portb_r),
411   DEVCB_HANDLER(cd32_cia_0_portb_w)      /* port B */
408412};
409413
410static const cia6526_interface a1200_cia_1_intf =
414static const mos6526_interface a1200_cia_1_intf =
411415{
416   0,                                       /* tod_clock */
412417   DEVCB_LINE(amiga_cia_1_irq),                           /* irq_func */
413418   DEVCB_NULL,   /* pc_func */
414   0,                                       /* tod_clock */
415   {
416      { DEVCB_NULL, DEVCB_NULL },                           /* port A */
417      { DEVCB_NULL, DEVCB_DEVICE_HANDLER("fdc", amiga_fdc_control_w) }         /* port B */
418   }
419   DEVCB_NULL,
420   DEVCB_NULL,
421   DEVCB_NULL,
422   DEVCB_NULL,                           /* port A */
423   DEVCB_NULL,
424   DEVCB_DEVICE_HANDLER("fdc", amiga_fdc_control_w)         /* port B */
419425};
420426
421static const cia6526_interface cd32_cia_1_intf =
427static const mos6526_interface cd32_cia_1_intf =
422428{
429   0,                                       /* tod_clock */
423430   DEVCB_LINE(amiga_cia_1_irq),                           /* irq_func */
424431   DEVCB_NULL,   /* pc_func */
425   0,                                       /* tod_clock */
426   {
427      { DEVCB_NULL, DEVCB_NULL },                           /* port A */
428      { DEVCB_NULL, DEVCB_NULL }                           /* port B */
429   }
432   DEVCB_NULL,
433   DEVCB_NULL,
434   DEVCB_NULL,
435   DEVCB_NULL,                           /* port A */
436   DEVCB_NULL,
437   DEVCB_NULL                           /* port B */
430438};
431439
432440static MACHINE_DRIVER_START( a1200n )
r7066r7067
460468    MDRV_SOUND_ROUTE(3, "lspeaker", 0.25)
461469
462470   /* cia */
463   MDRV_CIA8520_ADD("cia_0", AMIGA_68EC020_NTSC_CLOCK / 10, a1200_cia_0_intf)
464   MDRV_CIA8520_ADD("cia_1", AMIGA_68EC020_NTSC_CLOCK / 10, a1200_cia_1_intf)
471   MDRV_MOS8520_ADD("cia_0", AMIGA_68EC020_NTSC_CLOCK / 10, a1200_cia_0_intf)
472   MDRV_MOS8520_ADD("cia_1", AMIGA_68EC020_NTSC_CLOCK / 10, a1200_cia_1_intf)
465473   
466474   MDRV_AMIGA_FDC_ADD("fdc")
467475MACHINE_DRIVER_END
r7066r7067
523531   MDRV_SOUND_ROUTE( 1, "rspeaker", 0.50 )
524532
525533   /* cia */
526   MDRV_CIA8520_ADD("cia_0", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_0_intf)
527   MDRV_CIA8520_ADD("cia_1", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_1_intf)
534   MDRV_MOS8520_ADD("cia_0", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_0_intf)
535   MDRV_MOS8520_ADD("cia_1", AMIGA_68EC020_PAL_CLOCK / 10, cd32_cia_1_intf)
528536MACHINE_DRIVER_END
529537
530538
src/mess/drivers/c64.c
r7066r7067
398398   AM_RANGE(0xd000, 0xd3ff) AM_READWRITE(vic2_port_r, vic2_port_w)
399399   AM_RANGE(0xd400, 0xd7ff) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)
400400   AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE( c64_colorram_write) AM_BASE(&c64_colorram) /* colorram  */
401   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", cia_r, cia_w)
401   AM_RANGE(0xdc00, 0xdcff) AM_DEVREADWRITE("cia_0", mos6526_r, mos6526_w)
402402   AM_RANGE(0xe000, 0xffff) AM_ROM AM_BASE(&c64_romh)            /* ram or kernel rom */
403403ADDRESS_MAP_END
404404
r7066r7067
570570   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
571571
572572   /* cia */
573   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6567_CLOCK, c64_ntsc_cia0)
574   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6567_CLOCK, c64_ntsc_cia1)
573   MDRV_MOS6526R1_ADD("cia_0", VIC6567_CLOCK, c64_ntsc_cia0)
574   MDRV_MOS6526R1_ADD("cia_1", VIC6567_CLOCK, c64_ntsc_cia1)
575575
576576   /* floppy from serial bus */
577577   MDRV_CBM_IEC_ADD("iec", cbm_iec_daisy)
r7066r7067
612612   MDRV_CASSETTE_ADD( "cassette", cbm_cassette_config )
613613
614614   /* cia */
615   MDRV_CIA6526_ADD("cia_0", CIA6526R1, VIC6569_CLOCK, c64_pal_cia0)
616   MDRV_CIA6526_ADD("cia_1", CIA6526R1, VIC6569_CLOCK, c64_pal_cia1)
615   MDRV_MOS6526R1_ADD("cia_0", VIC6569_CLOCK, c64_pal_cia0)
616   MDRV_MOS6526R1_ADD("cia_1", VIC6569_CLOCK, c64_pal_cia1)
617617
618618   /* floppy from serial bus */
619619   MDRV_CBM_IEC_ADD("iec", cbm_iec_daisy)
src/mess/drivers/sbc6510.c
r7066r7067
5959   DEVCB_NULL
6060};
6161
62const cia6526_interface sbc6510_ntsc_cia0 =
62const mos6526_interface sbc6510_ntsc_cia0 =
6363{
64   10, /* 1/10 second */
6465   DEVCB_NULL,
6566   DEVCB_NULL,   /* pc_func */
66   10, /* 1/10 second */
67   {
68      { DEVCB_NULL, DEVCB_NULL },
69      { DEVCB_NULL, DEVCB_NULL }
70   }
67   DEVCB_NULL,
68   DEVCB_NULL,
69   DEVCB_NULL,
70   DEVCB_NULL,
71   DEVCB_NULL,
72   DEVCB_NULL
7173};
74
7275static MACHINE_DRIVER_START( sbc6510 )
7376    /* basic machine hardware */
7477    MDRV_CPU_ADD("maincpu",M6510, XTAL_1MHz)
r7066r7067
9699   MDRV_SOUND_CONFIG(sbc6510_ay_interface)
97100   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)   
98101   
99   MDRV_CIA6526_ADD("cia_0", CIA6526R1, XTAL_1MHz, sbc6510_ntsc_cia0)
102   MDRV_MOS6526R1_ADD("cia_0", XTAL_1MHz, sbc6510_ntsc_cia0)
100103MACHINE_DRIVER_END
101104
102105/* ROM definition */
docs/messnew.txt
r7066r7067
3636
3737Source Changes:
3838----------------
39(none)
39- [CIA6526] Refactored interface, and added SP/CNT callbacks. [Curt Coder]
4040
4141
4242

Previous 15994 Revisions Next


© 1998-2018 The MESS Team