Previous 199869 Revisions Next

r20171 Thursday 10th January, 2013 at 01:14:52 UTC by Angelo Salese
Added very preliminary timers
[src/mame/drivers]3do.c
[src/mame/includes]3do.h
[src/mame/machine]3do.c

trunk/src/mame/drivers/3do.c
r20170r20171
157157   MCFG_CPU_ADD( "maincpu", ARM7_BE, XTAL_50MHz/4 )
158158   MCFG_CPU_PROGRAM_MAP( 3do_mem)
159159
160   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_x16", _3do_state, timer_x16_cb, attotime::from_hz(12000)) // TODO: timing
160161
161162   MCFG_VIDEO_START_OVERRIDE(_3do_state, _3do )
162163
trunk/src/mame/machine/3do.c
r20170r20171
6161#define LOG(x) do { if (VERBOSE) printf x; } while (0)
6262
6363/*
64IRQ0
64650x80000000 Second Priority
65660x40000000 SW irq
66670x20000000 DMA<->EXP
r20170r20171
78790x00000004 Expansion Bus
79800x00000002 Vertical 1
80810x00000001 Vertical 0
82
83---
84IRQ1
850x00000400 DSPPOVER (Red rev. only)
860x00000200 DSPPUNDER (Red rev. only)
870x00000100 BadBits
880x00000080 DMA<-External
890x00000040 DMA->External
900x00000020 DMA<-Uncle
910x00000010 DMA->Uncle
920x00000008 DMA RAM->DSPP N
930x00000004 SlowBus
940x00000002 Disk Inserted
950x00000001 DMA Player bus
96
8197*/
8298void _3do_state::m_3do_request_fiq(UINT32 irq_req, UINT8 type)
8399{
r20170r20171
93109
94110   if((m_clio.irq0 & m_clio.irq0_enable) || (m_clio.irq1 & m_clio.irq1_enable))
95111   {
96      printf("Go irq %08x & %08x %08x & %08x\n",m_clio.irq0, m_clio.irq0_enable, m_clio.irq1, m_clio.irq1_enable);
112      //printf("Go irq %08x & %08x %08x & %08x\n",m_clio.irq0, m_clio.irq0_enable, m_clio.irq1, m_clio.irq1_enable);
97113      generic_pulse_irq_line(m_maincpu, ARM7_FIRQ_LINE, 1);
98114   }
99115}
100116
101/*
1020x00000400 DSPPOVER (Red rev. only)
1030x00000200 DSPPUNDER (Red rev. only)
1040x00000100 BadBits
1050x00000080 DMA<-External
1060x00000040 DMA->External
1070x00000020 DMA<-Uncle
1080x00000010 DMA->Uncle
1090x00000008 DMA RAM->DSPP N
1100x00000004 SlowBus
1110x00000002 Disk Inserted
1120x00000001 DMA Player bus
113*/
117/* TODO: timer frequency is unknown, everything else is guesswork. */
118TIMER_DEVICE_CALLBACK_MEMBER( _3do_state::timer_x16_cb )
119{
120   /*
121      x--- fablode flag (wtf?)
122      -x-- cascade flag (TODO: not knowing the timing also means that this one would be VERY slow if implemented)
123      --x- reload flag
124      ---x decrement flag (enable)
125   */
126   UINT8 timer_flag;
114127
128   for(int i = 0;i < 16; i++)
129   {
130      timer_flag = (m_clio.timer_ctrl >> i*4) & 0xf;
115131
132      if(timer_flag & 1)
133      {
134         m_clio.timer_count[i]--;
135
136         if(m_clio.timer_count[i] == 0) // timer hit
137         {
138            if(i & 1) // odd timer irq fires
139               m_3do_request_fiq(8 << (7-(i >> 1)),0);
140
141            if(timer_flag & 2)
142               m_clio.timer_count[i] = m_clio.timer_backup[i];
143            else
144               m_clio.timer_ctrl &= (~1 << i*4);
145         }
146      }
147   }
148}
149
116150READ32_MEMBER(_3do_state::_3do_nvarea_r){
117151   logerror( "%08X: NVRAM read offset = %08X\n", machine().device("maincpu")->safe_pc(), offset );
118152   return 0;
r20170r20171
440474      break;
441475   case 0x0028/4:
442476      m_madam.statbits = data;
477      break; // <- this was a fall-through?
443478   case 0x0040/4:
444479      m_madam.diag = 1;
445480      break;
r20170r20171
651686   case 0x0088/4:
652687      return m_clio.adbctl;
653688
654   case 0x0100/4:
655      return m_clio.timer0;
656   case 0x0104/4:
657      return m_clio.timerback0;
658   case 0x0108/4:
659      return m_clio.timer1;
660   case 0x010c/4:
661      return m_clio.timerback1;
662   case 0x0110/4:
663      return m_clio.timer2;
664   case 0x0114/4:
665      return m_clio.timerback2;
666   case 0x0118/4:
667      return m_clio.timer3;
668   case 0x011c/4:
669      return m_clio.timerback3;
670   case 0x0120/4:
671      return m_clio.timer4;
672   case 0x0124/4:
673      return m_clio.timerback4;
674   case 0x0128/4:
675      return m_clio.timer5;
676   case 0x012c/4:
677      return m_clio.timerback5;
678   case 0x0130/4:
679      return m_clio.timer6;
680   case 0x0134/4:
681      return m_clio.timerback6;
682   case 0x0138/4:
683      return m_clio.timer7;
684   case 0x013c/4:
685      return m_clio.timerback7;
686   case 0x0140/4:
687      return m_clio.timer8;
688   case 0x0144/4:
689      return m_clio.timerback8;
690   case 0x0148/4:
691      return m_clio.timer9;
692   case 0x014c/4:
693      return m_clio.timerback9;
694   case 0x0150/4:
695      return m_clio.timer10;
696   case 0x0154/4:
697      return m_clio.timerback10;
698   case 0x0158/4:
699      return m_clio.timer11;
700   case 0x015c/4:
701      return m_clio.timerback11;
702   case 0x0160/4:
703      return m_clio.timer12;
704   case 0x0164/4:
705      return m_clio.timerback12;
706   case 0x0168/4:
707      return m_clio.timer13;
708   case 0x016c/4:
709      return m_clio.timerback13;
710   case 0x0170/4:
711      return m_clio.timer14;
712   case 0x0174/4:
713      return m_clio.timerback14;
714   case 0x0178/4:
715      return m_clio.timer15;
716   case 0x017c/4:
717      return m_clio.timerback15;
689   case 0x0100/4:   case 0x0108/4:   case 0x0110/4:   case 0x0118/4:
690   case 0x0120/4:   case 0x0128/4:   case 0x0130/4:   case 0x0138/4:
691   case 0x0140/4:   case 0x0148/4:   case 0x0150/4:  case 0x0158/4:
692   case 0x0160/4:   case 0x0168/4:   case 0x0170/4:   case 0x0178/4:
693      return m_clio.timer_count[((offset & 0x3f) >> 1)+0];
694   case 0x0104/4:   case 0x010c/4:   case 0x0114/4:   case 0x011c/4:
695   case 0x0124/4:   case 0x012c/4:   case 0x0134/4:   case 0x013c/4:
696   case 0x0144/4:   case 0x014c/4:   case 0x0154/4:   case 0x015c/4:
697   case 0x0164/4:   case 0x016c/4:   case 0x0174/4:   case 0x017c/4:
698      return m_clio.timer_backup[((offset & 0x3f) >> 1)];
718699
719700   case 0x0200/4:
720      return m_clio.settm0;
721701   case 0x0204/4:
722      return m_clio.clrtm0;
702      return m_clio.timer_ctrl;
723703   case 0x0208/4:
724      return m_clio.settm1;
725704   case 0x020c/4:
726      return m_clio.clrtm1;
705      return m_clio.timer_ctrl >> 32;
727706
728707   case 0x0220/4:
729708      return m_clio.slack;
r20170r20171
809788      m_3do_request_fiq(0,0);
810789      break;
811790   case 0x0044/4:
812      LOG(("%08x PEND0 CLEAR\n",data));
791      //LOG(("%08x PEND0 CLEAR\n",data));
813792      m_clio.irq0 &= ~data;
814793      m_3do_request_fiq(0,0);
815794      break;
r20170r20171
865844      m_clio.adbctl = data;
866845      break;
867846
868   case 0x0100/4:
869      m_clio.timer0 = data & 0x0000ffff;
847   /* only lower 16-bits are uploaded */
848   case 0x0100/4:   case 0x0108/4:   case 0x0110/4:   case 0x0118/4:
849   case 0x0120/4:   case 0x0128/4:   case 0x0130/4:   case 0x0138/4:
850   case 0x0140/4:   case 0x0148/4:   case 0x0150/4:  case 0x0158/4:
851   case 0x0160/4:   case 0x0168/4:   case 0x0170/4:   case 0x0178/4:
852      m_clio.timer_count[((offset & 0x3f) >> 1)] = data & 0xffff;
870853      break;
871   case 0x0104/4:
872      m_clio.timerback0 = data & 0x0000ffff;
854   case 0x0104/4:   case 0x010c/4:   case 0x0114/4:   case 0x011c/4:
855   case 0x0124/4:   case 0x012c/4:   case 0x0134/4:   case 0x013c/4:
856   case 0x0144/4:   case 0x014c/4:   case 0x0154/4:   case 0x015c/4:
857   case 0x0164/4:   case 0x016c/4:   case 0x0174/4:   case 0x017c/4:
858      m_clio.timer_backup[((offset & 0x3f) >> 1)] = data & 0xffff;
873859      break;
874   case 0x0108/4:
875      m_clio.timer1 = data & 0x0000ffff;
876      break;
877   case 0x010c/4:
878      m_clio.timerback1 = data & 0x0000ffff;
879      break;
880   case 0x0110/4:
881      m_clio.timer2 = data & 0x0000ffff;
882      break;
883   case 0x0114/4:
884      m_clio.timerback2 = data & 0x0000ffff;
885      break;
886   case 0x0118/4:
887      m_clio.timer3 = data & 0x0000ffff;
888      break;
889   case 0x011c/4:
890      m_clio.timerback3 = data & 0x0000ffff;
891      break;
892   case 0x0120/4:
893      m_clio.timer4 = data & 0x0000ffff;
894      break;
895   case 0x0124/4:
896      m_clio.timerback4 = data & 0x0000ffff;
897      break;
898   case 0x0128/4:
899      m_clio.timer5 = data & 0x0000ffff;
900      break;
901   case 0x012c/4:
902      m_clio.timerback5 = data & 0x0000ffff;
903      break;
904   case 0x0130/4:
905      m_clio.timer6 = data & 0x0000ffff;
906      break;
907   case 0x0134/4:
908      m_clio.timerback6 = data & 0x0000ffff;
909      break;
910   case 0x0138/4:
911      m_clio.timer7 = data & 0x0000ffff;
912      break;
913   case 0x013c/4:
914      m_clio.timerback7 = data & 0x0000ffff;
915      break;
916   case 0x0140/4:
917      m_clio.timer8 = data & 0x0000ffff;
918      break;
919   case 0x0144/4:
920      m_clio.timerback8 = data & 0x0000ffff;
921      break;
922   case 0x0148/4:
923      m_clio.timer9 = data & 0x0000ffff;
924      break;
925   case 0x014c/4:
926      m_clio.timerback9 = data & 0x0000ffff;
927      break;
928   case 0x0150/4:
929      m_clio.timer10 = data & 0x0000ffff;
930      break;
931   case 0x0154/4:
932      m_clio.timerback10 = data & 0x0000ffff;
933      break;
934   case 0x0158/4:
935      m_clio.timer11 = data & 0x0000ffff;
936      break;
937   case 0x015c/4:
938      m_clio.timerback11 = data & 0x0000ffff;
939      break;
940   case 0x0160/4:
941      m_clio.timer12 = data & 0x0000ffff;
942      break;
943   case 0x0164/4:
944      m_clio.timerback12 = data & 0x0000ffff;
945      break;
946   case 0x0168/4:
947      m_clio.timer13 = data & 0x0000ffff;
948      break;
949   case 0x016c/4:
950      m_clio.timerback13 = data & 0x0000ffff;
951      break;
952   case 0x0170/4:
953      m_clio.timer14 = data & 0x0000ffff;
954      break;
955   case 0x0174/4:
956      m_clio.timerback14 = data & 0x0000ffff;
957      break;
958   case 0x0178/4:
959      m_clio.timer15 = data & 0x0000ffff;
960      break;
961   case 0x017c/4:
962      m_clio.timerback15 = data & 0x0000ffff;
963      break;
964860
965861   case 0x0200/4:
966      m_clio.settm0 = data;
862      m_clio.timer_ctrl |= (UINT64)data;
967863      break;
968864   case 0x0204/4:
969      m_clio.clrtm0 = data;
865      m_clio.timer_ctrl &= ~(UINT64)data;
970866      break;
971867   case 0x0208/4:
972      m_clio.settm0 = data;
868      m_clio.timer_ctrl |= ((UINT64)data << 32);
973869      break;
974870   case 0x020c/4:
871      m_clio.timer_ctrl &= ~((UINT64)data << 32);
975872      break;
976873
977874   case 0x0220/4:
trunk/src/mame/includes/3do.h
r20170r20171
8080   UINT32   adbio;         /* 03400084 */
8181   UINT32   adbctl;         /* 03400088 */
8282                     /* Timers */
83   UINT32   timer0;         /* 03400100 */
84   UINT32   timerback0;      /* 03400104 */
85   UINT32   timer1;         /* 03400108 */
86   UINT32   timerback1;      /* 0340010c */
87   UINT32   timer2;         /* 03400110 */
88   UINT32   timerback2;      /* 03400114 */
89   UINT32   timer3;         /* 03400118 */
90   UINT32   timerback3;      /* 0340011c */
91   UINT32   timer4;         /* 03400120 */
92   UINT32   timerback4;      /* 03400124 */
93   UINT32   timer5;         /* 03400128 */
94   UINT32   timerback5;      /* 0340012c */
95   UINT32   timer6;         /* 03400130 */
96   UINT32   timerback6;      /* 03400134 */
97   UINT32   timer7;         /* 03400138 */
98   UINT32   timerback7;      /* 0340013c */
99   UINT32   timer8;         /* 03400140 */
100   UINT32   timerback8;      /* 03400144 */
101   UINT32   timer9;         /* 03400148 */
102   UINT32   timerback9;      /* 0340014c */
103   UINT32   timer10;      /* 03400150 */
104   UINT32   timerback10;   /* 03400154 */
105   UINT32   timer11;      /* 03400158 */
106   UINT32   timerback11;   /* 0340015c */
107   UINT32   timer12;      /* 03400160 */
108   UINT32   timerback12;   /* 03400164 */
109   UINT32   timer13;      /* 03400168 */
110   UINT32   timerback13;   /* 0340016c */
111   UINT32   timer14;      /* 03400170 */
112   UINT32   timerback14;   /* 03400174 */
113   UINT32   timer15;      /* 03400178 */
114   UINT32   timerback15;   /* 0340017c */
115   UINT32   settm0;         /* 03400200 */
116   UINT32   clrtm0;         /* 03400204 */
117   UINT32   settm1;         /* 03400208 */
118   UINT32   clrtm1;         /* 0340020c */
83   UINT32   timer_count[16];/* 034001** & 8 */
84   UINT32   timer_backup[16];   /* 034001**+4 & 8 */
85   UINT64   timer_ctrl;      /* 03400200 */
11986   UINT32   slack;         /* 03400220 */
12087                     /* DMA */
12188   UINT32   dmareqdis;      /* 03400308 */
r20170r20171
190157   DECLARE_VIDEO_START(_3do);
191158   UINT32 screen_update__3do(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
192159
160   TIMER_DEVICE_CALLBACK_MEMBER( timer_x16_cb );
161
193162private:
194163   void m_3do_request_fiq(UINT32 irq_req, UINT8 type);
195164};

Previous 199869 Revisions Next


© 1997-2024 The MAME Team