trunk/src/mame/drivers/coolridr.c
| r21400 | r21401 | |
| 379 | 379 | m_subcpu(*this,"sub"), |
| 380 | 380 | m_soundcpu(*this,"soundcpu"), |
| 381 | 381 | //m_dmac(*this, "i8237"), |
| 382 | | m_h1_vram(*this, "h1_vram"), |
| 383 | 382 | m_h1_charram(*this, "h1_charram"), |
| 384 | 383 | m_framebuffer_vram(*this, "fb_vram"), |
| 385 | 384 | m_txt_vram(*this, "txt_vram"), |
| r21400 | r21401 | |
| 402 | 401 | // store the blit params here |
| 403 | 402 | UINT32 m_spriteblit[12]; |
| 404 | 403 | |
| 405 | | |
| 406 | | |
| 407 | | |
| 408 | | |
| 409 | | |
| 410 | | |
| 411 | | |
| 412 | | |
| 413 | | |
| 414 | | |
| 415 | 404 | required_device<cpu_device> m_maincpu; |
| 416 | 405 | required_device<cpu_device> m_subcpu; |
| 417 | 406 | required_device<cpu_device> m_soundcpu; |
| 418 | 407 | //required_device<am9517a_device> m_dmac; |
| 419 | 408 | |
| 420 | | required_shared_ptr<UINT32> m_h1_vram; |
| 421 | 409 | required_shared_ptr<UINT32> m_h1_charram; |
| 422 | 410 | required_shared_ptr<UINT32> m_framebuffer_vram; |
| 423 | 411 | required_shared_ptr<UINT32> m_txt_vram; |
| r21400 | r21401 | |
| 447 | 435 | DECLARE_WRITE32_MEMBER(sysh1_sound_dma_w); |
| 448 | 436 | DECLARE_READ32_MEMBER(sysh1_ioga_r); |
| 449 | 437 | DECLARE_WRITE32_MEMBER(sysh1_ioga_w); |
| 438 | DECLARE_READ32_MEMBER(sysh1_unk_blit_r); |
| 450 | 439 | DECLARE_WRITE32_MEMBER(sysh1_unk_blit_w); |
| 451 | 440 | DECLARE_WRITE32_MEMBER(sysh1_blit_mode_w); |
| 452 | 441 | DECLARE_WRITE32_MEMBER(sysh1_blit_data_w); |
| r21400 | r21401 | |
| 481 | 470 | |
| 482 | 471 | void sysh1_dma_transfer( address_space &space, UINT16 dma_index ); |
| 483 | 472 | |
| 473 | UINT8 *m_h1_vram; |
| 474 | |
| 484 | 475 | }; |
| 485 | 476 | |
| 486 | 477 | #define PRINT_BLIT_STUFF \ |
| 487 | 478 | printf("type blit %08x %08x(%d, %03x) %08x(%02x, %03x) %08x(%06x) %08x(%08x, %d, %d, %d) %08x(%d,%d) %04x %04x %04x %04x %08x %08x %d %d\n", blit0, blit1_unused,b1mode,b1colorNumber, blit2_unused,b2tpen,b2colorNumber, blit3_unused,b3romoffset, blit4_unused, blit4, blit_flipy,blit_rotate, blit_flipx, blit5_unused, indirect_tile_enable, indirect_zoom_enable, vCellCount, hCellCount, vZoom, hZoom, blit10, textlookup, vPosition, hPosition); \ |
| 488 | 479 | |
| 489 | 480 | |
| 481 | |
| 490 | 482 | /* video */ |
| 491 | 483 | |
| 484 | #define VRAM_SIZE 0x100000 |
| 485 | |
| 492 | 486 | void coolridr_state::video_start() |
| 493 | 487 | { |
| 494 | 488 | machine().primary_screen->register_screen_bitmap(m_temp_bitmap_sprites[0]); |
| r21400 | r21401 | |
| 504 | 498 | |
| 505 | 499 | machine().primary_screen->register_screen_bitmap(m_screen1_bitmap); |
| 506 | 500 | machine().primary_screen->register_screen_bitmap(m_screen2_bitmap); |
| 501 | |
| 502 | m_h1_vram = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); |
| 503 | |
| 504 | save_pointer(NAME(m_h1_vram), VRAM_SIZE); |
| 507 | 505 | } |
| 508 | 506 | |
| 509 | 507 | // might be a page 'map / base' setup somewhere, but it's just used for ingame backgrounds |
| r21400 | r21401 | |
| 520 | 518 | int scrollx; |
| 521 | 519 | int scrolly; |
| 522 | 520 | |
| 523 | | count = 0/4; |
| 521 | count = 0; |
| 524 | 522 | m_color = 0; |
| 525 | 523 | |
| 526 | 524 | if (which==1) |
| 527 | 525 | { |
| 528 | | count += 0x20000/4; |
| 526 | count += 0x20000; |
| 529 | 527 | // color += 0x5e; |
| 530 | 528 | m_color = 2; |
| 531 | 529 | } |
| r21400 | r21401 | |
| 541 | 539 | /* TODO: optimize! */ |
| 542 | 540 | for (y=0;y<64;y++) |
| 543 | 541 | { |
| 544 | | for (x=0;x<128;x+=2) |
| 542 | for (x=0;x<128;x++) |
| 545 | 543 | { |
| 546 | 544 | int tile; |
| 547 | 545 | int res_x,res_y; |
| 546 | UINT16 cur_ptr; |
| 548 | 547 | |
| 549 | | res_x = ((x+0)*16)-scrollx; |
| 548 | res_x = (x*16)-scrollx; |
| 550 | 549 | res_y = (y*16)-scrolly; |
| 551 | 550 | |
| 552 | | tile = (m_h1_vram[count] & 0x0fff0000) >> 16; |
| 553 | | color = m_color + ((tile & 0x800) >> 11) * 4; |
| 551 | cur_ptr = (m_h1_vram[count]<<8)|m_h1_vram[count+1]; |
| 554 | 552 | |
| 555 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y); |
| 556 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y); |
| 557 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y+1024); |
| 558 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y+1024); |
| 553 | tile = cur_ptr & 0x07ff; |
| 554 | color = m_color + ((cur_ptr & 0x0800) >> 11) * 4; |
| 559 | 555 | |
| 560 | | res_x = ((x+1)*16)-scrollx; |
| 561 | | res_y = (y*16)-scrolly; |
| 556 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color,0,0,res_x,res_y); |
| 557 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color,0,0,res_x+2048,res_y); |
| 558 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color,0,0,res_x,res_y+1024); |
| 559 | drawgfx_opaque(bitmap,cliprect,gfx,tile,color,0,0,res_x+2048,res_y+1024); |
| 562 | 560 | |
| 563 | | tile = (m_h1_vram[count] & 0x00000fff) >> 0; |
| 564 | | color = m_color + ((tile & 0x800) >> 11) * 4; |
| 565 | | |
| 566 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y); |
| 567 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y); |
| 568 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y+1024); |
| 569 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y+1024); |
| 570 | | |
| 571 | | |
| 572 | | count++; |
| 561 | count+=2; |
| 573 | 562 | } |
| 574 | 563 | } |
| 575 | 564 | |
| r21400 | r21401 | |
| 1477 | 1466 | m_blitterClearCount++; |
| 1478 | 1467 | } |
| 1479 | 1468 | |
| 1469 | READ32_MEMBER(coolridr_state::sysh1_unk_blit_r) |
| 1470 | { |
| 1471 | // if(offset == 0x0c/4) reads |
| 1480 | 1472 | |
| 1473 | return m_sysh1_txt_blit[offset]; |
| 1474 | } |
| 1481 | 1475 | |
| 1476 | |
| 1482 | 1477 | WRITE32_MEMBER(coolridr_state::sysh1_unk_blit_w) |
| 1483 | 1478 | { |
| 1484 | 1479 | COMBINE_DATA(&m_sysh1_txt_blit[offset]); |
| r21400 | r21401 | |
| 1501 | 1496 | case 0x02: |
| 1502 | 1497 | { |
| 1503 | 1498 | |
| 1504 | | // writes 3d0dxxxx / 3d0exxxx before a level start.. tilemaps transfer? |
| 1499 | // writes 3d0dxxxx / 3d0exxxx before a level start.. offset for a transfer read at 0x400000c, stored in work RAM H |
| 1505 | 1500 | |
| 1506 | 1501 | //printf("sysh1_unk_blit_w unhandled offset %04x %08x %08x\n", offset, data, mem_mask); |
| 1507 | 1502 | |
| r21400 | r21401 | |
| 1556 | 1551 | if(dst & 0xfff00000) |
| 1557 | 1552 | printf("unk values to %02x dst %08x\n",cmd,dst); |
| 1558 | 1553 | dst &= 0x000fffff; |
| 1559 | | dst |= 0x03000000; |
| 1560 | | size*=2; |
| 1561 | 1554 | is_dma = 1; |
| 1562 | | //printf("%08x %08x %08x %02x\n",src,dst,size,cmd); |
| 1563 | 1555 | dma_index+=0xc; |
| 1564 | 1556 | break; |
| 1565 | 1557 | |
| r21400 | r21401 | |
| 1572 | 1564 | dst &= 0x000fffff; |
| 1573 | 1565 | dst |= 0x05800000; |
| 1574 | 1566 | size*=2; |
| 1575 | | is_dma = 1; |
| 1567 | is_dma = 2; |
| 1576 | 1568 | //printf("%08x %08x %08x %02x\n",src,dst,size,cmd); |
| 1577 | 1569 | dma_index+=0xc; |
| 1578 | 1570 | break; |
| r21400 | r21401 | |
| 1586 | 1578 | printf("unk values to %02x dst %08x\n",cmd,dst); |
| 1587 | 1579 | dst &= 0x000fffff; |
| 1588 | 1580 | dst |= 0x03800000; |
| 1589 | | is_dma = 1; |
| 1581 | is_dma = 2; |
| 1590 | 1582 | //printf("%08x %08x %08x %02x\n",src,dst,size,cmd); |
| 1591 | 1583 | dma_index+=0xc; |
| 1592 | 1584 | break; |
| r21400 | r21401 | |
| 1610 | 1602 | break; |
| 1611 | 1603 | } |
| 1612 | 1604 | |
| 1613 | | if(is_dma) |
| 1605 | /* TODO: clean-up at a later stage (once that I properly rewrite everything) */ |
| 1606 | if(is_dma == 1) |
| 1614 | 1607 | { |
| 1608 | UINT16 read_src; |
| 1609 | |
| 1610 | for(int i=0;i<size;i+=2) |
| 1611 | { |
| 1612 | read_src = space.read_word(src); |
| 1613 | |
| 1614 | m_h1_vram[dst] = read_src >> 8; |
| 1615 | m_h1_vram[dst+1] = read_src & 0xff; |
| 1616 | dst+=2; |
| 1617 | src+=2; |
| 1618 | } |
| 1619 | } |
| 1620 | else if(is_dma == 2) |
| 1621 | { |
| 1615 | 1622 | for(int i=0;i<size;i+=4) |
| 1616 | 1623 | { |
| 1617 | 1624 | space.write_dword(dst,space.read_dword(src)); |
| r21400 | r21401 | |
| 1655 | 1662 | AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_SHARE("share1") AM_WRITENOP |
| 1656 | 1663 | AM_RANGE(0x01000000, 0x01ffffff) AM_ROM AM_REGION("gfx_data",0x0000000) |
| 1657 | 1664 | |
| 1658 | | AM_RANGE(0x03000000, 0x030fffff) AM_RAM AM_SHARE("h1_vram")//bg vram TODO: fake region |
| 1659 | 1665 | AM_RANGE(0x03800000, 0x0380ffff) AM_RAM_WRITE(sysh1_pal_w) AM_SHARE("paletteram") |
| 1660 | 1666 | AM_RANGE(0x03c00000, 0x03c1ffff) AM_MIRROR(0x00200000) AM_RAM_WRITE(sysh1_dma_w) AM_SHARE("fb_vram") /* mostly mapped at 0x03e00000 */ |
| 1661 | 1667 | |
| 1662 | 1668 | AM_RANGE(0x03f00000, 0x03f0ffff) AM_RAM AM_SHARE("share3") /*Communication area RAM*/ |
| 1663 | 1669 | AM_RANGE(0x03f40000, 0x03f4ffff) AM_RAM AM_SHARE("txt_vram")//text tilemap + "lineram" |
| 1664 | | AM_RANGE(0x04000000, 0x0400000f) AM_RAM_WRITE(sysh1_unk_blit_w) AM_SHARE("sysh1_txt_blit") |
| 1670 | AM_RANGE(0x04000000, 0x0400000f) AM_READWRITE(sysh1_unk_blit_r,sysh1_unk_blit_w) AM_SHARE("sysh1_txt_blit") |
| 1665 | 1671 | AM_RANGE(0x04000010, 0x04000013) AM_WRITE(sysh1_blit_mode_w) |
| 1666 | 1672 | AM_RANGE(0x04000014, 0x04000017) AM_WRITE(sysh1_blit_data_w) |
| 1667 | 1673 | AM_RANGE(0x04000018, 0x0400001b) AM_WRITE(sysh1_fb_mode_w) |
| r21400 | r21401 | |
| 2280 | 2286 | |
| 2281 | 2287 | void coolridr_state::machine_start() |
| 2282 | 2288 | { |
| 2283 | | // machine().device("maincpu")->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2284 | | // m_soundcpu->execute().set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 2285 | | |
| 2286 | | // memcpy(memregion("soundcpu")->base(), memregion("maincpu")->base()+0x100000, 0x80000); |
| 2287 | | // m_soundcpu->reset(); |
| 2288 | 2289 | m_compressedgfx = memregion( "compressedgfx" )->base(); |
| 2289 | 2290 | size_t size = memregion( "compressedgfx" )->bytes(); |
| 2290 | 2291 | |
| r21400 | r21401 | |
| 2552 | 2553 | sh2drc_set_options(machine().device("sub"), SH2DRC_FASTEST_OPTIONS); |
| 2553 | 2554 | } |
| 2554 | 2555 | |
| 2555 | | GAME( 1995, coolridr, 0, coolridr, coolridr, coolridr_state, coolridr, ROT0, "Sega", "Cool Riders",GAME_NOT_WORKING|GAME_NO_SOUND ) // region is set in test mode, this set is for Japan, USA and Export (all regions) |
| 2556 | GAME( 1995, coolridr, 0, coolridr, coolridr, coolridr_state, coolridr, ROT0, "Sega", "Cool Riders",GAME_NOT_WORKING|GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // region is set in test mode, this set is for Japan, USA and Export (all regions) |
| 2556 | 2557 | |