Previous 199869 Revisions Next

r21179 Tuesday 19th February, 2013 at 12:39:59 UTC by David Haywood
coolriders is a dual screen game, so give it 2 screens and take a wild guess at the screen select.
[src/mame/drivers]coolridr.c

trunk/src/mame/drivers/coolridr.c
r21178r21179
252252#include "cpu/m68000/m68000.h"
253253#include "sound/scsp.h"
254254#include "machine/am9517a.h"
255#include "rendlay.h"
255256
256
257257class coolridr_state : public driver_device
258258{
259259public:
r21178r21179
305305   required_shared_ptr<UINT32> m_sysh1_workram_h;
306306   required_shared_ptr<UINT32> m_h1_unk;
307307   bitmap_rgb32 m_temp_bitmap_sprites;
308   bitmap_rgb32 m_temp_bitmap_sprites2;
308309   UINT32 m_test_offs;
309310   int m_color;
310311   UINT8 m_vblank;
r21178r21179
324325   DECLARE_DRIVER_INIT(coolridr);
325326   virtual void machine_reset();
326327   virtual void video_start();
327   UINT32 screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
328   UINT32 screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which);
329   UINT32 screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
330   UINT32 screen_update_coolridr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
328331   INTERRUPT_GEN_MEMBER(system_h1);
329332   TIMER_DEVICE_CALLBACK_MEMBER(system_h1_sub);
330333};
r21178r21179
336339void coolridr_state::video_start()
337340{
338341   machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites);
342   machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2);
339343   m_test_offs = 0x2000;
340344}
341345
342UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
346UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which)
343347{
344348   /* planes seems to basically be at 0x8000 and 0x28000... */
345349   gfx_element *gfx = machine().gfx[2];
346350   UINT32 count;
347351   int y,x;
348352
353   count = m_test_offs/4;
349354
355   for (y=0;y<64;y++)
356   {
357      for (x=0;x<128;x+=2)
358      {
359         int tile;
360
361         tile = (m_h1_vram[count] & 0x0fff0000) >> 16;
362         drawgfx_opaque(bitmap,cliprect,gfx,tile,m_color,0,0,(x+0)*16,y*16);
363
364         tile = (m_h1_vram[count] & 0x00000fff) >> 0;
365         drawgfx_opaque(bitmap,cliprect,gfx,tile,m_color,0,0,(x+1)*16,y*16);
366
367         count++;
368      }
369   }
370
371   if (which==0)
372   {
373      copybitmap_trans(bitmap, m_temp_bitmap_sprites, 0, 0, 0, 0, cliprect, 0);
374      m_temp_bitmap_sprites.fill(0, cliprect);
375   }
376   else
377   {
378      copybitmap_trans(bitmap, m_temp_bitmap_sprites2, 0, 0, 0, 0, cliprect, 0);
379      m_temp_bitmap_sprites2.fill(0, cliprect);
380   }
381
382   return 0;
383}
384
385UINT32 coolridr_state::screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
386{
387
350388   if(machine().input().code_pressed(KEYCODE_Z))
351389      m_test_offs+=4;
352390
r21178r21179
374412   if(m_test_offs > 0x100000*4)
375413      m_test_offs = 0;
376414
377   count = m_test_offs/4;
378
379415   popmessage("%08x %04x",m_test_offs,m_color);
380416
381   for (y=0;y<64;y++)
382   {
383      for (x=0;x<128;x+=2)
384      {
385         int tile;
417   return screen_update_coolridr(screen,bitmap,cliprect,0);
418}
386419
387         tile = (m_h1_vram[count] & 0x0fff0000) >> 16;
388         drawgfx_opaque(bitmap,cliprect,gfx,tile,m_color,0,0,(x+0)*16,y*16);
389
390         tile = (m_h1_vram[count] & 0x00000fff) >> 0;
391         drawgfx_opaque(bitmap,cliprect,gfx,tile,m_color,0,0,(x+1)*16,y*16);
392
393         count++;
394      }
395   }
396
397   copybitmap_trans(bitmap, m_temp_bitmap_sprites, 0, 0, 0, 0, cliprect, 0);
398   m_temp_bitmap_sprites.fill(0, cliprect);
399
400
401   return 0;
420UINT32 coolridr_state::screen_update_coolridr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
421{
422   return screen_update_coolridr(screen,bitmap,cliprect,1);
402423}
403424
404425/* end video */
r21178r21179
522543            else if (m_blitterSerialCount == 11)
523544            {
524545               const UINT32 memOffset = data;
546               bitmap_rgb32* drawbitmap;
547               
548               // guess, you can see the different sizes of bike cross from the left screen to the right where the attract text is
549               if (m_blitterMode == 0x30)
550                  drawbitmap = &m_temp_bitmap_sprites;
551               else // 0x90
552                  drawbitmap = &m_temp_bitmap_sprites2;
525553
526554               // Splat some sprites
527555               for (int h = 0; h < m_hCellCount; h++)
528556               {
529557                  for (int v = 0; v < m_vCellCount; v++)
530558                  {
531                     const int pixelOffsetX = m_hPosition + (h*16);
532                     const int pixelOffsetY = m_vPosition + (v*16);
559                     const int pixelOffsetX = (m_hPosition) + (h*16);
560                     const int pixelOffsetY = (m_vPosition) + (v*16);
533561
534562                     // It's unknown if it's row-major or column-major
535563                     // TODO: Study the CRT test and "Cool Riders" logo for clues.
r21178r21179
553581                              color = 0xff0000ff;
554582                           else
555583                              color = 0xff00ffff;
556                           m_temp_bitmap_sprites.pix32(pixelOffsetY+y, pixelOffsetX+x) = color;
584
585                           if (drawbitmap->cliprect().contains(pixelOffsetX+x, pixelOffsetY+y))
586                              drawbitmap->pix32(pixelOffsetY+y, pixelOffsetX+x) = color;
557587                        }
558588                     }
559589                  }
r21178r21179
562592
563593            m_blitterSerialCount++;
564594         }
595         // are these blits to other layers, road, object etc?
596         else if (m_blitterMode == 0xa0)
597         {
598            // ?
599         }
600         else if (m_blitterMode == 0xb0)
601         {
602            // ?
603         }
604         else if (m_blitterMode == 0x40)
605         {
606            // ?
607         }
608         else if (m_blitterMode == 0x50)
609         {
610            // ?
611         }
612         else
613         {
614            logerror("unk blit mode %02x\n", m_blitterMode);
615         }
565616         break;
566617      }
567618   }
r21178r21179
11741225static MACHINE_CONFIG_START( coolridr, coolridr_state )
11751226   MCFG_CPU_ADD("maincpu", SH2, MAIN_CLOCK)  // 28 mhz
11761227   MCFG_CPU_PROGRAM_MAP(system_h1_map)
1177   MCFG_CPU_VBLANK_INT_DRIVER("screen", coolridr_state, system_h1)
1228   MCFG_CPU_VBLANK_INT_DRIVER("lscreen", coolridr_state, system_h1)
11781229
11791230   MCFG_CPU_ADD("soundcpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz
11801231   MCFG_CPU_PROGRAM_MAP(system_h1_sound_map)
11811232
11821233   MCFG_CPU_ADD("sub", SH1, 16000000)  // SH7032 HD6417032F20!! 16 mhz
11831234   MCFG_CPU_PROGRAM_MAP(coolridr_submap)
1184   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", coolridr_state, system_h1_sub, "screen", 0, 1)
1235   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", coolridr_state, system_h1_sub, "lscreen", 0, 1)
11851236
11861237   MCFG_I8237_ADD("i8237", 16000000, dmac_intf)
11871238
11881239   MCFG_GFXDECODE(coolridr)
11891240
1190   MCFG_SCREEN_ADD("screen", RASTER)
1241   MCFG_SCREEN_ADD("lscreen", RASTER)
11911242   MCFG_SCREEN_REFRESH_RATE(60)
1192   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
1193   MCFG_SCREEN_SIZE(128*8+22, 64*8+44)
1194   MCFG_SCREEN_VISIBLE_AREA(0*8, 128*8-1, 0*8, 64*8-1) //TODO: these are just two different screens
1195   MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update_coolridr)
1243   MCFG_SCREEN_SIZE(640, 512)
1244   //MCFG_SCREEN_VISIBLE_AREA(0,495, 0, 383) // this resolution is right for test mode, but too low for the game, it can probably change
1245   MCFG_SCREEN_VISIBLE_AREA(0,639, 0, 479)
1246   MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update_coolridr1)
11961247
1248   MCFG_SCREEN_ADD("rscreen", RASTER)
1249   MCFG_SCREEN_REFRESH_RATE(60)
1250   MCFG_SCREEN_SIZE(640, 512)
1251   //MCFG_SCREEN_VISIBLE_AREA(0,495, 0, 383)
1252   MCFG_SCREEN_VISIBLE_AREA(0,639, 0, 479)
1253   MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update_coolridr2)
1254
1255
11971256   MCFG_PALETTE_LENGTH(0x10000)
1257   MCFG_DEFAULT_LAYOUT(layout_dualhsxs)
11981258
11991259MACHINE_CONFIG_END
12001260
r21178r21179
12191279   ROM_REGION32_BE( 0x100000, "ram_gfx", ROMREGION_ERASE00 ) /* SH2 code */
12201280
12211281   ROM_REGION( 0x100000, "soundcpu", ROMREGION_ERASE00 )   /* 68000 */
1222   ROM_COPY( "maincpu", 0x100000, 0x000000, 0x080000 ) //hardcoded from SH-2 roms? no, It doesn't seem so...
1282   ROM_COPY( "maincpu", 0x100000, 0x000000, 0x080000 ) //hardcoded from SH-2 roms? no, It doesn't seem so... (missing a DMA transfer for it?)
12231283
12241284   ROM_REGION( 0x100000, "sub", 0 ) /* SH1 */
12251285   ROM_LOAD16_WORD_SWAP( "ep17662.12", 0x000000, 0x020000,  CRC(50d66b1f) SHA1(f7b7f2f5b403a13b162f941c338a3e1207762a0b) )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team