src/mess/drivers/supracan.c
| r9127 | r9128 | |
| 52 | 52 | - Speedy Dragon: Backgrounds are broken (wrong tile bank/region). |
| 53 | 53 | - Super Taiwanese Baseball League: Does not boot, uses an unemulated DMA type |
| 54 | 54 | - Super Taiwanese Baseball League: Missing window effect applied on tilemaps? |
| 55 | | - The Son of Evil: Does not boot, missing irq firing; |
| 56 | 55 | - The Son of Evil: Many graphical issues. |
| 56 | - Visible area, looks like it should be 224 pixels high at most, most games need 8 off the top and 8 off the bottom (or a global scroll) |
| 57 | Sango looks like it needs 16 off the bottom instead |
| 58 | Visible area is almost certainly 224 as Son of Evil has an explicit check in the vblank handler |
| 57 | 59 | |
| 58 | 60 | - All: are ALL the layers ROZ capable?? |
| 59 | 61 | |
| r9127 | r9128 | |
| 451 | 453 | |
| 452 | 454 | |
| 453 | 455 | |
| 454 | | |
| 455 | 456 | static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) |
| 456 | 457 | { |
| 457 | 458 | supracan_state *state = machine->driver_data<supracan_state>(); |
| 458 | 459 | UINT16 *supracan_vram = state->vram; |
| 459 | 460 | |
| 460 | 461 | // [0] |
| 462 | // -e-- ---- ---- ---- sprite enable? |
| 461 | 463 | // ---h hhh- ---- ---- Y size (not always right) |
| 462 | 464 | // ---- ---y yyyy yyyy Y position |
| 463 | 465 | // [1] |
| r9127 | r9128 | |
| 481 | 483 | // printf("frame\n"); |
| 482 | 484 | #define VRAM_MASK (0xffff) |
| 483 | 485 | |
| 484 | | |
| 485 | 486 | for(int i = start_word; i < end_word; i += 4) |
| 486 | 487 | { |
| 487 | 488 | int x = supracan_vram[i+2] & 0x01ff; |
| r9127 | r9128 | |
| 489 | 490 | |
| 490 | 491 | int sprite_offset = (supracan_vram[i+3])<< 1; |
| 491 | 492 | |
| 492 | | //sprite_offset &= VRAM_MASK; // there are only 0xffff words of vram? sango is specifying tiles outside of this, why, I'm sure it didn't used to, timing? DMA? |
| 493 | | |
| 494 | | |
| 495 | 493 | int bank = (supracan_vram[i+1] & 0xf000) >> 12; |
| 496 | 494 | //int mask = (supracan_vram[i+1] & 0x0300) >> 8; |
| 497 | | bool sprite_xflip = (supracan_vram[i+1] & 0x0800) ? true : false; |
| 498 | | bool sprite_yflip = (supracan_vram[i+1] & 0x0400) ? true : false; |
| 495 | int sprite_xflip = (supracan_vram[i+1] & 0x0800) >> 11; |
| 496 | int sprite_yflip = (supracan_vram[i+1] & 0x0400) >> 10; |
| 499 | 497 | //int xscale = (supracan_vram[i+2] & 0xf000) >> 12; |
| 500 | 498 | const gfx_element *gfx = machine->gfx[region]; |
| 501 | 499 | |
| 502 | | /* |
| 503 | | printf("%d (unk Y %02x) (unk Y2 %02x) (y pos %02x) (bank %01x) (flip %01x) (unknown %02x) (x size %02x) (xscale %01x) (unk %01x) (xpos %02x) (code %04x)\n", i, |
| 504 | | (supracan_vram[i+0] & 0xe000) >> 12, |
| 505 | | (supracan_vram[i+0] & 0x1e00) >> 8, |
| 506 | | (supracan_vram[i+0] & 0x01ff), |
| 507 | | (supracan_vram[i+1] & 0xf000) >> 12, |
| 508 | | (supracan_vram[i+1] & 0x0c00) >> 10, |
| 509 | | (supracan_vram[i+1] & 0x03f0) >> 4, |
| 510 | | (supracan_vram[i+1] & 0x000f), |
| 511 | | (supracan_vram[i+2] & 0xf000) >> 12, |
| 512 | | (supracan_vram[i+2] & 0x0e00) >> 8, |
| 513 | | (supracan_vram[i+2] & 0x01ff) >> 0, |
| 514 | | (supracan_vram[i+3] & 0xffff)); |
| 515 | | */ |
| 516 | 500 | |
| 517 | 501 | |
| 502 | |
| 518 | 503 | // wraparound |
| 519 | 504 | if (y>=0x180) y-=0x200; |
| 520 | 505 | if (x>=0x180) x-=0x200; |
| 521 | 506 | |
| 522 | | if(supracan_vram[i+3] != 0) |
| 507 | if((supracan_vram[i+0] & 0x4000)) |
| 523 | 508 | { |
| 509 | |
| 510 | #if 0 |
| 511 | printf("%d (unk %02x) (enable %02x) (unk Y2 %02x, %02x) (y pos %02x) (bank %01x) (flip %01x) (unknown %02x) (x size %02x) (xscale %01x) (unk %01x) (xpos %02x) (code %04x)\n", i, |
| 512 | (supracan_vram[i+0] & 0x8000) >> 15, |
| 513 | (supracan_vram[i+0] & 0x4000) >> 14, |
| 514 | (supracan_vram[i+0] & 0x2000) >> 13, |
| 515 | (supracan_vram[i+0] & 0x1e00) >> 8, |
| 516 | (supracan_vram[i+0] & 0x01ff), |
| 517 | (supracan_vram[i+1] & 0xf000) >> 12, |
| 518 | (supracan_vram[i+1] & 0x0c00) >> 10, |
| 519 | (supracan_vram[i+1] & 0x03f0) >> 4, |
| 520 | (supracan_vram[i+1] & 0x000f), |
| 521 | (supracan_vram[i+2] & 0xf000) >> 12, |
| 522 | (supracan_vram[i+2] & 0x0e00) >> 8, |
| 523 | (supracan_vram[i+2] & 0x01ff) >> 0, |
| 524 | (supracan_vram[i+3] & 0xffff)); |
| 525 | #endif |
| 526 | |
| 527 | |
| 524 | 528 | if (supracan_vram[i+3] &0x8000) |
| 525 | 529 | { |
| 526 | 530 | UINT16 data = supracan_vram[i+3]; |
| r9127 | r9128 | |
| 540 | 544 | { |
| 541 | 545 | int xsize = 1 << (supracan_vram[i+1] & 7); |
| 542 | 546 | int ysize = ((supracan_vram[i+0] & 0x1e00) >> 9) + 1; |
| 543 | | |
| 544 | | if(sprite_yflip) |
| 547 | |
| 548 | // I think the xsize must influence the ysize somehow, there are too many conflicting cases otherwise |
| 549 | // there don't appear to be any special markers in the actual looked up tile data to indicate skip / end of list |
| 550 | |
| 551 | for(int ytile = 0; ytile < ysize; ytile++) |
| 545 | 552 | { |
| 546 | | for(int ytile = (ysize - 1); ytile >= 0; ytile--) |
| 553 | for(int xtile = 0; xtile< xsize; xtile++) |
| 547 | 554 | { |
| 548 | | if(sprite_xflip) |
| 549 | | { |
| 550 | | for(int xtile = (xsize - 1); xtile >= 0; xtile--) |
| 551 | | { |
| 552 | | UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; |
| 553 | | int tile = (bank * 0x200) + (data & 0x03ff); |
| 554 | | int tile_xflip = (data & 0x0800) ? false : true; |
| 555 | | int tile_yflip = (data & 0x0400) ? false : true; |
| 556 | | int palette = (data & 0xf000) >> 12; |
| 557 | | int xpos = x + ((xsize - 1) - xtile)*8; |
| 558 | | int ypos = y + ((ysize - 1) - ytile)*8; |
| 555 | UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; |
| 556 | int tile = (bank * 0x200) + (data & 0x03ff); |
| 557 | int palette = (data & 0xf000) >> 12; |
| 559 | 558 | |
| 560 | | drawgfx_transpen(bitmap,cliprect,gfx,tile,palette,tile_xflip,tile_yflip, |
| 561 | | xpos, |
| 562 | | ypos, |
| 563 | | 0); |
| 564 | | |
| 565 | | } |
| 559 | int xpos, ypos; |
| 560 | |
| 561 | if (!sprite_yflip) |
| 562 | { |
| 563 | ypos = y + ytile*8; |
| 566 | 564 | } |
| 567 | 565 | else |
| 568 | 566 | { |
| 569 | | for(int xtile = 0; xtile < xsize; xtile++) |
| 570 | | { |
| 571 | | UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; |
| 572 | | int tile = (bank * 0x200) + (data & 0x03ff); |
| 573 | | int tile_xflip = (data & 0x0800) ? true : false; |
| 574 | | int tile_yflip = (data & 0x0400) ? false : true; |
| 575 | | int palette = (data & 0xf000) >> 12; |
| 576 | | |
| 577 | | int xpos = x + xtile*8; |
| 578 | | int ypos = y + ((ysize - 1) - ytile)*8; |
| 579 | | |
| 580 | | drawgfx_transpen(bitmap,cliprect,gfx,tile,palette,tile_xflip,tile_yflip, |
| 581 | | xpos, |
| 582 | | ypos, |
| 583 | | 0); |
| 584 | | } |
| 567 | ypos = y - (ytile+1)*8; |
| 568 | ypos += ysize*8; |
| 585 | 569 | } |
| 586 | | } |
| 587 | | } |
| 588 | | else |
| 589 | | { |
| 590 | | for(int ytile = 0; ytile < ysize; ytile++) |
| 591 | | { |
| 592 | | if(sprite_xflip) |
| 570 | |
| 571 | if (!sprite_xflip) |
| 593 | 572 | { |
| 594 | | for(int xtile = (xsize - 1); xtile >= 0; xtile--) |
| 595 | | { |
| 596 | | UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; |
| 597 | | int tile = (bank * 0x200) + (data & 0x03ff); |
| 598 | | int tile_xflip = (data & 0x0800) ? false : true; |
| 599 | | int tile_yflip = (data & 0x0400) ? true : false; |
| 600 | | int palette = (data & 0xf000) >> 12; |
| 601 | | |
| 602 | | int xpos = x + ((xsize - 1) - xtile)*8; |
| 603 | | int ypos = y + ytile*8; |
| 604 | | |
| 605 | | drawgfx_transpen(bitmap,cliprect,gfx,tile,palette,tile_xflip,tile_yflip, |
| 606 | | xpos, |
| 607 | | ypos, |
| 608 | | 0); |
| 609 | | } |
| 573 | xpos = x + xtile*8; |
| 610 | 574 | } |
| 611 | 575 | else |
| 612 | 576 | { |
| 613 | | for(int xtile = 0; xtile < xsize; xtile++) |
| 614 | | { |
| 615 | | UINT16 data = supracan_vram[(sprite_offset+ytile*xsize+xtile)&VRAM_MASK]; |
| 616 | | int tile = (bank * 0x200) + (data & 0x03ff); |
| 617 | | int tile_xflip = (data & 0x0800) ? true : false; |
| 618 | | int tile_yflip = (data & 0x0400) ? true : false; |
| 619 | | int palette = (data & 0xf000) >> 12; |
| 620 | | |
| 621 | | int xpos = x + xtile*8; |
| 622 | | int ypos = y + ytile*8; |
| 623 | | |
| 624 | | drawgfx_transpen(bitmap,cliprect,gfx,tile,palette,tile_xflip,tile_yflip, |
| 625 | | xpos, |
| 626 | | ypos, |
| 627 | | 0); |
| 628 | | |
| 629 | | } |
| 577 | xpos = x - (xtile+1)*8; |
| 578 | xpos += xsize*8; |
| 630 | 579 | } |
| 580 | |
| 581 | int tile_xflip = sprite_xflip ^ ((data & 0x0800)>>11); |
| 582 | int tile_yflip = sprite_yflip ^ ((data & 0x0400)>>10); |
| 583 | |
| 584 | drawgfx_transpen(bitmap,cliprect,gfx,tile,palette,tile_xflip,tile_yflip,xpos,ypos,0); |
| 631 | 585 | } |
| 632 | 586 | } |
| 633 | 587 | } |
| 588 | |
| 634 | 589 | #if 0 |
| 635 | 590 | if(xscale == 0) continue; |
| 636 | 591 | UINT32 delta = (1 << 17) / xscale; |
| r9127 | r9128 | |
| 991 | 946 | |
| 992 | 947 | if (incxx & 0x8000) incxx -= 0x10000; |
| 993 | 948 | |
| 994 | | supracan_suprnova_draw_roz(screen->machine, bitmap, &clip, state->tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); |
| 949 | |
| 950 | if (state->vram[state->roz_unk_base0/2 + y]) // incxx = 0, no draw? |
| 951 | supracan_suprnova_draw_roz(screen->machine, bitmap, &clip, state->tilemap_sizes[layer][which_tilemap_size], scrollx<<8, scrolly<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8, wrap, transmask); |
| 995 | 952 | } |
| 996 | 953 | } |
| 997 | 954 | else |
| r9127 | r9128 | |
| 1581 | 1538 | |
| 1582 | 1539 | |
| 1583 | 1540 | break; |
| 1584 | | case 224: //FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash |
| 1541 | |
| 1542 | case 224://FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash |
| 1585 | 1543 | state->video_regs[0] |= 0x8000; |
| 1544 | break; |
| 1545 | |
| 1546 | case 240: |
| 1586 | 1547 | if(state->irq_mask & 1) |
| 1587 | 1548 | { |
| 1588 | 1549 | verboselog("maincpu", machine, 0, "Triggering VBL IRQ\n\n"); |
| r9127 | r9128 | |
| 1591 | 1552 | break; |
| 1592 | 1553 | } |
| 1593 | 1554 | |
| 1594 | | state->video_regs[1] = machine->primary_screen->vpos(); |
| 1555 | state->video_regs[1] = machine->primary_screen->vpos()-16; // for son of evil, wants vblank active around 224 instead... |
| 1595 | 1556 | |
| 1596 | 1557 | timer_adjust_oneshot( state->hbl_timer, machine->primary_screen->time_until_pos( vpos, 320 ), 0 ); |
| 1597 | 1558 | timer_adjust_oneshot( state->video_timer, machine->primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ), 0 ); |
| r9127 | r9128 | |
| 1684 | 1645 | |
| 1685 | 1646 | rectangle visarea = space->machine->primary_screen->visible_area(); |
| 1686 | 1647 | |
| 1687 | | visarea.min_x = visarea.min_y = 0; |
| 1688 | | visarea.max_y = 240 - 1; |
| 1648 | visarea.min_x = visarea.min_y = 8; |
| 1649 | visarea.max_y = 232 - 1; |
| 1689 | 1650 | visarea.max_x = ((state->video_flags & 0x100) ? 320 : 256) - 1; |
| 1690 | 1651 | space->machine->primary_screen->configure(348, 256, visarea, space->machine->primary_screen->frame_period().attoseconds); |
| 1691 | 1652 | } |