Previous 15994 Revisions Next

r7105 Thursday 21st January, 2010 at 17:21:09 UTC by Curt Coder
[C128] Fast IEC serial bus is now supported with a 1571.
[docs]messnew.txt
[src/emu/machine]6526cia.c
[src/mess/machine]c128.c c1541.c c1571.c

src/emu/machine/6526cia.c
r7104r7105
573573
574574         if (cia->shift == 8)
575575         {
576            logerror("MOS6526 '%s' SDR received %02x\n", device->tag.cstr(), cia->serial);
577576            cia->sdr = cia->serial;
578577            cia->serial = 0;
579578            cia->shift = 0;
r7104r7105
838837
839838      /* serial data ready */
840839      case CIA_SDR:
841         logerror("MOS6526 '%s' SDR write %02x\n", device->tag.cstr(), data);
842840         cia->sdr = data;
843841         if (cia->timer[0].mode & 0x40)
844842            cia->loaded = 1;
src/mess/machine/c128.c
r7104r7105
213213#endif
214214}
215215
216static void c128_iec_data_w(running_machine *machine)
216static void c128_iec_data_out_w(running_machine *machine)
217217{
218218   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
219219   const device_config *iec = devtag_get_device(machine, "iec");
220220   int data = !c128_data_out;
221221
222222   /* fast serial data */
223//   if (MMU_FSDIR) data &= c128_sp1;
223   if (MMU_FSDIR) data &= c128_sp1;
224224   
225225   cbm_iec_data_w(iec, cia_1, data);
226226}
227227
228static void c128_iec_srq_w(running_machine *machine)
228static void c128_iec_srq_out_w(running_machine *machine)
229229{
230230   const device_config *cia_1 = devtag_get_device(machine, "cia_1");
231231   const device_config *iec = devtag_get_device(machine, "iec");
232232   int srq = 1;
233233   
234234   /* fast serial clock */
235//   if (MMU_FSDIR) srq &= c128_cnt1;
235   if (MMU_FSDIR) srq &= c128_cnt1;
236236
237237   cbm_iec_srq_w(iec, cia_1, srq);
238238}
r7104r7105
241241{
242242   /* fast clock out */
243243   c128_cnt1 = state;
244   c128_iec_srq_w(device->machine);
244   c128_iec_srq_out_w(device->machine);
245245}
246246
247247static WRITE_LINE_DEVICE_HANDLER( cia0_sp_w )
248248{
249249   /* fast data out */
250250   c128_sp1 = state;
251   c128_iec_data_w(device->machine);
251   c128_iec_data_out_w(device->machine);
252252}
253253
254254const mos6526_interface c128_ntsc_cia0 =
r7104r7105
337337   const device_config *serbus = devtag_get_device(device->machine, "iec");
338338
339339   c128_data_out = BIT(data, 5);
340   c128_iec_data_w(device->machine);
340   c128_iec_data_out_w(device->machine);
341341
342342   cbm_iec_clk_w(serbus, device, !BIT(data, 4));
343343
r7104r7105
861861   case 5:
862862      c128_mmu[offset] = data;
863863      c128_bankswitch (space->machine, 0);
864      c128_iec_srq_w(space->machine);
865      c128_iec_data_w(space->machine);
864      c128_iec_srq_out_w(space->machine);
865      c128_iec_data_out_w(space->machine);
866866      break;
867867   case 0:
868868   case 6:
src/mess/machine/c1541.c
r7104r7105
127127
128128    TODO:
129129
130   - drive speed is 300 rpm, should be 310
130131   - ROM version selection
131132    - allocate track buffer runtime
132133    - accurate timing
r7104r7105
895896   }
896897}
897898
899static READ_LINE_DEVICE_HANDLER( byte_ready_r )
900{
901   c1541_t *c1541 = get_safe_token(device->owner);
902
903   return !(c1541->byte && c1541->soe);
904}
905
898906static WRITE_LINE_DEVICE_HANDLER( soe_w )
899907{
900908   c1541_t *c1541 = get_safe_token(device->owner);
r7104r7105
917925{
918926   DEVCB_HANDLER(yb_r),
919927   DEVCB_HANDLER(via1_pb_r),
920   DEVCB_NULL, /* BYTE READY */
928   DEVCB_LINE(byte_ready_r),
921929   DEVCB_NULL,
922930   DEVCB_NULL,
923931   DEVCB_NULL,
src/mess/machine/c1571.c
r7104r7105
1111
1212   TODO:
1313
14   - 1541/1571 Alignment shows drive speed as 266 rpm, should be 310
1415   - toggle WPRT line on disk change
1516   - save state
1617   - D71 disks
r7104r7105
3738#define LOG 0
3839
3940#define M6502_TAG      "u1"
40#define M6522_0_TAG      "u4"
41#define M6522_1_TAG      "u9"
41#define M6522_0_TAG      "u9"
42#define M6522_1_TAG      "u4"
4243#define M6526_TAG      "u20"
4344#define WD1770_TAG      "u11"
4445
r7104r7105
125126
126127INLINE void iec_data_w(const device_config *device)
127128{
128   c1571_t *c1571 = get_safe_token(device->owner);
129   c1571_t *c1571 = get_safe_token(device);
129130
130131   int atn = cbm_iec_atn_r(c1571->serial_bus);
131132   int data = !c1571->data_out & !(c1571->atn_ack ^ !atn);
r7104r7105
133134   /* fast serial data */
134135   if (c1571->ser_dir) data &= c1571->sp_out;
135136   
136   cbm_iec_data_w(c1571->serial_bus, device->owner, data);
137   cbm_iec_data_w(c1571->serial_bus, device, data);
137138}
138139
139140INLINE void iec_srq_w(const device_config *device)
140141{
141   c1571_t *c1571 = get_safe_token(device->owner);
142   c1571_t *c1571 = get_safe_token(device);
142143
143144   int srq = 1;
144145   
145146   /* fast serial clock */
146147   if (c1571->ser_dir) srq &= c1571->cnt_out;
147148
148   cbm_iec_srq_w(c1571->serial_bus, device->owner, srq);
149   cbm_iec_srq_w(c1571->serial_bus, device, srq);
149150}
150151
151152/***************************************************************************
r7104r7105
217218WRITE_LINE_DEVICE_HANDLER( c1571_iec_atn_w )
218219{
219220   c1571_t *c1571 = get_safe_token(device);
220   int data_out = !c1571->data_out && !(c1571->atn_ack ^ !state);
221221
222222   via_ca1_w(c1571->via0, !state);
223
224   cbm_iec_data_w(c1571->serial_bus, device, data_out);
223   iec_data_w(device);
225224}
226225
227226/*-------------------------------------------------
r7104r7105
283282
284283static ADDRESS_MAP_START( c1571_map, ADDRESS_SPACE_PROGRAM, 8 )
285284   AM_RANGE(0x0000, 0x07ff) AM_RAM
286   AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE(M6522_0_TAG, via_r, via_w)
287   AM_RANGE(0x1c00, 0x1c0f) AM_DEVREADWRITE(M6522_1_TAG, via_r, via_w)
288   AM_RANGE(0x2000, 0x2003) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
289   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE(M6526_TAG, mos6526_r, mos6526_w)
285   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_0_TAG, via_r, via_w)
286   AM_RANGE(0x1c00, 0x1c0f) AM_MIRROR(0x03f0) AM_DEVREADWRITE(M6522_1_TAG, via_r, via_w)
287   AM_RANGE(0x2000, 0x2003) AM_MIRROR(0x1ffc) AM_DEVREADWRITE(WD1770_TAG, wd17xx_r, wd17xx_w)
288   AM_RANGE(0x4000, 0x400f) AM_MIRROR(0x3ff0) AM_DEVREADWRITE(M6526_TAG, mos6526_r, mos6526_w)
290289   AM_RANGE(0x8000, 0xffff) AM_ROM AM_REGION("c1571", 0)
291290ADDRESS_MAP_END
292291
r7104r7105
342341   data |= floppy_tk00_r(c1571->image);
343342
344343   /* byte ready */
345   data |= c1571->byte << 7;
344   data |= !(c1571->byte && c1571->soe) << 7;
346345
347346   return data;
348347}
r7104r7105
376375
377376   /* fast serial direction */
378377   c1571->ser_dir = BIT(data, 1);
379   iec_data_w(device);
380   iec_srq_w(device);
378   iec_data_w(device->owner);
379   iec_srq_w(device->owner);
381380
382381   /* side select */
383382   wd17xx_set_side(c1571->wd1770, BIT(data, 2));
r7104r7105
445444
446445   /* data out */
447446   c1571->data_out = BIT(data, 1);
448   iec_data_w(device);
447   iec_data_w(device->owner);
449448
450449   /* clock out */
451450   cbm_iec_clk_w(c1571->serial_bus, device->owner, !BIT(data, 3));
r7104r7105
621620   }
622621}
623622
623static READ_LINE_DEVICE_HANDLER( byte_ready_r )
624{
625   c1571_t *c1571 = get_safe_token(device->owner);
626
627   return !(c1571->byte && c1571->soe);
628}
629
624630static WRITE_LINE_DEVICE_HANDLER( soe_w )
625631{
626632   c1571_t *c1571 = get_safe_token(device->owner);
r7104r7105
643649{
644650   DEVCB_HANDLER(yb_r),
645651   DEVCB_HANDLER(via1_pb_r),
652   DEVCB_LINE(byte_ready_r),
646653   DEVCB_NULL,
647654   DEVCB_NULL,
648655   DEVCB_NULL,
649   DEVCB_NULL,
650656
651657   DEVCB_HANDLER(yb_w),
652658   DEVCB_HANDLER(via1_pb_w),
r7104r7105
677683
678684   /* fast serial clock out */
679685   c1571->cnt_out = state;
680   iec_srq_w(device);
686   iec_srq_w(device->owner);
681687}
682688
683689static WRITE_LINE_DEVICE_HANDLER( cia_sp_w )
r7104r7105
686692
687693   /* fast serial data out */
688694   c1571->sp_out = state;
689   iec_data_w(device);
695   iec_data_w(device->owner);
690696}
691697
692698static MOS6526_INTERFACE( c1571_cia_intf )
r7104r7105
718724-------------------------------------------------*/
719725
720726static FLOPPY_OPTIONS_START( c1571 )
721   FLOPPY_OPTION( c1571, "g64", "Commodore 1571 GCR Disk Image", g64_dsk_identify, g64_dsk_construct, NULL )
722//  FLOPPY_OPTION( c1571, "d64", "Commodore 1571 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL )
727   FLOPPY_OPTION( c1571, "g64", "Commodore 1541 GCR Disk Image", g64_dsk_identify, g64_dsk_construct, NULL )
728//  FLOPPY_OPTION( c1571, "d64", "Commodore 1541 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL )
723729//  FLOPPY_OPTION( c1571, "d71", "Commodore 1571 Disk Image", d64_dsk_identify, d64_dsk_construct, NULL )
724730FLOPPY_OPTIONS_END
725731
docs/messnew.txt
r7104r7105
2424
2525System Driver Changes:
2626----------------------
27- [C128] Fast IEC serial bus is now supported with a 1571. [Curt Coder]
28
2729- [MIKROMIK] Fixed memory banking regression. [Curt Coder]
2830
2931
r7104r7105
3941- The core is based on MAME 0.136.1.  This incorporates all features of the
4042  update to this core.  [MAME team]
4143
42- [CIA6526] Refactored interface, and added SP/CNT callbacks. [Curt Coder]
44- [CIA6526] Refactored interface, added SP/CNT callbacks, and fixed serial
45  port transfer. [Curt Coder]
4346
4447
4548

Previous 15994 Revisions Next


© 1998-2018 The MESS Team