Previous 15994 Revisions Next

r9220 Friday 24th September, 2010 at 00:52:35 UTC by Curt Coder
[ABC800] Emulated the "fast" floppy disk controller. Note that only raw sector dumps work currently (td0 not supported).
[docs]messnew.txt
[src/emu/machine]z80dma.c
[src/mess/drivers]abc80x.c
[src/mess/machine]abc830.c abc830.h

src/emu/machine/z80dma.c
r9219r9220
662662
663663   if (m_num_follow == 0)
664664   {
665      m_reset_pointer = 0;
666     
665667      if ((data & 0x87) == 0) // WR2
666668      {
667669         WR2 = data;
r9219r9220
841843            m_regs_follow[m_num_follow++] = GET_REGNUM(INTERRUPT_VECTOR);
842844         m_cur_follow = 0;
843845      }
846
847      m_reset_pointer++;
848      if(m_reset_pointer >= 6) { m_reset_pointer = 0; }
844849   }
845850}
846851
src/mess/machine/abc830.c
r9219r9220
174174   - ABC80 ERR 48 on boot
175175   - side select makes controller go crazy and try to WRITE_TRK
176176
177    Fast Controller
178    ---------------
179   - Z80 DMA reset command is broken (it keeps resetting A/B port addresses)
180   - 2KB RAM option
181   - 160KB disks need a 7:1 sector interleave to load (physical sectors: 1,8,F,6,D,4,B,2,9,10,7,E,5,C,3,A)
182
183177*/
184178
185179#include "emu.h"
r9219r9220
243237   int dma_irq;         /* DMA interrupt */
244238   int busy;            /* busy bit */
245239   int force_busy;         /* force busy bit */
240   UINT8 sw1;            /* DS/DD */
241   UINT8 sw2;            /* drive type */
242   UINT8 sw3;            /* ABC bus address */
246243
247244   /* devices */
248245   running_device *bus;
r9219r9220
387384
388385   slow_t *conkort = get_safe_token_slow(device->owner());
389386
390   /* drive selection */
387   // drive selection
391388   if (BIT(data, 0)) wd17xx_set_drive(device, 0);
392389   if (BIT(data, 1)) wd17xx_set_drive(device, 1);
393390//  if (BIT(data, 2)) wd17xx_set_drive(device, 2);
394391   conkort->sel0 = BIT(data, 0);
395392   conkort->sel1 = BIT(data, 1);
396393
397   /* motor enable */
394   // motor enable
398395   int mtron = BIT(data, 3);
399396   floppy_mon_w(conkort->image0, mtron);
400397   floppy_mon_w(conkort->image1, mtron);
401398   floppy_drive_set_ready_state(conkort->image0, !mtron, 1);
402399   floppy_drive_set_ready_state(conkort->image1, !mtron, 1);
403400
404   /* disk side selection */
401   // side selection
405402   //wd17xx_set_side(device, BIT(data, 4));
406403
407   /* wait enable */
404   // wait enable
408405   conkort->wait_enable = BIT(data, 6);
409406
410   /* FDC master reset */
407   // FDC master reset
411408   wd17xx_mr_w(device, BIT(data, 7));
412409}
413410
r9219r9220
430427
431428   slow_t *conkort = get_safe_token_slow(device->owner());
432429
433   /* interrupt */
434   abcbus_int_w(conkort->bus, BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE);
430   // interrupt
431//   abcbus_int_w(conkort->bus, BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE);
435432
436433   conkort->status = data & 0xfe;
437434}
r9219r9220
443440
444441   if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq)
445442   {
446      /* TODO: this is really connected to the Z80 WAIT line */
443      // TODO: this is really connected to the Z80 WAIT line
447444      cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE);
448445   }
449446
r9219r9220
455452   case 3: data = wd17xx_data_r(device, 0); break;
456453   }
457454
458   /* FD1791 has inverted data lines */
455   // FD1791 has inverted data lines
459456   return data ^ 0xff;
460457}
461458
r9219r9220
466463   if (!conkort->wait_enable && !conkort->fdc_irq && !conkort->fdc_drq)
467464   {
468465      logerror("WAIT\n");
469      /* TODO: this is really connected to the Z80 WAIT line */
466      // TODO: this is really connected to the Z80 WAIT line
470467      cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, ASSERT_LINE);
471468   }
472469
473   /* FD1791 has inverted data lines */
470   // FD1791 has inverted data lines
474471   data ^= 0xff;
475472
476473   switch (offset & 0x03)
r9219r9220
488485{
489486   fast_t *conkort = get_safe_token_fast(device);
490487
491   conkort->cs = (data == input_port_read(device->machine, "luxor_55_21046:SW3"));
488//   conkort->cs = (data == input_port_read(device->machine, "luxor_55_21046:SW3"));
489   conkort->cs = (data == conkort->sw3);
492490}
493491
494492READ8_DEVICE_HANDLER( luxor_55_21046_stat_r )
r9219r9220
633631
634632   fast_t *conkort = get_safe_token_fast(device->owner());
635633
636   /* drive select */
634   // drive select
637635   if (BIT(data, 0)) wd17xx_set_drive(device, 0);
638636   if (BIT(data, 1)) wd17xx_set_drive(device, 1);
639637   //if (BIT(data, 2)) wd17xx_set_drive(device, 2);
640638
641   /* motor enable */
639   // motor enable
642640   int mtron = BIT(data, 3);
643641   floppy_mon_w(conkort->image0, !mtron);
644642   floppy_mon_w(conkort->image1, !mtron);
645643   floppy_drive_set_ready_state(conkort->image0, mtron, 1);
646644   floppy_drive_set_ready_state(conkort->image1, mtron, 1);
647645
648   /* side select */
646   // side select
649647   wd17xx_set_side(device, BIT(data, 5));
650648}
651649
r9219r9220
668666
669667   */
670668
671   /* master reset */
669   // FDC master reset
672670   wd17xx_mr_w(device, BIT(data, 0));
673671
674   /* density select */
672   // density select
675673   wd17xx_dden_w(device, BIT(data, 1));
676674}
677675
r9219r9220
696694
697695   UINT8 data = 0;
698696
699   /* busy */
697   // busy
700698   data |= conkort->busy;
701699
702   /* SW1 */
703   UINT8 sw1 = input_port_read(device->machine, "luxor_55_21046:SW1") & 0x0f;
700   // SW1
701//   UINT8 sw1 = input_port_read(device->machine, "luxor_55_21046:SW1") & 0x0f;
702   UINT8 sw1 = conkort->sw1;
704703
705704   data |= sw1 << 4;
706705
707   /* SW2 */
708   UINT8 sw2 = input_port_read(device->machine, "luxor_55_21046:SW2") & 0x0f;
706   // SW2
707//   UINT8 sw2 = input_port_read(device->machine, "luxor_55_21046:SW2") & 0x0f;
708   UINT8 sw2 = conkort->sw2;
709709   
710   // TTL inputs float high
710   // TTL inputs float high so DIP switch in off position equals 1
711711   int sw2_1 = BIT(sw2, 0) ? 1 : BIT(offset, 8);
712712   int sw2_2 = BIT(sw2, 1) ? 1 : BIT(offset, 9);
713713   int sw2_3 = BIT(sw2, 2) ? 1 : BIT(offset, 10);
r9219r9220
778778
779779   PORT_START("luxor_55_10828:S1")
780780   PORT_DIPNAME( 0x01, 0x01, "Card Address" ) PORT_DIPLOCATION("S1:1")
781   PORT_DIPSETTING(    0x00, "44" )
782   PORT_DIPSETTING(    0x01, "45" )
781   PORT_DIPSETTING(    0x00, "44 (ABC 832/834/850)" )
782   PORT_DIPSETTING(    0x01, "45 (ABC 830)" )
783783INPUT_PORTS_END
784784
785785INPUT_PORTS_START( luxor_55_21046 )
r9219r9220
885885
886886   UINT8 data = 0x04;
887887
888   /* single/double sided drive */
888   // single/double sided drive
889889   UINT8 sw1 = input_port_read(device->machine, "luxor_55_10828:SW1") & 0x0f;
890890   int ds0 = conkort->sel0 ? BIT(sw1, 0) : 1;
891891   int ds1 = conkort->sel1 ? BIT(sw1, 1) : 1;
892892   data |= !(ds0 & ds1);
893893
894   /* single/double density drive */
894   // single/double density drive
895895   int dd0 = conkort->sel0 ? BIT(sw1, 2) : 1;
896896   int dd1 = conkort->sel1 ? BIT(sw1, 3) : 1;
897897   data |= !(dd0 & dd1) << 1;
898898
899   /* radial/binary drive select */
899   // radial/binary drive select
900900   data |= 0x10;
901901
902   /* head load */
902   // head load
903903//  data |= wd17xx_hdld_r(device) << 6;
904904   data |= 0x40;
905905
906   /* FDC interrupt request */
906   // FDC interrupt request
907907   data |= conkort->fdc_irq << 7;
908908
909909   return data;
r9219r9220
928928
929929   slow_t *conkort = get_safe_token_slow(device->owner());
930930
931   /* double density enable */
931   // double density enable
932932   wd17xx_dden_w(conkort->fd1791, BIT(data, 3));
933933
934   /* head load timing */
934   // head load timing
935935//  wd17xx_hlt_w(conkort->fd1791, BIT(data, 5));
936936}
937937
r9219r9220
980980    CF  load
981981    87  enable DMA
982982
983    ??
984    --
983    WRITE TO DISK
984    -------------
985985    C3 14 28 95 7B 02 8A CF 05 AF CF 87
986986
987987    C3  reset
r9219r9220
10151015
10161016   conkort->dma_irq = state;
10171017
1018   // FDC and DMA interrupts are wire-ORed to the Z80
10181019   cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, conkort->fdc_irq | conkort->dma_irq);
10191020}
10201021
r9219r9220
10431044
10441045   if (state)
10451046   {
1046      /* TODO: this is really connected to the Z80 WAIT line */
1047      // TODO: this is really connected to the Z80 WAIT line
10471048      cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, CLEAR_LINE);
10481049   }
10491050}
r9219r9220
10561057
10571058   if (state)
10581059   {
1059      /* TODO: this is really connected to the Z80 WAIT line */
1060      // TODO: this is really connected to the Z80 WAIT line
10601061      cpu_set_input_line(conkort->cpu, INPUT_LINE_HALT, CLEAR_LINE);
10611062   }
10621063}
r9219r9220
10681069   DEVCB_LINE(slow_fd1791_drq_w),
10691070   { FLOPPY_0, FLOPPY_1, NULL, NULL }
10701071};
1071/*
1072
10721073static FLOPPY_OPTIONS_START( fd2 )
1074   // NOTE: FD2 cannot be used with the Luxor controller card,
1075   // it has a proprietary one. This is just for reference.
10731076   FLOPPY_OPTION(fd2, "dsk", "Scandia Metric FD2", basicdsk_identify_default, basicdsk_construct_default,
10741077      HEADS([1])
10751078      TRACKS([40])
r9219r9220
10771080      SECTOR_LENGTH([256])
10781081      FIRST_SECTOR_ID([1]))
10791082FLOPPY_OPTIONS_END
1080*/
1081static FLOPPY_OPTIONS_START( abc830 )
1082   FLOPPY_OPTION(abc830, "dsk", "ABC 830", basicdsk_identify_default, basicdsk_construct_default,
1083      HEADS([1])
1084      TRACKS([40])
1085      SECTORS([16])
1086      SECTOR_LENGTH([256])
1087      FIRST_SECTOR_ID([1]))
1088FLOPPY_OPTIONS_END
10891083
1090static FLOPPY_OPTIONS_START( abc832 )
1091   FLOPPY_OPTION(abc832, "dsk", "ABC 832/834", basicdsk_identify_default, basicdsk_construct_default,
1092      HEADS([2])
1093      TRACKS([80])
1094      SECTORS([16])
1095      SECTOR_LENGTH([256])
1096      FIRST_SECTOR_ID([1]))
1097FLOPPY_OPTIONS_END
1098
1099static FLOPPY_OPTIONS_START( abc838 )
1100   FLOPPY_OPTION(abc838, "dsk", "ABC 838", basicdsk_identify_default, basicdsk_construct_default,
1101      HEADS([2])
1102      TRACKS([77])
1103      SECTORS([26])
1104      SECTOR_LENGTH([256])
1105      FIRST_SECTOR_ID([1]))
1106FLOPPY_OPTIONS_END
1107/*
11081084static const floppy_config fd2_floppy_config =
11091085{
11101086    DEVCB_NULL,
r9219r9220
11161092    FLOPPY_OPTIONS_NAME(fd2),
11171093    NULL
11181094};
1119*/
1095
1096static FLOPPY_OPTIONS_START( abc830 )
1097   // NOTE: Real ABC 830 (160KB) disks use a 7:1 sector interleave.
1098   //
1099   // The controller ROM is patched to remove the interleaving so
1100   // you can use disk images with logical sector layout instead.
1101   //
1102   // Specify INTERLEAVE([7]) below if you prefer the physical layout.
1103   FLOPPY_OPTION(abc830, "dsk", "Luxor ABC 830", basicdsk_identify_default, basicdsk_construct_default,
1104      HEADS([1])
1105      TRACKS([40])
1106      SECTORS([16])
1107      SECTOR_LENGTH([256])
1108      FIRST_SECTOR_ID([1]))
1109FLOPPY_OPTIONS_END
1110
11201111static const floppy_config abc830_floppy_config =
11211112{
11221113    DEVCB_NULL,
r9219r9220
11291120    NULL
11301121};
11311122
1123static FLOPPY_OPTIONS_START( abc832 )
1124   FLOPPY_OPTION(abc832, "dsk", "Luxor ABC 832/834", basicdsk_identify_default, basicdsk_construct_default,
1125      HEADS([2])
1126      TRACKS([80])
1127      SECTORS([16])
1128      SECTOR_LENGTH([256])
1129      FIRST_SECTOR_ID([1]))
1130FLOPPY_OPTIONS_END
1131
11321132static const floppy_config abc832_floppy_config =
11331133{
11341134    DEVCB_NULL,
r9219r9220
11411141    NULL
11421142};
11431143
1144static FLOPPY_OPTIONS_START( abc838 )
1145   FLOPPY_OPTION(abc838, "dsk", "Luxor ABC 838", basicdsk_identify_default, basicdsk_construct_default,
1146      HEADS([2])
1147      TRACKS([77])
1148      SECTORS([26])
1149      SECTOR_LENGTH([256])
1150      FIRST_SECTOR_ID([1]))
1151FLOPPY_OPTIONS_END
1152
11441153static const floppy_config abc838_floppy_config =
11451154{
11461155    DEVCB_NULL,
r9219r9220
11611170
11621171   conkort->fdc_irq = state;
11631172
1173   // FDC and DMA interrupts are wire-ORed to the Z80
11641174   cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, conkort->fdc_irq | conkort->dma_irq);
11651175}
11661176
r9219r9220
12581268   slow_t *conkort = get_safe_token_slow(device);
12591269   const conkort_config *config = get_safe_config(device);
12601270
1261   /* find our CPU */
1271   // find our CPU
12621272   conkort->cpu = device->subdevice(Z80_TAG);
12631273
1264   /* find devices */
1274   // find devices
12651275   conkort->bus = device->machine->device(config->bus_tag);
12661276   conkort->z80pio = device->subdevice(Z80PIO_TAG);
12671277   conkort->fd1791 = device->subdevice(FD1791_TAG);
12681278   conkort->image0 = device->subdevice(FLOPPY_0);
12691279   conkort->image1 = device->subdevice(FLOPPY_1);
12701280
1271   /* register for state saving */
1281   // register for state saving
12721282   state_save_register_device_item(device, 0, conkort->cs);
12731283   state_save_register_device_item(device, 0, conkort->status);
12741284   state_save_register_device_item(device, 0, conkort->data);
r9219r9220
12781288   state_save_register_device_item(device, 0, conkort->sel0);
12791289   state_save_register_device_item(device, 0, conkort->sel1);
12801290
1281   /* patch out protection checks */
1291   // patch out protection checks
12821292   UINT8 *rom = device->subregion("abc830")->base();
1293   rom[0x00fa] = 0xff;
1294   rom[0x0336] = 0xff;
12831295   rom[0x0718] = 0xff;
12841296   rom[0x072c] = 0xff;
1285   rom[0x0336] = 0xff;
1286   rom[0x00fa] = 0xff;
12871297   rom[0x0771] = 0xff;
12881298   rom[0x0788] = 0xff;
12891299}
r9219r9220
13581368   fast_t *conkort = get_safe_token_fast(device);
13591369   const conkort_config *config = get_safe_config(device);
13601370
1361   /* find our CPU */
1371   // find our CPU
13621372   conkort->cpu = device->subdevice(Z80_TAG);
13631373
1364   /* find devices */
1374   // find devices
13651375   conkort->bus = device->machine->device(config->bus_tag);
13661376   conkort->z80dma = device->subdevice(Z80DMA_TAG);
13671377   conkort->wd1793 = device->subdevice(SAB1793_TAG);
13681378   conkort->image0 = device->subdevice(FLOPPY_0);
13691379   conkort->image1 = device->subdevice(FLOPPY_1);
13701380
1381   // set initial values
13711382   conkort->dma_irq = 0;
13721383   conkort->fdc_irq = 0;
13731384   conkort->busy = 0;
13741385
1375   /* register for state saving */
1386   // inherit DIP switch settings
1387   conkort->sw1 = config->sw1;
1388   conkort->sw2 = config->sw2;
1389   conkort->sw3 = config->address;
1390
1391   // register for state saving
13761392   state_save_register_device_item(device, 0, conkort->cs);
13771393   state_save_register_device_item(device, 0, conkort->status);
13781394   state_save_register_device_item(device, 0, conkort->data_in);
r9219r9220
13811397   state_save_register_device_item(device, 0, conkort->dma_irq);
13821398   state_save_register_device_item(device, 0, conkort->busy);
13831399
1384   /* patch out sector skew table */
1400   // patch out sector skew table
13851401   UINT8 *rom = device->subregion("conkort")->base();
13861402
13871403   for (int i = 0; i < 16; i++)
src/mess/machine/abc830.h
r9219r9220
4848    MDRV_DEVICE_CONFIG_DATA32(conkort_config, sw2, _drive) \
4949    MDRV_DEVICE_CONFIG_DATA32(conkort_config, address, ADDRESS_ABC832)
5050
51#define MDRV_ABC834_ADD(_tag, _bus_tag) \
52   MDRV_DEVICE_ADD(_tag, ABC832, 0) \
53   MDRV_DEVICE_CONFIG_DATAPTR(conkort_config, bus_tag, _bus_tag) \
54    MDRV_DEVICE_CONFIG_DATA32(conkort_config, sw1, 0x03) \
55    MDRV_DEVICE_CONFIG_DATA32(conkort_config, sw2, DRIVE_TEAC_FD55F) \
56    MDRV_DEVICE_CONFIG_DATA32(conkort_config, address, ADDRESS_ABC832)
57
5158#define MDRV_ABC838_ADD(_tag, _bus_tag, _drive) \
5259   MDRV_DEVICE_ADD(_tag, ABC838, 0) \
5360   MDRV_DEVICE_CONFIG_DATAPTR(conkort_config, bus_tag, _bus_tag) \
src/mess/drivers/abc80x.c
r9219r9220
877877   PORT_DIPSETTING(    0x50, "Synchronous" )
878878   PORT_DIPSETTING(    0x8b, "ABC NET" )
879879
880   PORT_INCLUDE(luxor_55_21046)
880   //PORT_INCLUDE(luxor_55_21046)
881881INPUT_PORTS_END
882882
883883static INPUT_PORTS_START( fake_keyboard )
r9219r9220
986986   PORT_DIPSETTING(    0x00, "60 Hz" )
987987   PORT_DIPSETTING(    0x08, "50 Hz" )
988988
989   PORT_INCLUDE(luxor_55_21046)
989   //PORT_INCLUDE(luxor_55_21046)
990990INPUT_PORTS_END
991991
992992static INPUT_PORTS_START( abc806 )
r9219r9220
999999   PORT_DIPSETTING(    0x50, "Synchronous" )
10001000   PORT_DIPSETTING(    0x8b, "ABC NET" )
10011001
1002   PORT_INCLUDE(luxor_55_21046)
1002   //PORT_INCLUDE(luxor_55_21046)
10031003INPUT_PORTS_END
10041004
10051005/* ABC 77 */
r9219r9220
14771477
14781478   /* ABC bus */
14791479   MDRV_ABCBUS_ADD(ABCBUS_TAG, abcbus_daisy, Z80_TAG)
1480   MDRV_ABC832_ADD("luxor_55_21046", ABCBUS_TAG, DRIVE_TEAC_FD55F)
1480   MDRV_ABC834_ADD("luxor_55_21046", ABCBUS_TAG)
14811481
14821482   /* fake keyboard */
14831483   MDRV_TIMER_ADD_PERIODIC("keyboard", keyboard_tick, USEC(2500))
docs/messnew.txt
r9219r9220
4343
4444- [ABC800] Emulated the built-in keyboard. [Curt Coder, exon]
4545
46- [ABC800] Emulated the "fast" floppy disk controller. Note that only raw
47  sector dumps work currently (td0 not supported). [Curt Coder, exon]
48
4649- [ABC806] Added enhanced options ROM. [exon, Curt Coder]
4750
4851

Previous 15994 Revisions Next


© 1998-2018 The MESS Team