src/mess/video/gb.c
| r1665 | r1666 | |
| 290 | 290 | for (bit = 0; bit < 8; bit++, xindex++) |
| 291 | 291 | { |
| 292 | 292 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 293 | | if (colour && !bg_zbuf[xindex]) |
| 293 | if (colour && !bg_zbuf[xindex] && xindex >= 0 && xindex < 160) |
| 294 | 294 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[spal[colour]]); |
| 295 | 295 | data >>= 1; |
| 296 | 296 | } |
| r1665 | r1666 | |
| 299 | 299 | for (bit = 0; bit < 8; bit++, xindex++) |
| 300 | 300 | { |
| 301 | 301 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 302 | | if (colour) |
| 302 | if (colour && xindex >= 0 && xindex < 160) |
| 303 | 303 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[spal[colour]]); |
| 304 | 304 | data >>= 1; |
| 305 | 305 | } |
| 306 | 306 | break; |
| 307 | 307 | case 0x80: /* priority is set (behind bgnd & wnd, don't flip x) */ |
| 308 | | for (bit = 0; bit < 8; bit++, xindex++) |
| 308 | for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) |
| 309 | 309 | { |
| 310 | 310 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 311 | | if (colour && !bg_zbuf[xindex]) |
| 311 | if (colour && !bg_zbuf[xindex] && xindex >= 0 && xindex < 160) |
| 312 | 312 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[spal[colour]]); |
| 313 | 313 | data <<= 1; |
| 314 | 314 | } |
| 315 | 315 | break; |
| 316 | 316 | case 0x00: /* priority is not set (overlaps bgnd & wnd, don't flip x) */ |
| 317 | | for (bit = 0; bit < 8; bit++, xindex++) |
| 317 | for (bit = 0; bit < 8 && xindex < 160; bit++, xindex++) |
| 318 | 318 | { |
| 319 | 319 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 320 | | if (colour) |
| 320 | if (colour && xindex >= 0 && xindex < 160) |
| 321 | 321 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[spal[colour]]); |
| 322 | 322 | data <<= 1; |
| 323 | 323 | } |
| r1665 | r1666 | |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | if ( cycles_to_go < 160 ) { |
| 381 | | gb_lcd.end_x = 160 - cycles_to_go; |
| 381 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 382 | 382 | /* Draw empty pixels when the background is disabled */ |
| 383 | 383 | if ( ! ( LCDCONT & 0x01 ) ) { |
| 384 | 384 | rectangle r; |
| r1665 | r1666 | |
| 517 | 517 | for (bit = 0; bit < 8; bit++, xindex++) |
| 518 | 518 | { |
| 519 | 519 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 520 | | if ((xindex >= SGB_XOFFSET && xindex <= SGB_XOFFSET + 160) && colour && !bg_zbuf[xindex - SGB_XOFFSET]) |
| 520 | if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !bg_zbuf[xindex - SGB_XOFFSET]) |
| 521 | 521 | gb_plot_pixel(bitmap, xindex, yindex, sgb_pal[pal + spal[colour]]); |
| 522 | 522 | data >>= 1; |
| 523 | 523 | } |
| r1665 | r1666 | |
| 526 | 526 | for (bit = 0; bit < 8; bit++, xindex++) |
| 527 | 527 | { |
| 528 | 528 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 529 | | if ((xindex >= SGB_XOFFSET && xindex <= SGB_XOFFSET + 160) && colour) |
| 529 | if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) |
| 530 | 530 | gb_plot_pixel(bitmap, xindex, yindex, sgb_pal[pal + spal[colour]]); |
| 531 | 531 | data >>= 1; |
| 532 | 532 | } |
| r1665 | r1666 | |
| 535 | 535 | for (bit = 0; bit < 8; bit++, xindex++) |
| 536 | 536 | { |
| 537 | 537 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 538 | | if ((xindex >= SGB_XOFFSET && xindex <= SGB_XOFFSET + 160) && colour && !bg_zbuf[xindex - SGB_XOFFSET]) |
| 538 | if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour && !bg_zbuf[xindex - SGB_XOFFSET]) |
| 539 | 539 | gb_plot_pixel(bitmap, xindex, yindex, sgb_pal[pal + spal[colour]]); |
| 540 | 540 | data <<= 1; |
| 541 | 541 | } |
| r1665 | r1666 | |
| 544 | 544 | for (bit = 0; bit < 8; bit++, xindex++) |
| 545 | 545 | { |
| 546 | 546 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 547 | | if ((xindex >= SGB_XOFFSET && xindex <= SGB_XOFFSET + 160) && colour) |
| 547 | if ((xindex >= SGB_XOFFSET && xindex < SGB_XOFFSET + 160) && colour) |
| 548 | 548 | gb_plot_pixel(bitmap, xindex, yindex, sgb_pal[pal + spal[colour]]); |
| 549 | 549 | data <<= 1; |
| 550 | 550 | } |
| r1665 | r1666 | |
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | if ( cycles_to_go < 160 ) { |
| 702 | | gb_lcd.end_x = 160 - cycles_to_go; |
| 702 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 703 | 703 | |
| 704 | 704 | /* if background or screen disabled clear line */ |
| 705 | 705 | if ( ! ( LCDCONT & 0x01 ) ) { |
| r1665 | r1666 | |
| 842 | 842 | for (bit = 0; bit < 8; bit++, xindex++) |
| 843 | 843 | { |
| 844 | 844 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 845 | | if (colour && !bg_zbuf[xindex]) |
| 845 | if (colour && !bg_zbuf[xindex] && xindex >= 0 && xindex < 160) |
| 846 | 846 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[cgb_spal[pal + colour]]); |
| 847 | 847 | data >>= 1; |
| 848 | 848 | } |
| r1665 | r1666 | |
| 853 | 853 | register int colour = ((data & 0x0100) ? 2 : 0) | ((data & 0x0001) ? 1 : 0); |
| 854 | 854 | if((bg_zbuf[xindex] & 0x80) && (bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) |
| 855 | 855 | colour = 0; |
| 856 | | if (colour) |
| 856 | if (colour && xindex >= 0 && xindex < 160) |
| 857 | 857 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[cgb_spal[pal + colour]]); |
| 858 | 858 | data >>= 1; |
| 859 | 859 | } |
| r1665 | r1666 | |
| 862 | 862 | for (bit = 0; bit < 8; bit++, xindex++) |
| 863 | 863 | { |
| 864 | 864 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 865 | | if (colour && !bg_zbuf[xindex]) |
| 865 | if (colour && !bg_zbuf[xindex] && xindex >= 0 && xindex < 160) |
| 866 | 866 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[cgb_spal[pal + colour]]); |
| 867 | 867 | data <<= 1; |
| 868 | 868 | } |
| r1665 | r1666 | |
| 873 | 873 | register int colour = ((data & 0x8000) ? 2 : 0) | ((data & 0x0080) ? 1 : 0); |
| 874 | 874 | if((bg_zbuf[xindex] & 0x80) && (bg_zbuf[xindex] & 0x7f) && (LCDCONT & 0x1)) |
| 875 | 875 | colour = 0; |
| 876 | | if (colour) |
| 876 | if (colour && xindex >= 0 && xindex < 160) |
| 877 | 877 | gb_plot_pixel(bitmap, xindex, yindex, Machine->pens[cgb_spal[pal + colour]]); |
| 878 | 878 | data <<= 1; |
| 879 | 879 | } |
| r1665 | r1666 | |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | if ( cycles_to_go < 160 ) { |
| 937 | | gb_lcd.end_x = 160 - cycles_to_go; |
| 937 | gb_lcd.end_x = MIN(160 - cycles_to_go,160); |
| 938 | 938 | /* Draw empty line when the background is disabled */ |
| 939 | 939 | if ( ! ( LCDCONT & 0x01 ) ) { |
| 940 | 940 | rectangle r = Machine->screen[0].visarea; |