trunk/src/mame/drivers/coolridr.c
| r21178 | r21179 | |
| 252 | 252 | #include "cpu/m68000/m68000.h" |
| 253 | 253 | #include "sound/scsp.h" |
| 254 | 254 | #include "machine/am9517a.h" |
| 255 | #include "rendlay.h" |
| 255 | 256 | |
| 256 | | |
| 257 | 257 | class coolridr_state : public driver_device |
| 258 | 258 | { |
| 259 | 259 | public: |
| r21178 | r21179 | |
| 305 | 305 | required_shared_ptr<UINT32> m_sysh1_workram_h; |
| 306 | 306 | required_shared_ptr<UINT32> m_h1_unk; |
| 307 | 307 | bitmap_rgb32 m_temp_bitmap_sprites; |
| 308 | bitmap_rgb32 m_temp_bitmap_sprites2; |
| 308 | 309 | UINT32 m_test_offs; |
| 309 | 310 | int m_color; |
| 310 | 311 | UINT8 m_vblank; |
| r21178 | r21179 | |
| 324 | 325 | DECLARE_DRIVER_INIT(coolridr); |
| 325 | 326 | virtual void machine_reset(); |
| 326 | 327 | 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); |
| 328 | 331 | INTERRUPT_GEN_MEMBER(system_h1); |
| 329 | 332 | TIMER_DEVICE_CALLBACK_MEMBER(system_h1_sub); |
| 330 | 333 | }; |
| r21178 | r21179 | |
| 336 | 339 | void coolridr_state::video_start() |
| 337 | 340 | { |
| 338 | 341 | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites); |
| 342 | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites2); |
| 339 | 343 | m_test_offs = 0x2000; |
| 340 | 344 | } |
| 341 | 345 | |
| 342 | | UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 346 | UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which) |
| 343 | 347 | { |
| 344 | 348 | /* planes seems to basically be at 0x8000 and 0x28000... */ |
| 345 | 349 | gfx_element *gfx = machine().gfx[2]; |
| 346 | 350 | UINT32 count; |
| 347 | 351 | int y,x; |
| 348 | 352 | |
| 353 | count = m_test_offs/4; |
| 349 | 354 | |
| 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 | |
| 385 | UINT32 coolridr_state::screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 386 | { |
| 387 | |
| 350 | 388 | if(machine().input().code_pressed(KEYCODE_Z)) |
| 351 | 389 | m_test_offs+=4; |
| 352 | 390 | |
| r21178 | r21179 | |
| 374 | 412 | if(m_test_offs > 0x100000*4) |
| 375 | 413 | m_test_offs = 0; |
| 376 | 414 | |
| 377 | | count = m_test_offs/4; |
| 378 | | |
| 379 | 415 | popmessage("%08x %04x",m_test_offs,m_color); |
| 380 | 416 | |
| 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 | } |
| 386 | 419 | |
| 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; |
| 420 | UINT32 coolridr_state::screen_update_coolridr2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 421 | { |
| 422 | return screen_update_coolridr(screen,bitmap,cliprect,1); |
| 402 | 423 | } |
| 403 | 424 | |
| 404 | 425 | /* end video */ |
| r21178 | r21179 | |
| 522 | 543 | else if (m_blitterSerialCount == 11) |
| 523 | 544 | { |
| 524 | 545 | 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; |
| 525 | 553 | |
| 526 | 554 | // Splat some sprites |
| 527 | 555 | for (int h = 0; h < m_hCellCount; h++) |
| 528 | 556 | { |
| 529 | 557 | for (int v = 0; v < m_vCellCount; v++) |
| 530 | 558 | { |
| 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); |
| 533 | 561 | |
| 534 | 562 | // It's unknown if it's row-major or column-major |
| 535 | 563 | // TODO: Study the CRT test and "Cool Riders" logo for clues. |
| r21178 | r21179 | |
| 553 | 581 | color = 0xff0000ff; |
| 554 | 582 | else |
| 555 | 583 | 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; |
| 557 | 587 | } |
| 558 | 588 | } |
| 559 | 589 | } |
| r21178 | r21179 | |
| 562 | 592 | |
| 563 | 593 | m_blitterSerialCount++; |
| 564 | 594 | } |
| 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 | } |
| 565 | 616 | break; |
| 566 | 617 | } |
| 567 | 618 | } |
| r21178 | r21179 | |
| 1174 | 1225 | static MACHINE_CONFIG_START( coolridr, coolridr_state ) |
| 1175 | 1226 | MCFG_CPU_ADD("maincpu", SH2, MAIN_CLOCK) // 28 mhz |
| 1176 | 1227 | 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) |
| 1178 | 1229 | |
| 1179 | 1230 | MCFG_CPU_ADD("soundcpu", M68000, 11289600) //256 x 44100 Hz = 11.2896 MHz |
| 1180 | 1231 | MCFG_CPU_PROGRAM_MAP(system_h1_sound_map) |
| 1181 | 1232 | |
| 1182 | 1233 | MCFG_CPU_ADD("sub", SH1, 16000000) // SH7032 HD6417032F20!! 16 mhz |
| 1183 | 1234 | 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) |
| 1185 | 1236 | |
| 1186 | 1237 | MCFG_I8237_ADD("i8237", 16000000, dmac_intf) |
| 1187 | 1238 | |
| 1188 | 1239 | MCFG_GFXDECODE(coolridr) |
| 1189 | 1240 | |
| 1190 | | MCFG_SCREEN_ADD("screen", RASTER) |
| 1241 | MCFG_SCREEN_ADD("lscreen", RASTER) |
| 1191 | 1242 | 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) |
| 1196 | 1247 | |
| 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 | |
| 1197 | 1256 | MCFG_PALETTE_LENGTH(0x10000) |
| 1257 | MCFG_DEFAULT_LAYOUT(layout_dualhsxs) |
| 1198 | 1258 | |
| 1199 | 1259 | MACHINE_CONFIG_END |
| 1200 | 1260 | |
| r21178 | r21179 | |
| 1219 | 1279 | ROM_REGION32_BE( 0x100000, "ram_gfx", ROMREGION_ERASE00 ) /* SH2 code */ |
| 1220 | 1280 | |
| 1221 | 1281 | 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?) |
| 1223 | 1283 | |
| 1224 | 1284 | ROM_REGION( 0x100000, "sub", 0 ) /* SH1 */ |
| 1225 | 1285 | ROM_LOAD16_WORD_SWAP( "ep17662.12", 0x000000, 0x020000, CRC(50d66b1f) SHA1(f7b7f2f5b403a13b162f941c338a3e1207762a0b) ) |