trunk/src/mame/drivers/coolridr.c
| r21403 | r21404 | |
| 470 | 470 | |
| 471 | 471 | UINT8 *m_h1_vram; |
| 472 | 472 | UINT8 *m_h1_pcg; |
| 473 | | |
| 473 | UINT8 *m_h1_pal; |
| 474 | 474 | }; |
| 475 | 475 | |
| 476 | 476 | #define PRINT_BLIT_STUFF \ |
| r21403 | r21404 | |
| 500 | 500 | |
| 501 | 501 | m_h1_vram = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); |
| 502 | 502 | m_h1_pcg = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); |
| 503 | m_h1_pal = auto_alloc_array_clear(machine(), UINT8, VRAM_SIZE); |
| 503 | 504 | |
| 504 | 505 | save_pointer(NAME(m_h1_vram), VRAM_SIZE); |
| 505 | 506 | save_pointer(NAME(m_h1_pcg), VRAM_SIZE); |
| 507 | save_pointer(NAME(m_h1_pal), VRAM_SIZE); |
| 506 | 508 | } |
| 507 | 509 | |
| 508 | 510 | // might be a page 'map / base' setup somewhere, but it's just used for ingame backgrounds |
| r21403 | r21404 | |
| 538 | 540 | for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) |
| 539 | 541 | { |
| 540 | 542 | UINT16 cur_tile; |
| 541 | | UINT16 dot_data; |
| 543 | UINT16 dot_data,pal_data; |
| 544 | int r,g,b; |
| 542 | 545 | |
| 543 | 546 | xsrc = ((xdst + scrollx) >> 4) & (xsize_mask); |
| 544 | 547 | ysrc = ((ydst + scrolly) >> 4) & (ysize_mask); |
| r21403 | r21404 | |
| 557 | 560 | pcg_offs = (xisrc+yisrc*xi_size)+tile*xi_size*yi_size; |
| 558 | 561 | dot_data = m_h1_pcg[pcg_offs] & 0xff; |
| 559 | 562 | dot_data+= color<<8; |
| 563 | dot_data*= 2; |
| 560 | 564 | |
| 561 | | bitmap.pix32(ydst, xdst) = machine().pens[dot_data]; |
| 565 | /* finally, take the palette data (TODO: apply RGB control) */ |
| 566 | pal_data = m_h1_pal[dot_data]<<8|m_h1_pal[dot_data+1]; |
| 567 | r = pal5bit((pal_data >> 10) & 0x1f); |
| 568 | g = pal5bit((pal_data >> 5) & 0x1f); |
| 569 | b = pal5bit((pal_data >> 0) & 0x1f); |
| 570 | |
| 571 | bitmap.pix32(ydst, xdst) = r<<16 | g<<8 | b; |
| 562 | 572 | } |
| 563 | 573 | } |
| 564 | 574 | |
| r21403 | r21404 | |
| 576 | 586 | |
| 577 | 587 | UINT32 coolridr_state::screen_update_coolridr1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 578 | 588 | { |
| 579 | | #if 0 |
| 580 | | if(machine().input().code_pressed_once(KEYCODE_A)) |
| 581 | | m_color++; |
| 582 | | |
| 583 | | if(machine().input().code_pressed_once(KEYCODE_S)) |
| 584 | | m_color--; |
| 585 | | |
| 586 | | #endif |
| 587 | | |
| 588 | | // popmessage("%04x",m_color); |
| 589 | | |
| 590 | 589 | return screen_update_coolridr(screen,bitmap,cliprect,0); |
| 591 | 590 | } |
| 592 | 591 | |
| r21403 | r21404 | |
| 1508 | 1507 | } |
| 1509 | 1508 | |
| 1510 | 1509 | |
| 1511 | | // NOTE, this gets called from the blitter code above AND the DMA code below.. addresses from each are probably wrong |
| 1512 | | WRITE32_MEMBER(coolridr_state::sysh1_pal_w) |
| 1513 | | { |
| 1514 | | int r,g,b; |
| 1515 | | COMBINE_DATA(&m_generic_paletteram_32[offset]); |
| 1516 | 1510 | |
| 1517 | | r = ((m_generic_paletteram_32[offset] & 0x00007c00) >> 10); |
| 1518 | | g = ((m_generic_paletteram_32[offset] & 0x000003e0) >> 5); |
| 1519 | | b = ((m_generic_paletteram_32[offset] & 0x0000001f) >> 0); |
| 1520 | | palette_set_color_rgb(machine(),(offset*2)+1,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 1521 | | r = ((m_generic_paletteram_32[offset] & 0x7c000000) >> 26); |
| 1522 | | g = ((m_generic_paletteram_32[offset] & 0x03e00000) >> 21); |
| 1523 | | b = ((m_generic_paletteram_32[offset] & 0x001f0000) >> 16); |
| 1524 | | palette_set_color_rgb(machine(),offset*2,pal5bit(r),pal5bit(g),pal5bit(b)); |
| 1525 | | } |
| 1526 | 1511 | |
| 1527 | 1512 | void coolridr_state::sysh1_dma_transfer( address_space &space, UINT16 dma_index ) |
| 1528 | 1513 | { |
| r21403 | r21404 | |
| 1575 | 1560 | if(dst & 0xfff00000) |
| 1576 | 1561 | printf("unk values to %02x dst %08x\n",cmd,dst); |
| 1577 | 1562 | dst &= 0x000fffff; |
| 1578 | | dst |= 0x03800000; |
| 1579 | 1563 | is_dma = 2; |
| 1580 | 1564 | //printf("%08x %08x %08x %02x\n",src,dst,size,cmd); |
| 1581 | 1565 | dma_index+=0xc; |
| r21403 | r21404 | |
| 1617 | 1601 | } |
| 1618 | 1602 | else if(is_dma == 2) |
| 1619 | 1603 | { |
| 1620 | | for(int i=0;i<size;i+=4) |
| 1604 | UINT16 read_src; |
| 1605 | |
| 1606 | for(int i=0;i<size;i+=2) |
| 1621 | 1607 | { |
| 1622 | | space.write_dword(dst,space.read_dword(src)); |
| 1623 | | dst+=4; |
| 1624 | | src+=4; |
| 1608 | read_src = space.read_word(src); |
| 1609 | |
| 1610 | m_h1_pal[dst] = read_src >> 8; |
| 1611 | m_h1_pal[dst+1] = read_src & 0xff; |
| 1612 | dst+=2; |
| 1613 | src+=2; |
| 1625 | 1614 | } |
| 1626 | 1615 | } |
| 1627 | 1616 | else if(is_dma == 3) |
| r21403 | r21404 | |
| 1659 | 1648 | AM_RANGE(0x00000000, 0x001fffff) AM_ROM AM_SHARE("share1") AM_WRITENOP |
| 1660 | 1649 | AM_RANGE(0x01000000, 0x01ffffff) AM_ROM AM_REGION("gfx_data",0x0000000) |
| 1661 | 1650 | |
| 1662 | | AM_RANGE(0x03800000, 0x0380ffff) AM_RAM_WRITE(sysh1_pal_w) AM_SHARE("paletteram") |
| 1663 | 1651 | AM_RANGE(0x03c00000, 0x03c1ffff) AM_MIRROR(0x00200000) AM_RAM_WRITE(sysh1_dma_w) AM_SHARE("fb_vram") /* mostly mapped at 0x03e00000 */ |
| 1664 | 1652 | |
| 1665 | 1653 | AM_RANGE(0x03f00000, 0x03f0ffff) AM_RAM AM_SHARE("share3") /*Communication area RAM*/ |