src/mame/video/snes.c
| r7605 | r7606 | |
| 89 | 89 | UINT8 mode_disabled[8]; |
| 90 | 90 | UINT8 draw_subscreen; |
| 91 | 91 | UINT8 windows_disabled; |
| 92 | | UINT8 transparency_disabled; |
| 92 | UINT8 mosaic_disabled; |
| 93 | UINT8 colormath_disabled; |
| 93 | 94 | UINT8 sprite_reversed; |
| 94 | 95 | UINT8 select_oam; |
| 95 | 96 | }; |
| r7605 | r7606 | |
| 140 | 141 | |
| 141 | 142 | INLINE void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens ) |
| 142 | 143 | { |
| 144 | #ifdef SNES_LAYER_DEBUG |
| 145 | if (debug_options.colormath_disabled) |
| 146 | return; |
| 147 | #endif /* SNES_LAYER_DEBUG */ |
| 148 | |
| 143 | 149 | /* when color math is applied to subscreen pixels, the blending depends on the blending used by the previous mainscreen |
| 144 | 150 | pixel, except for subscreen pixel 0 which has no previous mainscreen pixel, see comments in snes_refresh_scanline */ |
| 145 | 151 | if (switch_screens && offset > 0) |
| r7605 | r7606 | |
| 153 | 159 | if (prevent_color_math == SNES_CLIP_ALWAYS) // blending mode 3 == always OFF |
| 154 | 160 | return; |
| 155 | 161 | |
| 156 | | #ifdef SNES_LAYER_DEBUG |
| 157 | | if (!debug_options.transparency_disabled) |
| 158 | | #endif /* SNES_LAYER_DEBUG */ |
| 159 | 162 | if ((prevent_color_math == SNES_CLIP_NEVER) || |
| 160 | 163 | (prevent_color_math == SNES_CLIP_IN && !snes_ppu.clipmasks[SNES_COLOR][offset]) || |
| 161 | 164 | (prevent_color_math == SNES_CLIP_OUT && snes_ppu.clipmasks[SNES_COLOR][offset])) |
| r7605 | r7606 | |
| 294 | 297 | if (scanlines[SNES_MAINSCREEN].priority[ii] <= priority) |
| 295 | 298 | { |
| 296 | 299 | UINT8 clr = colour; |
| 300 | UINT8 mask = snes_ppu.clipmasks[layer][ii]; |
| 301 | UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled; |
| 297 | 302 | |
| 298 | 303 | #ifdef SNES_LAYER_DEBUG |
| 299 | | if (!debug_options.windows_disabled) |
| 304 | if (debug_options.windows_disabled) |
| 305 | mask = 0xff; |
| 306 | if (debug_options.mosaic_disabled) |
| 307 | mosaic = 0; |
| 300 | 308 | #endif /* SNES_LAYER_DEBUG */ |
| 309 | |
| 301 | 310 | /* Clip to windows */ |
| 302 | 311 | if (scanlines[SNES_MAINSCREEN].clip) |
| 303 | | clr &= snes_ppu.clipmasks[layer][ii]; |
| 312 | clr &= mask; |
| 304 | 313 | |
| 305 | | /* Only draw if we have a colour (0 == transparent) */ |
| 314 | /* Only draw if we have a colour (0 == transparent) */ |
| 306 | 315 | if (clr) |
| 307 | 316 | { |
| 308 | 317 | if (direct_colors) |
| r7605 | r7606 | |
| 314 | 323 | else |
| 315 | 324 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 316 | 325 | |
| 317 | | if (snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled) // handle horizontal mosaic |
| 326 | if (mosaic) // handle horizontal mosaic |
| 318 | 327 | { |
| 319 | 328 | int x_mos; |
| 320 | 329 | |
| r7605 | r7606 | |
| 343 | 352 | if (scanlines[SNES_SUBSCREEN].priority[ii] <= priority) |
| 344 | 353 | { |
| 345 | 354 | UINT8 clr = colour; |
| 355 | UINT8 mask = snes_ppu.clipmasks[layer][ii]; |
| 356 | UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled; |
| 346 | 357 | |
| 347 | 358 | #ifdef SNES_LAYER_DEBUG |
| 348 | | if (!debug_options.windows_disabled) |
| 359 | if (debug_options.windows_disabled) |
| 360 | mask = 0xff; |
| 361 | if (debug_options.mosaic_disabled) |
| 362 | mosaic = 0; |
| 349 | 363 | #endif /* SNES_LAYER_DEBUG */ |
| 364 | |
| 350 | 365 | /* Clip to windows */ |
| 351 | 366 | if (scanlines[SNES_SUBSCREEN].clip) |
| 352 | | clr &= snes_ppu.clipmasks[layer][ii]; |
| 367 | clr &= mask; |
| 353 | 368 | |
| 354 | 369 | /* Only draw if we have a colour (0 == transparent) */ |
| 355 | 370 | if (clr) |
| r7605 | r7606 | |
| 363 | 378 | else |
| 364 | 379 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 365 | 380 | |
| 366 | | if (snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled) // handle horizontal mosaic |
| 381 | if (mosaic) // handle horizontal mosaic |
| 367 | 382 | { |
| 368 | 383 | int x_mos; |
| 369 | 384 | |
| r7605 | r7606 | |
| 394 | 409 | if (scanlines[SNES_MAINSCREEN].priority[ii >> 1] <= priority) |
| 395 | 410 | { |
| 396 | 411 | UINT8 clr = colour; |
| 412 | UINT8 mask = snes_ppu.clipmasks[layer][ii]; |
| 413 | UINT8 mosaic = snes_ppu.layer[SNES_MAINSCREEN].mosaic_enabled; |
| 397 | 414 | |
| 398 | 415 | #ifdef SNES_LAYER_DEBUG |
| 399 | | if (!debug_options.windows_disabled) |
| 416 | if (debug_options.windows_disabled) |
| 417 | mask = 0xff; |
| 418 | if (debug_options.mosaic_disabled) |
| 419 | mosaic = 0; |
| 400 | 420 | #endif /* SNES_LAYER_DEBUG */ |
| 421 | |
| 401 | 422 | /* Clip to windows */ |
| 402 | 423 | if (scanlines[SNES_MAINSCREEN].clip) |
| 403 | | clr &= snes_ppu.clipmasks[layer][ii >> 1]; |
| 424 | clr &= mask; |
| 404 | 425 | |
| 405 | 426 | /* Only draw if we have a colour (0 == transparent) */ |
| 406 | 427 | if (clr) |
| r7605 | r7606 | |
| 414 | 435 | else |
| 415 | 436 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 416 | 437 | |
| 417 | | if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic |
| 438 | if (mosaic) // handle horizontal mosaic |
| 418 | 439 | { |
| 419 | 440 | int x_mos; |
| 420 | 441 | |
| r7605 | r7606 | |
| 442 | 463 | if (scanlines[SNES_SUBSCREEN].priority[ii >> 1] <= priority) |
| 443 | 464 | { |
| 444 | 465 | UINT8 clr = colour; |
| 466 | UINT8 mask = snes_ppu.clipmasks[layer][ii]; |
| 467 | UINT8 mosaic = snes_ppu.layer[SNES_SUBSCREEN].mosaic_enabled; |
| 445 | 468 | |
| 446 | 469 | #ifdef SNES_LAYER_DEBUG |
| 447 | | if (!debug_options.windows_disabled) |
| 470 | if (debug_options.windows_disabled) |
| 471 | mask = 0xff; |
| 472 | if (debug_options.mosaic_disabled) |
| 473 | mosaic = 0; |
| 448 | 474 | #endif /* SNES_LAYER_DEBUG */ |
| 475 | |
| 449 | 476 | /* Clip to windows */ |
| 450 | 477 | if (scanlines[SNES_SUBSCREEN].clip) |
| 451 | | clr &= snes_ppu.clipmasks[layer][ii >> 1]; |
| 478 | clr &= mask; |
| 452 | 479 | |
| 453 | 480 | /* Only draw if we have a colour (0 == transparent) */ |
| 454 | 481 | if (clr) |
| r7605 | r7606 | |
| 462 | 489 | else |
| 463 | 490 | c = snes_cgram[(pal + clr) % FIXED_COLOUR]; |
| 464 | 491 | |
| 465 | | if (snes_ppu.layer[layer].mosaic_enabled) // handle horizontal mosaic |
| 492 | if (mosaic) // handle horizontal mosaic |
| 466 | 493 | { |
| 467 | 494 | int x_mos; |
| 468 | 495 | |
| r7605 | r7606 | |
| 558 | 585 | if (scanlines[SNES_MAINSCREEN].priority[pos] <= priority) |
| 559 | 586 | { |
| 560 | 587 | UINT8 clr = colour; |
| 588 | UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos]; |
| 561 | 589 | |
| 562 | 590 | #ifdef SNES_LAYER_DEBUG |
| 563 | | if (!debug_options.windows_disabled) |
| 591 | if (debug_options.windows_disabled) |
| 592 | mask = 0xff; |
| 564 | 593 | #endif /* SNES_LAYER_DEBUG */ |
| 594 | |
| 565 | 595 | /* Clip to windows */ |
| 566 | 596 | if (scanlines[SNES_MAINSCREEN].clip) |
| 567 | | clr &= snes_ppu.clipmasks[SNES_OAM][pos]; |
| 597 | clr &= mask; |
| 568 | 598 | |
| 569 | 599 | /* Only draw if we have a colour (0 == transparent) */ |
| 570 | 600 | if (clr) |
| r7605 | r7606 | |
| 585 | 615 | if (scanlines[SNES_SUBSCREEN].priority[pos] <= priority) |
| 586 | 616 | { |
| 587 | 617 | UINT8 clr = colour; |
| 618 | UINT8 mask = snes_ppu.clipmasks[SNES_OAM][pos]; |
| 588 | 619 | |
| 589 | 620 | #ifdef SNES_LAYER_DEBUG |
| 590 | | if (!debug_options.windows_disabled) |
| 621 | if (debug_options.windows_disabled) |
| 622 | mask = 0xff; |
| 591 | 623 | #endif /* SNES_LAYER_DEBUG */ |
| 624 | |
| 592 | 625 | /* Clip to windows */ |
| 593 | 626 | if (scanlines[SNES_SUBSCREEN].clip) |
| 594 | | clr &= snes_ppu.clipmasks[SNES_OAM][pos]; |
| 627 | clr &= mask; |
| 595 | 628 | |
| 596 | 629 | /* Only draw if we have a colour (0 == transparent) */ |
| 597 | 630 | if (clr) |
| r7605 | r7606 | |
| 638 | 671 | * Update an entire line of tiles. |
| 639 | 672 | *********************************************/ |
| 640 | 673 | |
| 641 | | INLINE void snes_update_line( UINT8 color_depth, UINT8 hires, UINT8 priority_a, UINT8 priority_b, UINT8 layer, UINT16 curline, UINT8 offset_per_tile, UINT8 direct_colors ) |
| 674 | INLINE void snes_update_line( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a, UINT8 color_depth, UINT8 hires, UINT8 offset_per_tile, UINT8 direct_colors ) |
| 642 | 675 | { |
| 643 | 676 | UINT32 tmap, tile, xoff, yoff; |
| 644 | 677 | UINT32 charaddr; |
| r7605 | r7606 | |
| 746 | 779 | tilemap = snes_vram[addr] | (snes_vram[addr + 1] << 8); |
| 747 | 780 | vflip = BIT(tilemap, 15); |
| 748 | 781 | hflip = BIT(tilemap, 14); |
| 749 | | priority = BIT(tilemap, 13) ? priority_b : priority_a; |
| 782 | priority = BIT(tilemap, 13) ? priority_a : priority_b; |
| 750 | 783 | pal_direct = ((tilemap & 0x1c00) >> 8); |
| 751 | 784 | tile = tilemap & 0x03ff; |
| 752 | 785 | |
| r7605 | r7606 | |
| 820 | 853 | |
| 821 | 854 | #define MODE7_CLIP(x) (((x) & 0x2000) ? ((x) | ~0x03ff) : ((x) & 0x03ff)) |
| 822 | 855 | |
| 823 | | static void snes_update_line_mode7( UINT8 priority_a, UINT8 priority_b, UINT8 layer, UINT16 curline ) |
| 856 | static void snes_update_line_mode7( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a ) |
| 824 | 857 | { |
| 825 | 858 | UINT32 tiled; |
| 826 | 859 | INT16 ma, mb, mc, md; |
| 827 | 860 | INT32 xc, yc, tx, ty, sx, sy, hs, vs, xpos, xdir, x0, y0; |
| 828 | | UINT8 priority = priority_a; |
| 861 | UINT8 priority = priority_b; |
| 829 | 862 | UINT8 colour = 0; |
| 830 | 863 | UINT16 *mosaic_x, *mosaic_y; |
| 831 | 864 | UINT16 c; |
| r7605 | r7606 | |
| 881 | 914 | } |
| 882 | 915 | |
| 883 | 916 | /* MOSAIC - to be verified */ |
| 884 | | if (layer == 1) // BG2 use two different bits for horizontal and vertical mosaic |
| 917 | if (layer == SNES_BG2) // BG2 use two different bits for horizontal and vertical mosaic |
| 885 | 918 | { |
| 886 | 919 | mosaic_x = snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG2].mosaic_enabled ? snes_ppu.mosaic_size : 0]; |
| 887 | 920 | mosaic_y = snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG1].mosaic_enabled ? snes_ppu.mosaic_size : 0]; |
| r7605 | r7606 | |
| 892 | 925 | mosaic_y = snes_ppu.mosaic_table[snes_ppu.layer[SNES_BG1].mosaic_enabled ? snes_ppu.mosaic_size : 0]; |
| 893 | 926 | } |
| 894 | 927 | |
| 928 | #ifdef SNES_LAYER_DEBUG |
| 929 | if (debug_options.mosaic_disabled) |
| 930 | { |
| 931 | mosaic_x = snes_ppu.mosaic_table[0]; |
| 932 | mosaic_y = snes_ppu.mosaic_table[0]; |
| 933 | } |
| 934 | #endif /* SNES_LAYER_DEBUG */ |
| 935 | |
| 895 | 936 | /* Let's do some mode7 drawing huh? */ |
| 896 | 937 | /* These can be computed only once, since they do not depend on sx */ |
| 897 | 938 | x0 = ((ma * MODE7_CLIP(hs - xc)) & ~0x3f) + ((mb * mosaic_y[sy]) & ~0x3f) + ((mb * MODE7_CLIP(vs - yc)) & ~0x3f) + (xc << 8); |
| r7605 | r7606 | |
| 912 | 953 | colour = snes_vram[tiled + ((tx & 0x07) * 2) + ((ty & 0x07) * 16) + 1]; |
| 913 | 954 | break; |
| 914 | 955 | case 0x02: /* Single colour backdrop screen if outside screen area */ |
| 915 | | if ((tx > 0) && (tx < 1024) && (ty > 0) && (ty < 1024)) |
| 956 | if ((tx >= 0) && (tx < 1024) && (ty >= 0) && (ty < 1024)) |
| 916 | 957 | { |
| 917 | 958 | tiled = snes_vram[(((tx >> 3) & 0x7f) + (((ty >> 3) & 0x7f) * 128)) * 2] << 7; |
| 918 | 959 | colour = snes_vram[tiled + ((tx & 0x07) * 2) + ((ty & 0x07) * 16) + 1]; |
| r7605 | r7606 | |
| 921 | 962 | colour = 0; |
| 922 | 963 | break; |
| 923 | 964 | case 0x03: /* Character 0x00 repeat if outside screen area */ |
| 924 | | if ((tx > 0) && (tx < 1024) && (ty > 0) && (ty < 1024)) |
| 965 | if ((tx >= 0) && (tx < 1024) && (ty >= 0) && (ty < 1024)) |
| 925 | 966 | tiled = snes_vram[(((tx >> 3) & 0x7f) + (((ty >> 3) & 0x7f) * 128)) * 2] << 7; |
| 926 | 967 | else |
| 927 | 968 | tiled = 0; |
| r7605 | r7606 | |
| 931 | 972 | } |
| 932 | 973 | |
| 933 | 974 | /* The last bit is for priority in EXTBG mode (used only for BG2) */ |
| 934 | | if (layer == 1) |
| 975 | if (layer == SNES_BG2) |
| 935 | 976 | { |
| 936 | | priority = ((colour & 0x80) >> 7) ? priority_b : priority_a; |
| 977 | priority = ((colour & 0x80) >> 7) ? priority_a : priority_b; |
| 937 | 978 | colour &= 0x7f; |
| 938 | 979 | } |
| 939 | 980 | |
| 940 | 981 | if (scanlines[SNES_MAINSCREEN].enable) |
| 941 | 982 | { |
| 942 | 983 | UINT8 clr = colour; |
| 984 | UINT8 mask = snes_ppu.clipmasks[layer][xpos]; |
| 943 | 985 | |
| 986 | #ifdef SNES_LAYER_DEBUG |
| 987 | if (debug_options.windows_disabled) |
| 988 | mask = 0xff; |
| 989 | #endif /* SNES_LAYER_DEBUG */ |
| 990 | |
| 991 | /* Clip to windows */ |
| 944 | 992 | if (scanlines[SNES_MAINSCREEN].clip) |
| 945 | | clr &= snes_ppu.clipmasks[layer][xpos]; |
| 993 | clr &= mask; |
| 946 | 994 | |
| 947 | 995 | /* Draw pixel if appropriate */ |
| 948 | 996 | if (scanlines[SNES_MAINSCREEN].priority[xpos] <= priority && clr > 0) |
| 949 | 997 | { |
| 950 | 998 | /* Direct select, but only outside EXTBG! */ |
| 951 | | if (snes_ppu.direct_color && layer == 0) |
| 999 | if (snes_ppu.direct_color && layer == SNES_BG1) |
| 952 | 1000 | { |
| 953 | 1001 | /* 0 | BB000 | GGG00 | RRR00, HW confirms that the data is zero padded. */ |
| 954 | 1002 | c = ((clr & 0x07) << 2) | ((clr & 0x38) << 4) | ((clr & 0xc0) << 7); |
| r7605 | r7606 | |
| 965 | 1013 | if (scanlines[SNES_SUBSCREEN].enable) |
| 966 | 1014 | { |
| 967 | 1015 | UINT8 clr = colour; |
| 1016 | UINT8 mask = snes_ppu.clipmasks[layer][xpos]; |
| 968 | 1017 | |
| 1018 | #ifdef SNES_LAYER_DEBUG |
| 1019 | if (debug_options.windows_disabled) |
| 1020 | mask = 0xff; |
| 1021 | #endif /* SNES_LAYER_DEBUG */ |
| 1022 | |
| 1023 | /* Clip to windows */ |
| 969 | 1024 | if (scanlines[SNES_SUBSCREEN].clip) |
| 970 | | clr &= snes_ppu.clipmasks[layer][xpos]; |
| 1025 | clr &= mask; |
| 971 | 1026 | |
| 972 | 1027 | /* Draw pixel if appropriate */ |
| 973 | 1028 | if (scanlines[SNES_SUBSCREEN].priority[xpos] <= priority && clr > 0) |
| 974 | 1029 | { |
| 975 | 1030 | /* Direct select, but only outside EXTBG! */ |
| 976 | | if (snes_ppu.direct_color && layer == 0) |
| 1031 | if (snes_ppu.direct_color && layer == SNES_BG1) |
| 977 | 1032 | { |
| 978 | 1033 | /* 0 | BB000 | GGG00 | RRR00, HW confirms that the data is zero padded. */ |
| 979 | 1034 | c = ((clr & 0x07) << 2) | ((clr & 0x38) << 4) | ((clr & 0xc0) << 7); |
| r7605 | r7606 | |
| 1232 | 1287 | snes_ppu.stat77_flags |= 0x80; |
| 1233 | 1288 | } |
| 1234 | 1289 | |
| 1235 | | static void snes_update_objects( UINT8 priority_tbl ) |
| 1290 | static void snes_update_objects( UINT8 priority_oam0, UINT8 priority_oam1, UINT8 priority_oam2, UINT8 priority_oam3 ) |
| 1236 | 1291 | { |
| 1237 | | UINT8 priority; |
| 1292 | UINT8 pri, priority[4]; |
| 1238 | 1293 | UINT32 charaddr; |
| 1239 | 1294 | int i; |
| 1240 | | static const UINT8 table_obj_priority[10][4] = { |
| 1241 | | {2, 5, 8, 11}, // mode 0 |
| 1242 | | {1, 3, 6, 9}, // mode 1 |
| 1243 | | {1, 3, 5, 7}, // mode 2 |
| 1244 | | {1, 3, 5, 7}, // mode 3 |
| 1245 | | {1, 3, 5, 7}, // mode 4 |
| 1246 | | {1, 3, 5, 7}, // mode 5 |
| 1247 | | {0, 2, 3, 5}, // mode 6 |
| 1248 | | {0, 2, 3, 4}, // mode 7 |
| 1249 | | {1, 3, 5, 6}, // mode 7 EXTBG |
| 1250 | | {1, 2, 5, 8} // mode 1 + BG3 priority bit |
| 1251 | | }; |
| 1252 | 1295 | |
| 1253 | 1296 | #ifdef SNES_LAYER_DEBUG |
| 1254 | 1297 | if (debug_options.bg_disabled[SNES_OAM]) |
| r7605 | r7606 | |
| 1265 | 1308 | |
| 1266 | 1309 | charaddr = snes_ppu.layer[SNES_OAM].charmap << 13; |
| 1267 | 1310 | |
| 1311 | priority[0] = priority_oam0; |
| 1312 | priority[1] = priority_oam1; |
| 1313 | priority[2] = priority_oam2; |
| 1314 | priority[3] = priority_oam3; |
| 1315 | |
| 1268 | 1316 | /* finally draw the tiles from the tilelist */ |
| 1269 | 1317 | for (i = 0; i < 34; i++) |
| 1270 | 1318 | { |
| r7605 | r7606 | |
| 1277 | 1325 | if (oam_tilelist[tile].tileaddr == 0xffff) |
| 1278 | 1326 | continue; |
| 1279 | 1327 | |
| 1280 | | priority = table_obj_priority[priority_tbl][oam_tilelist[tile].priority]; |
| 1328 | pri = priority[oam_tilelist[tile].priority]; |
| 1281 | 1329 | |
| 1282 | 1330 | #ifdef SNES_LAYER_DEBUG |
| 1283 | 1331 | if (debug_options.select_oam) |
| 1284 | 1332 | { |
| 1285 | 1333 | int oam_draw = debug_options.select_oam - 1; |
| 1286 | 1334 | if (oam_draw != oam_tilelist[tile].priority) |
| 1287 | | priority = 0; |
| 1335 | continue; |
| 1288 | 1336 | } |
| 1289 | 1337 | #endif /* SNES_LAYER_DEBUG */ |
| 1290 | 1338 | |
| 1291 | | snes_draw_tile_object(charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, priority, oam_tilelist[tile].hflip, oam_tilelist[tile].pal); |
| 1339 | snes_draw_tile_object(charaddr + oam_tilelist[tile].tileaddr, oam_tilelist[tile].x, pri, oam_tilelist[tile].hflip, oam_tilelist[tile].pal); |
| 1292 | 1340 | } |
| 1293 | 1341 | } |
| 1294 | 1342 | |
| r7605 | r7606 | |
| 1306 | 1354 | return; |
| 1307 | 1355 | #endif /* SNES_LAYER_DEBUG */ |
| 1308 | 1356 | |
| 1309 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 3, SNES_BG4, curline, SNES_OPT_NONE, 0); |
| 1310 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 1, 4, SNES_BG3, curline, SNES_OPT_NONE, 0); |
| 1311 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 6, 9, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1312 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 7, 10, SNES_BG1, curline, SNES_OPT_NONE, 0); |
| 1313 | | snes_update_objects(0); |
| 1357 | snes_update_line(curline, SNES_BG4, 1, 4, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1358 | snes_update_line(curline, SNES_BG3, 2, 5, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1359 | snes_update_line(curline, SNES_BG2, 7, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1360 | snes_update_line(curline, SNES_BG1, 8, 11, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1361 | snes_update_objects(3, 6, 9, 12); |
| 1314 | 1362 | } |
| 1315 | 1363 | |
| 1316 | 1364 | static void snes_update_mode_1( UINT16 curline ) |
| r7605 | r7606 | |
| 1322 | 1370 | |
| 1323 | 1371 | if (!snes_ppu.bg3_priority_bit) |
| 1324 | 1372 | { |
| 1325 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 2, SNES_BG3, curline, SNES_OPT_NONE, 0); |
| 1326 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1327 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 5, 8, SNES_BG1, curline, SNES_OPT_NONE, 0); |
| 1328 | | snes_update_objects(1); |
| 1373 | snes_update_line(curline, SNES_BG3, 1, 3, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1374 | snes_update_line(curline, SNES_BG2, 5, 8, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0); |
| 1375 | snes_update_line(curline, SNES_BG1, 6, 9, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0); |
| 1376 | snes_update_objects(2, 4, 7, 10); |
| 1329 | 1377 | } |
| 1330 | 1378 | else |
| 1331 | 1379 | { |
| 1332 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 9, SNES_BG3, curline, SNES_OPT_NONE, 0); |
| 1333 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 3, 6, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1334 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 4, 7, SNES_BG1, curline, SNES_OPT_NONE, 0); |
| 1335 | | snes_update_objects(9); |
| 1380 | snes_update_line(curline, SNES_BG3, 1, 10, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_NONE, 0); |
| 1381 | snes_update_line(curline, SNES_BG2, 4, 7, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0); |
| 1382 | snes_update_line(curline, SNES_BG1, 5, 8, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0); |
| 1383 | snes_update_objects(2, 3, 6, 9); |
| 1336 | 1384 | } |
| 1337 | 1385 | } |
| 1338 | 1386 | |
| r7605 | r7606 | |
| 1343 | 1391 | return; |
| 1344 | 1392 | #endif /* SNES_LAYER_DEBUG */ |
| 1345 | 1393 | |
| 1346 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE2, 0); |
| 1347 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE2, 0); |
| 1348 | | snes_update_objects(2); |
| 1394 | snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0); |
| 1395 | snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_MODE2, 0); |
| 1396 | snes_update_objects(2, 4, 6, 8); |
| 1349 | 1397 | } |
| 1350 | 1398 | |
| 1351 | 1399 | static void snes_update_mode_3( UINT16 curline ) |
| r7605 | r7606 | |
| 1355 | 1403 | return; |
| 1356 | 1404 | #endif /* SNES_LAYER_DEBUG */ |
| 1357 | 1405 | |
| 1358 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1359 | | snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, snes_ppu.direct_color); |
| 1360 | | snes_update_objects(3); |
| 1406 | snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_4BPP, 0, SNES_OPT_NONE, 0); |
| 1407 | snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_NONE, snes_ppu.direct_color); |
| 1408 | snes_update_objects(2, 4, 6, 8); |
| 1361 | 1409 | } |
| 1362 | 1410 | |
| 1363 | 1411 | static void snes_update_mode_4( UINT16 curline ) |
| r7605 | r7606 | |
| 1367 | 1415 | return; |
| 1368 | 1416 | #endif /* SNES_LAYER_DEBUG */ |
| 1369 | 1417 | |
| 1370 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 0, 0, 4, SNES_BG2, curline, SNES_OPT_MODE4, 0); |
| 1371 | | snes_update_line(SNES_COLOR_DEPTH_8BPP, 0, 2, 6, SNES_BG1, curline, SNES_OPT_MODE4, snes_ppu.direct_color); |
| 1372 | | snes_update_objects(4); |
| 1418 | snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 0, SNES_OPT_MODE4, 0); |
| 1419 | snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_8BPP, 0, SNES_OPT_MODE4, snes_ppu.direct_color); |
| 1420 | snes_update_objects(2, 4, 6, 8); |
| 1373 | 1421 | } |
| 1374 | 1422 | |
| 1375 | 1423 | static void snes_update_mode_5( UINT16 curline ) |
| r7605 | r7606 | |
| 1379 | 1427 | return; |
| 1380 | 1428 | #endif /* SNES_LAYER_DEBUG */ |
| 1381 | 1429 | |
| 1382 | | snes_update_line(SNES_COLOR_DEPTH_2BPP, 1, 0, 4, SNES_BG2, curline, SNES_OPT_NONE, 0); |
| 1383 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 2, 6, SNES_BG1, curline, SNES_OPT_NONE, 0); |
| 1384 | | snes_update_objects(5); |
| 1430 | snes_update_line(curline, SNES_BG2, 1, 5, SNES_COLOR_DEPTH_2BPP, 1, SNES_OPT_NONE, 0); |
| 1431 | snes_update_line(curline, SNES_BG1, 3, 7, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_NONE, 0); |
| 1432 | snes_update_objects(2, 4, 6, 8); |
| 1385 | 1433 | } |
| 1386 | 1434 | |
| 1387 | 1435 | static void snes_update_mode_6( UINT16 curline ) |
| r7605 | r7606 | |
| 1391 | 1439 | return; |
| 1392 | 1440 | #endif /* SNES_LAYER_DEBUG */ |
| 1393 | 1441 | |
| 1394 | | snes_update_line(SNES_COLOR_DEPTH_4BPP, 1, 1, 4, SNES_BG1, curline, SNES_OPT_MODE6, 0); |
| 1395 | | snes_update_objects(6); |
| 1442 | snes_update_line(curline, SNES_BG1, 2, 5, SNES_COLOR_DEPTH_4BPP, 1, SNES_OPT_MODE6, 0); |
| 1443 | snes_update_objects(1, 3, 4, 6); |
| 1396 | 1444 | } |
| 1397 | 1445 | |
| 1398 | 1446 | static void snes_update_mode_7( UINT16 curline ) |
| r7605 | r7606 | |
| 1404 | 1452 | |
| 1405 | 1453 | if (!snes_ppu.mode7.extbg) |
| 1406 | 1454 | { |
| 1407 | | snes_update_line_mode7(1, 1, SNES_BG1, curline); |
| 1408 | | snes_update_objects(7); |
| 1455 | snes_update_line_mode7(curline, SNES_BG1, 2, 2); |
| 1456 | snes_update_objects(1, 3, 4, 5); |
| 1409 | 1457 | } |
| 1410 | 1458 | else |
| 1411 | 1459 | { |
| 1412 | | snes_update_line_mode7(0, 4, SNES_BG2, curline); |
| 1413 | | snes_update_line_mode7(2, 2, SNES_BG1, curline); |
| 1414 | | snes_update_objects(8); |
| 1460 | snes_update_line_mode7(curline, SNES_BG2, 1, 5); |
| 1461 | snes_update_line_mode7(curline, SNES_BG1, 3, 3); |
| 1462 | snes_update_objects(2, 4, 6, 7); |
| 1415 | 1463 | } |
| 1416 | 1464 | } |
| 1417 | 1465 | |
| r7605 | r7606 | |
| 1712 | 1760 | if (BIT(toggles, 5)) |
| 1713 | 1761 | debug_options.draw_subscreen = !debug_options.draw_subscreen; |
| 1714 | 1762 | if (BIT(toggles, 6)) |
| 1715 | | debug_options.bg_disabled[5] = !debug_options.bg_disabled[5]; |
| 1763 | debug_options.colormath_disabled = !debug_options.colormath_disabled; |
| 1716 | 1764 | if (BIT(toggles, 7)) |
| 1717 | 1765 | debug_options.windows_disabled = !debug_options.windows_disabled; |
| 1718 | 1766 | toggles = input_port_read_safe(machine, "DEBUG4", 0); |
| r7605 | r7606 | |
| 1734 | 1782 | debug_options.mode_disabled[7] = !debug_options.mode_disabled[7]; |
| 1735 | 1783 | toggles = input_port_read_safe(machine, "DEBUG3", 0); |
| 1736 | 1784 | if (toggles & 0x4) |
| 1737 | | debug_options.transparency_disabled = !debug_options.transparency_disabled; |
| 1785 | debug_options.mosaic_disabled = !debug_options.mosaic_disabled; |
| 1738 | 1786 | debug_options.input_count = 5; |
| 1739 | 1787 | } |
| 1740 | 1788 | |
| 1741 | | logerror("%s%s", debug_options.windows_disabled?" ":"W", debug_options.transparency_disabled?" ":"T" ); |
| 1789 | logerror("%s", debug_options.windows_disabled?" ":"W"); |
| 1742 | 1790 | logerror("%s1 %s%s%s%s%s%c%s%s%d%s %d %4X %4X", |
| 1743 | 1791 | debug_options.bg_disabled[0]?" ":"*", |
| 1744 | 1792 | (snes_ram[TM] & 0x1)?"M":" ", |
| r7605 | r7606 | |
| 1812 | 1860 | (snes_ram[WOBJSEL] & 0x8)?((snes_ram[WOBJSEL] & 0x4)?"o":"i"):" ", |
| 1813 | 1861 | snes_ppu.layer[SNES_OAM].charmap << 13 ); |
| 1814 | 1862 | logerror("%sB %s %c%s%s", |
| 1815 | | debug_options.bg_disabled[5]?" ":"*", |
| 1863 | debug_options.colormath_disabled?" ":"*", |
| 1816 | 1864 | (snes_ram[CGADSUB] & 0x20)?"B":" ", |
| 1817 | 1865 | WINLOGIC[(snes_ram[WOBJLOG] & 0xc)>>2], |
| 1818 | 1866 | (snes_ram[WOBJSEL] & 0x20)?((snes_ram[WOBJSEL] & 0x10)?"o":"i"):" ", |