Previous 15994 Revisions Next

r3693 Thursday 27th November, 2008 at 23:08:13 UTC by Wilbert Pol
Reenabled coco.a
[src/mess]mess.mak
[src/mess/devices]coco_fdc.c
[src/mess/machine]6883sam.c coco.c ds1315.c

src/mess/machine/coco.c
r3692r3693
208208#define GIME_TYPE_1987   0
209209
210210#ifdef MAME_DEBUG
211static offs_t coco_dasm_override(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
211static offs_t coco_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram);
212212#endif /* MAME_DEBUG */
213213
214214
r3692r3693
455455   return 0;
456456}
457457
458static void pak_load_trailer(const pak_decodedtrailer *trailer)
458static void pak_load_trailer(running_machine *machine, const pak_decodedtrailer *trailer)
459459{
460460   cpu_set_reg(machine->cpu[0], M6809_PC, trailer->reg_pc);
461461   cpu_set_reg(machine->cpu[0], M6809_X, trailer->reg_x);
r3692r3693
586586   memcpy(pakbase, rambase + 0xC000, 0x3F00);
587587
588588   if (trailer_load)
589      pak_load_trailer(&trailer);
589      pak_load_trailer(Machine, &trailer);
590590   return INIT_PASS;
591591}
592592
r3692r3693
630630      if (preamble != 0)
631631      {
632632         /* start address - just set the address and return */
633         cpu_set_reg(machine->cpu[0], REG_PC, block_address);
633         cpu_set_reg(image->machine->cpu[0], REG_PC, block_address);
634634         done = TRUE;
635635      }
636636      else
637637      {
638         const address_space *space = cpu_get_address_space( image->machine->cpu[0], ADDRESS_SPACE_PROGRAM );
639
638640         /* data block - need to cap the maximum length of the block */
639641         block_length = MIN(block_length, length - position);
640642
r3692r3693
781783   UINT8 pia0_irq_b = pia_get_irq_b(0);
782784
783785   if (pia0_irq_a || pia0_irq_b)
784      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
786      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE);
785787   else
786      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, CLEAR_LINE);
788      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, CLEAR_LINE);
787789}
788790
789791static void d_recalc_firq(running_machine *machine)
r3692r3693
794796   UINT8 pia2_firq_b = pia_get_irq_b(2);
795797
796798   if (pia1_firq_a || pia1_firq_b || pia2_firq_a || pia2_firq_b)
797      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
799      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE);
798800   else
799      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, CLEAR_LINE);
801      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, CLEAR_LINE);
800802}
801803
802804static void coco3_recalc_irq(running_machine *machine)
803805{
804806   if ((coco3_gimereg[0] & 0x20) && gime_irq)
805      cpunum_set_input_line(machine, 0, M6809_IRQ_LINE, ASSERT_LINE);
807      cpu_set_input_line(machine->cpu[0], M6809_IRQ_LINE, ASSERT_LINE);
806808   else
807809      d_recalc_irq(machine);
808810}
r3692r3693
810812static void coco3_recalc_firq(running_machine *machine)
811813{
812814   if ((coco3_gimereg[0] & 0x10) && gime_firq)
813      cpunum_set_input_line(machine, 0, M6809_FIRQ_LINE, ASSERT_LINE);
815      cpu_set_input_line(machine->cpu[0], M6809_FIRQ_LINE, ASSERT_LINE);
814816   else
815817      d_recalc_firq(machine);
816818}
r3692r3693
902904
903905void coco3_horizontal_sync_callback(int data)
904906{
905   pia_0_ca1_w(Machine, 0, data);
907   const address_space *space = cpu_get_address_space( Machine->cpu[0], ADDRESS_SPACE_PROGRAM );
908
909   pia_0_ca1_w(space, 0, data);
906910   coco3_raise_interrupt(Machine, COCO3_INT_HBORD, data);
907911}
908912
r3692r3693
910914
911915void coco3_field_sync_callback(int data)
912916{
913   pia_0_cb1_w(Machine, 0, data);
917   const address_space *space = cpu_get_address_space( Machine->cpu[0], ADDRESS_SPACE_PROGRAM );
918
919   pia_0_cb1_w(space, 0, data);
914920}
915921
916922void coco3_gime_field_sync_callback(running_machine *machine)
r3692r3693
14131419
14141420
14151421/* three functions that update the keyboard in varying ways */
1416static WRITE8_HANDLER ( d_pia0_pb_w )               { (*update_keyboard)(machine); }
1422static WRITE8_HANDLER ( d_pia0_pb_w )               { (*update_keyboard)(space->machine); }
14171423INPUT_CHANGED(coco_keyboard_changed)               { (*update_keyboard)(field->port->machine); }
14181424static TIMER_CALLBACK(coco_update_keyboard_timerproc)   { (*update_keyboard)(machine); }
14191425
14201426static WRITE8_HANDLER ( d_pia0_pa_w )
14211427{
1422   if (get_input_device(machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_CC3MAX_INTERFACE)
1423      coco_hiresjoy_w(machine, data & 0x04);
1428   if (get_input_device(space->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_CC3MAX_INTERFACE)
1429      coco_hiresjoy_w(space->machine, data & 0x04);
14241430}
14251431
14261432
r3692r3693
14471453
14481454static WRITE8_HANDLER ( d_pia1_cb2_w )
14491455{
1450   soundmux_update(machine);
1456   soundmux_update(space->machine);
14511457}
14521458
14531459/* Printer output functions used by d_pia1_pa_w */
r3692r3693
14831489
14841490   coco_sound_update();
14851491
1486   if (get_input_device(machine, INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN)
1492   if (get_input_device(space->machine, INPUTPORT_SERIAL) == INPUTDEVICE_DIECOM_LIGHTGUN)
14871493   {
14881494      int dclg_this_bit = ((data & 2) >> 1);
14891495
r3692r3693
15261532   }
15271533   else
15281534   {
1529      cassette_output(cassette_device_image(machine), ((int) dac - 0x80) / 128.0);
1535      cassette_output(cassette_device_image(space->machine), ((int) dac - 0x80) / 128.0);
15301536   }
15311537
1532   (*update_keyboard)(machine);
1538   (*update_keyboard)(space->machine);
15331539
1534   if (get_input_device(machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_INTERFACE)
1535      coco_hiresjoy_w(machine, dac >= 0x80);
1540   if (get_input_device(space->machine, INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_INTERFACE)
1541      coco_hiresjoy_w(space->machine, dac >= 0x80);
15361542
15371543   /* Handle printer output, serial for CoCos, Paralell for Dragons */
15381544
r3692r3693
15641570{
15651571   int ddr;
15661572
1567   d_pia1_pb_w(machine, 0, data);
1573   d_pia1_pb_w(space, 0, data);
15681574
15691575   ddr = ~pia_get_port_b_z_mask(1);
15701576
r3692r3693
15741580   /* always be high (enabling 32k basic rom) */
15751581   if (ddr & 0x04)
15761582   {
1577      dragon_page_rom(machine, data & 0x04);
1583      dragon_page_rom(space->machine, data & 0x04);
15781584   }
15791585}
15801586
r3692r3693
15991605   /* always be high (enabling boot rom) */
16001606   /* PIA FIXME if (pia_get_ddr_a(2) & 0x04) */
16011607   {
1602      dragon_page_rom(machine, data & 0x04);   /* bit 2 controls boot or basic rom */
1608      dragon_page_rom(space->machine, data & 0x04);   /* bit 2 controls boot or basic rom */
16031609   }
16041610
16051611   /* Bits 0 and 1 for pia2 port a control the BCDIR and BC1 lines of the */
r3692r3693
16111617      case 0x00   :       /* Inactive, do nothing */
16121618         break;
16131619      case 0x01   :       /* Write to selected port */
1614         ay8910_write_port_0_w(machine, 0, pia_get_output_b(2));
1620         ay8910_write_port_0_w(space, 0, pia_get_output_b(2));
16151621         break;
16161622      case 0x02   :       /* Read from selected port */
1617         pia_set_input_b(2, ay8910_read_port_0_r(machine, 0));
1623         pia_set_input_b(2, ay8910_read_port_0_r(space, 0));
16181624         break;
16191625      case 0x03   :      /* Select port to write to */
1620         ay8910_control_port_0_w(machine, 0, pia_get_output_b(2));
1626         ay8910_control_port_0_w(space, 0, pia_get_output_b(2));
16211627         break;
16221628   }
16231629}
r3692r3693
16491655   /* The NMI line on the alphaAlpha is gated through IC16 (early PLD), and is gated by pia2 CA2  */
16501656   /* The DRQ line goes through pia2 cb1, in exactly the same way as DRQ from DragonDos does */
16511657   /* for pia1 cb1 */
1658
1659   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
1660
16521661   switch(event)
16531662   {
16541663      case WD17XX_IRQ_CLR:
1655         cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE);
1664         cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, CLEAR_LINE);
16561665         break;
16571666      case WD17XX_IRQ_SET:
16581667         if(dgnalpha_just_reset)
r3692r3693
16621671         else
16631672         {
16641673            if (pia_get_output_ca2_z(2))
1665               cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
1674               cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, ASSERT_LINE);
16661675         }
16671676         break;
16681677      case WD17XX_DRQ_CLR:
1669         pia_2_cb1_w(machine, 0, CARTLINE_CLEAR);
1678         pia_2_cb1_w(space, 0, CARTLINE_CLEAR);
16701679         break;
16711680      case WD17XX_DRQ_SET:
1672         pia_2_cb1_w(machine, 0, CARTLINE_ASSERTED);
1681         pia_2_cb1_w(space, 0, CARTLINE_ASSERTED);
16731682         break;
16741683   }
16751684}
r3692r3693
16821691   switch(offset & 0x03)
16831692   {
16841693      case 0:
1685         result = wd17xx_data_r(machine, 0);
1694         result = wd17xx_data_r(space, 0);
16861695         break;
16871696      case 1:
1688         result = wd17xx_sector_r(machine, 0);
1697         result = wd17xx_sector_r(space, 0);
16891698         break;
16901699      case 2:
1691         result = wd17xx_track_r(machine, 0);
1700         result = wd17xx_track_r(space, 0);
16921701         break;
16931702      case 3:
1694         result = wd17xx_status_r(machine, 0);
1703         result = wd17xx_status_r(space, 0);
16951704         break;
16961705      default:
16971706         break;
r3692r3693
17051714    switch(offset & 0x3)
17061715   {
17071716      case 0:
1708         wd17xx_data_w(machine, 0, data);
1717         wd17xx_data_w(space, 0, data);
17091718         break;
17101719      case 1:
1711         wd17xx_sector_w(machine, 0, data);
1720         wd17xx_sector_w(space, 0, data);
17121721         break;
17131722      case 2:
1714         wd17xx_track_w(machine, 0, data);
1723         wd17xx_track_w(space, 0, data);
17151724         break;
17161725      case 3:
1717         wd17xx_command_w(machine, 0, data);
1726         wd17xx_command_w(space, 0, data);
17181727
17191728         /* disk head is encoded in the command byte */
17201729         wd17xx_set_side((data & 0x02) ? 1 : 0);
r3692r3693
17341743static WRITE8_HANDLER ( d_pia1_ca2_w )
17351744{
17361745   cassette_change_state(
1737      cassette_device_image(machine),
1746      cassette_device_image(space->machine),
17381747      data ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
17391748      CASSETTE_MASK_MOTOR);
17401749}
r3692r3693
17431752
17441753static READ8_HANDLER ( d_pia1_pa_r )
17451754{
1746   return (cassette_input(cassette_device_image(machine)) >= 0) ? 1 : 0;
1755   return (cassette_input(cassette_device_image(space->machine)) >= 0) ? 1 : 0;
17471756}
17481757
17491758
r3692r3693
18471856      default   : bottom_32k=&mess_ram[0x00000]; break; // Just to shut the compiler up !
18481857   }
18491858
1850   setup_memory_map(machine);
1859   setup_memory_map(space->machine);
18511860}
18521861
18531862
r3692r3693
18801889    * TODO:  Make the overclock more accurate.  In dual speed, ROM was a fast
18811890    * access but RAM was not.  I don't know how to simulate this.
18821891    */
1883    cpunum_set_clockscale(Machine, 0, val ? 2 : 1);
1892    cpu_set_clockscale(Machine->cpu[0], val ? 2 : 1);
18841893}
18851894
18861895READ8_HANDLER(dragon_alpha_mapped_irq_r)
r3692r3693
19401949   };
19411950
19421951   /* We need to init these vars from the sam, as this may be called from outside the sam callbacks */
1952   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
19431953   UINT8 memsize   = get_sam_memorysize();
19441954   UINT8 maptype   = get_sam_maptype();
19451955//   UINT8 pagemode   = get_sam_pagemode();
r3692r3693
19741984      {
19751985         /* This deals with the bottom 32K page switch and the Dragon Plus paged ram */
19761986         if(block_index<8)
1977            memory_set_bankptr(block_index+1,&bottom_32k[memmap[wbank-1].start]);
1987            memory_set_bankptr(machine, block_index+1,&bottom_32k[memmap[wbank-1].start]);
19781988         else
1979            memory_set_bankptr(block_index+1,&mess_ram[memmap[wbank-1].start]);
1989            memory_set_bankptr(machine, block_index+1,&mess_ram[memmap[wbank-1].start]);
19801990
1981         memory_install_read_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
1982         memory_install_write_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
1991         memory_install_read_handler(space, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
1992         memory_install_write_handler(space, memmap[block_index].start, memmap[block_index].end, 0, 0, block_index+1);
19831993      }
19841994      else
19851995      {
1986         memory_install_read_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
1987         memory_install_write_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
1996         memory_install_read_handler(space, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
1997         memory_install_write_handler(space, memmap[block_index].start, memmap[block_index].end, 0, 0, STATIC_NOP);
19881998      }
19891999   }
19902000
r3692r3693
20012011         else
20022012            offset=&coco_rom[0x4000+(0x1000*(block_index-4))];
20032013
2004         memory_set_bankptr(block_index + 9,offset);
2005         memory_install_write_handler(machine, 0, ADDRESS_SPACE_PROGRAM, memmap[block_index+8].start, memmap[block_index+8].end, 0, 0, STATIC_NOP);
2014         memory_set_bankptr(machine, block_index + 9,offset);
2015         memory_install_write_handler(space, memmap[block_index+8].start, memmap[block_index+8].end, 0, 0, STATIC_NOP);
20062016      }
20072017   }
20082018}
r3692r3693
22782288      { 0xfe00, 0xfeff }
22792289   };
22802290
2291   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
22812292   int i, offset, writebank;
22822293   UINT8 *readbank;
22832294
r3692r3693
22982309      }
22992310
23002311      /* set up the banks */
2301      memory_set_bankptr(i + 1, readbank);
2302      memory_install_write_handler(machine, 0, ADDRESS_SPACE_PROGRAM, bank_info[i].start, bank_info[i].end, 0, 0, writebank);
2312      memory_set_bankptr(machine, i + 1, readbank);
2313      memory_install_write_handler(space, bank_info[i].start, bank_info[i].end, 0, 0, writebank);
23032314
23042315      if (LOG_MMU)
23052316      {
r3692r3693
23302341   if ((offset >> 3) == (coco3_gimereg[1] & 1))
23312342   {
23322343      offset &= 7;
2333      coco3_mmu_update(machine, offset, (offset == 7) ? 8 : offset);
2344      coco3_mmu_update(space->machine, offset, (offset == 7) ? 8 : offset);
23342345   }
23352346}
23362347
r3692r3693
23492360      result = gime_irq;
23502361      if (result) {
23512362         gime_irq = 0;
2352         coco3_recalc_irq(machine);
2363         coco3_recalc_irq(space->machine);
23532364      }
23542365      break;
23552366
r3692r3693
23572368      result = gime_firq;
23582369      if (result) {
23592370         gime_firq = 0;
2360         coco3_recalc_firq(machine);
2371         coco3_recalc_firq(space->machine);
23612372      }
23622373      break;
23632374
r3692r3693
24002411         *        Bit 1 MC1 ROM map control
24012412         *        Bit 0 MC0 ROM map control
24022413         */
2403         coco3_mmu_update(machine, 0, 8);
2414         coco3_mmu_update(space->machine, 0, 8);
24042415         break;
24052416
24062417      case 1:
r3692r3693
24142425         *        Bit 1 Unused
24152426         *        Bit 0 TR Task register select
24162427         */
2417         coco3_mmu_update(machine, 0, 8);
2428         coco3_mmu_update(space->machine, 0, 8);
24182429         coco3_timer_reset();
24192430         break;
24202431
r3692r3693
26202631READ8_HANDLER(coco3_cartridge_r)
26212632{
26222633   /* this behavior is documented in Super Extended Basic Unravelled, page 14 */
2623   return ((coco3_gimereg[0] & 0x04) || (offset >= 0x10)) ? coco_cartridge_r(machine, offset) : 0;
2634   return ((coco3_gimereg[0] & 0x04) || (offset >= 0x10)) ? coco_cartridge_r(space, offset) : 0;
26242635}
26252636
26262637
r3692r3693
26342645{
26352646   /* this behavior is documented in Super Extended Basic Unravelled, page 14 */
26362647   if ((coco3_gimereg[0] & 0x04) || (offset >= 0x10))
2637      coco_cartridge_w(machine, offset, data);
2648      coco_cartridge_w(space, offset, data);
26382649}
26392650
26402651
r3692r3693
26452656
26462657static void coco_cart_timer_w(running_machine *machine, int data)
26472658{
2648   pia_1_cb1_w(machine, 0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2659   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
26492660
2661   pia_1_cb1_w(space, 0, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2662
26502663   /* special code for Q state */
26512664   if ((data == 0x02) || (data == 0x03) || (data == 0x04))
26522665      timer_adjust_oneshot(cart_timer, ATTOTIME_IN_USEC(0), data + 1);
r3692r3693
26872700static TIMER_CALLBACK(halt_timer_proc)
26882701{
26892702   int data = param;
2690   cpunum_set_input_line(machine, 0, INPUT_LINE_HALT, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2703   cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
26912704}
26922705
26932706
r3692r3693
26992712static TIMER_CALLBACK(nmi_timer_proc)
27002713{
27012714   int data = param;
2702   cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
2715   cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, (data & 0x01) ? ASSERT_LINE : CLEAR_LINE);
27032716}
27042717
27052718
r3692r3693
27952808
27962809WRITE8_HANDLER(coco_pia_1_w)
27972810{
2798   pia_1_w(machine, offset, data);
2811   pia_1_w(space, offset, data);
27992812   twiddle_cart_line_if_q();
28002813}
28012814
r3692r3693
28932906   coco_cart = cococart_init(machine, cart_hardware, &cart_config);
28942907
28952908#ifdef MAME_DEBUG
2896   cpuintrf_set_dasm_override(0, coco_dasm_override);
2909   cpu_set_dasm_override(machine->cpu[0], coco_dasm_override);
28972910#endif
28982911
28992912   state_save_register_global(mux_sel1);
r3692r3693
32943307};
32953308
32963309
3297static offs_t coco_dasm_override(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
3310static offs_t coco_dasm_override(const device_config *device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
32983311{
32993312   unsigned call;
33003313   unsigned result = 0;
src/mess/machine/6883sam.c
r3692r3693
135135   add_reset_callback(machine, sam_reset);
136136
137137   /* save state registration */
138   state_save_register_item("6883sam", 0, sam.state);
139   state_save_register_item("6883sam", 0, sam.video_position);
138   state_save_register_item("6883sam", NULL, 0, sam.state);
139   state_save_register_item("6883sam", NULL, 0, sam.video_position);
140140   state_save_register_postload(machine, update_sam_postload, NULL);
141141}
142142
src/mess/machine/ds1315.c
r3692r3693
4444         /* entire pattern matched */
4545         ds1315_count = 0;
4646         ds1315_mode = ds_calendar_io;
47         ds1315_fill_raw_data(machine);
47         ds1315_fill_raw_data(space->machine);
4848      }
4949
5050      return 0;
src/mess/mess.mak
r3692r3693
390390   $(MESSOBJ)/cbm.a \
391391   $(MESSOBJ)/cbmshare.a \
392392   $(MESSOBJ)/cgenie.a \
393   $(MESSOBJ)/coco.a \
393394   $(MESSOBJ)/coleco.a \
394395   $(MESSOBJ)/compis.a \
395396   $(MESSOBJ)/comx.a \
r3692r3693
483484   $(MESSOBJ)/vtech.a \
484485   $(MESSOBJ)/shared.a \
485486
486#   $(MESSOBJ)/coco.a \
487487#   $(MESSOBJ)/dgn_beta.a \
488488#   $(MESSOBJ)/mk1.a \
489489
src/mess/devices/coco_fdc.c
r3692r3693
284284static UINT8 fdc_coco_r(coco_cartridge *cartridge, UINT16 addr)
285285{
286286   running_machine *machine = Machine;
287   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
287288   UINT8 result = 0;
288289   switch(addr & 0xEF)
289290   {
290291      case 8:
291         result = wd17xx_status_r(machine, 0);
292         result = wd17xx_status_r(space, 0);
292293         break;
293294      case 9:
294         result = wd17xx_track_r(machine, 0);
295         result = wd17xx_track_r(space, 0);
295296         break;
296297      case 10:
297         result = wd17xx_sector_r(machine, 0);
298         result = wd17xx_sector_r(space, 0);
298299         break;
299300      case 11:
300         result = wd17xx_data_r(machine, 0);
301         result = wd17xx_data_r(space, 0);
301302         break;
302303   }
303304   return result;
r3692r3693
312313static void fdc_coco_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
313314{
314315   running_machine *machine = Machine;
316   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
315317   switch(addr & 0xEF)
316318   {
317319      case 0: case 1: case 2: case 3:
r3692r3693
319321         fdc_coco_dskreg_w(cartridge, data);
320322         break;
321323      case 8:
322         wd17xx_command_w(machine, 0, data);
324         wd17xx_command_w(space, 0, data);
323325         break;
324326      case 9:
325         wd17xx_track_w(machine, 0, data);
327         wd17xx_track_w(space, 0, data);
326328         break;
327329      case 10:
328         wd17xx_sector_w(machine, 0, data);
330         wd17xx_sector_w(space, 0, data);
329331         break;
330332      case 11:
331         wd17xx_data_w(machine, 0, data);
333         wd17xx_data_w(space, 0, data);
332334         break;
333335   };
334336}
r3692r3693
392394{
393395   const device_config *dev;
394396   running_machine *machine = Machine;
397   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
395398   UINT8 result = fdc_coco_r(cartridge, addr);
396399
397400   switch(addr)
r3692r3693
406409
407410      case 0x38:   /* FF78 */
408411         if (real_time_clock() == RTC_CLOUD9)
409            ds1315_r_0(machine, addr);
412            ds1315_r_0(space, addr);
410413         break;
411414
412415      case 0x39:   /* FF79 */
413416         if (real_time_clock() == RTC_CLOUD9)
414            ds1315_r_1(machine, addr);
417            ds1315_r_1(space, addr);
415418         break;
416419
417420      case 0x3C:   /* FF7C */
418421         if (real_time_clock() == RTC_CLOUD9)
419            result = ds1315_r_data(machine, addr);
422            result = ds1315_r_data(space, addr);
420423         break;
421424
422425      case 0x40:
r3692r3693
577580static UINT8 fdc_dragon_r(coco_cartridge *cartridge, UINT16 addr)
578581{
579582   running_machine *machine = Machine;
583   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
580584   UINT8 result = 0;
581585   switch(addr & 0xEF)
582586   {
583587      case 0:
584         result = wd17xx_status_r(machine, 0);
588         result = wd17xx_status_r(space, 0);
585589         break;
586590      case 1:
587         result = wd17xx_track_r(machine, 0);
591         result = wd17xx_track_r(space, 0);
588592         break;
589593      case 2:
590         result = wd17xx_sector_r(machine, 0);
594         result = wd17xx_sector_r(space, 0);
591595         break;
592596      case 3:
593         result = wd17xx_data_r(machine, 0);
597         result = wd17xx_data_r(space, 0);
594598         break;
595599   }
596600   return result;
r3692r3693
605609static void fdc_dragon_w(coco_cartridge *cartridge, UINT16 addr, UINT8 data)
606610{
607611   running_machine *machine = Machine;
612   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
608613   switch(addr & 0xEF)
609614   {
610615      case 0:
611         wd17xx_command_w(machine, 0, data);
616         wd17xx_command_w(space, 0, data);
612617
613618         /* disk head is encoded in the command byte */
614619         /* Only for type 3 & 4 commands */
r3692r3693
616621            wd17xx_set_side((data & 0x02) ? 1 : 0);
617622         break;
618623      case 1:
619         wd17xx_track_w(machine, 0, data);
624         wd17xx_track_w(space, 0, data);
620625         break;
621626      case 2:
622         wd17xx_sector_w(machine, 0, data);
627         wd17xx_sector_w(space, 0, data);
623628         break;
624629      case 3:
625         wd17xx_data_w(machine, 0, data);
630         wd17xx_data_w(space, 0, data);
626631         break;
627632      case 8: case 9: case 10: case 11:
628633      case 12: case 13: case 14: case 15:

Previous 15994 Revisions Next


© 1998-2018 The MESS Team