Previous 15994 Revisions Next

r9087 Friday 10th September, 2010 at 14:11:27 UTC by Curt Coder
[CONKORT] Implemented busy handling, SW1 reading, interrupt control.
[src/mess/drivers]abc80x.c
[src/mess/machine]conkort.c

src/mess/machine/conkort.c
r9086r9087
176176
177177    Fast Controller
178178    ---------------
179   - status bit 0
179   - status bit 0 (busy)
180   - SW2 reading
181   - "track 0 sector 25 not found!"
180182
181183*/
182184
r9086r9087
235237   UINT8 data_in;         /* ABC BUS data in */
236238   UINT8 data_out;         /* ABC BUS data out */
237239   int fdc_irq;         /* FDC interrupt */
240   int dma_irq;         /* DMA interrupt */
241   int busy;            /* busy bit */
238242
239243   /* devices */
240244   running_device *cpu;
r9086r9087
467471{
468472   fast_t *conkort = get_safe_token_fast(device);
469473
470   conkort->cs = (data == input_port_read(device->machine, "SW3"));
474   conkort->cs = (data == input_port_read(device->machine, "abc830:SW3"));
471475}
472476
473477READ8_DEVICE_HANDLER( luxor_55_21046_stat_r )
r9086r9087
478482
479483   if (conkort->cs)
480484   {
481      // TODO: D0 handling (NANDed with something)
482485      // LS240 inverts the data, D4/D5 not connected
483      data = (~conkort->status & 0xcf) | 0x31;
486      data = (~conkort->status & 0xcf) | 0x30 | !(conkort->busy & BIT(conkort->status, 0));
484487   }
485488
486489   return data;
r9086r9087
495498   if (conkort->cs)
496499   {
497500      data = conkort->data_out;
501      conkort->busy = 1;
502      logerror("busy %u\n", conkort->busy);
498503   }
499504
500505   return data;
r9086r9087
507512   if (conkort->cs)
508513   {
509514      conkort->data_in = data;
515      conkort->busy = 1;
516      logerror("busy %u\n", conkort->busy);
510517   }
511518}
512519
r9086r9087
558565
559566   fast_t *conkort = get_safe_token_fast(device->owner());
560567
568   conkort->busy = 0;
569   logerror("busy %u\n", conkort->busy);
570
561571   return conkort->data_in;
562572}
563573
r9086r9087
579589   */
580590
581591   fast_t *conkort = get_safe_token_fast(device->owner());
592   
593   conkort->busy = 0;
594   logerror("busy %u\n", conkort->busy);
582595
583596   conkort->data_out = data;
584597}
r9086r9087
589602
590603      bit      description
591604
592      0     
593      1     
594      2     
595      3     
596      4     
597      5     
598      6     
599      7     
605      0      busy
606      1      index pulse/DRQ
607      2      track 0/lost data
608      3      CRC error
609      4      seek error/RNF
610      5      head loaded/write fault
611      6      write protect
612      7      not ready
600613
601614   */
602615
603616   fast_t *conkort = get_safe_token_fast(device->owner());
604617
605618   conkort->status = data;
619
620   if (BIT(data, 0))
621   {
622      conkort->busy = 0;
623      logerror("busy %u\n", conkort->busy);
624   }
606625}
607626
608627static WRITE8_DEVICE_HANDLER( fast_9b_w )
r9086r9087
664683   wd17xx_dden_w(device, BIT(data, 1));
665684}
666685
686static READ8_DEVICE_HANDLER( fast_9a_r )
687{
688   /*
689
690      bit      description
691
692      0      3A.8 (busy)
693      1      SW1-2
694      2      3A.12 (SW2)
695      3      GND
696      4      SW1-1
697      5      GND
698      6      SW1-3
699      7      SW1-4
700
701   */
702
703   fast_t *conkort = get_safe_token_fast(device->owner());
704
705   UINT8 data = 0;
706
707   /* busy */
708   data |= (conkort->busy & BIT(conkort->status, 0));
709
710   /* SW1 */
711   UINT8 sw1 = input_port_read(device->machine, "abc830:SW1");
712
713   data |= BIT(sw1, 0) << 4;
714   data |= BIT(sw1, 1) << 1;
715   data |= BIT(sw1, 2) << 6;
716   data |= BIT(sw1, 3) << 7;
717
718   /* SW2 */
719/*   UINT8 sw2 = input_port_read(device->machine, "abc830:SW2");
720
721   int sw2_1 = BIT(offset, 8) & BIT(sw2, 0);
722   int sw2_2 = BIT(offset, 9) & BIT(sw2, 1);
723   int sw2_3 = BIT(offset, 10) & BIT(sw2, 2);
724   int sw2_4 = BIT(offset, 11) & BIT(sw2, 3);
725   int sw2_data = !(sw2_1 & sw2_2 & !(sw2_3 ^ sw2_4));
726   
727   data |= sw2_data << 2;*/
728
729   return data ^ 0xff;
730}
731
667732/* Memory Maps */
668733
669734// Slow Controller
r9086r9087
690755ADDRESS_MAP_END
691756
692757static ADDRESS_MAP_START( fast_io_map, ADDRESS_SPACE_IO, 8 )
693   ADDRESS_MAP_GLOBAL_MASK(0xff)
694   AM_RANGE(0x00, 0x00) AM_MIRROR(0x0f) AM_DEVREAD(SAB1793_TAG,  fast_3d_r)
695   AM_RANGE(0x10, 0x10) AM_MIRROR(0x0f) AM_DEVWRITE(SAB1793_TAG, fast_4d_w)
696   AM_RANGE(0x20, 0x20) AM_MIRROR(0x0f) AM_DEVWRITE(SAB1793_TAG, fast_4b_w)
697   AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_DEVWRITE(SAB1793_TAG, fast_9b_w)
698   AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_DEVWRITE(SAB1793_TAG, fast_8a_w)
699   AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ_PORT("SW1")
700   AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREAD(SAB1793_TAG, wd17xx_r)
701   AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVWRITE(SAB1793_TAG, wd17xx_w)
702   AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_r, z80dma_w)
758   AM_RANGE(0x00, 0x00) AM_MIRROR(0xff0f) AM_DEVREAD(SAB1793_TAG, fast_3d_r)
759   AM_RANGE(0x10, 0x10) AM_MIRROR(0xff0f) AM_DEVWRITE(SAB1793_TAG, fast_4d_w)
760   AM_RANGE(0x20, 0x20) AM_MIRROR(0xff0f) AM_DEVWRITE(SAB1793_TAG, fast_4b_w)
761   AM_RANGE(0x30, 0x30) AM_MIRROR(0xff0f) AM_DEVWRITE(SAB1793_TAG, fast_9b_w)
762   AM_RANGE(0x40, 0x40) AM_MIRROR(0xff0f) AM_DEVWRITE(SAB1793_TAG, fast_8a_w)
763   AM_RANGE(0x50, 0x50) AM_MIRROR(0xff0f) AM_MASK(0xff00) AM_DEVREAD(SAB1793_TAG, fast_9a_r)
764   AM_RANGE(0x60, 0x63) AM_MIRROR(0xff0c) AM_DEVREAD(SAB1793_TAG, wd17xx_r)
765   AM_RANGE(0x70, 0x73) AM_MIRROR(0xff0c) AM_DEVWRITE(SAB1793_TAG, wd17xx_w)
766   AM_RANGE(0x80, 0x80) AM_MIRROR(0xff0f) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_r, z80dma_w)
703767ADDRESS_MAP_END
704768
705769/* Input Ports */
706770
707771INPUT_PORTS_START( luxor_55_21046 )
708772   PORT_START("abc830:SW1")
709   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
710   PORT_DIPNAME( 0x05, 0x00, "Drive 0" ) PORT_DIPLOCATION("SW1:1,3") PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
711   PORT_DIPSETTING(    0x00, "SS SD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
712   PORT_DIPSETTING(    0x04, "SS DD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
713   PORT_DIPSETTING(    0x01, "DS SD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
714   PORT_DIPSETTING(    0x05, "DS DD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
715   PORT_DIPNAME( 0x0a, 0x00, "Drive 1" ) PORT_DIPLOCATION("SW1:2,4") PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
716   PORT_DIPSETTING(    0x00, "SS SD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
717   PORT_DIPSETTING(    0x08, "SS DD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
718   PORT_DIPSETTING(    0x02, "DS SD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
719   PORT_DIPSETTING(    0x0a, "DS DD" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
720   PORT_DIPNAME( 0x05, 0x01, "Drive 0" ) PORT_DIPLOCATION("SW1:1,3") PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
721   PORT_DIPSETTING(    0x00, "SS DD 80" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
722   PORT_DIPSETTING(    0x04, "SS DD 40" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
723   PORT_DIPSETTING(    0x01, "DS DD 80" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
724   PORT_DIPSETTING(    0x05, "DS DD 40" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
725   PORT_DIPNAME( 0x0a, 0x02, "Drive 1" ) PORT_DIPLOCATION("SW1:2,4") PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
726   PORT_DIPSETTING(    0x00, "SS DD 80" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
727   PORT_DIPSETTING(    0x08, "SS DD 40" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
728   PORT_DIPSETTING(    0x02, "DS DD 80" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
729   PORT_DIPSETTING(    0x0a, "DS DD 40" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
730   PORT_DIPNAME( 0xf0, 0x80, "Disk Drive" ) PORT_DIPLOCATION("SW2:1,2,3,4")
731   PORT_DIPSETTING(    0x80, "BASF 6106/08 (ABC 830, 190 9206-16)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
732   PORT_DIPSETTING(    0x90, "MPI 51 (ABC 830, 190 9206-16)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
733   PORT_DIPSETTING(    0x40, "BASF 6118 (ABC 832, 190 9711-16)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
734   PORT_DIPSETTING(    0x30, "Micropolis 1015F (ABC 832, 190 9711-15)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
735   PORT_DIPSETTING(    0x50, "Micropolis 1115F (ABC 832, 190 9711-17)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
736   PORT_DIPSETTING(    0x10, "TEAC FD55F (ABC 834, 230 7802-01)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
737   PORT_DIPSETTING(    0x20, "BASF 6138 (ABC 850, 230 8440-15)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
738   PORT_DIPSETTING(    0xe0, "BASF 6105" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
739   PORT_DIPSETTING(    0xf0, "BASF 6106 (ABC 838, 230 8838-15)" ) PORT_CONDITION("SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
773   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
774   PORT_DIPNAME( 0x05, 0x00, "Drive 0" ) PORT_DIPLOCATION("SW1:1,3") PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
775   PORT_DIPSETTING(    0x00, "SS SD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
776   PORT_DIPSETTING(    0x04, "SS DD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
777   PORT_DIPSETTING(    0x01, "DS SD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
778   PORT_DIPSETTING(    0x05, "DS DD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
779   PORT_DIPNAME( 0x0a, 0x00, "Drive 1" ) PORT_DIPLOCATION("SW1:2,4") PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
780   PORT_DIPSETTING(    0x00, "SS SD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
781   PORT_DIPSETTING(    0x08, "SS DD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
782   PORT_DIPSETTING(    0x02, "DS SD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
783   PORT_DIPSETTING(    0x0a, "DS DD" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
784   PORT_DIPNAME( 0x05, 0x01, "Drive 0" ) PORT_DIPLOCATION("SW1:1,3") PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
785   PORT_DIPSETTING(    0x00, "SS DD 80" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
786   PORT_DIPSETTING(    0x04, "SS DD 40" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
787   PORT_DIPSETTING(    0x01, "DS DD 80" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
788   PORT_DIPSETTING(    0x05, "DS DD 40" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
789   PORT_DIPNAME( 0x0a, 0x02, "Drive 1" ) PORT_DIPLOCATION("SW1:2,4") PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
790   PORT_DIPSETTING(    0x00, "SS DD 80" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
791   PORT_DIPSETTING(    0x08, "SS DD 40" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
792   PORT_DIPSETTING(    0x02, "DS DD 80" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
793   PORT_DIPSETTING(    0x0a, "DS DD 40" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
740794
741   PORT_START("SW3")
795   PORT_START("abc830:SW2")
796   PORT_DIPNAME( 0x0f, 0x08, "Disk Drive" ) PORT_DIPLOCATION("SW2:1,2,3,4")
797   PORT_DIPSETTING(    0x08, "BASF 6106/08 (ABC 830, 190 9206-16)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
798   PORT_DIPSETTING(    0x09, "MPI 51 (ABC 830, 190 9206-16)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2d)
799   PORT_DIPSETTING(    0x04, "BASF 6118 (ABC 832, 190 9711-16)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
800   PORT_DIPSETTING(    0x03, "Micropolis 1015F (ABC 832, 190 9711-15)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
801   PORT_DIPSETTING(    0x05, "Micropolis 1115F (ABC 832, 190 9711-17)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
802   PORT_DIPSETTING(    0x01, "TEAC FD55F (ABC 834, 230 7802-01)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
803   PORT_DIPSETTING(    0x02, "BASF 6138 (ABC 850, 230 8440-15)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2c)
804   PORT_DIPSETTING(    0x0e, "BASF 6105" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
805   PORT_DIPSETTING(    0x0f, "BASF 6106 (ABC 838, 230 8838-15)" ) PORT_CONDITION("abc830:SW3", 0x7f, PORTCOND_EQUALS, 0x2e)
806   
807   PORT_START("abc830:SW3") // controller card ABC bus address
742808   PORT_DIPNAME( 0x7f, 0x2d, "Disk Drive" ) PORT_DIPLOCATION("SW3:1,2,3,4,5,6,7")
743809   PORT_DIPSETTING(    0x2c, "ABC 832/834/850" )
744810   PORT_DIPSETTING(    0x2d, "ABC 830" )
745811   PORT_DIPSETTING(    0x2e, "ABC 838" )
746812
747   PORT_START("CONKORT_ROM")
813   PORT_START("abc830:CONKORT_ROM")
748814   PORT_CONFNAME( 0x07, 0x00, "Controller PROM" )
749815   PORT_CONFSETTING(    0x00, "Luxor v1.07" )
750816   PORT_CONFSETTING(    0x01, "Luxor v1.08" )
r9086r9087
907973
908974*/
909975
976static WRITE_LINE_DEVICE_HANDLER( z80dma_int_w )
977{
978   fast_t *conkort = get_safe_token_fast(device->owner());
979
980   conkort->dma_irq = state;
981
982   cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, conkort->fdc_irq | conkort->dma_irq);
983}
984
910985static UINT8 memory_read_byte(address_space *space, offs_t address) { return space->read_byte(address); }
911986static void memory_write_byte(address_space *space, offs_t address, UINT8 data) { space->write_byte(address, data); }
912987
913988static Z80DMA_INTERFACE( dma_intf )
914989{
915990   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_HALT),
916   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),
991   DEVCB_LINE(z80dma_int_w),
917992   DEVCB_NULL,
918993   DEVCB_MEMORY_HANDLER(Z80_TAG, PROGRAM, memory_read_byte),
919994   DEVCB_MEMORY_HANDLER(Z80_TAG, PROGRAM, memory_write_byte),
r9086r9087
9701045{
9711046   fast_t *conkort = get_safe_token_fast(device->owner());
9721047
973   cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, state);
1048   conkort->fdc_irq = state;
1049
1050   cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, conkort->fdc_irq | conkort->dma_irq);
9741051}
9751052
9761053static const wd17xx_interface fast_wd17xx_interface =
r9086r9087
11611238   conkort->image0 = device->subdevice(FLOPPY_0);
11621239   conkort->image1 = device->subdevice(FLOPPY_1);
11631240
1241   conkort->fdc_irq = 0;
1242   conkort->busy = 0;
1243
11641244   /* register for state saving */
11651245   state_save_register_device_item(device, 0, conkort->cs);
11661246   state_save_register_device_item(device, 0, conkort->status);
src/mess/drivers/abc80x.c
r9086r9087
10121012
10131013static ABCBUS_DAISY( abcbus_daisy )
10141014{
1015   { LUXOR_55_21046_ABCBUS("abc830") },
1015//   { LUXOR_55_21046_ABCBUS("abc830") },
10161016   { NULL }
10171017};
10181018

Previous 15994 Revisions Next


© 1998-2018 The MESS Team