Previous 15994 Revisions Next

r8874 Monday 23rd August, 2010 at 20:49:48 UTC by Angelo Salese
[A310]: Updated to latest source tree
[src/mame/includes]archimds.h
[src/mame/machine]archimds.c

src/mame/machine/archimds.c
r8873r8874
3131#include "sound/dac.h"
3232#include "includes/archimds.h"
3333#include "machine/i2cmem.h"
34#include "debugger.h"
3435
3536#ifdef MESS
3637#include "machine/wd17xx.h"
r8873r8874
139140
140141   vidc_sndcur++;
141142
142   if (vidc_sndcur >= vidc_sndend-vidc_sndstart)
143   if (vidc_sndcur >= (vidc_sndend-vidc_sndstart)+0x10)
143144   {
144145      vidc_sndcur = 0;
145146      archimedes_request_irq_b(machine, ARCHIMEDES_IRQB_SOUND_EMPTY);
r8873r8874
156157{
157158   double freq;
158159
159   if(ioc_timercnt[tmr] != 0) // FIXME: dmdtouch does a divide by zero?
160   switch(tmr)
160161   {
161      freq = 2000000.0 / (double)ioc_timercnt[tmr];
162//     logerror("IOC: starting timer %d, %d ticks, freq %f Hz\n", tmr, ioc_timercnt[tmr], freq);
163      timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_HZ(freq), tmr);
162      case 0:
163      case 1:
164         timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_USEC(ioc_timercnt[tmr]/8), tmr); // TODO: ARM timings are quite off there, it should be latch and not latch/8
165         break;
166      case 2:
167         freq = 1000000.0 / (double)(ioc_timercnt[tmr]+1);
168         timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_HZ(freq), tmr);
169         break;
170      case 3:
171         freq = 1000000.0 / (double)((ioc_timercnt[tmr]+1)*16);
172         timer_adjust_oneshot(timer[tmr], ATTOTIME_IN_HZ(freq), tmr);
173         break;
164174   }
165175}
166176
r8873r8874
198208   ioc_regs[IRQ_STATUS_A] = 0x10 | 0x80; //set up POR (Power On Reset) and Force IRQ at start-up
199209   ioc_regs[IRQ_STATUS_B] = 0x02; //set up IL[1] On
200210   ioc_regs[FIQ_STATUS] = 0x80;   //set up Force FIQ
211   ioc_regs[CONTROL] = 0xff;
201212}
202213
203214void archimedes_init(running_machine *machine)
r8873r8874
365376   if(IOC_LOG)
366377   logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
367378
379   if((offset & 0x1f) >= 0x40/4)
380   printf("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
381
368382   switch (offset & 0x1f)
369383   {
370384      case CONTROL:
r8873r8874
381395         return (flyback) | (ioc_regs[CONTROL] & 0x7c) | (i2c_clk<<1) | i2c_data;
382396      }
383397
384      case 1:   // keyboard read
398      case KART:   // keyboard read
385399         archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_KBD_XMIT_EMPTY);
386400         break;
387401
r8873r8874
412426      case FIQ_MASK:
413427         return (ioc_regs[FIQ_MASK]);
414428
415      case 16:   // timer 0 read
416         return ioc_timerout[0]&0xff;
417      case 17:
418         return (ioc_timerout[0]>>8)&0xff;
419      case 20:   // timer 1 read
420         return ioc_timerout[1]&0xff;
421      case 21:
422         return (ioc_timerout[1]>>8)&0xff;
423      case 24:   // timer 2 read
424         return ioc_timerout[2]&0xff;
425      case 25:
426         return (ioc_timerout[2]>>8)&0xff;
427      case 28:   // timer 3 read
428         return ioc_timerout[3]&0xff;
429      case 29:
430         return (ioc_timerout[3]>>8)&0xff;
429      case T0_LATCH_LO: return ioc_timerout[0]&0xff;
430      case T0_LATCH_HI: return (ioc_timerout[0]>>8)&0xff;
431
432      case T1_LATCH_LO: return ioc_timerout[1]&0xff;
433      case T1_LATCH_HI: return (ioc_timerout[1]>>8)&0xff;
434
435      case T2_LATCH_LO: return ioc_timerout[2]&0xff;
436      case T2_LATCH_HI: return (ioc_timerout[2]>>8)&0xff;
437
438      case T3_LATCH_LO: return ioc_timerout[3]&0xff;
439      case T3_LATCH_HI: return (ioc_timerout[3]>>8)&0xff;
431440      default:
432441         if(!IOC_LOG)
433442            logerror("IOC: R %s = %02x (PC=%x) %02x\n", ioc_regnames[offset&0x1f], ioc_regs[offset&0x1f], cpu_get_pc( space->cpu ),offset & 0x1f);
r8873r8874
443452   if(IOC_LOG)
444453   logerror("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
445454
455   if((offset & 0x1f) >= 0x40/4)
456   printf("IOC: W %02x @ reg %s (PC=%x)\n", data&0xff, ioc_regnames[offset&0x1f], cpu_get_pc( space->cpu ));
457
458
446459   switch (offset&0x1f)
447460   {
448      case 0:   // I2C bus control
461      case CONTROL:   // I2C bus control
449462         //logerror("IOC I2C: CLK %d DAT %d\n", (data>>1)&1, data&1);
450463         i2cmem_sda_write(space->machine->device("i2cmem"), data & 0x01);
451464         i2cmem_scl_write(space->machine->device("i2cmem"), (data & 0x02) >> 1);
452465         i2c_clk = (data & 2) >> 1;
453466         break;
454467
455      case 1:
468      case KART:
456469         #if 0
457470         if(data == 0x0d)
458471            printf("\n");
r8873r8874
470483         if(data & 0x08) //set up the VBLANK timer
471484            timer_adjust_oneshot(vbl_timer, space->machine->primary_screen->time_until_pos(vidc_regs[0xb4]), 0);
472485
473         //printf("MASKA: %02x\n",data);
474486         break;
475487
476      case IRQ_MASK_B:
477         ioc_regs[IRQ_MASK_B] = data & 0xff;
478
479         //printf("MASKB: %02x\n",data);
480         break;
481
482488      case FIQ_MASK:
483489         ioc_regs[FIQ_MASK] = data & 0xff;
484490
485491         if(data & 0x80) //force a FIRQ
486492            archimedes_request_fiq(space->machine,ARCHIMEDES_FIQ_FORCE);
487493
488         //printf("FMASK: %02x\n",data);
489
490494         break;
491495
492496      case IRQ_REQUEST_A:    // IRQ clear A
493497         ioc_regs[IRQ_STATUS_A] &= ~(data&0xff);
494498
495499         // if that did it, clear the IRQ
496         if (ioc_regs[IRQ_STATUS_A] == 0)
500         //if (ioc_regs[IRQ_STATUS_A] == 0)
497501         {
498            printf("IRQ clear A\n");
502            //printf("IRQ clear A\n");
499503            cputag_set_input_line(space->machine, "maincpu", ARM_IRQ_LINE, CLEAR_LINE);
500504         }
501505         break;
502506
503      case 16:
504      case 17:
507      case T0_LATCH_LO:
508      case T0_LATCH_HI:
505509         ioc_regs[offset&0x1f] = data & 0xff;
506510         break;
507511
508      case 20:
509      case 21:
512      case T1_LATCH_LO:
513      case T1_LATCH_HI:
510514         ioc_regs[offset&0x1f] = data & 0xff;
511515         break;
512516
513      case 24:
514      case 25:
517      case T2_LATCH_LO:
518      case T2_LATCH_HI:
515519         ioc_regs[offset&0x1f] = data & 0xff;
516520         break;
517521
518      case 28:
519      case 29:
522      case T3_LATCH_LO:
523      case T3_LATCH_HI:
520524         ioc_regs[offset&0x1f] = data & 0xff;
521525         break;
522526
523      case 19:   // Timer 0 latch
527      case T0_LATCH:   // Timer 0 latch
524528         latch_timer_cnt(0);
525529         break;
526530
527      case 23:   // Timer 1 latch
531      case T1_LATCH:   // Timer 1 latch
528532         latch_timer_cnt(1);
529533         break;
530534
531      case 27:   // Timer 2 latch
535      case T2_LATCH:   // Timer 2 latch
532536         latch_timer_cnt(2);
533537         break;
534538
535      case 31:   // Timer 3 latch
539      case T3_LATCH:   // Timer 3 latch
536540         latch_timer_cnt(3);
537541         break;
538542
539      case 18:   // Timer 0 start
540         ioc_timercnt[0] = ioc_regs[17]<<8 | ioc_regs[16];
543      case T0_GO:   // Timer 0 start
544         ioc_timercnt[0] = ioc_regs[T0_LATCH_HI]<<8 | ioc_regs[T0_LATCH_LO];
541545         a310_set_timer(0);
542546         break;
543547
544      case 22:   // Timer 1 start
545         ioc_timercnt[1] = ioc_regs[21]<<8 | ioc_regs[20];
548      case T1_GO:   // Timer 1 start
549         ioc_timercnt[1] = ioc_regs[T1_LATCH_HI]<<8 | ioc_regs[T1_LATCH_LO];
546550         a310_set_timer(1);
547551         break;
548552
549      case 26:   // Timer 2 start
550         ioc_timercnt[2] = ioc_regs[25]<<8 | ioc_regs[24];
553      case T2_GO:   // Timer 2 start
554         ioc_timercnt[2] = ioc_regs[T2_LATCH_HI]<<8 | ioc_regs[T2_LATCH_LO];
551555         a310_set_timer(2);
552556         break;
553557
554      case 30:   // Timer 3 start
555         ioc_timercnt[3] = ioc_regs[29]<<8 | ioc_regs[28];
558      case T3_GO:   // Timer 3 start
559         ioc_timercnt[3] = ioc_regs[T3_LATCH_HI]<<8 | ioc_regs[T3_LATCH_LO];
556560         a310_set_timer(3);
557561         break;
558562
r8873r8874
855859            break;
856860
857861         case 4:   /* sound start */
858            //logerror("MEMC: VIDSNDSTART %08x\n",data);
862            //logerror("MEMC: SNDSTART %08x\n",data);
859863            vidc_sndstart = 0x2000000 | ((data>>2)&0x7fff)*16;
864            ioc_regs[IRQ_STATUS_B] &= ~ARCHIMEDES_IRQB_SOUND_EMPTY;
860865            break;
861866
862867         case 5: /* sound end */
863            //logerror("MEMC: VIDSNDEND %08x\n",data);
868            //logerror("MEMC: SNDEND %08x\n",data);
864869            vidc_sndend = 0x2000000 | ((data>>2)&0x7fff)*16;
870            archimedes_request_irq_b(space->machine, ARCHIMEDES_IRQB_SOUND_EMPTY);
865871            break;
866872
867873         case 7:   /* Control */
src/mame/includes/archimds.h
r8873r8874
6666extern UINT8 vidc_bpp_mode;
6767extern UINT8 vidc_interlace;
6868
69/* IOC registers */
70
6971#define CONTROL         0x00/4
72#define KART         0x04/4 // Keyboard Asynchronous Receiver Transmitter
73
7074#define IRQ_STATUS_A    0x10/4
7175#define IRQ_REQUEST_A   0x14/4
7276#define IRQ_MASK_A       0x18/4
r8873r8874
7882#define FIQ_REQUEST     0x34/4
7983#define FIQ_MASK      0x38/4
8084
85#define T0_LATCH_LO   0x40/4
86#define T0_LATCH_HI 0x44/4
87#define T0_GO      0x48/4
88#define T0_LATCH   0x4c/4
89
90#define T1_LATCH_LO   0x50/4
91#define T1_LATCH_HI 0x54/4
92#define T1_GO      0x58/4
93#define T1_LATCH   0x5c/4
94
95#define T2_LATCH_LO   0x60/4
96#define T2_LATCH_HI 0x64/4
97#define T2_GO      0x68/4
98#define T2_LATCH   0x6c/4
99
100#define T3_LATCH_LO   0x70/4
101#define T3_LATCH_HI 0x74/4
102#define T3_GO      0x78/4
103#define T3_LATCH   0x7c/4
104
105
81106/*----------- defined in video/archimds.c -----------*/
82107
83108extern VIDEO_START( archimds_vidc );

Previous 15994 Revisions Next


© 1998-2018 The MESS Team