src/mess/video/vdc.c
| r935 | r936 | |
| 223 | 223 | { |
| 224 | 224 | int i; |
| 225 | 225 | |
| 226 | /* Are we in greyscale mode or in color mode? */ |
| 227 | int color_base = vdc.vce_control & 0x80 ? 512 : 0; |
| 228 | |
| 226 | 229 | /* our line buffer */ |
| 227 | 230 | UINT16 *line_buffer = BITMAP_ADDR16( vdc.bmp, line, 0 ); |
| 228 | 231 | |
| 229 | 232 | for ( i = 0; i < VDC_WPF; i++ ) |
| 230 | | line_buffer[i] = Machine->pens[vdc.vce_data[0x100].w]; |
| 233 | line_buffer[i] = Machine->pens[color_base + vdc.vce_data[0x100].w]; |
| 231 | 234 | |
| 232 | 235 | } |
| 233 | 236 | |
| r935 | r936 | |
| 391 | 394 | int r = (( i >> 3) & 7) << 5; |
| 392 | 395 | int g = (( i >> 6) & 7) << 5; |
| 393 | 396 | int b = (( i ) & 7) << 5; |
| 394 | | palette_set_color_rgb(Machine, i, r, g, b); |
| 397 | int y = ( ( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16; |
| 398 | palette_set_color_rgb(machine, i, r, g, b); |
| 399 | palette_set_color_rgb(machine, 512+i, y, y, y); |
| 395 | 400 | } |
| 396 | 401 | } |
| 397 | 402 | |
| r935 | r936 | |
| 472 | 477 | /* pointer to the name table (Background Attribute Table) in VRAM */ |
| 473 | 478 | UINT8 *bat = &(vdc.vram[nt_row << (v_width+1)]); |
| 474 | 479 | |
| 480 | /* Are we in greyscale mode or in color mode? */ |
| 481 | int color_base = vdc.vce_control & 0x80 ? 512 : 0; |
| 482 | |
| 475 | 483 | int b0, b1, b2, b3; |
| 476 | 484 | int i0, i1, i2, i3; |
| 477 | 485 | int cell_pattern_index; |
| r935 | r936 | |
| 490 | 498 | |
| 491 | 499 | /* First fill line with overscan colour */ |
| 492 | 500 | for ( i = -86; i < VDC_WPF - 86; i++ ) |
| 493 | | line_buffer[i] = Machine->pens[vdc.vce_data[0x100].w]; |
| 501 | line_buffer[i] = Machine->pens[color_base + vdc.vce_data[0x100].w]; |
| 494 | 502 | |
| 495 | 503 | for(i=0;i<(vdc.physical_width >> 3) + 1;i++) |
| 496 | 504 | { |
| r935 | r936 | |
| 526 | 534 | c &= 0x0F; |
| 527 | 535 | |
| 528 | 536 | if ( phys_x >= 0 && phys_x < vdc.physical_width ) { |
| 529 | | line_buffer[ pixel ] = Machine->pens[vdc.vce_data[c].w]; |
| 537 | line_buffer[ pixel ] = Machine->pens[color_base + vdc.vce_data[c].w]; |
| 530 | 538 | pixel++; |
| 531 | 539 | if ( vdc.physical_width != 512 ) { |
| 532 | 540 | if ( pixel < ( ( ( phys_x + 1 ) * 512 ) / vdc.physical_width ) ) { |
| 533 | | line_buffer[ pixel ] = Machine->pens[vdc.vce_data[c].w]; |
| 541 | line_buffer[ pixel ] = Machine->pens[color_base + vdc.vce_data[c].w]; |
| 534 | 542 | pixel++; |
| 535 | 543 | } |
| 536 | 544 | } |
| r935 | r936 | |
| 588 | 596 | /* 0 -> no sprite pixels drawn, otherwise is sprite #+1 */ |
| 589 | 597 | UINT8 drawn[VDC_WPF]; |
| 590 | 598 | |
| 599 | /* Are we in greyscale mode or in color mode? */ |
| 600 | int color_base = vdc.vce_control & 0x80 ? 512 : 0; |
| 601 | |
| 591 | 602 | /* clear our sprite-to-sprite clipping buffer. */ |
| 592 | 603 | memset(drawn, 0, VDC_WPF); |
| 593 | 604 | /* count up: Highest priority is Sprite 0 */ |
| r935 | r936 | |
| 657 | 668 | { |
| 658 | 669 | if(!drawn[obj_x+x]) |
| 659 | 670 | { |
| 660 | | if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) { |
| 661 | | line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 671 | if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) { |
| 672 | line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 662 | 673 | if ( vdc.physical_width != 512 ) { |
| 663 | 674 | if ( pixel_x + 1 < ( ( ( obj_x + x + 1 ) * 512 ) / vdc.physical_width ) ) { |
| 664 | | line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 675 | line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 665 | 676 | } |
| 666 | 677 | } |
| 667 | 678 | drawn[obj_x+x]=i+1; |
| r935 | r936 | |
| 698 | 709 | { |
| 699 | 710 | if(!drawn[obj_x+x]) |
| 700 | 711 | { |
| 701 | | if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) { |
| 702 | | line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 712 | if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) { |
| 713 | line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 703 | 714 | if ( vdc.physical_width != 512 ) { |
| 704 | 715 | if ( pixel_x + 1 < ( ( ( obj_x + x + 1 ) * 512 ) / vdc.physical_width ) ) { |
| 705 | | line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 716 | line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 706 | 717 | } |
| 707 | 718 | } |
| 708 | 719 | drawn[obj_x + x]=i+1; |
| r935 | r936 | |
| 735 | 746 | { |
| 736 | 747 | if(!drawn[obj_x+0x10+x]) |
| 737 | 748 | { |
| 738 | | if(priority || (line_buffer[pixel_x] == Machine->pens[vdc.vce_data[0].w])) { |
| 739 | | line_buffer[pixel_x] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 749 | if(priority || (line_buffer[pixel_x] == Machine->pens[color_base + vdc.vce_data[0].w])) { |
| 750 | line_buffer[pixel_x] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 740 | 751 | if ( vdc.physical_width != 512 ) { |
| 741 | 752 | if ( pixel_x + 1 < ( ( ( obj_x + x + 17 ) * 512 ) / vdc.physical_width ) ) { |
| 742 | | line_buffer[pixel_x + 1] = Machine->pens[vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 753 | line_buffer[pixel_x + 1] = Machine->pens[color_base + vdc.vce_data[0x100 + (palette << 4) + buf[x]].w]; |
| 743 | 754 | } |
| 744 | 755 | } |
| 745 | 756 | drawn[obj_x + 0x10 + x]=i+1; |