Previous 15994 Revisions Next

r7076 Wednesday 20th January, 2010 at 13:39:55 UTC by Curt Coder
[C1571] Added G64 read support, attention out, and fast serial bus.
[C1581] Added fast serial bus.
[C128] Added fast serial bus lines, not quite working yet.
[6526CIA] Fixed serial transfer.
[src/emu/machine]6526cia.c
[src/mess/drivers]c128.c
[src/mess/includes]c128.h
[src/mess/machine]c128.c c1571.c c1581.c

src/emu/machine/6526cia.c
r7075r7076
362362               cia->serial <<= 1;
363363               cia->cnt = 0;
364364
365               devcb_call_write_line(&cia->out_sp_func, cia->sp);
365366               devcb_call_write_line(&cia->out_cnt_func, cia->cnt);
366               devcb_call_write_line(&cia->out_sp_func, cia->sp);
367367            }
368368            else
369369            {
r7075r7076
373373
374374               if (cia->shift == 8)
375375               {
376                  cia->shift = 0;
376377                  cia->ics |= 0x08;
377378                  cia_update_interrupts(device);
378379               }
src/mess/includes/c128.h
r7075r7076
6565extern const mos6526_interface c128_ntsc_cia0, c128_pal_cia0;
6666extern const mos6526_interface c128_ntsc_cia1, c128_pal_cia1;
6767
68WRITE_LINE_DEVICE_HANDLER( c128_iec_srq_w );
69WRITE_LINE_DEVICE_HANDLER( c128_iec_data_w );
6870
6971#endif /* C128_H_ */
src/mess/machine/c1581.c
r7075r7076
4646typedef struct _c1581_t c1581_t;
4747struct _c1581_t
4848{
49   int address;
49   int address;                  /* device number */
5050
51   int data_out;
52   int atn_ack;
51   int data_out;                  /* serial data out */
52   int atn_ack;                  /* attention acknowledge */
53   int ser_dir;                  /* fast serial direction */
5354
5455   /* devices */
5556   const device_config *cpu;
r7075r7076
104105{
105106   c1581_t *c1581 = get_safe_token(device);
106107
107   mos6526_cnt_w(c1581->cia, state);
108   if (!c1581->ser_dir)
109   {
110      mos6526_cnt_w(c1581->cia, state);
111   }
108112}
109113
110114/*-------------------------------------------------
r7075r7076
115119{
116120   c1581_t *c1581 = get_safe_token(device);
117121
118   mos6526_sp_w(c1581->cia, state);
122   if (!c1581->ser_dir)
123   {
124      mos6526_sp_w(c1581->cia, state);
125   }
119126}
120127
121128/*-------------------------------------------------
r7075r7076
285292   cbm_iec_clk_w(c1581->serial_bus, device->owner, !clk_out);
286293
287294   /* attention acknowledge */
288   c1581->atn_ack = BIT(data, 4);
295   c1581->atn_ack = atn_ack;
296
297   /* fast serial direction */
298   c1581->ser_dir = BIT(data, 5);
289299}
290300
291301static WRITE_LINE_DEVICE_HANDLER( cia_cnt_w )
292302{
293303   c1581_t *c1581 = get_safe_token(device->owner);
294304
295   /* fast clock out */
296   cbm_iec_srq_w(c1581->serial_bus, device->owner, state);
305   if (c1581->ser_dir)
306   {
307      /* fast clock out */
308      cbm_iec_srq_w(c1581->serial_bus, device->owner, state);
309   }
297310}
298311
299312static WRITE_LINE_DEVICE_HANDLER( cia_sp_w )
300313{
301314   c1581_t *c1581 = get_safe_token(device->owner);
302315
303   /* fast data out */
304   cbm_iec_data_w(c1581->serial_bus, device->owner, state);
316   if (c1581->ser_dir)
317   {
318      /* fast data out */
319      cbm_iec_data_w(c1581->serial_bus, device->owner, state);
320   }
305321}
306322
307323static MOS8520_INTERFACE( cia_intf )
src/mess/machine/c128.c
r7075r7076
2121#include "video/vic6567.h"
2222#include "video/vdc8563.h"
2323
24static UINT8 c128_mmu[0x0b];
25static const int c128_mmu_helper[4] =
26{0x400, 0x1000, 0x2000, 0x4000};
27static int mmu_cpu;
28static int mmu_page0, mmu_page1;
29
2430#define VERBOSE_LEVEL 0
2531#define DBG_LOG( MACHINE, N, M, A ) \
2632   do { \
r7075r7076
176182#endif
177183}
178184
185static WRITE_LINE_DEVICE_HANDLER( cia0_cnt_w )
186{
187   const device_config *serbus = devtag_get_device(device->machine, "iec");
188
189   if (BIT(c128_mmu[5], 3))
190   {
191      /* fast clock out */
192      cbm_iec_srq_w(serbus, device, state);
193   }
194}
195
196static WRITE_LINE_DEVICE_HANDLER( cia0_sp_w )
197{
198   const device_config *serbus = devtag_get_device(device->machine, "iec");
199
200   if (BIT(c128_mmu[5], 3))
201   {
202      /* fast data out */
203      cbm_iec_data_w(serbus, device, state);
204   }
205}
206
179207const mos6526_interface c128_ntsc_cia0 =
180208{
181209   60,
182210   DEVCB_LINE(c128_cia0_interrupt),
183211   DEVCB_NULL,   /* pc_func */
184   DEVCB_NULL,
185   DEVCB_NULL,
212   DEVCB_LINE(cia0_cnt_w),
213   DEVCB_LINE(cia0_sp_w),
186214   DEVCB_HANDLER(c128_cia0_port_a_r),
187215   DEVCB_NULL,
188216   DEVCB_HANDLER(c128_cia0_port_b_r),
r7075r7076
202230   DEVCB_HANDLER(c128_cia0_port_b_w)
203231};
204232
233WRITE_LINE_DEVICE_HANDLER( c128_iec_srq_w )
234{
235   if (!BIT(c128_mmu[5], 3))
236   {
237      mos6526_flag_w(device, state);
238      mos6526_cnt_w(device, state);
239   }
240}
205241
242WRITE_LINE_DEVICE_HANDLER( c128_iec_data_w )
243{
244   if (!BIT(c128_mmu[5], 3))
245   {
246      mos6526_sp_w(device, state);
247   }
248}
249
206250/*
207251 * CIA 1 - Port A
208252 * bit 7 serial bus data input
r7075r7076
460504   game =c64_game;
461505}
462506
463static UINT8 c128_mmu[0x0b];
464static const int c128_mmu_helper[4] =
465{0x400, 0x1000, 0x2000, 0x4000};
466static int mmu_cpu;
467static int mmu_page0, mmu_page1;
468
469507#define MMU_PAGE1 ((((c128_mmu[10]&0xf)<<8)|c128_mmu[9])<<8)
470508#define MMU_PAGE0 ((((c128_mmu[8]&0xf)<<8)|c128_mmu[7])<<8)
471509#define MMU_VIC_ADDR ((c128_mmu[6]&0xc0)<<10)
src/mess/machine/c1571.c
r7075r7076
77
88**********************************************************************/
99
10/*
11
12   TODO:
13
14   - toggle WPRT line on disk change
15   - save state
16   - D71 disks
17   - CP/M disks
18    - power LED
19    - activity LED
20
21*/
22
1023#include "emu.h"
1124#include "c1571.h"
1225#include "cpu/m6502/m6502.h"
r7075r7076
5063struct _c1571_t
5164{
5265   /* abstractions */
53   int address;
66   int address;                  /* device number */
5467   UINT8 track_buffer[TRACK_BUFFER_SIZE];            /* track data buffer */
5568   int track_len;                  /* track length */
5669   int buffer_pos;                  /* current byte position within track buffer */
r7075r7076
6780   int soe;                     /* s? output enable */
6881   int mode;                     /* mode (0 = write, 1 = read) */
6982
70   int data_out;
71   int atn_ack;
83   int data_out;                  /* serial data out */
84   int atn_ack;                  /* attention acknowledge */
85   int ser_dir;                  /* fast serial direction */
7286
7387   /* interrupts */
7488   int via0_irq;                  /* VIA #0 interrupt request */
r7075r7076
191205{
192206   c1571_t *c1571 = get_safe_token(device);
193207
194   mos6526_cnt_w(c1571->cia, state);
208   if (!c1571->ser_dir)
209   {
210      mos6526_cnt_w(c1571->cia, state);
211   }
195212}
196213
197214/*-------------------------------------------------
r7075r7076
202219{
203220   c1571_t *c1571 = get_safe_token(device);
204221
205   mos6526_sp_w(c1571->cia, state);
222   if (!c1571->ser_dir)
223   {
224      mos6526_sp_w(c1571->cia, state);
225   }
206226}
207227
208228/*-------------------------------------------------
r7075r7076
289309    */
290310
291311   c1571_t *c1571 = get_safe_token(device->owner);
312   UINT8 data = 0;
292313
293   return floppy_tk00_r(c1571->image);
314   /* track 0 sense */
315   data |= floppy_tk00_r(c1571->image);
316
317   /* byte ready */
318   data |= c1571->byte << 7;
319
320   return data;
294321}
295322
296323static WRITE8_DEVICE_HANDLER( via0_pa_w )
r7075r7076
320347   device_set_clock(c1571->via0, clock);
321348   device_set_clock(c1571->via1, clock);
322349
323   /* side */
350   /* fast serial direction */
351   c1571->ser_dir = BIT(data, 1);
352
353   /* side select */
324354   wd17xx_set_side(c1571->wd1770, BIT(data, 2));
355
356   /* attention out */
357   cbm_iec_atn_w(c1571->serial_bus, device->owner, !BIT(data, 6));
325358}
326359
327360static READ8_DEVICE_HANDLER( via0_pb_r )
r7075r7076
398431{
399432   DEVCB_HANDLER(via0_pa_r),
400433   DEVCB_HANDLER(via0_pb_r),
434   DEVCB_NULL, /* ATN IN */
401435   DEVCB_NULL,
436   DEVCB_NULL, /* _WPRT */
402437   DEVCB_NULL,
403   DEVCB_NULL,
404   DEVCB_NULL,
405438
406439   DEVCB_HANDLER(via0_pa_w),
407440   DEVCB_HANDLER(via0_pb_w),
408   DEVCB_NULL, /* ATN IN */
409441   DEVCB_NULL,
410   DEVCB_NULL, /* _WPRT */
411442   DEVCB_NULL,
443   DEVCB_NULL,
444   DEVCB_NULL,
412445
413446   DEVCB_LINE(via0_irq_w)
414447};
r7075r7076
443476
444477    */
445478
446   return 0;
479   c1571_t *c1571 = get_safe_token(device->owner);
480
481   return c1571->data & 0xff;
447482}
448483
449484static WRITE8_DEVICE_HANDLER( yb_w )
r7075r7076
488523   data |= !floppy_wpt_r(c1571->image) << 4;
489524
490525   /* SYNC detect line */
526   data |= !((c1571->data & SYNC_MARK) == SYNC_MARK) << 7;
491527
492528   return data;
493529}
r7075r7076
583619{
584620   DEVCB_HANDLER(yb_r),
585621   DEVCB_HANDLER(via1_pb_r),
586   DEVCB_NULL, /* BYTE READY */
587622   DEVCB_NULL,
588623   DEVCB_NULL,
589624   DEVCB_NULL,
625   DEVCB_NULL,
590626
591627   DEVCB_HANDLER(yb_w),
592628   DEVCB_HANDLER(via1_pb_w),
r7075r7076
615651{
616652   c1571_t *c1571 = get_safe_token(device->owner);
617653
618   /* fast clock out */
619   cbm_iec_srq_w(c1571->serial_bus, device->owner, state);
654   if (c1571->ser_dir)
655   {
656      /* fast clock out */
657      cbm_iec_srq_w(c1571->serial_bus, device->owner, state);
658   }
620659}
621660
622661static WRITE_LINE_DEVICE_HANDLER( cia_sp_w )
623662{
624663   c1571_t *c1571 = get_safe_token(device->owner);
625664
626   /* fast data out */
627   cbm_iec_data_w(c1571->serial_bus, device->owner, state);
665   if (c1571->ser_dir)
666   {
667      /* fast data out */
668      cbm_iec_data_w(c1571->serial_bus, device->owner, state);
669   }
628670}
629671
630672static MOS6526_INTERFACE( c1571_cia_intf )
631673{
632   10,
674   0,
633675   DEVCB_LINE(cia_irq_w),
634676   DEVCB_NULL,
635677   DEVCB_LINE(cia_cnt_w),
src/mess/drivers/c128.c
r7075r7076
581581
582582static CBM_IEC_DAISY( c128_iec_bus )
583583{
584   { "cia_1", DEVCB_DEVICE_LINE("cia_0", mos6526_flag_w) },
584   { "cia_0", DEVCB_DEVICE_LINE("cia_0", c128_iec_srq_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE("cia_0", c128_iec_data_w) },
585   { "cia_1" },
585586   { C1571_IEC("c1571") },
586587   { NULL}
587588};
588589
589590static CBM_IEC_DAISY( c128d81_iec_bus )
590591{
591   { "cia_1", DEVCB_DEVICE_LINE("cia_0", mos6526_flag_w) },
592   { "cia_0", DEVCB_DEVICE_LINE("cia_0", c128_iec_srq_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DEVICE_LINE("cia_0", c128_iec_data_w) },
593   { "cia_1" },
592594   { C1581_IEC("c1563") },
593595   { NULL}
594596};

Previous 15994 Revisions Next


© 1998-2018 The MESS Team