Previous 15994 Revisions Next

r8801 Thursday 19th August, 2010 at 01:37:26 UTC by Angelo Salese
[A310]: Updated to latest source tree
[src/mame/includes]archimds.h
[src/mame/machine]archimds.c
[src/mame/video]archimds.c
[src/mess/drivers]a310.c

src/mame/machine/archimds.c
r8800r8801
4242static UINT32 memc_pagesize;
4343static int memc_latchrom;
4444static UINT32 ioc_timercnt[4], ioc_timerout[4];
45static UINT32 vidc_vidstart, vidc_vidend, vidc_vidinit;
45static UINT32 vidc_vidstart, vidc_vidend, vidc_vidinit,vidc_vidcur;
4646static UINT32 vidc_sndstart, vidc_sndend, vidc_sndcur;
4747static UINT8 video_dma_on;
4848UINT8 i2c_clk;
r8800r8801
5050UINT32 vidc_regs[256];
5151UINT8 ioc_regs[0x80/4];
5252UINT8 vidc_bpp_mode;
53UINT8 vidc_interlace;
5354
54static emu_timer *timer[4], *snd_timer;
55static emu_timer *timer[4], *snd_timer, *vid_timer;
5556emu_timer  *vbl_timer;
5657
5758void archimedes_request_irq_a(running_machine *machine, int mask)
r8800r8801
105106
106107   // set up for next vbl
107108   timer_adjust_oneshot(vbl_timer, machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
109}
108110
109   /* TODO: timing of this isn't currently handled */
111/* at about every ~4/4 USEC do a DMA transfer byte */
112static TIMER_CALLBACK( vidc_video_tick )
113{
114   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
115   static UINT8 *vram = memory_region(machine,"vram");
116
117   vram[vidc_vidcur] = (memory_read_byte(space,vidc_vidstart+vidc_vidcur));
118
119   vidc_vidcur++;
120
110121   if(video_dma_on)
111122   {
112      const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
113      static UINT8 *vram = memory_region(machine,"vram");
114      int i;
123      if (vidc_vidcur >= vidc_vidend)
124         vidc_vidcur = 0;
115125
116      for(i=0;i<(vidc_vidend-vidc_vidstart);i++)
117         vram[i] = (memory_read_byte(space,vidc_vidstart+i));
126      timer_adjust_oneshot(vid_timer, ATTOTIME_IN_USEC(1), 0);
118127   }
128   else
129      timer_adjust_oneshot(vid_timer, attotime_never, 0);
119130}
120131
121static TIMER_CALLBACK( a310_audio_tick )
132static TIMER_CALLBACK( vidc_audio_tick )
122133{
123134   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
124135
r8800r8801
129140   if (vidc_sndcur >= vidc_sndend)
130141   {
131142      archimedes_request_irq_b(machine, ARCHIMEDES_IRQB_SOUND_EMPTY);
143
144      /* TODO */
132145      timer_adjust_oneshot(snd_timer, attotime_never, 0);
133146      dac_signed_data_w(space->machine->device("dac"), 0x80);
134147   }
r8800r8801
180193   ioc_regs[IRQ_STATUS_A] = 0x10 | 0x80; //set up POR (Power On Reset) and Force IRQ at start-up
181194   ioc_regs[IRQ_STATUS_B] = 0x02; //set up IL[1] On
182195   ioc_regs[FIQ_STATUS] = 0x80;   //set up Force FIQ
183
184   /* Aristocrat MK-5 tests this inside the CPU check routine *without* firing a latch command in the POST, could be open bus, fixed value or undefined behaviour,
185      almost surely something checked as an anti-cheat measure */
186   ioc_timerout[1] = 0xf5;
187196}
188197
189198void archimedes_init(running_machine *machine)
r8800r8801
202211   timer_adjust_oneshot(timer[2], attotime_never, 0);
203212   timer_adjust_oneshot(timer[3], attotime_never, 0);
204213
205   snd_timer = timer_alloc(machine, a310_audio_tick, NULL);
214   vid_timer = timer_alloc(machine, vidc_video_tick, NULL);
215   snd_timer = timer_alloc(machine, vidc_audio_tick, NULL);
206216   timer_adjust_oneshot(snd_timer, attotime_never, 0);
207217}
208218
r8800r8801
346356   ioc_timerout[tmr] = ioc_timercnt[tmr] - (UINT32)time;
347357}
348358
349READ32_HANDLER(archimedes_ioc_r)
359/* TODO: should be a 8-bit handler */
360static READ32_HANDLER( ioc_ctrl_r )
350361{
351   #ifdef MESS
352   running_device *fdc = (running_device *)space->machine->device("wd1772");
353   #endif
354   if (offset*4 >= 0x200000 && offset*4 < 0x300000)
362   //if(((offset & 0x1f) != 16) && ((offset & 0x1f) != 17) && ((offset & 0x1f) != 24) && ((offset & 0x1f) != 25))
363   //logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
364
365   switch (offset & 0x1f)
355366   {
356      if(((offset & 0x1f) != 16) && ((offset & 0x1f) != 17) && ((offset & 0x1f) != 24) && ((offset & 0x1f) != 25))
357      logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
358
359      switch (offset & 0x1f)
367      case CONTROL:
360368      {
361         case CONTROL:
362         {
363            UINT8 i2c_data;
369         UINT8 i2c_data;
364370
365            i2c_data = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1);
371         i2c_data = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1);
366372
367            return (ioc_regs[CONTROL] & 0xfc) | (i2c_clk<<1) | i2c_data;
368         }
373         return (ioc_regs[CONTROL] & 0xfc) | (i2c_clk<<1) | i2c_data;
374      }
369375
370         case 1:   // keyboard read
371            archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
372            break;
376      case 1:   // keyboard read
377         archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
378         break;
373379
374         case IRQ_STATUS_A:
375            return (ioc_regs[IRQ_STATUS_A] & 0x7f) | 0x80; // Force IRQ is always '1'
380      case IRQ_STATUS_A:
381         return (ioc_regs[IRQ_STATUS_A] & 0x7f) | 0x80; // Force IRQ is always '1'
376382
377         case IRQ_REQUEST_A:
378            return (ioc_regs[IRQ_STATUS_A] & ioc_regs[IRQ_MASK_A]);
383      case IRQ_REQUEST_A:
384         return (ioc_regs[IRQ_STATUS_A] & ioc_regs[IRQ_MASK_A]);
379385
380         case IRQ_MASK_A:
381            return (ioc_regs[IRQ_MASK_A]);
386      case IRQ_MASK_A:
387         return (ioc_regs[IRQ_MASK_A]);
382388
383         case IRQ_STATUS_B:
384            return (ioc_regs[IRQ_STATUS_B]);
389      case IRQ_STATUS_B:
390         return (ioc_regs[IRQ_STATUS_B]);
385391
386         case IRQ_REQUEST_B:
387            return (ioc_regs[IRQ_STATUS_B] & ioc_regs[IRQ_MASK_B]);
392      case IRQ_REQUEST_B:
393         return (ioc_regs[IRQ_STATUS_B] & ioc_regs[IRQ_MASK_B]);
388394
389         case IRQ_MASK_B:
390            return (ioc_regs[IRQ_MASK_B]);
395      case IRQ_MASK_B:
396         return (ioc_regs[IRQ_MASK_B]);
391397
392         case FIQ_STATUS:
393            return (ioc_regs[FIQ_STATUS] & 0x7f) | 0x80; // Force FIQ is always '1'
398      case FIQ_STATUS:
399         return (ioc_regs[FIQ_STATUS] & 0x7f) | 0x80; // Force FIQ is always '1'
394400
395         case FIQ_REQUEST:
396            return (ioc_regs[FIQ_STATUS] & ioc_regs[FIQ_MASK]);
401      case FIQ_REQUEST:
402         return (ioc_regs[FIQ_STATUS] & ioc_regs[FIQ_MASK]);
397403
398         case FIQ_MASK:
399            return (ioc_regs[FIQ_MASK]);
404      case FIQ_MASK:
405         return (ioc_regs[FIQ_MASK]);
400406
401         case 16:   // timer 0 read
402            return ioc_timerout[0]&0xff;
403         case 17:
404            return (ioc_timerout[0]>>8)&0xff;
405         case 20:   // timer 1 read
406            return ioc_timerout[1]&0xff;
407         case 21:
408            return (ioc_timerout[1]>>8)&0xff;
409         case 24:   // timer 2 read
410            return ioc_timerout[2]&0xff;
411         case 25:
412            return (ioc_timerout[2]>>8)&0xff;
413         case 28:   // timer 3 read
414            return ioc_timerout[3]&0xff;
415         case 29:
416            return (ioc_timerout[3]>>8)&0xff;
417      }
418
419      return ioc_regs[offset&0x1f];
407      case 16:   // timer 0 read
408         return ioc_timerout[0]&0xff;
409      case 17:
410         return (ioc_timerout[0]>>8)&0xff;
411      case 20:   // timer 1 read
412         return ioc_timerout[1]&0xff;
413      case 21:
414         return (ioc_timerout[1]>>8)&0xff;
415      case 24:   // timer 2 read
416         return ioc_timerout[2]&0xff;
417      case 25:
418         return (ioc_timerout[2]>>8)&0xff;
419      case 28:   // timer 3 read
420         return ioc_timerout[3]&0xff;
421      case 29:
422         return (ioc_timerout[3]>>8)&0xff;
420423   }
421   #ifdef MESS
422   else if (offset*4 >= 0x310000 && offset*4 < 0x310040)
423   {
424      logerror("17XX: R @ addr %x mask %08x\n", offset*4, mem_mask);
425      return wd17xx_data_r(fdc, offset&0xf);
426   }
427   #endif
428   else
429   {
430      logerror("IOC: R @ %x (mask %08x)\n", (offset*4)+0x3000000, mem_mask);
431   }
432424
433
434   return 0;
425   return ioc_regs[offset&0x1f];
435426}
436427
437WRITE32_HANDLER(archimedes_ioc_w)
428/* TODO: should be a 8-bit handler */
429static WRITE32_HANDLER( ioc_ctrl_w )
438430{
439   #ifdef MESS
440   running_device *fdc = (running_device *)space->machine->device("wd1772");
441   #endif
431   if(((offset & 0x1f) != 16) && ((offset & 0x1f) != 17) && ((offset & 0x1f) != 24) && ((offset & 0x1f) != 25))
432        if((offset & 0x1f) != 1)
433           logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
442434
443   if (offset*4 >= 0x200000 && offset*4 < 0x300000)
435   switch (offset&0x1f)
444436   {
445      if(((offset & 0x1f) != 16) && ((offset & 0x1f) != 17) && ((offset & 0x1f) != 24) && ((offset & 0x1f) != 25))
446        logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
437      case 0:   // I2C bus control
438         //logerror("IOC I2C: CLK %d DAT %d\n", (data>>1)&1, data&1);
439         i2cmem_sda_write(space->machine->device("i2cmem"), data & 0x01);
440         i2cmem_scl_write(space->machine->device("i2cmem"), (data & 0x02) >> 1);
441         i2c_clk = (data & 2) >> 1;
442         break;
447443
448      switch (offset&0x1f)
449      {
450         case 0:   // I2C bus control
451            //logerror("IOC I2C: CLK %d DAT %d\n", (data>>1)&1, data&1);
452            i2cmem_sda_write(space->machine->device("i2cmem"), data & 0x01);
453            i2cmem_scl_write(space->machine->device("i2cmem"), (data & 0x02) >> 1);
454            i2c_clk = (data & 2) >> 1;
455            break;
444      case 1:
445         #if 0
446         if(data == 0x0d)
447            printf("\n");
448         else
449            printf("%c",data);
450         #endif
451         break;
456452
457         case IRQ_MASK_A:
458            ioc_regs[IRQ_MASK_A] = data & 0xff;
453      case IRQ_MASK_A:
454         ioc_regs[IRQ_MASK_A] = data & 0xff;
459455
460            if(data & 0x80) //force an IRQ
461               archimedes_request_irq_a(space->machine,ARCHIMEDES_IRQA_FORCE);
456         if(data & 0x80) //force an IRQ
457            archimedes_request_irq_a(space->machine,ARCHIMEDES_IRQA_FORCE);
462458
463            break;
459         break;
464460
465         case FIQ_MASK:
466            ioc_regs[FIQ_MASK] = data & 0xff;
461      case FIQ_MASK:
462         ioc_regs[FIQ_MASK] = data & 0xff;
467463
468            if(data & 0x80) //force a FIRQ
469               archimedes_request_fiq(space->machine,ARCHIMEDES_FIQ_FORCE);
464         if(data & 0x80) //force a FIRQ
465            archimedes_request_fiq(space->machine,ARCHIMEDES_FIQ_FORCE);
470466
471            break;
467         break;
472468
473         case 5:    // IRQ clear A
474            ioc_regs[IRQ_STATUS_A] &= ~(data&0xff);
469      case 5:    // IRQ clear A
470         ioc_regs[IRQ_STATUS_A] &= ~(data&0xff);
475471
476            // if that did it, clear the IRQ
477            if (ioc_regs[IRQ_STATUS_A] == 0)
478            {
479               printf("IRQ clear A\n");
480               cputag_set_input_line(space->machine, "maincpu", ARM_IRQ_LINE, CLEAR_LINE);
481            }
482            break;
472         // if that did it, clear the IRQ
473         if (ioc_regs[IRQ_STATUS_A] == 0)
474         {
475            printf("IRQ clear A\n");
476            cputag_set_input_line(space->machine, "maincpu", ARM_IRQ_LINE, CLEAR_LINE);
477         }
478         break;
483479
484         case 16:
485         case 17:
486            ioc_regs[offset&0x1f] = data & 0xff;
487            break;
480      case 16:
481      case 17:
482         ioc_regs[offset&0x1f] = data & 0xff;
483         break;
488484
489         case 20:
490         case 21:
491            ioc_regs[offset&0x1f] = data & 0xff;
492            break;
485      case 20:
486      case 21:
487         ioc_regs[offset&0x1f] = data & 0xff;
488         break;
493489
494         case 24:
495         case 25:
496            ioc_regs[offset&0x1f] = data & 0xff;
497            break;
490      case 24:
491      case 25:
492         ioc_regs[offset&0x1f] = data & 0xff;
493         break;
498494
499         case 28:
500         case 29:
501            ioc_regs[offset&0x1f] = data & 0xff;
502            break;
495      case 28:
496      case 29:
497         ioc_regs[offset&0x1f] = data & 0xff;
498         break;
503499
504         case 19:   // Timer 0 latch
505            latch_timer_cnt(0);
506            break;
500      case 19:   // Timer 0 latch
501         latch_timer_cnt(0);
502         break;
507503
508         case 23:   // Timer 1 latch
509            latch_timer_cnt(1);
510            break;
504      case 23:   // Timer 1 latch
505         latch_timer_cnt(1);
506         break;
511507
512         case 27:   // Timer 2 latch
513            latch_timer_cnt(2);
514            break;
508      case 27:   // Timer 2 latch
509         latch_timer_cnt(2);
510         break;
515511
516         case 31:   // Timer 3 latch
517            latch_timer_cnt(3);
518            break;
512      case 31:   // Timer 3 latch
513         latch_timer_cnt(3);
514         break;
519515
520         case 18:   // Timer 0 start
521            ioc_timercnt[0] = ioc_regs[17]<<8 | ioc_regs[16];
522            a310_set_timer(0);
523            break;
516      case 18:   // Timer 0 start
517         ioc_timercnt[0] = ioc_regs[17]<<8 | ioc_regs[16];
518         a310_set_timer(0);
519         break;
524520
525         case 22:   // Timer 1 start
526            ioc_timercnt[1] = ioc_regs[21]<<8 | ioc_regs[20];
527            a310_set_timer(1);
528            break;
521      case 22:   // Timer 1 start
522         ioc_timercnt[1] = ioc_regs[21]<<8 | ioc_regs[20];
523         a310_set_timer(1);
524         break;
529525
530         case 26:   // Timer 2 start
531            ioc_timercnt[2] = ioc_regs[25]<<8 | ioc_regs[24];
532            a310_set_timer(2);
533            break;
526      case 26:   // Timer 2 start
527         ioc_timercnt[2] = ioc_regs[25]<<8 | ioc_regs[24];
528         a310_set_timer(2);
529         break;
534530
535         case 30:   // Timer 3 start
536            ioc_timercnt[3] = ioc_regs[29]<<8 | ioc_regs[28];
537            a310_set_timer(3);
538            break;
531      case 30:   // Timer 3 start
532         ioc_timercnt[3] = ioc_regs[29]<<8 | ioc_regs[28];
533         a310_set_timer(3);
534         break;
539535
540         default:
541            ioc_regs[offset&0x1f] = data & 0xff;
542            break;
543      }
536      default:
537         ioc_regs[offset&0x1f] = data & 0xff;
538         break;
544539   }
540}
541
542READ32_HANDLER(archimedes_ioc_r)
543{
544   UINT32 ioc_addr;
545545   #ifdef MESS
546   else if (offset*4 >= 0x310000 && offset*4 < 0x310040)
546   running_device *fdc = (running_device *)space->machine->device("wd1772");
547   #endif
548
549   ioc_addr = offset*4;
550
551   switch((ioc_addr & 0x300000) >> 20)
547552   {
548      logerror("17XX: %x to addr %x mask %08x\n", data, offset*4, mem_mask);
549      wd17xx_data_w(fdc, offset&0xf, data&0xff);
550   }
551   else if (offset*4 == 0x350018)
552   {
553      // latch A
554      if (data & 1)
553      /*82c711*/
554      case 0:
555         logerror("82c711 read at address %08x\n",ioc_addr);
556         return 0;
557      case 2:
558      case 3:
555559      {
556         wd17xx_set_drive(fdc,0);
560         switch((ioc_addr & 0x70000) >> 16)
561         {
562            case 0: return ioc_ctrl_r(space,offset,mem_mask);
563            case 1:
564               #ifdef MESS
565                  logerror("17XX: R @ addr %x mask %08x\n", offset*4, mem_mask);
566                  return wd17xx_data_r(fdc, offset&0xf);
567               #else
568                  logerror("Read from FDC device?\n");
569                  return 0;
570               #endif
571            case 2:
572               logerror("IOC: Econet Read %08x\n",ioc_addr);
573               return 0xffff;
574            case 3:
575               logerror("IOC: Serial Read\n");
576               return 0xffff;
577            case 4:
578               logerror("IOC: Internal Podule Read\n");
579               return 0xffff;
580            case 5:
581               logerror("IOC: Internal Latches Read %08x\n",ioc_addr);
582               return 0xffff;
583         }
557584      }
558      if (data & 2)
559      {
560         wd17xx_set_drive(fdc,1);
561      }
562      if (data & 4)
563      {
564         wd17xx_set_drive(fdc,2);
565      }
566      if (data & 8)
567      {
568         wd17xx_set_drive(fdc,3);
569      }
585   }
570586
571      wd17xx_set_side(fdc,(data & 0x10)>>4);
587   logerror("IOC: Unknown read at %08x\n",ioc_addr);
572588
573   }
574   else if (offset*4 == 0x350040)
575   {
576      // latch B
577      wd17xx_dden_w(fdc, BIT(data, 1));
578   }
589   return 0;
590}
591
592WRITE32_HANDLER(archimedes_ioc_w)
593{
594   UINT32 ioc_addr;
595   #ifdef MESS
596   running_device *fdc = (running_device *)space->machine->device("wd1772");
579597   #endif
580   else
598
599   ioc_addr = offset*4;
600
601   switch((ioc_addr & 0x300000) >> 20)
581602   {
582      logerror("I/O: W %x @ %x (mask %08x)\n", data, (offset*4)+0x3000000, mem_mask);
603      /*82c711*/
604      case 0:
605         logerror("82c711 write %08x to address %08x\n",data,ioc_addr);
606         return;
607      case 2:
608      case 3:
609      {
610         switch((ioc_addr & 0x70000) >> 16)
611         {
612            case 0: ioc_ctrl_w(space,offset,data,mem_mask); return;
613            case 1:
614               #ifdef MESS
615                  logerror("17XX: %x to addr %x mask %08x\n", data, offset*4, mem_mask);
616                  wd17xx_data_w(fdc, offset&0xf, data&0xff);
617               #else
618                  logerror("Write to FDC device?\n");
619               #endif
620                  return;
621            case 2:
622               logerror("IOC: Econet Write %02x at %08x\n",data,ioc_addr);
623               return;
624            case 3:
625               logerror("IOC: Serial Write\n");
626               return;
627            case 4:
628               logerror("IOC: Internal Podule Write\n");
629               return;
630            case 5:
631               switch(ioc_addr & 0xfffc)
632               {
633                  #ifdef MESS
634                  case 0x18: // latch B
635                     wd17xx_dden_w(fdc, BIT(data, 1));
636                     return;
637
638                  case 0x40: // latch A
639                     if (data & 1) { wd17xx_set_drive(fdc,0); }
640                     if (data & 2) {   wd17xx_set_drive(fdc,1); }
641                     if (data & 4) { wd17xx_set_drive(fdc,2); }
642                     if (data & 8) {   wd17xx_set_drive(fdc,3); }
643
644                     wd17xx_set_side(fdc,(data & 0x10)>>4);
645                     //bit 5 is motor on
646                     return;
647                  #endif
648               }
649               break;
650         }
651      }
583652   }
653
654
655   logerror("I/O: W %x @ %x (mask %08x)\n", data, (offset*4)+0x3000000, mem_mask);
584656}
585657
586658READ32_HANDLER(archimedes_vidc_r)
r8800r8801
622694   {
623695      int r,g,b;
624696
625      //TODO: 8bpp mode uses a different formula
626697      //i = (val & 0x1000) >> 12; //supremacy bit
627698      b = (val & 0x0f00) >> 8;
628699      g = (val & 0x00f0) >> 4;
r8800r8801
632703         logerror("WARNING: border color write here (PC=%08x)!\n",cpu_get_pc(space->cpu));
633704
634705      palette_set_color_rgb(space->machine, reg >> 2, pal4bit(r), pal4bit(g), pal4bit(b) );
706
707      /* handle 8bpp colors here */
708      {
709         int i;
710
711         for(i=0;i<0x100;i+=0x10)
712         {
713            b = ((val & 0x700) >> 8) | ((i & 0x80) >> 4);
714            g = ((val & 0x030) >> 4) | ((i & 0x20) >> 3) | ((i & 0x40) >> 3);
715            r = ((val & 0x007) >> 0) | ((i & 0x10) >> 1);
716
717            palette_set_color_rgb(space->machine, (reg >> 2) + 0x100 + i, pal4bit(r), pal4bit(g), pal4bit(b) );
718         }
719      }
720
635721   }
636722   else if (reg >= 0x80 && reg <= 0xbc)
637723   {
638724      switch(reg)
639725      {
640         case VIDC_HCR:  vidc_regs[VIDC_HCR] =  (val >> 14)+1;    break;
726         case VIDC_HCR:  vidc_regs[VIDC_HCR] =  ((val >> 14)<<1)+1;    break;
641727//         case VIDC_HSWR: vidc_regs[VIDC_HSWR] = (val >> 14)+1;    break;
642728         case VIDC_HBSR: vidc_regs[VIDC_HBSR] = (val >> 14)+1;    break;
643729         case VIDC_HDSR: vidc_regs[VIDC_HDSR] = (val >> 14);    break;
r8800r8801
646732//         #define VIDC_HCSR      0x98
647733//         #define VIDC_HIR      0x9c
648734
649         case VIDC_VCR:  vidc_regs[VIDC_VCR] = (val >> 14)+1;   break;
735         case VIDC_VCR:  vidc_regs[VIDC_VCR] = ((val >> 14)<<1)+1;   break;
650736//         #define VIDC_VSWR      0xa4
651737         case VIDC_VBSR: vidc_regs[VIDC_VBSR] = (val >> 14)+1;    break;
652738         case VIDC_VDSR: vidc_regs[VIDC_VDSR] = (val >> 14)+1;   break;
r8800r8801
663749
664750      /* sanity checks - first pass */
665751      /*
666         total cycles + border start/end
752         total cycles + border end
667753      */
668      if(vidc_regs[VIDC_HCR] && vidc_regs[VIDC_HBSR] && vidc_regs[VIDC_HBER] &&
669         vidc_regs[VIDC_VCR] && vidc_regs[VIDC_VBSR] && vidc_regs[VIDC_VBER])
754      if(vidc_regs[VIDC_HCR] && vidc_regs[VIDC_HBER] &&
755         vidc_regs[VIDC_VCR] && vidc_regs[VIDC_VBER])
670756      {
671757         /* sanity checks - second pass */
672758         /*
673         total cycles > border end > border start
759         total cycles >= border end >= border start
674760         */
675761         if((vidc_regs[VIDC_HCR] >= vidc_regs[VIDC_HBER]) &&
676762            (vidc_regs[VIDC_HBER] >= vidc_regs[VIDC_HBSR]) &&
r8800r8801
684770            visarea.max_x = vidc_regs[VIDC_HBER] - vidc_regs[VIDC_HBSR] - 1;
685771            visarea.max_y = vidc_regs[VIDC_VBER] - vidc_regs[VIDC_VBSR];
686772
687            logerror("Configuring: htotal %d vtotal %d border %d x %d display %d x %d\n",
688               vidc_regs[VIDC_HCR], vidc_regs[VIDC_VCR],
689               visarea.max_x, visarea.max_y,
690               vidc_regs[VIDC_HDER]-vidc_regs[VIDC_HDSR],vidc_regs[VIDC_VDER]-vidc_regs[VIDC_VDSR]+1);
773            //printf("Configuring: htotal %d vtotal %d border %d x %d display %d x %d\n",
774            //   vidc_regs[VIDC_HCR], vidc_regs[VIDC_VCR],
775            //   visarea.max_x, visarea.max_y,
776            //   vidc_regs[VIDC_HDER]-vidc_regs[VIDC_HDSR],vidc_regs[VIDC_VDER]-vidc_regs[VIDC_VDSR]+1);
691777
692778            space->machine->primary_screen->configure(vidc_regs[VIDC_HCR], vidc_regs[VIDC_VCR], visarea, space->machine->primary_screen->frame_period().attoseconds);
693779         }
r8800r8801
697783   else if(reg == 0xe0)
698784   {
699785      vidc_bpp_mode = ((val & 0xc) >> 2);
786      vidc_interlace = ((val & 0x40) >> 6);
700787   }
701788   else
702789   {
r8800r8801
744831
745832            video_dma_on = ((data>>10)&1);
746833
834            if ((data>>10)&1)
835            {
836               vidc_vidcur = 0;
837               timer_adjust_oneshot(vid_timer, ATTOTIME_IN_USEC(1), 0);
838            }
839
747840            if ((data>>11)&1)
748841            {
749842               double sndhz;
src/mame/includes/archimds.h
r8800r8801
6464extern UINT32 vidc_regs[256];
6565extern UINT8 ioc_regs[0x80/4];
6666extern UINT8 vidc_bpp_mode;
67extern UINT8 vidc_interlace;
6768
6869#define CONTROL         0x00/4
6970#define IRQ_STATUS_A    0x10/4
src/mame/video/archimds.c
r8800r8801
1414VIDEO_UPDATE( archimds_vidc )
1515{
1616   int xstart,ystart,xend,yend;
17   int res_x,res_y;
1718
1819   /* border color */
1920   bitmap_fill(bitmap, cliprect, screen->machine->pens[0x10]);
2021
2122   /* display area x/y */
22   xstart = vidc_regs[VIDC_HDSR];
23   ystart = vidc_regs[VIDC_VDSR];
24   xend = vidc_regs[VIDC_HDER];
25   yend = vidc_regs[VIDC_VDER];
23   xstart = vidc_regs[VIDC_HBSR]-vidc_regs[VIDC_HDSR];
24   ystart = vidc_regs[VIDC_VBSR]-vidc_regs[VIDC_VDSR];
25   xend = vidc_regs[VIDC_HDER]+xstart;
26   yend = vidc_regs[VIDC_VDER]+ystart;
2627
2728   /* disable the screen if display params are invalid */
28   if(xstart <= xend || ystart <= yend)
29   if(xstart > xend || ystart > yend)
2930      return 0;
3031
3132   {
r8800r8801
3435      UINT8 pen;
3536      static UINT8 *vram = memory_region(screen->machine,"vram");
3637
37      count = 0;
38      count = (0);
3839
3940      switch(vidc_bpp_mode)
4041      {
41         case 0:
42         case 0: //1 bpp
4243         {
4344            for(y=0;y<400;y++)
4445            {
r8800r8801
4849
4950                  for(xi=0;xi<8;xi++)
5051                  {
51                     if ((x+xi) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y &&
52                         (x+xi) <= xend && (y) <= yend)
53                        *BITMAP_ADDR32(bitmap, y+ystart, x+xi+xstart) = screen->machine->pens[(pen>>(xi))&0x1];
52                     res_x = x+xi+xstart;
53                     res_y = (y+ystart)*(vidc_interlace+1);
54
55                     if(vidc_interlace)
56                     {
57                        if ((res_x) >= 0 &&
58                           (res_y) >= 0 &&
59                           (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
60                           *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine->pens[(pen>>(xi))&0x1];
61                        if ((res_x) >= 0 &&
62                           (res_y) >= 0 &&
63                           (res_x) <= screen->visible_area().max_x && (res_y+1) <= screen->visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
64                           *BITMAP_ADDR32(bitmap, res_y+1, res_x) = screen->machine->pens[(pen>>(xi))&0x1];
65                     }
66                     else
67                     {
68                        if ((res_x) >= 0 &&
69                           (res_y) >= 0 &&
70                           (res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
71                           *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine->pens[(pen>>(xi))&0x1];
72                     }
5473                  }
5574
5675                  count++;
r8800r8801
5877            }
5978         }
6079         break;
80         case 3: //8 bpp
81         {
82            for(y=0;y<400;y++)
83            {
84               for(x=0;x<640;x++)
85               {
86                  pen = vram[count];
87
88                  res_x = x+xstart;
89                  res_y = (y+ystart)*(vidc_interlace+1);
90
91                  if(vidc_interlace)
92                  {
93                     if ((res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
94                        *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine->pens[(pen&0xff)+0x100];
95                     if ((res_x) <= screen->visible_area().max_x && (res_y+1) <= screen->visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
96                        *BITMAP_ADDR32(bitmap, res_y+1, res_x) = screen->machine->pens[(pen&0xff)+0x100];
97                  }
98                  else
99                  {
100                     if ((res_x) <= screen->visible_area().max_x && (res_y) <= screen->visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
101                        *BITMAP_ADDR32(bitmap, res_y, res_x) = screen->machine->pens[(pen&0xff)+0x100];
102                  }
103
104                  count++;
105               }
106            }
107         }
108         break;
61109      }
62110   }
63111
src/mess/drivers/a310.c
r8800r8801
7373
7474static ADDRESS_MAP_START( a310_mem, ADDRESS_SPACE_PROGRAM, 32 )
7575   AM_RANGE(0x00000000, 0x01ffffff) AM_READWRITE(archimedes_memc_logical_r, archimedes_memc_logical_w)
76   AM_RANGE(0x02000000, 0x023fffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
76   AM_RANGE(0x02000000, 0x02ffffff) AM_RAM AM_BASE(&archimedes_memc_physmem) /* physical RAM - 16 MB for now, should be 512k for the A310 */
7777   AM_RANGE(0x03000000, 0x033fffff) AM_READWRITE(archimedes_ioc_r, archimedes_ioc_w)
7878   AM_RANGE(0x03400000, 0x035fffff) AM_READWRITE(archimedes_vidc_r, archimedes_vidc_w)
7979   AM_RANGE(0x03600000, 0x037fffff) AM_READWRITE(archimedes_memc_r, archimedes_memc_w)
r8800r8801
223223   MDRV_SCREEN_REFRESH_RATE(60)
224224   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
225225   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
226   MDRV_SCREEN_SIZE(32*8, 16*16)
227   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8 - 1, 0*16, 16*16 - 1)
226   MDRV_SCREEN_SIZE(1280, 1024) //TODO: default screen size
227   MDRV_SCREEN_VISIBLE_AREA(0*8, 1280 - 1, 0*16, 1024 - 1)
228228   MDRV_PALETTE_LENGTH(32768)
229229
230230   MDRV_VIDEO_START(archimds_vidc)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team