Previous 15994 Revisions Next

r3670 Thursday 27th November, 2008 at 18:37:49 UTC by Wilbert Pol
Re-enabled cgenie.a
[src/mess]mess.mak
[src/mess/audio]cgenie.c
[src/mess/machine]cgenie.c

src/mess/audio/cgenie.c
r3669r3670
1818
1919READ8_HANDLER( cgenie_sh_data_port_r )
2020{
21   return ay8910_read_port_0_r(machine, offset);
21   return ay8910_read_port_0_r(space, offset);
2222}
2323
2424WRITE8_HANDLER( cgenie_sh_control_port_w )
2525{
2626   control_port = data;
27   ay8910_control_port_0_w(machine, offset, data);
27   ay8910_control_port_0_w(space, offset, data);
2828}
2929
3030WRITE8_HANDLER( cgenie_sh_data_port_w )
3131{
32   ay8910_write_port_0_w(machine, offset, data);
32   ay8910_write_port_0_w(space, offset, data);
3333}
3434
src/mess/machine/cgenie.c
r3669r3670
1919
2020
2121#define AYWriteReg(chip,port,value) \
22   ay8910_control_port_0_w(machine, 0,port);  \
23   ay8910_write_port_0_w(machine, 0,value)
22   ay8910_control_port_0_w(space, 0,port);  \
23   ay8910_write_port_0_w(space, 0,value)
2424
2525#define TAPE_HEADER "Colour Genie - Virtual Tape File"
2626
r3669r3670
9797
9898MACHINE_RESET( cgenie )
9999{
100   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
100101   UINT8 *ROM = memory_region(machine, "main");
101102
102103   /* reset the AY8910 to be quiet, since the cgenie BIOS doesn't */
r3669r3670
132133   {
133134      if ( input_port_read(machine, "DSW0") & 0x80 )
134135      {
135         memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_BANK10);
136         memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
136         memory_install_read8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_BANK10);
137         memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_NOP);
137138         memory_set_bankptr(machine, 10, &ROM[0x0c000]);
138139         logerror("cgenie DOS enabled\n");
139140         memcpy(&ROM[0x0c000],&ROM[0x10000], 0x2000);
140141      }
141142      else
142143      {
143         memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
144         memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
144         memory_install_read8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_NOP);
145         memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_NOP);
145146         logerror("cgenie DOS disabled (no floppy image given)\n");
146147      }
147148   }
148149   else
149150   {
150      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
151      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc000, 0xdfff, 0, 0, SMH_NOP);
151      memory_install_read8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_NOP);
152      memory_install_write8_handler(space, 0xc000, 0xdfff, 0, 0, SMH_NOP);
152153      logerror("cgenie DOS disabled\n");
153154      memset(&memory_region(machine, "main")[0x0c000], 0x00, 0x2000);
154155   }
r3669r3670
156157   /* copy EXT ROM, if enabled or wipe out that memory area */
157158   if( input_port_read(machine, "DSW0") & 0x20 )
158159   {
159      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM);
160      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_ROM);
160      memory_install_read8_handler(space, 0xe000, 0xefff, 0, 0, SMH_ROM);
161      memory_install_write8_handler(space, 0xe000, 0xefff, 0, 0, SMH_ROM);
161162      logerror("cgenie EXT enabled\n");
162163      memcpy(&memory_region(machine, "main")[0x0e000],
163164            &memory_region(machine, "main")[0x12000], 0x1000);
164165   }
165166   else
166167   {
167      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_NOP);
168      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe000, 0xefff, 0, 0, SMH_NOP);
168      memory_install_read8_handler(space, 0xe000, 0xefff, 0, 0, SMH_NOP);
169      memory_install_write8_handler(space, 0xe000, 0xefff, 0, 0, SMH_NOP);
169170      logerror("cgenie EXT disabled\n");
170171      memset(&memory_region(machine, "main")[0x0e000], 0x00, 0x1000);
171172   }
r3669r3670
177178
178179MACHINE_START( cgenie )
179180{
181   const address_space *space = cpu_get_address_space( machine->cpu[0], ADDRESS_SPACE_PROGRAM );
180182   UINT8 *gfx = memory_region(machine, "gfx2");
181183   int i;
182184
r3669r3670
197199      memset(gfx + i * 8, i, 8);
198200
199201   /* set up RAM */
200   memory_install_read8_handler(machine, 0,  ADDRESS_SPACE_PROGRAM, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, SMH_BANK1);
201   memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, cgenie_videoram_w);
202   memory_install_read8_handler(space, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, SMH_BANK1);
203   memory_install_write8_handler(space, 0x4000, 0x4000 + mess_ram_size - 1, 0, 0, cgenie_videoram_w);
202204   videoram = mess_ram;
203205   memory_set_bankptr(machine, 1, mess_ram);
204206
r3669r3670
324326{
325327   int port_ff_changed = port_ff ^ data;
326328
327   cassette_output ( device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), data & 0x01 ? -1.0 : 1.0 );
329   cassette_output ( device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), data & 0x01 ? -1.0 : 1.0 );
328330
329331   /* background bits changed ? */
330332   if( port_ff_changed & FF_BGD )
r3669r3670
372374            b = 15;
373375         }
374376      }
375      palette_set_color_rgb(machine, 0, r, g, b);
377      palette_set_color_rgb(space->machine, 0, r, g, b);
376378   }
377379
378380   /* character mode changed ? */
r3669r3670
429431      /* comparator value */
430432      psg_b_inp = 0x00;
431433
432      if( input_port_read(machine, "JOY0") > psg_a_out )
434      if( input_port_read(space->machine, "JOY0") > psg_a_out )
433435         psg_b_inp |= 0x80;
434436
435      if( input_port_read(machine, "JOY1") > psg_a_out )
437      if( input_port_read(space->machine, "JOY1") > psg_a_out )
436438         psg_b_inp |= 0x40;
437439
438      if( input_port_read(machine, "JOY2") > psg_a_out )
440      if( input_port_read(space->machine, "JOY2") > psg_a_out )
439441         psg_b_inp |= 0x20;
440442
441      if( input_port_read(machine, "JOY3") > psg_a_out )
443      if( input_port_read(space->machine, "JOY3") > psg_a_out )
442444         psg_b_inp |= 0x10;
443445   }
444446   else
r3669r3670
447449      psg_b_inp = 0xFF;
448450
449451      if( !(psg_a_out & 0x01) )
450         psg_b_inp &= ~input_port_read(machine, "KP0");
452         psg_b_inp &= ~input_port_read(space->machine, "KP0");
451453
452454      if( !(psg_a_out & 0x02) )
453         psg_b_inp &= ~input_port_read(machine, "KP1");
455         psg_b_inp &= ~input_port_read(space->machine, "KP1");
454456
455457      if( !(psg_a_out & 0x04) )
456         psg_b_inp &= ~input_port_read(machine, "KP2");
458         psg_b_inp &= ~input_port_read(space->machine, "KP2");
457459
458460      if( !(psg_a_out & 0x08) )
459         psg_b_inp &= ~input_port_read(machine, "KP3");
461         psg_b_inp &= ~input_port_read(space->machine, "KP3");
460462
461463      if( !(psg_a_out & 0x10) )
462         psg_b_inp &= ~input_port_read(machine, "KP4");
464         psg_b_inp &= ~input_port_read(space->machine, "KP4");
463465
464466      if( !(psg_a_out & 0x20) )
465         psg_b_inp &= ~input_port_read(machine, "KP5");
467         psg_b_inp &= ~input_port_read(space->machine, "KP5");
466468   }
467469   return psg_b_inp;
468470}
r3669r3670
480482 READ8_HANDLER( cgenie_status_r )
481483{
482484   /* If the floppy isn't emulated, return 0 */
483   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
485   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
484486      return 0;
485   return wd17xx_status_r(machine, offset);
487   return wd17xx_status_r(space, offset);
486488}
487489
488490 READ8_HANDLER( cgenie_track_r )
489491{
490492   /* If the floppy isn't emulated, return 0xff */
491   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
493   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
492494      return 0xff;
493   return wd17xx_track_r(machine, offset);
495   return wd17xx_track_r(space, offset);
494496}
495497
496498 READ8_HANDLER( cgenie_sector_r )
497499{
498500   /* If the floppy isn't emulated, return 0xff */
499   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
501   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
500502      return 0xff;
501   return wd17xx_sector_r(machine, offset);
503   return wd17xx_sector_r(space, offset);
502504}
503505
504506 READ8_HANDLER(cgenie_data_r )
505507{
506508   /* If the floppy isn't emulated, return 0xff */
507   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
509   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
508510      return 0xff;
509   return wd17xx_data_r(machine, offset);
511   return wd17xx_data_r(space, offset);
510512}
511513
512514WRITE8_HANDLER( cgenie_command_w )
513515{
514516   /* If the floppy isn't emulated, return immediately */
515   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
517   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
516518      return;
517   wd17xx_command_w(machine, offset, data);
519   wd17xx_command_w(space, offset, data);
518520}
519521
520522WRITE8_HANDLER( cgenie_track_w )
521523{
522524   /* If the floppy isn't emulated, ignore the write */
523   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
525   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
524526      return;
525   wd17xx_track_w(machine, offset, data);
527   wd17xx_track_w(space, offset, data);
526528}
527529
528530WRITE8_HANDLER( cgenie_sector_w )
529531{
530532   /* If the floppy isn't emulated, ignore the write */
531   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
533   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
532534      return;
533   wd17xx_sector_w(machine, offset, data);
535   wd17xx_sector_w(space, offset, data);
534536}
535537
536538WRITE8_HANDLER( cgenie_data_w )
537539{
538540   /* If the floppy isn't emulated, ignore the write */
539   if( (input_port_read(machine, "DSW0") & 0x80) == 0 )
541   if( (input_port_read(space->machine, "DSW0") & 0x80) == 0 )
540542      return;
541   wd17xx_data_w(machine, offset, data);
543   wd17xx_data_w(space, offset, data);
542544}
543545
544546 READ8_HANDLER( cgenie_irq_status_r )
r3669r3670
554556   if( (irq_status & IRQ_TIMER) == 0 )
555557   {
556558      irq_status |= IRQ_TIMER;
557      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
559      cpu_set_input_line(device->machine->cpu[0], 0, HOLD_LINE);
558560   }
559561}
560562
561static INTERRUPT_GEN( cgenie_fdc_interrupt )
562{
563   if( (irq_status & IRQ_FDC) == 0 )
564   {
565      irq_status |= IRQ_FDC;
566      cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
567   }
568}
569
570563void cgenie_fdc_callback(running_machine *machine, wd17xx_state_t event, void *param)
571564{
572565   /* if disc hardware is not enabled, do not cause an int */
r3669r3670
579572         irq_status &= ~IRQ_FDC;
580573         break;
581574      case WD17XX_IRQ_SET:
582         cgenie_fdc_interrupt(machine, 0);
575         if( (irq_status & IRQ_FDC) == 0 )
576         {
577            irq_status |= IRQ_FDC;
578            cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE);
579         }
583580         break;
584581      case WD17XX_DRQ_CLR:
585582      case WD17XX_DRQ_SET:
r3669r3670
624621   int result = 0;
625622
626623   if( offset & 0x01 )
627      result |= input_port_read(machine, "ROW0");
624      result |= input_port_read(space->machine, "ROW0");
628625
629626   if( offset & 0x02 )
630      result |= input_port_read(machine, "ROW1");
627      result |= input_port_read(space->machine, "ROW1");
631628
632629   if( offset & 0x04 )
633      result |= input_port_read(machine, "ROW2");
630      result |= input_port_read(space->machine, "ROW2");
634631
635632   if( offset & 0x08 )
636      result |= input_port_read(machine, "ROW3");
633      result |= input_port_read(space->machine, "ROW3");
637634
638635   if( offset & 0x10 )
639      result |= input_port_read(machine, "ROW4");
636      result |= input_port_read(space->machine, "ROW4");
640637
641638   if( offset & 0x20 )
642      result |= input_port_read(machine, "ROW5");
639      result |= input_port_read(space->machine, "ROW5");
643640
644641   if( offset & 0x40 )
645      result |= input_port_read(machine, "ROW6");
642      result |= input_port_read(space->machine, "ROW6");
646643
647644   if( offset & 0x80 )
648      result |= input_port_read(machine, "ROW7");
645      result |= input_port_read(space->machine, "ROW7");
649646
650647   return result;
651648}
r3669r3670
702699   cgenie_fontram[offset] = data;
703700
704701   /* convert eight pixels */
705   dp = &machine->gfx[0]->gfxdata[(256 * 8 + offset) * machine->gfx[0]->width];
702   dp = &space->machine->gfx[0]->gfxdata[(256 * 8 + offset) * space->machine->gfx[0]->width];
706703   dp[0] = (data & 0x80) ? 1 : 0;
707704   dp[1] = (data & 0x40) ? 1 : 0;
708705   dp[2] = (data & 0x20) ? 1 : 0;
r3669r3670
721718
722719INTERRUPT_GEN( cgenie_frame_interrupt )
723720{
724   if( cgenie_tv_mode != (input_port_read(machine, "DSW0") & 0x10) )
721   if( cgenie_tv_mode != (input_port_read(device->machine, "DSW0") & 0x10) )
725722   {
726      cgenie_tv_mode = input_port_read(machine, "DSW0") & 0x10;
723      cgenie_tv_mode = input_port_read(device->machine, "DSW0") & 0x10;
727724      /* force setting of background color */
728725      port_ff ^= FF_BGD0;
729      cgenie_port_ff_w(machine, 0, port_ff ^ FF_BGD0);
726      cgenie_port_ff_w(cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0, port_ff ^ FF_BGD0);
730727   }
731728}
src/mess/mess.mak
r3669r3670
388388   $(MESSOBJ)/bondwell.a \
389389   $(MESSOBJ)/cbm.a \
390390   $(MESSOBJ)/cbmshare.a \
391   $(MESSOBJ)/cgenie.a \
391392   $(MESSOBJ)/coleco.a \
392393   $(MESSOBJ)/comx.a \
393394   $(MESSOBJ)/dai.a \
r3669r3670
452453   $(MESSOBJ)/shared.a \
453454
454455#   $(MESSOBJ)/atari.a \
455#   $(MESSOBJ)/cgenie.a \
456456#   $(MESSOBJ)/coco.a \
457457#   $(MESSOBJ)/compis.a \
458458#   $(MESSOBJ)/concept.a \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team