src/mame/machine/snes.c
| r7581 | r7582 | |
| 461 | 461 | if (snes_ram[OAMDATA] == 0) |
| 462 | 462 | { |
| 463 | 463 | snes_ppu.oam.address++; |
| 464 | | snes_ppu.oam.address_low = snes_ram[OAMADDL] = snes_ppu.oam.address & 0xff; |
| 465 | | snes_ppu.oam.address_high = snes_ram[OAMADDH] = (snes_ppu.oam.address >> 8) & 0x1; |
| 464 | snes_ppu.oam.address &= 0x1ff; |
| 466 | 465 | snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0; |
| 467 | 466 | } |
| 468 | 467 | return snes_ppu.ppu1_open_bus; |
| r7581 | r7582 | |
| 687 | 686 | |
| 688 | 687 | #ifndef MESS |
| 689 | 688 | case 0x4100: /* NSS Dip-Switches */ |
| 690 | | #ifdef MAME_DEBUG |
| 691 | | return input_port_read_safe(space->machine, "DEBUG1", 0); |
| 692 | | #else |
| 693 | 689 | return input_port_read(space->machine, "DSW"); |
| 694 | | #endif /* MAME_DEBUG */ |
| 695 | 690 | // case 0x4101: //PC: a104 - a10e - a12a //only nss_actr |
| 696 | 691 | // case 0x420c: //PC: 9c7d - 8fab //only nss_ssoc |
| 697 | 692 | |
| r7581 | r7582 | |
| 705 | 700 | |
| 706 | 701 | /* Unsupported reads returns open bus */ |
| 707 | 702 | // printf("%02x %02x\n",offset,snes_open_bus_r(space,0)); |
| 708 | | return snes_open_bus_r(space,0); |
| 703 | return snes_open_bus_r(space, 0); |
| 709 | 704 | } |
| 710 | 705 | |
| 711 | 706 | /* |
| r7581 | r7582 | |
| 818 | 813 | break; |
| 819 | 814 | } |
| 820 | 815 | case OAMADDL: /* Address for accessing OAM (low) */ |
| 821 | | snes_ppu.oam.address_low = data; |
| 822 | 816 | snes_ppu.oam.saved_address_low = data; |
| 823 | | snes_ppu.oam.address = ((snes_ppu.oam.address_high & 0x1) << 8) + data; |
| 817 | snes_ppu.oam.address = (snes_ppu.oam.address & 0xff00) + data; |
| 824 | 818 | snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0; |
| 825 | 819 | snes_ram[OAMDATA] = 0; |
| 826 | 820 | break; |
| 827 | 821 | case OAMADDH: /* Address for accessing OAM (high) */ |
| 828 | | snes_ppu.oam.address_high = data & 0x1; |
| 829 | 822 | snes_ppu.oam.saved_address_high = data; |
| 830 | | snes_ppu.oam.address = ((data & 0x1) << 8) + snes_ppu.oam.address_low; |
| 823 | snes_ppu.oam.address = (snes_ppu.oam.address & 0x00ff) | ((data & 0x01) << 8); |
| 831 | 824 | snes_ppu.oam.priority_rotation = BIT(data, 7); |
| 832 | 825 | snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0; |
| 833 | 826 | snes_ram[OAMDATA] = 0; |
| r7581 | r7582 | |
| 867 | 860 | { |
| 868 | 861 | snes_ram[OAMDATA] = 0; |
| 869 | 862 | snes_ppu.oam.address++; |
| 870 | | snes_ppu.oam.address_low = snes_ram[OAMADDL] = snes_ppu.oam.address & 0xff; |
| 871 | | snes_ppu.oam.address_high = snes_ram[OAMADDH] = (snes_ppu.oam.address >> 8) & 0x1; |
| 863 | snes_ppu.oam.address &= 0x1ff; |
| 872 | 864 | snes_ppu.oam.first_sprite = snes_ppu.oam.priority_rotation ? (snes_ppu.oam.address >> 1) & 127 : 0; |
| 873 | 865 | } |
| 874 | 866 | return; |
src/mame/video/snes.c
| r7581 | r7582 | |
| 514 | 514 | * that it takes a blend parameter. |
| 515 | 515 | *****************************************/ |
| 516 | 516 | |
| 517 | | INLINE void snes_draw_tile_object( UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal, UINT8 blend ) |
| 517 | INLINE void snes_draw_tile_object( UINT16 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT16 pal ) |
| 518 | 518 | { |
| 519 | 519 | UINT8 mask, plane[4]; |
| 520 | 520 | UINT16 c; |
| 521 | int blend; |
| 521 | 522 | INT16 ii, jj; |
| 522 | 523 | |
| 523 | 524 | plane[0] = snes_vram[tileaddr]; |
| r7581 | r7582 | |
| 548 | 549 | mask >>= 1; |
| 549 | 550 | } |
| 550 | 551 | |
| 551 | | if (ii >= 0 && ii < SNES_SCR_WIDTH && scanlines[SNES_MAINSCREEN].enable) |
| 552 | INT16 pos = ii & 0x1ff; |
| 553 | |
| 554 | if (pos >= 0 && pos < SNES_SCR_WIDTH && scanlines[SNES_MAINSCREEN].enable) |
| 552 | 555 | { |
| 553 | | if (scanlines[SNES_MAINSCREEN].priority[ii] <= priority) |
| 556 | if (scanlines[SNES_MAINSCREEN].priority[pos] <= priority) |
| 554 | 557 | { |
| 555 | 558 | UINT8 clr = colour; |
| 556 | 559 | |
| r7581 | r7582 | |
| 559 | 562 | #endif /* SNES_LAYER_DEBUG */ |
| 560 | 563 | /* Clip to windows */ |
| 561 | 564 | if (scanlines[SNES_MAINSCREEN].clip) |
| 562 | | clr &= snes_ppu.clipmasks[SNES_OAM][ii]; |
| 565 | clr &= snes_ppu.clipmasks[SNES_OAM][pos]; |
| 563 | 566 | |
| 564 | 567 | /* Only draw if we have a colour (0 == transparent) */ |
| 565 | 568 | if (clr) |
| 566 | 569 | { |
| 567 | 570 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 571 | blend = (pal + clr < 192) ? 1 : 0; |
| 568 | 572 | |
| 569 | | scanlines[SNES_MAINSCREEN].buffer[ii] = c; |
| 570 | | scanlines[SNES_MAINSCREEN].priority[ii] = priority; |
| 571 | | scanlines[SNES_MAINSCREEN].layer[ii] = SNES_OAM; |
| 572 | | scanlines[SNES_MAINSCREEN].blend_exception[ii] = blend; |
| 573 | scanlines[SNES_MAINSCREEN].buffer[pos] = c; |
| 574 | scanlines[SNES_MAINSCREEN].priority[pos] = priority; |
| 575 | scanlines[SNES_MAINSCREEN].layer[pos] = SNES_OAM; |
| 576 | scanlines[SNES_MAINSCREEN].blend_exception[pos] = blend; |
| 573 | 577 | } |
| 574 | 578 | } |
| 575 | 579 | } |
| 576 | 580 | |
| 577 | | if (ii >= 0 && ii < SNES_SCR_WIDTH && scanlines[SNES_SUBSCREEN].enable) |
| 581 | if (pos >= 0 && pos < SNES_SCR_WIDTH && scanlines[SNES_SUBSCREEN].enable) |
| 578 | 582 | { |
| 579 | | if (scanlines[SNES_SUBSCREEN].priority[ii] <= priority) |
| 583 | if (scanlines[SNES_SUBSCREEN].priority[pos] <= priority) |
| 580 | 584 | { |
| 581 | 585 | UINT8 clr = colour; |
| 582 | 586 | |
| r7581 | r7582 | |
| 585 | 589 | #endif /* SNES_LAYER_DEBUG */ |
| 586 | 590 | /* Clip to windows */ |
| 587 | 591 | if (scanlines[SNES_SUBSCREEN].clip) |
| 588 | | clr &= snes_ppu.clipmasks[SNES_OAM][ii]; |
| 592 | clr &= snes_ppu.clipmasks[SNES_OAM][pos]; |
| 589 | 593 | |
| 590 | 594 | /* Only draw if we have a colour (0 == transparent) */ |
| 591 | 595 | if (clr) |
| 592 | 596 | { |
| 593 | 597 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 598 | blend = (pal + clr < 192) ? 1 : 0; |
| 594 | 599 | |
| 595 | | scanlines[SNES_SUBSCREEN].buffer[ii] = c; |
| 596 | | scanlines[SNES_SUBSCREEN].priority[ii] = priority; |
| 597 | | scanlines[SNES_SUBSCREEN].layer[ii] = SNES_OAM; |
| 598 | | scanlines[SNES_SUBSCREEN].blend_exception[ii] = blend; |
| 600 | scanlines[SNES_SUBSCREEN].buffer[pos] = c; |
| 601 | scanlines[SNES_SUBSCREEN].priority[pos] = priority; |
| 602 | scanlines[SNES_SUBSCREEN].layer[pos] = SNES_OAM; |
| 603 | scanlines[SNES_SUBSCREEN].blend_exception[pos] = blend; |
| 599 | 604 | } |
| 600 | 605 | } |
| 601 | 606 | } |
| r7581 | r7582 | |
| 1226 | 1231 | |
| 1227 | 1232 | static void snes_update_objects( UINT8 priority_tbl ) |
| 1228 | 1233 | { |
| 1229 | | UINT8 blend, priority; |
| 1234 | UINT8 priority; |
| 1230 | 1235 | UINT32 charaddr; |
| 1231 | 1236 | int i; |
| 1232 | 1237 | static const UINT8 table_obj_priority[10][4] = { |
| r7581 | r7582 | |
| 1263 | 1268 | if (oam_tilelist[i].tileaddr == 0xffff) |
| 1264 | 1269 | continue; |
| 1265 | 1270 | |
| 1266 | | blend = (oam_tilelist[i].pal < 192) ? 1 : 0; |
| 1267 | 1271 | priority = table_obj_priority[priority_tbl][oam_tilelist[i].priority]; |
| 1268 | | snes_draw_tile_object(charaddr + oam_tilelist[i].tileaddr, oam_tilelist[i].x, priority, oam_tilelist[i].hflip, oam_tilelist[i].pal, blend); |
| 1272 | snes_draw_tile_object(charaddr + oam_tilelist[i].tileaddr, oam_tilelist[i].x, priority, oam_tilelist[i].hflip, oam_tilelist[i].pal); |
| 1269 | 1273 | } |
| 1270 | 1274 | } |
| 1271 | 1275 | |
| r7581 | r7582 | |
| 1356 | 1360 | return; |
| 1357 | 1361 | #endif /* SNES_LAYER_DEBUG */ |
| 1358 | 1362 | |
| 1363 | snes_update_line(SNES_COLOR_DEPTH_2BPP, 1, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1359 | 1364 | snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, 0); |
| 1360 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 1, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1361 | 1365 | snes_update_objects(5); |
| 1362 | 1366 | } |
| 1363 | 1367 | |