Previous 15994 Revisions Next

r3561 Tuesday 25th November, 2008 at 15:27:25 UTC by Curt Coder
[CONKORT] Added miscellanous stuff.
[src/mess/machine]conkort.c

src/mess/machine/conkort.c
r3560r3561
4141Notes:
4242    All IC's shown.
4343 
44    ROM     - Toshiba TMM27128D-20 "CNTR 1.07 6490318-07"
45    TC5565  - Toshiba TC5565PL-15 8192x8 bit Static Random Access Memory
44    ROM     - Toshiba TMM27128D-20 16Kx8 EPROM "CNTR 1.07 6490318-07"
45    TC5565  - Toshiba TC5565PL-15 8Kx8 bit Static RAM
4646    Z80       - Zilog Z8400APS Z80A CPU Central Processing Unit
4747    Z80DMA  - Zilog Z8410APS Z80A DMA Direct Memory Access Controller
4848    SAB1793 - Siemens SAB1793-02P Floppy Disc Controller
r3560r3561
6969 
7070   TODO:
7171 
72   - Assertion failed: header, file src/mess/tagpool.c, line 76
73   - floppy drive selection
74   - floppy side selection
72   Common
73   ------
74   - remove cpunum references
75   - separate wd17xx reset from init
76 
77   Slow Controller
78   ---------------
7579   - DS/DD SS/DS jumpers
7680   - S1-S5 jumpers
7781   - protection device @ 8B
82   - FDC DRQ
7883   - Z80 wait logic
79   - everything for fast controller
8084 
85   Fast Controller
86   ---------------
87   - Z80 DMA interrupt
88   - Z80 DMA memory <-> IO transfer
89   - FDC INT
90   - FDC DRQ
91 
8192*/
8293 
8394#include "driver.h"
r3560r3561
130141   return (fast_t *)device->token;
131142}
132143 
144static const device_config *get_floppy_image(int drive)
145{
146   return image_from_devtype_and_index(IO_FLOPPY, drive);
147}
148 
133149/* Slow Controller */
134150 
135151static READ8_HANDLER( slow_bus_data_r )
r3560r3561
180196 
181197static WRITE8_HANDLER( slow_bus_c1_w )
182198{
183   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
199   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
200   slow_t *conkort = get_safe_token_slow(device);
201 
202   cpunum_set_input_line(machine, conkort->cpunum, INPUT_LINE_NMI, PULSE_LINE);
184203}
185204 
186205static WRITE8_HANDLER( slow_bus_c3_w )
187206{
188   cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE);
207   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
208   slow_t *conkort = get_safe_token_slow(device);
209 
210   cpunum_set_input_line(machine, conkort->cpunum, INPUT_LINE_RESET, PULSE_LINE);
189211}
190212 
191213static void slow_card_select(const device_config *device, UINT8 data)
192214{
215   slow_t *conkort = get_safe_token_slow(device);
216 
193217   if (data == 0x2d) // TODO: bit 0 of this is configurable with S1
194218   {
195219      memory_install_readwrite8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_INP, ABCBUS_OUT, 0x18, 0, slow_bus_data_r, slow_bus_data_w);
r3560r3561
200224      memory_install_write8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_C4, ABCBUS_C4, 0x18, 0, SMH_NOP);
201225   }
202226 
203   cpunum_set_input_line(device->machine, 0, INPUT_LINE_RESET, PULSE_LINE);
227   cpunum_set_input_line(device->machine, conkort->cpunum, INPUT_LINE_RESET, PULSE_LINE);
204228}
205229 
206READ8_HANDLER( slow_ctrl_r )
230static WRITE8_HANDLER( slow_ctrl_w )
207231{
208232   /*
209233 
r3560r3561
214238      2      _SEL 2
215239      3      _MOT
216240      4      _SIDE
217      5      8B pin 2 or GND
241      5      8B pin 2 (if S4 shorted)
218242      6      8A pin 13
219243      7      FDC _MR
220244 
221245   */
222246 
223   return 0;
224}
247   /* drive selection */
248   if (!BIT(data, 0)) wd17xx_set_drive(0);
249   if (!BIT(data, 1)) wd17xx_set_drive(1);
250//   if (!BIT(data, 2)) wd17xx_set_drive(2);
225251 
226WRITE8_HANDLER( slow_ctrl_w )
227{
252   /* motor enable */
253   floppy_drive_set_motor_state(get_floppy_image(0), !BIT(data, 3));
254   floppy_drive_set_motor_state(get_floppy_image(1), !BIT(data, 3));
255   floppy_drive_set_ready_state(get_floppy_image(0), 1, 1);
256   floppy_drive_set_ready_state(get_floppy_image(1), 1, 1);
257 
258   /* disk side selection */
259   wd17xx_set_side(!BIT(data, 4));
260 
261   if (!BIT(data, 7))
262   {
263      /* FDC master reset */
264      wd17xx_reset(machine);
265   }
228266}
229267 
230WRITE8_HANDLER( slow_status_w )
268static WRITE8_HANDLER( slow_status_w )
231269{
232270   const device_config *device = devtag_get_device(machine, LUXOR_55_10828, CONKORT_TAG);
233271   slow_t *conkort = get_safe_token_slow(device);
r3560r3561
239277 
240278/* Fast Controller */
241279 
280static READ8_HANDLER( fast_bus_data_r )
281{
282   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
283   fast_t *conkort = get_safe_token_fast(device);
284 
285   UINT8 data = 0xff;
286 
287   if (!BIT(conkort->status, 6))
288   {
289      data = conkort->data;
290   }
291 
292   return data;
293}
294 
295static WRITE8_HANDLER( fast_bus_data_w )
296{
297   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
298   fast_t *conkort = get_safe_token_fast(device);
299 
300   if (BIT(conkort->status, 6))
301   {
302      conkort->data = data;
303   }
304 
305//   cpunum_set_input_line(machine, conkort->cpunum, INPUT_LINE_NMI, PULSE_LINE);
306}
307 
308static READ8_HANDLER( fast_bus_stat_r )
309{
310   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
311   fast_t *conkort = get_safe_token_fast(device);
312 
313   return conkort->status;
314}
315 
316static WRITE8_HANDLER( fast_bus_c1_w )
317{
318   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
319   fast_t *conkort = get_safe_token_fast(device);
320 
321   cpunum_set_input_line(machine, conkort->cpunum, INPUT_LINE_NMI, PULSE_LINE);
322}
323 
324static WRITE8_HANDLER( fast_bus_c3_w )
325{
326   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
327   fast_t *conkort = get_safe_token_fast(device);
328 
329   cpunum_set_input_line(machine, conkort->cpunum, INPUT_LINE_RESET, PULSE_LINE);
330}
331 
242332static void fast_card_select(const device_config *device, UINT8 data)
243333{
334   fast_t *conkort = get_safe_token_fast(device);
335 
336   if (data == input_port_read(device->machine, "SW3"))
337   {
338      memory_install_readwrite8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_INP, ABCBUS_OUT, 0x18, 0, fast_bus_data_r, fast_bus_data_w);
339      memory_install_read8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_STAT, ABCBUS_STAT, 0x18, 0, fast_bus_stat_r);
340      memory_install_write8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_C1, ABCBUS_C1, 0x18, 0, fast_bus_c1_w);
341      memory_install_write8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_C2, ABCBUS_C2, 0x18, 0, SMH_NOP);
342      memory_install_write8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_C3, ABCBUS_C3, 0x18, 0, fast_bus_c3_w);
343      memory_install_write8_handler(device->machine, 0, ADDRESS_SPACE_IO, ABCBUS_C4, ABCBUS_C4, 0x18, 0, SMH_NOP);
344   }
345 
346   cpunum_set_input_line(device->machine, conkort->cpunum, INPUT_LINE_RESET, PULSE_LINE);
244347}
245348 
349static WRITE8_HANDLER( fast_1f_w )
350{
351   /*
352 
353      bit      description
354 
355      0       
356      1       
357      2       
358      3       
359      4       
360      5       
361      6       
362      7       
363 
364   */
365 
366   logerror("1F write %02x\n", data);
367}
368 
369static WRITE8_HANDLER( fast_3f_w )
370{
371   /*
372 
373      bit      description
374 
375      0       
376      1       
377      2       
378      3       
379      4       
380      5       
381      6       
382      7       
383 
384   */
385 
386   logerror("3F write %02x\n", data);
387}
388 
389static WRITE8_HANDLER( fast_ctrl_w )
390{
391   /*
392 
393      bit      description
394 
395      0      _SEL 0
396      1      _SEL 1
397      2      _MOT
398      3      _SIDE
399      4       
400      5       
401      6       
402      7       
403 
404   */
405 
406   /* drive selection */
407   if (!BIT(data, 0)) wd17xx_set_drive(0);
408   if (!BIT(data, 1)) wd17xx_set_drive(1);
409 
410   /* motor enable */
411   floppy_drive_set_motor_state(get_floppy_image(0), !BIT(data, 2));
412   floppy_drive_set_motor_state(get_floppy_image(1), !BIT(data, 2));
413   floppy_drive_set_ready_state(get_floppy_image(0), 1, 1);
414   floppy_drive_set_ready_state(get_floppy_image(1), 1, 1);
415 
416   /* disk side selection */
417   wd17xx_set_side(!BIT(data, 3));
418}
419 
420static READ8_HANDLER( fast_data_r )
421{
422   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
423   fast_t *conkort = get_safe_token_fast(device);
424 
425   return conkort->data;
426}
427 
428static WRITE8_HANDLER( fast_data_w )
429{
430   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
431   fast_t *conkort = get_safe_token_fast(device);
432 
433   conkort->data = data;
434}
435 
436static WRITE8_HANDLER( fast_status_w )
437{
438   const device_config *device = devtag_get_device(machine, LUXOR_55_21046, CONKORT_TAG);
439   fast_t *conkort = get_safe_token_fast(device);
440 
441   conkort->status = data;
442}
443 
246444/* Memory Maps */
247445 
248446// Slow Controller
r3560r3561
257455   AM_RANGE(0x7c, 0x7f) AM_DEVREADWRITE(Z80PIO, CONKORT_Z80PIO_TAG, z80pio_alt_r, z80pio_alt_w)
258456   AM_RANGE(0xbc, 0xbf) AM_READWRITE(wd17xx_r, wd17xx_w)
259457   AM_RANGE(0xdf, 0xdf) AM_WRITE(slow_status_w)
260   AM_RANGE(0xef, 0xef) AM_READWRITE(slow_ctrl_r, slow_ctrl_w)
458   AM_RANGE(0xef, 0xef) AM_WRITE(slow_ctrl_w)
261459ADDRESS_MAP_END
262460 
263461// Fast Controller
r3560r3561
269467 
270468static ADDRESS_MAP_START( fast_io_map, ADDRESS_SPACE_IO, 8 )
271469   ADDRESS_MAP_GLOBAL_MASK(0xff)
470   AM_RANGE(0x0f, 0x0f) AM_READ(fast_data_r)
471   AM_RANGE(0x1f, 0x1f) AM_WRITE(fast_data_w)
472   AM_RANGE(0x2f, 0x2f) AM_WRITE(fast_status_w)
473//   AM_RANGE(0x3f, 0x3f) AM_WRITE()
474//   AM_RANGE(0x4f, 0x4f) AM_WRITE()
475//   AM_RANGE(0x5d, 0x5d) AM_READ()
476 
477   AM_RANGE(0x68, 0x6b) AM_READ(wd17xx_r)
478   AM_RANGE(0x78, 0x7b) AM_WRITE(wd17xx_w)
479   AM_RANGE(0x87, 0x87) AM_DEVREADWRITE(Z80DMA, CONKORT_Z80DMA_TAG, z80dma_r, z80dma_w)
272480ADDRESS_MAP_END
273481 
274482/* Input Ports */
r3560r3561
425633 
426634/* Z80 DMA */
427635 
636#define Z80DMA_CPUNUM 1
637 
638static dma_irq_callback(const device_config *device, int state)
639{
640   cpunum_set_input_line(device->machine, Z80DMA_CPUNUM, INPUT_LINE_IRQ0, state);
641}
642 
428643static READ8_DEVICE_HANDLER( dma_read_byte )
429644{
430645   UINT8 data;
431646 
432   cpuintrf_push_context(1);
647   cpuintrf_push_context(Z80DMA_CPUNUM);
433648   data = program_read_byte(offset);
434649   cpuintrf_pop_context();
435650 
r3560r3561
438653 
439654static WRITE8_DEVICE_HANDLER( dma_write_byte )
440655{
441   cpuintrf_push_context(1);
656   cpuintrf_push_context(Z80DMA_CPUNUM);
442657   program_write_byte(offset, data);
443658   cpuintrf_pop_context();
444659}
r3560r3561
455670 
456671static const z80dma_interface dma_intf =
457672{
458   0,
459   XTAL_16MHz/4, // ???
460   dma_read_byte,
461   dma_write_byte,
462   wd17xx_read_byte,
463   wd17xx_write_byte,
464   0,
465   0
673   Z80DMA_CPUNUM,         /* cpunum to HALT */
674   XTAL_16MHz/4,         /* chip clock */
675   dma_read_byte,         /* memory read */
676   dma_write_byte,         /* memory write */
677   wd17xx_read_byte,      /* port A read */
678   wd17xx_write_byte,      /* port A write */
679   0,                  /* port B read */
680   0,                  /* port B write */
681   dma_irq_callback      /* interrupt callback */
466682};
467683 
468684static const z80_daisy_chain fast_daisy_chain[] =
r3560r3561
486702      case WD17XX_IRQ_SET:
487703         conkort->fdc_irq = 1;
488704         break;
489      case WD17XX_DRQ_CLR:           
705      case WD17XX_DRQ_CLR:
490706         break;
491707      case WD17XX_DRQ_SET:
492708         break;
r3560r3561
497713 
498714static void fast_wd1793_callback(running_machine *machine, wd17xx_state_t state, void *param)
499715{
716//   const device_config *z80dma = devtag_get_device(machine, Z80DMA, CONKORT_Z80DMA_TAG);
717 
500718   switch(state)
501719   {
502720      case WD17XX_IRQ_CLR:
503721         break;
504722      case WD17XX_IRQ_SET:
505723         break;
506      case WD17XX_DRQ_CLR:             
724      case WD17XX_DRQ_CLR:
725         //z80dma_rdy_w(z80dma, 0, 0);
507726         break;
508727      case WD17XX_DRQ_SET:
728         //z80dma_rdy_w(z80dma, 0, 1);
509729         break;
510730   }
511731}
r3560r3561
563783ROM_START( l5521046 )
564784   ROM_REGION( 0x10000, CONKORT_Z80_TAG, 0 )
565785   ROM_LOAD( "fast108.bin",   0x0000, 0x2000, CRC(229764cb) SHA1(a2e2f6f49c31b827efc62f894de9a770b65d109d) ) // Luxor v1.08
786   ROM_LOAD( "6490318-07.bin", 0x0000, 0x2000, CRC(06ae1fe8) SHA1(ad1d9d0c192539af70cb95223263915a09693ef8) ) // PROM v1.07, Art N/O 6490318-07. Luxor Styrkort Art. N/O 55 21046-41. Date 1985-07-03
566787   ROM_LOAD( "fast207.bin",   0x0000, 0x2000, CRC(86622f52) SHA1(61ad271de53152c1640c0b364fce46d1b0b4c7e2) ) // DIAB v2.07
567   ROM_LOAD( "6490318-07.bin", 0x0000, 0x2000, CRC(06ae1fe8) SHA1(ad1d9d0c192539af70cb95223263915a09693ef8) ) // PROM v1.07, Art N/O 6490318-07. Luxor Styrkort Art. N/O 55 21046-41. Date 1985-07-03
568788ROM_END
569789 
570790/* Device Interface */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team