trunk/src/mame/drivers/coolridr.c
| r21422 | r21423 | |
| 499 | 499 | static const gfx_layout h1_tile_layout = |
| 500 | 500 | { |
| 501 | 501 | 16,16, |
| 502 | | 0x800, |
| 502 | 0x1000, |
| 503 | 503 | 8, |
| 504 | 504 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 505 | 505 | { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 }, |
| r21422 | r21423 | |
| 544 | 544 | /* |
| 545 | 545 | vregs are setted up with one of DMA commands (see below) |
| 546 | 546 | 0x3e09b80 screen 1 base, 0x3e9bc0 screen 2 base |
| 547 | | [+0x1c] ---- ---- ---- ---- ---- ---- ---- -x-- disabled on screen 1, enabled on screen 2 (tile offset start?) |
| 548 | | [+0x1c] ---- ---- ---- ---- ---- ---- ---- ---x Enabled on bike select screen in tandem with +0x3c, solid pen fill? |
| 547 | [+0x1c] ---- ---- ---- ---- ---- ---- ---- -xxx tile offset start * 0x8000 |
| 549 | 548 | [+0x2c] ---- -xxx xxxx xxxx ---- --yy yyyy yyyy scrolling registers |
| 550 | 549 | [+0x34] 1111 1111 2222 2222 3333 3333 4444 4444 - Almost surely Sega "map" registers |
| 551 | 550 | [+0x38] 5555 5555 6666 6666 7777 7777 8888 8888 / |
| 552 | | [+0x3c] ---- ---- ---- ---- xxxx xxxx xxxx xxxx 0x11b8 on bike select, solid pen value? |
| 551 | [+0x3c] x--- ---- ---- ---- xxxx xxxx xxxx xxxx 0x11b8 on bike select, 0xffffffff otherwise, transparent pen value? |
| 553 | 552 | (everything else is unknown at current time) |
| 554 | 553 | */ |
| 555 | 554 | |
| 556 | 555 | UINT32 coolridr_state::screen_update_coolridr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int which) |
| 557 | 556 | { |
| 558 | 557 | /* planes seems to basically be at 0x8000 and 0x28000... */ |
| 559 | | UINT32 base_offset; |
| 560 | | int tile,color; |
| 561 | | int scrollx; |
| 562 | | int scrolly; |
| 563 | | gfx_element *gfx = machine().gfx[m_gfx_index]; |
| 564 | 558 | |
| 565 | | scrollx = (m_framebuffer_vram[(0x9bac+which*0x40)/4] >> 16) & 0x7ff; |
| 566 | | scrolly = m_framebuffer_vram[(0x9bac+which*0x40)/4] & 0x3ff; |
| 567 | | |
| 568 | | base_offset = (which * 0x20000)/2; |
| 569 | | m_color_bank = which * 2; |
| 570 | | |
| 571 | 559 | if(m_pen_fill[which]) |
| 572 | 560 | { |
| 573 | 561 | int bg_r,bg_g,bg_b; |
| r21422 | r21423 | |
| 579 | 567 | } |
| 580 | 568 | else |
| 581 | 569 | { |
| 570 | UINT32 base_offset; |
| 571 | int tile,vram_data,color; |
| 572 | int scrollx; |
| 573 | int scrolly; |
| 574 | UINT8 transpen_setting; |
| 575 | gfx_element *gfx = machine().gfx[m_gfx_index]; |
| 576 | #define VREG(_offs) \ |
| 577 | m_framebuffer_vram[(0x9b80+_offs+which*0x40)/4] |
| 578 | |
| 579 | scrollx = (VREG(0x2c) >> 16) & 0x7ff; |
| 580 | scrolly = VREG(0x2c) & 0x3ff; |
| 581 | |
| 582 | base_offset = (VREG(0x1c) * 0x8000)/2; |
| 583 | m_color_bank = which * 2; |
| 584 | /* TODO: the whole transpen logic might be incorrect */ |
| 585 | transpen_setting = (VREG(0x3c) & 0x80000000) >> 31; |
| 586 | |
| 587 | bitmap.fill(MAKE_ARGB(0xff,(VREG(0x3c) >> 16) & 0xff,(VREG(0x3c) >> 8) & 0xff,VREG(0x3c) & 0xff),cliprect); |
| 588 | |
| 582 | 589 | for (int y=0;y<64;y++) |
| 583 | 590 | { |
| 584 | 591 | for (int x=0;x<128;x++) |
| r21422 | r21423 | |
| 588 | 595 | res_x = (x*16)-scrollx; |
| 589 | 596 | res_y = (y*16)-scrolly; |
| 590 | 597 | |
| 591 | | tile = (m_h1_vram[x+y*128+base_offset] & 0x0fff); |
| 592 | | color = m_color_bank + ((tile & 0x800) >> 11) * 4; |
| 598 | vram_data = (m_h1_vram[x+y*128+base_offset] & 0xffff); |
| 599 | color = m_color_bank + ((vram_data & 0x800) >> 11) * 4; |
| 600 | /* bike select enables bits 15-12, pretty sure one of these is tile bank (because there's a solid pen on 0x3ff / 0x7ff). */ |
| 601 | tile = (vram_data & 0x7ff) | ((vram_data & 0x8000) >> 4); |
| 593 | 602 | |
| 594 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y); |
| 595 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y); |
| 596 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x,res_y+1024); |
| 597 | | drawgfx_opaque(bitmap,cliprect,gfx,tile & 0x7ff,color,0,0,res_x+2048,res_y+1024); |
| 603 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,res_x,res_y,transpen_setting ? -1 : 0); |
| 604 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,res_x+2048,res_y,transpen_setting ? -1 : 0); |
| 605 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,res_x,res_y+1024,transpen_setting ? -1 : 0); |
| 606 | drawgfx_transpen(bitmap,cliprect,gfx,tile,color,0,0,res_x+2048,res_y+1024,transpen_setting ? -1 : 0); |
| 598 | 607 | } |
| 599 | 608 | } |
| 600 | 609 | } |