Previous 199869 Revisions Next

r21259 Thursday 21st February, 2013 at 14:36:50 UTC by Angelo Salese
Found a way to split irqs
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21258r21259
248248
249249/*
250250
251some Sprite compression notes from Charles and Andrew
251some Sprite compression notes from Charles and Andrew
252252
253253OK so here's what we know. Andrew and I were playing with the ROMs and
254254Guru traced out connections on the board at the time:
r21258r21259
427427   UINT32 m_blit10; // an address
428428
429429   UINT16 m_tempshape[16*16];
430   
430
431431   required_device<cpu_device> m_maincpu;
432432   required_device<cpu_device> m_subcpu;
433433   required_device<cpu_device> m_soundcpu;
r21258r21259
449449   UINT8 m_vblank;
450450   int m_scsp_last_line;
451451   UINT8 an_mux_data;
452   UINT8 sound_data;
452   UINT8 sound_data, sound_fifo_full;
453453
454454   UINT8* m_compressedgfx;
455455   UINT32 get_20bit_data(UINT32 romoffset, int _20bitwordnum);
r21258r21259
472472   DECLARE_READ8_MEMBER(analog_mux_r);
473473   DECLARE_WRITE8_MEMBER(analog_mux_w);
474474   DECLARE_WRITE8_MEMBER(lamps_w);
475   DECLARE_WRITE_LINE_MEMBER(scsp_to_main_irq);
475   DECLARE_WRITE_LINE_MEMBER(scsp1_to_sh1_irq);
476   DECLARE_WRITE_LINE_MEMBER(scsp2_to_sh1_irq);
476477   DECLARE_WRITE8_MEMBER(sound_to_sh1_w);
477478   DECLARE_DRIVER_INIT(coolridr);
478479   virtual void machine_start();
r21258r21259
691692            m_textBytesToWrite = (data & 0xff000000) >> 24;
692693            m_textOffset = (data & 0x0000ffff);
693694            m_blitterSerialCount = 0;
694           
695
695696            // this is ONLY used when there is text on the screen
696           
697
697698            //printf("set mode %08x\n", data);
698699
699         
700
700701         }
701702         else if (m_blitterMode == 0x30 || m_blitterMode == 0x40 || m_blitterMode == 0x50 || m_blitterMode == 0x60
702703              || m_blitterMode == 0x90 || m_blitterMode == 0xa0 || m_blitterMode == 0xb0 || m_blitterMode == 0xc0)
r21258r21259
706707            // The lower word always seems to be 0x0001 and the upper byte always 0xac.
707708            m_blitterSerialCount = 0;
708709
709            // form 0xacMM-xxx   ac = fixed value for this mode?  MM = modes above.  -xxx = some kind of offset? but it doesn't increment for each blit like the textOffset / paletteOffset stuff, investigate 
710            // form 0xacMM-xxx   ac = fixed value for this mode?  MM = modes above.  -xxx = some kind of offset? but it doesn't increment for each blit like the textOffset / paletteOffset stuff, investigate
710711
711712         }
712713         else if (m_blitterMode == 0x10)
r21258r21259
786787               // this is also set at times during the game
787788               //
788789               // the sprites with 1 set appear to have 0x00000000 in everything after the 4th write (m_blit4 and above)
789               // so likely have some other meaning and are NOT regular sprite data           
790               // so likely have some other meaning and are NOT regular sprite data
790791               m_blit0 = data;
791792
792               
793793
794794
795795
796
796797            //   if (data!=0) printf("blit %08x\n", data);
797798            }
798799            else if (m_blitterSerialCount == 1)
r21258r21259
805806                  m_blit1_unused = data & 0xfffef800;
806807                  m_b1mode = (data & 0x00010000)>>16;
807808                  m_b1colorNumber = (data & 0x000007ff);    // Probably more bits
808           
809
809810                  if (m_blit1_unused!=0) printf("blit1 unknown bits set %08x\n", data);
810811               }
811812            }
812813            else if (m_blitterSerialCount == 2)
813814            {
814815               if (!(m_blit0 & 1)) // don't bother for non-sprites
815               {   
816               
816               {
817
817818                  // seems to be more complex than just transparency
818819                  m_blit2_unused = data&0xff80f800;
819820                  m_b2tpen = (data & 0x007f0000)>>16;
820821                  m_b2colorNumber = (data & 0x000007ff);
821               
822
822823                  if (m_blit2_unused!=0) printf("blit1 unknown bits set %08x\n", data);
823824                  if (m_b1mode)
824825                  {
r21258r21259
830831                     if ((m_b2tpen != 0x00) && (m_b2tpen != 0x01) && (m_b2tpen != 0x02)) printf("m_b1mode 0, m_b2tpen!=0x00,0x01 or 0x02 (is %02x)\n", m_b2tpen);
831832                  }
832833
833                   // 00??0uuu 
834                   // 00??0uuu
834835                   // ?? seems to be 00 or 7f, set depending on b1mode
835836                   // uuu, at least 11 bits used, maybe 12 usually the same as m_blit1_unused? leftover?
836837               }
r21258r21259
839840            else if (m_blitterSerialCount == 3)
840841            {
841842               if (!(m_blit0 & 1)) // don't bother for non-sprites
842               {   
843               {
843844                  m_blit3_unused = data & 0xffe00000;
844845                  m_b3romoffset = (data & 0x001fffff)*2;
845846                  // if this is an offset into the compressed data then it's probably a word offset into each rom (each is 0x400000 bytes) with the data from all 10 being used in parallel as per the notes from Charles
r21258r21259
862863                     printf("\n");
863864#endif
864865#if 0
865                     // look at the values actually at the address we're using..
866                     // look at the values actually at the address we're using..
866867                     // often have a similar form to
867868                     // 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080,
868869                     //   1     2     3     4     5     6     7     8     9    10
r21258r21259
870871                     if (m_b3romoffset == 0x0000848e)
871872                     {
872873                        printf("rom offset %08x, values : \n", m_b3romoffset);
873                     
874
874875                        for (int b=0;b<8;b++)
875876                        {
876877                           for (int i=0;i<8;i++)
r21258r21259
896897
897898
898899
899     
900900
901
901902                     // these are used for slider bars in test mode
902903                     //   rom offset 00140000, values : 0008, 0000, 8000, 0800, 0080, 0008, 0000, 8000, 0800, 0080,
903904                     //   rom offset 00140008, values : 0004, 9000, 4900, 0490, 0049, 0004, 9000, 4900, 0490, 0049,
904                     
905
905906                     // or as groups of 20-bits  00080 00080 00080 00080 00080 00080 00080 00080
906907                     // or as groups of 20-bits  00049 00049 00049 00049 00049 00049 00049 00049
907         
908
908909#endif
909910                  }
910                 
911911
912
912913               }
913914            }
914915            else if (m_blitterSerialCount == 4)
915916            {
916917               if (!(m_blit0 & 1)) // don't bother for non-sprites
917               {   
918               {
918919                  m_blit4_unused = data & 0xf8fefefe;
919920                  m_blit4 = data & 0x07010101;
920921
r21258r21259
995996                  // we also use this to trigger the actual draw operation
996997
997998                  //printf("blit %08x\n", data);
998               
999
9991000                  // debug, hide objects without m_blit10 set
10001001                  //if (m_blit10==0) return;
10011002                  //if (m_blit0==0) return;
r21258r21259
10051006                  {
10061007                     // with this bit enabled m_blit10 is a look up to the zoom(?) value eg. 03f42600
10071008                     //UINT32 temp = space.read_dword(m_blit10);
1008                     //PRINT_BLIT_STUFF     
1009                     //PRINT_BLIT_STUFF
10091010                     /* for the horizontal road during attract there are tables 0x480 bytes long (0x120 dwords) and the value passed points to the start of them */
10101011                     /* cell sizes for those are are 0011 (v) 0007 (h) with zoom factors of 0020 (half v) 0040 (normal h) */
10111012                     /* tables seem to be 2x 8-bit values, possibly zoom + linescroll, although ingame ones seem to be 2x16-bit (corrupt? more meaning) */
r21258r21259
11401141
1141114201a0(0x340) - 0403f 0003e 0f83e 0f83e 0f83a dd37e 05b2c e0f3c cf014 cb33c c5b16 c5800 0f83e 0f83e 0cb2c 01b2c // the compressed data referenced by (0x340)
1142114301b0(0x360) - 03374 de349 d0f83 d0f9a d0f83 02b9a e0f16 e8f16 d9688 c5a89 00b2c 00b7e e6365 d2348 c8b31 b7720
1143             c838a e4372 e0f43 d0f0e d2369 ce6dd da741 d07a7 c3b3c cf35c cf383 cf322 d2348 b7739 c8339 d0711           
1144             c838a e4372 e0f43 d0f0e d2369 ce6dd da741 d07a7 c3b3c cf35c cf383 cf322 d2348 b7739 c8339 d0711
11441145*/
11451146
11461147
r21258r21259
11791180                           {
11801181                                 int lookupnum = h + (v*m_hCellCount);
11811182                                 UINT32 spriteNumber = get_20bit_data( m_b3romoffset, lookupnum);
1182                                 
1183
11831184#if 0
11841185                                 printf("%05x (%08x,%d)  ",spriteNumber, (m_b3romoffset + (spriteNumber>>3)), spriteNumber&7 );
11851186
11861187
11871188                                 if ((h == m_hCellCount-1))
11881189                                    printf("\n");
1189                                 
1190
11901191                                 if ((h == m_hCellCount-1) && (v == m_vCellCount-1))
11911192                                    printf("\n");
11921193#endif
r21258r21259
11971198                                 if ((compdataoffset >= 0x016590) && (compdataoffset<=0x0165e6) && (h==0))
11981199                                 {
11991200                                    printf("%05x (%08x,%d) | ",spriteNumber, compdataoffset, spriteNumber&7 );
1200                                   
12011201
1202
12021203                                    //00200 (00016590,0)  00200 (00016590,0)
12031204                                    //00210 (00016592,0)  00210 (00016592,0)
12041205
r21258r21259
12131214
12141215                                       // as 10-bit (pretty, I like this)
12151216                                       /*                                                                                   |this is where 210 starts
1216                                       00200 (00016590,0) | 00f 03e 03e 03e 03e 03e 03e 03e 257 257 257 257 257 257 257 257 (00f 257)
1217                                       00200 (00016590,0) | 00f 03e 03e 03e 03e 03e 03e 03e 257 257 257 257 257 257 257 257 (00f 257)
12171218                                       00210 (00016592,0) | 00f 257 257 257 257 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 207 237 237 237 237 237 237 237 237 237 237 237 237 237 237 237 237 (00f 237) - these lines are 64 lone
12181219                                       00251 (0001659a,1) | 00f 237 237 237 237 237 237 237 237 237 237 237 237 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 22f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f (00f 21f)
12191220                                       00292 (000165a2,2) | 00f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 21f 24f 24f 24f 24f 24f 24f 24f 24f 24f 24f 24f 24f 0be 0be 0be 0be (00f 0be)
12201221                                       002b7 (000165a6,7) | 00f 0be 0be 0be 263 263 263 263 07e 07e 07e 07e 05e (00f 07e)
1221                                       002c4 (000165a8,4) | 00f 07e 07e 05e 247 247 247 247 247 247 247 247 247 247 247 247 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f (00f 20f)
1222                                       002c4 (000165a8,4) | 00f 07e 07e 05e 247 247 247 247 247 247 247 247 247 247 247 247 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f (00f 20f)
12221223                                       002f4 (000165ae,4) | 00f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 20f 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 233 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b 23b (00f 23b)
12231224                                       00335 (000165b6,5) | 00f 23b 23b 23b 23b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 20b 24b 24b 24b 24b 24b 24b 24b 24b 24b 24b 24b 24b 0de (00f 0fe)
12241225                                       00373 (000165be,3) | 00f 0fe 0fe 0fe 0fe 0fe 0fe 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 00f 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 223 267 267 267 267 17e 17e 17e 17e 15e (00f 17e)
r21258r21259
12461247                  for (int v = 0; v < m_vCellCount; v++)
12471248                  {
12481249                     const int pixelOffsetY = ((m_vPosition) + (v* 16 * m_vZoom)) / 0x40;
1249                     
1250
12501251                     if (pixelOffsetY>383)
12511252                     {
12521253                        v = m_vCellCount;
12531254                        continue;
12541255                     }
1255                     
12561256
1257
12571258                     for (int h = 0; h < m_hCellCount; h++)
12581259                     {
12591260                        const int pixelOffsetX = ((m_hPosition) + (h* 16 * m_hZoom)) / 0x40;
1260                       
1261
12611262                        if (pixelOffsetX>495)
12621263                        {
12631264                           h = m_hCellCount;
12641265                           continue;
12651266                        }
1266                           
1267
12671268                        int lookupnum = h + (v*m_hCellCount);
1268                       
1269
12691270                        // with this bit enabled the tile numbers gets looked up using 'data' (which would be m_blit11) (eg 03f40000 for startup text)
12701271                        // this allows text strings to be written as 8-bit ascii in one area (using command 0x10), and drawn using multi-width sprites
12711272                        if (m_indirect_tile_enable)
r21258r21259
12761277
12771278
12781279                        // these should be 'cell numbers' (tile numbers) which look up RLE data?
1279                        UINT32 spriteNumber = get_20bit_data( m_b3romoffset, lookupnum );     
1280                        UINT32 spriteNumber = get_20bit_data( m_b3romoffset, lookupnum );
12801281
12811282                        int i = 1;// skip first 10 bits for now
12821283                        int data_written = 0;
r21258r21259
12851286                        {
12861287
12871288                           UINT16 compdata = get_10bit_data( m_b3romoffset, spriteNumber + i);
1288                           
1289
12891290                           if (((compdata & 0x300) == 0x000) || ((compdata & 0x300) == 0x100))
12901291                           {
12911292                              // mm ccrr rrr0
r21258r21259
13231324                           i++;
13241325                        }
13251326
1326                           
13271327
1328                           
1329                       
13301328
1329
1330
1331
13311332                        int blockwide = ((16*m_hZoom)/0x40)-1;
13321333                        int blockhigh = ((16*m_vZoom)/0x40)-1;
13331334                        // hack
r21258r21259
13521353                                 if (line[drawx]==0) line[drawx] = clut[pix+0x4000];
13531354                           }
13541355                        }
1355                       
1356
13561357#if 0 // this one does zooming
13571358                        // DEBUG: Draw 16x16 block
13581359                        UINT32* line;
r21258r21259
16121613   if(offset == 8)
16131614   {
16141615      //popmessage("%02x",sound_data);
1615      /* TODO: this probably stalls the DMA transfers. */
1616      /*
1617      Checked in irq routine
1618      --x- ---- second SCSP
1619      ---x ---- first SCSP
1620      */
1621      m_subcpu->set_input_line(0xe, CLEAR_LINE);
16161622      return sound_data;
16171623   }
16181624
r21258r21259
17111717   AM_RANGE(0x60000000, 0x600003ff) AM_WRITENOP
17121718ADDRESS_MAP_END
17131719
1720/* TODO: what is this for, mixing? */
17141721WRITE8_MEMBER(coolridr_state::sound_to_sh1_w)
17151722{
1716   sound_data = data;
1723   sound_fifo_full = data & 0x80;
1724//   sound_data = data;
1725//   printf("%02x sound\n",data);
17171726}
17181727
17191728static ADDRESS_MAP_START( system_h1_sound_map, AS_PROGRAM, 16, coolridr_state )
r21258r21259
21702179      device->machine().device("soundcpu")->execute().set_input_line(-irq, CLEAR_LINE);
21712180}
21722181
2173WRITE_LINE_MEMBER(coolridr_state::scsp_to_main_irq)
2182/* TODO: how to clear the vector? */
2183WRITE_LINE_MEMBER(coolridr_state::scsp1_to_sh1_irq)
21742184{
2175   m_subcpu->set_input_line(0xe, HOLD_LINE);
2185   m_subcpu->set_input_line(0xe, ASSERT_LINE);
2186   sound_data = 0x10;
21762187}
21772188
2189WRITE_LINE_MEMBER(coolridr_state::scsp2_to_sh1_irq)
2190{
2191   m_subcpu->set_input_line(0xe, ASSERT_LINE);
2192   sound_data = 0x20;
2193}
2194
21782195static const scsp_interface scsp_config =
21792196{
21802197   0,
21812198   scsp_irq,
2182   DEVCB_DRIVER_LINE_MEMBER(coolridr_state, scsp_to_main_irq)
2199   DEVCB_DRIVER_LINE_MEMBER(coolridr_state, scsp1_to_sh1_irq)
21832200};
21842201
21852202static const scsp_interface scsp2_interface =
21862203{
21872204   0,
21882205   NULL,
2189   DEVCB_DRIVER_LINE_MEMBER(coolridr_state, scsp_to_main_irq)
2206   DEVCB_DRIVER_LINE_MEMBER(coolridr_state, scsp2_to_sh1_irq)
21902207};
21912208
21922209#define MAIN_CLOCK XTAL_28_63636MHz
r21258r21259
22752292   ROM_LOAD16_WORD_SWAP( "mpr-17647.ic8", 0x1c00000, 0x0400000, CRC(9dd9330c) SHA1(c91a7f497c1f4bd283bd683b06dff88893724d51) ) // 4900
22762293   ROM_LOAD16_WORD_SWAP( "mpr-17646.ic7", 0x2000000, 0x0400000, CRC(b77eb2ad) SHA1(b832c0f1798aca39adba840d56ae96a75346670a) ) // 0490
22772294   ROM_LOAD16_WORD_SWAP( "mpr-17645.ic6", 0x2400000, 0x0400000, CRC(56968d07) SHA1(e88c3d66ea05affb4681a25d155f097bd1b5a84b) ) // 0049
2278         
22792295
22802296
2297
22812298   ROM_REGION( 0x80000, "scsp1", 0 )   /* first SCSP's RAM */
22822299   ROM_FILL( 0x000000, 0x80000, 0 )
22832300

Previous 199869 Revisions Next


© 1997-2024 The MAME Team