Previous 15994 Revisions Next

r7623 Tuesday 23rd March, 2010 at 11:08:28 UTC by Curt Coder
[CONKORT] Fixed memory mirrors and FDC read/write.
[src/mess/machine]conkort.c

src/mess/machine/conkort.c
r7622r7623
101101
102102#define Z80_TAG      "5a"
103103#define Z80PIO_TAG   "3a"
104#define FD1791_TAG   "7a"
105
104106#define Z80DMA_TAG   "z80dma"
105#define WD1791_TAG   "wd1791"
106107#define SAB1793_TAG   "sab1793"
107108
108109/***************************************************************************
r7622r7623
116117   UINT8 data;            /* ABC BUS data */
117118   int fdc_irq;         /* floppy interrupt */
118119   int fdc_drq;         /* floppy data request */
119   int fdc_dden;         /* floppy density */
120120   int wait_enable;      /* wait enable */
121121
122122   /* devices */
123123   running_device *cpu;
124124   running_device *z80pio;
125   running_device *wd1791;
125   running_device *fd1791;
126126   running_device *image0;
127127   running_device *image1;
128128};
r7622r7623
184184
185185   UINT8 data = 0xff;
186186
187   z80pio_astb_w(conkort->z80pio, 0);
188
189187   if (!BIT(conkort->status, 6))
190188   {
191189      data = conkort->data;
192190   }
193191
192   logerror("INP\n");
193
194   z80pio_astb_w(conkort->z80pio, 0);
194195   z80pio_astb_w(conkort->z80pio, 1);
195196
196197   return data;
r7622r7623
200201{
201202   slow_t *conkort = get_safe_token_machine_slow(space->machine);
202203
203   z80pio_astb_w(conkort->z80pio, 0);
204
205204   if (BIT(conkort->status, 6))
206205   {
207206      conkort->data = data;
208207   }
209208
209   logerror("UTP %02x\n", data);
210
211   z80pio_astb_w(conkort->z80pio, 0);
210212   z80pio_astb_w(conkort->z80pio, 1);
211213}
212214
r7622r7623
214216{
215217   slow_t *conkort = get_safe_token_machine_slow(space->machine);
216218
219   logerror("STAT\n");
220
217221   return (conkort->status & 0xfe) | z80pio_ardy_r(conkort->z80pio);
218222}
219223
r7622r7623
221225{
222226   slow_t *conkort = get_safe_token_machine_slow(space->machine);
223227
224   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, PULSE_LINE);
228   logerror("C1 %02x\n", data);
229
230   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, ASSERT_LINE);
231   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, CLEAR_LINE);
225232}
226233
227234static WRITE8_HANDLER( slow_bus_c3_w )
228235{
229236   slow_t *conkort = get_safe_token_machine_slow(space->machine);
230237
238   logerror("C3 %02x\n", data);
239
231240   cpu_set_input_line(conkort->cpu, INPUT_LINE_RESET, PULSE_LINE);
232241}
233242
234243static ABCBUS_CARD_SELECT( luxor_55_10828 )
235244{
236   slow_t *conkort = get_safe_token_slow(device);
245   logerror("CS %02x\n", data);
237246
238247   if (data == 0x2d) // TODO: bit 0 of this is configurable with S1
239248   {
r7622r7623
246255      memory_install_write8_handler(io, ABCBUS_C3, ABCBUS_C3, 0x18, 0, slow_bus_c3_w);
247256      memory_nop_write(io, ABCBUS_C4, ABCBUS_C4, 0x18, 0);
248257   }
249
250   cpu_set_input_line(conkort->cpu, INPUT_LINE_RESET, PULSE_LINE);
251258}
252259
253260static WRITE8_HANDLER( slow_ctrl_w )
254261{
255262   /*
256263
257        bit     description
264        bit     signal         description
258265
259        0       SEL 0
260        1       SEL 1
261        2       SEL 2
262        3       MOT ON
266        0       _SEL 0
267        1       _SEL 1
268        2       _SEL 2
269        3       _MOT ON
263270        4       SIDE
264271        5       _PRECOMP ON
265272        6       _WAIT ENABLE
r7622r7623
270277   slow_t *conkort = get_safe_token_machine_slow(space->machine);
271278
272279   /* drive selection */
273   if (BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0);
274   if (BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1);
275//  if (BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2);
280   if (BIT(data, 0)) wd17xx_set_drive(conkort->fd1791, 0);
281   if (BIT(data, 1)) wd17xx_set_drive(conkort->fd1791, 1);
282//  if (BIT(data, 2)) wd17xx_set_drive(conkort->fd1791, 2);
276283
277284   /* motor enable */
278285   floppy_mon_w(conkort->image0, !BIT(data, 3));
r7622r7623
281288   floppy_drive_set_ready_state(conkort->image1, 1, 1);
282289
283290   /* disk side selection */
284   wd17xx_set_side(conkort->wd1791, BIT(data, 4));
291   wd17xx_set_side(conkort->fd1791, BIT(data, 4));
285292
286293   /* wait enable */
287294   conkort->wait_enable = BIT(data, 6);
288295
289   if (!BIT(data, 7))
290   {
291      /* FDC master reset */
292      wd17xx_reset(conkort->wd1791);
293   }
296   /* FDC master reset */
297   wd17xx_mr_w(conkort->fd1791, BIT(data, 7));
294298}
295299
296300static WRITE8_HANDLER( slow_status_w )
r7622r7623
398402{
399403   fast_t *conkort = get_safe_token_machine_fast(space->machine);
400404
401   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, PULSE_LINE);
405   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, ASSERT_LINE);
406   cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, CLEAR_LINE);
402407}
403408
404409static WRITE8_HANDLER( fast_bus_c3_w )
r7622r7623
473478// Slow Controller
474479
475480static ADDRESS_MAP_START( slow_map, ADDRESS_SPACE_PROGRAM, 8 )
476   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("abc830", 0)
477   AM_RANGE(0x1000, 0x13ff) AM_RAM
481   ADDRESS_MAP_GLOBAL_MASK(0x1fff)
482   AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_ROM AM_REGION("abc830", 0)
483   AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM
478484ADDRESS_MAP_END
479485
480486static ADDRESS_MAP_START( slow_io_map, ADDRESS_SPACE_IO, 8 )
481487   ADDRESS_MAP_GLOBAL_MASK(0xff)
482488   AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_ba_cd_r, z80pio_ba_cd_w)
483   AM_RANGE(0xb0, 0xb3) AM_MIRROR(0x0c) AM_DEVREADWRITE(WD1791_TAG, wd17xx_r, wd17xx_w)
489   AM_RANGE(0xb0, 0xb3) AM_MIRROR(0x0c) AM_DEVREADWRITE(FD1791_TAG, slow_fdc_r, slow_fdc_w)
484490   AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_WRITE(slow_status_w)
485491   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_WRITE(slow_ctrl_w)
486492ADDRESS_MAP_END
r7622r7623
500506//  AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE()
501507//  AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_WRITE()
502508   AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ(fast_ctrl_r)
503   AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREAD(SAB1793_TAG, slow_fdc_r)
504   AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVWRITE(SAB1793_TAG, slow_fdc_w)
509   AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREAD(SAB1793_TAG, wd17xx_r)
510   AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVWRITE(SAB1793_TAG, wd17xx_w)
505511   AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_r, z80dma_w)
506512ADDRESS_MAP_END
507513
r7622r7623
578584
579585        bit     description
580586
581        0       !(_DS0 & _DS1)
582        1       !(_DD0 & _DD1)
587        0       !(_DS0 & _DS1)   single/double sided (0=SS, 1=DS)
588        1       !(_DD0 & _DD1)   single/double density (0=DS, 1=DD)
583589        2       8B pin 10
584        3       FDC DDEN
585        4       _R/BS
586        5       FDC HLT
587        6       FDC _HDLD
588        7       FDC IRQ
590        3       FDC _DDEN      double density enable
591        4       _R/BS         radial/binary drive select
592        5       FDC HLT         head load timing
593        6       FDC _HDLD      head load
594        7       FDC IRQ         interrupt request
589595
590596    */
591597
592598   slow_t *conkort = get_safe_token_machine_slow(device->machine);
593599
594   return conkort->fdc_irq << 7 | 0x10 | !conkort->fdc_dden << 2;
600   UINT8 data = 0;
601
602   /* single/double sided drive */
603   data |= 0x01;
604
605   /* single/double density drive */
606   data |= 0x02;
607
608   /* radial/binary drive select */
609   data |= 0x10;
610
611   /* head load */
612//   data |= wd17xx_hdld_r(conkort->fd1791) << 6;
613
614   /* FDC interrupt request */
615   data |= conkort->fdc_irq << 7;
616
617   return data;
595618}
596619
597620static WRITE8_DEVICE_HANDLER( conkort_pio_port_b_w )
598621{
599622   /*
600623
601        bit     description
624        bit     signal         description
602625
603        0       !(_DS0 & _DS1)
604        1       !(_DD0 & _DD1)
626        0       !(_DS0 & _DS1)   single/double sided (0=SS, 1=DS)
627        1       !(_DD0 & _DD1)   single/double density (0=DS, 1=DD)
605628        2       8B pin 10
606        3       FDC _DDEN
607        4       _R/BS
608        5       FDC HLT
609        6       FDC _HDLD
610        7       FDC IRQ
629        3       FDC _DDEN      double density enable
630        4       _R/BS         radial/binary drive select
631        5       FDC HLT         head load timing
632        6       FDC _HDLD      head load
633        7       FDC IRQ         interrupt request
611634
612635    */
613636
614637   slow_t *conkort = get_safe_token_machine_slow(device->machine);
615638
616   /* disk density */
617   conkort->fdc_dden = BIT(data, 3);
618   wd17xx_dden_w(conkort->wd1791, conkort->fdc_dden);
639   /* double density enable */
640   wd17xx_dden_w(conkort->fd1791, BIT(data, 3));
641
642   /* head load timing */
643//   wd17xx_hlt_w(conkort->fd1791, BIT(data, 5));
619644}
620645
621646static Z80PIO_INTERFACE( conkort_pio_intf )
r7622r7623
701726
702727/* FD1791 */
703728
704static WRITE_LINE_DEVICE_HANDLER( slow_wd1791_intrq_w )
729static WRITE_LINE_DEVICE_HANDLER( slow_fd1791_intrq_w )
705730{
706731   slow_t *conkort = get_safe_token_machine_slow(device->machine);
707732
r7622r7623
714739   }
715740}
716741
717static WRITE_LINE_DEVICE_HANDLER( slow_wd1791_drq_w )
742static WRITE_LINE_DEVICE_HANDLER( slow_fd1791_drq_w )
718743{
719744   slow_t *conkort = get_safe_token_machine_slow(device->machine);
720745
r7622r7623
730755static const wd17xx_interface slow_wd17xx_interface =
731756{
732757   DEVCB_NULL,
733   DEVCB_LINE(slow_wd1791_intrq_w),
734   DEVCB_LINE(slow_wd1791_drq_w),
758   DEVCB_LINE(slow_fd1791_intrq_w),
759   DEVCB_LINE(slow_fd1791_drq_w),
735760   { FLOPPY_0, FLOPPY_1, NULL, NULL }
736761};
737762
r7622r7623
766791   MDRV_CPU_CONFIG(slow_daisy_chain)
767792
768793   MDRV_Z80PIO_ADD(Z80PIO_TAG, XTAL_4MHz/2, conkort_pio_intf)
769   MDRV_WD179X_ADD(WD1791_TAG, slow_wd17xx_interface)
794   MDRV_WD179X_ADD(FD1791_TAG, slow_wd17xx_interface)
770795
771796   MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config)
772797MACHINE_DRIVER_END
r7622r7623
843868
844869   /* find devices */
845870   conkort->z80pio = device->subdevice(Z80PIO_TAG);
846   conkort->wd1791 = device->subdevice(WD1791_TAG);
871   conkort->fd1791 = device->subdevice(FD1791_TAG);
847872   conkort->image0 = device->subdevice(FLOPPY_0);
848873   conkort->image1 = device->subdevice(FLOPPY_1);
849874
r7622r7623
852877   state_save_register_device_item(device, 0, conkort->data);
853878   state_save_register_device_item(device, 0, conkort->fdc_irq);
854879   state_save_register_device_item(device, 0, conkort->fdc_drq);
855   state_save_register_device_item(device, 0, conkort->fdc_dden);
856880   state_save_register_device_item(device, 0, conkort->wait_enable);
857881}
858882

Previous 15994 Revisions Next


© 1998-2018 The MESS Team