trunk/src/emu/video/pc_vga.c
r17576 | r17577 | |
2758 | 2758 | switch(s3.fgmix & 0x000f) |
2759 | 2759 | { |
2760 | 2760 | case 0x0000: |
2761 | | vga.memory[offset] = !dst; |
| 2761 | vga.memory[offset] = ~dst; |
2762 | 2762 | break; |
2763 | 2763 | case 0x0001: |
2764 | | // TODO: false |
| 2764 | vga.memory[offset] = 0x00; // is this correct? |
2765 | 2765 | break; |
2766 | 2766 | case 0x0002: |
2767 | | // TODO: true |
| 2767 | vga.memory[offset] = 0xff; // is this correct? |
2768 | 2768 | break; |
2769 | 2769 | case 0x0003: |
2770 | 2770 | // change nothing, pixel is unchanged |
2771 | 2771 | break; |
2772 | 2772 | case 0x0004: |
2773 | | vga.memory[offset] = !src; |
| 2773 | vga.memory[offset] = ~src; |
2774 | 2774 | break; |
2775 | 2775 | case 0x0005: |
2776 | 2776 | vga.memory[offset] = src ^ dst; |
2777 | 2777 | break; |
2778 | 2778 | case 0x0006: |
2779 | | vga.memory[offset] = !(src ^ dst); |
| 2779 | vga.memory[offset] = ~(src ^ dst); |
2780 | 2780 | break; |
2781 | 2781 | case 0x0007: |
2782 | 2782 | vga.memory[offset] = src; |
2783 | 2783 | break; |
2784 | 2784 | case 0x0008: |
2785 | | vga.memory[offset] = !(src & dst); |
| 2785 | vga.memory[offset] = ~(src & dst); |
2786 | 2786 | break; |
2787 | 2787 | case 0x0009: |
2788 | | vga.memory[offset] = (!src) | dst; |
| 2788 | vga.memory[offset] = (~src) | dst; |
2789 | 2789 | break; |
2790 | 2790 | case 0x000a: |
2791 | | vga.memory[offset] = src | (!dst); |
| 2791 | vga.memory[offset] = src | (~dst); |
2792 | 2792 | break; |
2793 | 2793 | case 0x000b: |
2794 | 2794 | vga.memory[offset] = src | dst; |
r17576 | r17577 | |
2797 | 2797 | vga.memory[offset] = src & dst; |
2798 | 2798 | break; |
2799 | 2799 | case 0x000d: |
2800 | | vga.memory[offset] = src & (!dst); |
| 2800 | vga.memory[offset] = src & (~dst); |
2801 | 2801 | break; |
2802 | 2802 | case 0x000e: |
2803 | | vga.memory[offset] = (!src) & dst; |
| 2803 | vga.memory[offset] = (~src) & dst; |
2804 | 2804 | break; |
2805 | 2805 | case 0x000f: |
2806 | | vga.memory[offset] = !(src | dst); |
| 2806 | vga.memory[offset] = ~(src | dst); |
2807 | 2807 | break; |
2808 | 2808 | } |
2809 | 2809 | } |
r17576 | r17577 | |
2833 | 2833 | switch(s3.bgmix & 0x000f) |
2834 | 2834 | { |
2835 | 2835 | case 0x0000: |
2836 | | vga.memory[offset] = !dst; |
| 2836 | vga.memory[offset] = ~dst; |
2837 | 2837 | break; |
2838 | 2838 | case 0x0001: |
2839 | | // TODO: false |
| 2839 | vga.memory[offset] = 0x00; // is this correct? |
2840 | 2840 | break; |
2841 | 2841 | case 0x0002: |
2842 | | // TODO: true |
| 2842 | vga.memory[offset] = 0xff; // is this correct? |
2843 | 2843 | break; |
2844 | 2844 | case 0x0003: |
2845 | 2845 | // change nothing, pixel is unchanged |
2846 | 2846 | break; |
2847 | 2847 | case 0x0004: |
2848 | | vga.memory[offset] = !src; |
| 2848 | vga.memory[offset] = ~src; |
2849 | 2849 | break; |
2850 | 2850 | case 0x0005: |
2851 | 2851 | vga.memory[offset] = src ^ dst; |
2852 | 2852 | break; |
2853 | 2853 | case 0x0006: |
2854 | | vga.memory[offset] = !(src ^ dst); |
| 2854 | vga.memory[offset] = ~(src ^ dst); |
2855 | 2855 | break; |
2856 | 2856 | case 0x0007: |
2857 | 2857 | vga.memory[offset] = src; |
2858 | 2858 | break; |
2859 | 2859 | case 0x0008: |
2860 | | vga.memory[offset] = !(src & dst); |
| 2860 | vga.memory[offset] = ~(src & dst); |
2861 | 2861 | break; |
2862 | 2862 | case 0x0009: |
2863 | | vga.memory[offset] = (!src) | dst; |
| 2863 | vga.memory[offset] = (~src) | dst; |
2864 | 2864 | break; |
2865 | 2865 | case 0x000a: |
2866 | | vga.memory[offset] = src | (!dst); |
| 2866 | vga.memory[offset] = src | (~dst); |
2867 | 2867 | break; |
2868 | 2868 | case 0x000b: |
2869 | 2869 | vga.memory[offset] = src | dst; |
r17576 | r17577 | |
2872 | 2872 | vga.memory[offset] = src & dst; |
2873 | 2873 | break; |
2874 | 2874 | case 0x000d: |
2875 | | vga.memory[offset] = src & (!dst); |
| 2875 | vga.memory[offset] = src & (~dst); |
2876 | 2876 | break; |
2877 | 2877 | case 0x000e: |
2878 | | vga.memory[offset] = (!src) & dst; |
| 2878 | vga.memory[offset] = (~src) & dst; |
2879 | 2879 | break; |
2880 | 2880 | case 0x000f: |
2881 | | vga.memory[offset] = !(src | dst); |
| 2881 | vga.memory[offset] = ~(src | dst); |
2882 | 2882 | break; |
2883 | 2883 | } |
2884 | 2884 | } |
r17576 | r17577 | |
3006 | 3006 | if(s3.enable_8514 != 0) |
3007 | 3007 | { |
3008 | 3008 | int x,y; |
3009 | | int dir_x; |
3010 | | // int pattern_x,pattern_y; |
| 3009 | int pattern_x,pattern_y; |
3011 | 3010 | UINT32 offset,src; |
3012 | 3011 | |
3013 | 3012 | s3.current_cmd = data; |
r17576 | r17577 | |
3038 | 3037 | offset = VGA_START_ADDRESS; |
3039 | 3038 | offset += (VGA_LINE_LENGTH * s3.curr_y); |
3040 | 3039 | offset += s3.curr_x; |
3041 | | if(data & 0x0020) |
3042 | | dir_x = 1; |
3043 | | else |
3044 | | dir_x = -1; |
3045 | 3040 | for(y=0;y<=s3.rect_height;y++) |
3046 | 3041 | { |
3047 | | for(x=0;x<=s3.rect_width;x+=dir_x) |
| 3042 | for(x=0;x<=s3.rect_width;x++) |
3048 | 3043 | { |
3049 | | s3_write_fg((offset+x) % vga.svga_intf.vram_size); |
| 3044 | if(data & 0x0020) |
| 3045 | s3_write_fg((offset+x) % vga.svga_intf.vram_size); |
| 3046 | else |
| 3047 | s3_write_fg((offset-x) % vga.svga_intf.vram_size); |
3050 | 3048 | } |
3051 | 3049 | if(data & 0x0080) |
3052 | 3050 | offset += VGA_LINE_LENGTH; |
r17576 | r17577 | |
3091 | 3089 | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
3092 | 3090 | break; |
3093 | 3091 | case 0xe000: // Pattern Fill |
3094 | | // offset = VGA_START_ADDRESS; |
3095 | | // offset += (VGA_LINE_LENGTH * s3.dest_y); |
3096 | | // offset += s3.dest_x; |
3097 | | // src = VGA_START_ADDRESS; |
3098 | | // src += (VGA_LINE_LENGTH * s3.curr_y); |
3099 | | // src += s3.curr_x; |
3100 | | // pattern_x = pattern_y = 0; |
3101 | | // for(y=0;y<=s3.rect_height;y++) |
3102 | | // { |
3103 | | // for(x=0;x<=s3.rect_width;x++) |
3104 | | // { |
3105 | | // if(data & 0x0020) |
3106 | | // vga.memory[(offset+x) % vga.svga_intf.vram_size] = vga.memory[(src+pattern_x) % vga.svga_intf.vram_size]; |
3107 | | // else |
3108 | | // vga.memory[(offset-x) % vga.svga_intf.vram_size] = vga.memory[(src-pattern_x) % vga.svga_intf.vram_size]; |
3109 | | // pattern_x++; |
3110 | | // pattern_x %= 8; |
3111 | | // } |
3112 | | // pattern_y++; |
3113 | | // src += VGA_LINE_LENGTH; |
3114 | | // if(pattern_y % 8 == 0) |
3115 | | // src -= (VGA_LINE_LENGTH * 8); // move src pointer back to top of pattern |
3116 | | // if(data & 0x0080) |
3117 | | // offset += VGA_LINE_LENGTH; |
3118 | | // else |
3119 | | // offset -= VGA_LINE_LENGTH; |
3120 | | // } |
| 3092 | offset = VGA_START_ADDRESS; |
| 3093 | offset += (VGA_LINE_LENGTH * s3.dest_y); |
| 3094 | offset += s3.dest_x; |
| 3095 | src = VGA_START_ADDRESS; |
| 3096 | src += (VGA_LINE_LENGTH * s3.curr_y); |
| 3097 | src += s3.curr_x; |
| 3098 | if(data & 0x0020) |
| 3099 | pattern_x = 0; |
| 3100 | else |
| 3101 | pattern_x = 7; |
| 3102 | if(data & 0x0080) |
| 3103 | pattern_y = 0; |
| 3104 | else |
| 3105 | pattern_y = 7; |
| 3106 | |
| 3107 | for(y=0;y<=s3.rect_height;y++) |
| 3108 | { |
| 3109 | for(x=0;x<=s3.rect_width;x++) |
| 3110 | { |
| 3111 | if(data & 0x0020) |
| 3112 | { |
| 3113 | if(vga.memory[(src+pattern_x) % vga.svga_intf.vram_size] == 0x00) |
| 3114 | s3_write_fg(offset+x); |
| 3115 | else |
| 3116 | s3_write_bg(offset+x); |
| 3117 | pattern_x++; |
| 3118 | if(pattern_x >= 8) |
| 3119 | pattern_x = 0; |
| 3120 | } |
| 3121 | else |
| 3122 | { |
| 3123 | if(vga.memory[(src-pattern_x) % vga.svga_intf.vram_size] == 0x00) |
| 3124 | s3_write_fg(offset-x); |
| 3125 | else |
| 3126 | s3_write_bg(offset-x); |
| 3127 | pattern_x--; |
| 3128 | if(pattern_x < 0) |
| 3129 | pattern_x = 7; |
| 3130 | } |
| 3131 | } |
| 3132 | |
| 3133 | // for now, presume that INC_X and INC_Y affect both src and dest, at is would for a bitblt. |
| 3134 | if(data & 0x0020) |
| 3135 | pattern_x = 0; |
| 3136 | else |
| 3137 | pattern_x = 7; |
| 3138 | if(data & 0x0080) |
| 3139 | { |
| 3140 | pattern_y++; |
| 3141 | src += VGA_LINE_LENGTH; |
| 3142 | if(pattern_y >= 8) |
| 3143 | { |
| 3144 | pattern_y = 0; |
| 3145 | src -= (VGA_LINE_LENGTH * 8); // move src pointer back to top of pattern |
| 3146 | } |
| 3147 | offset += VGA_LINE_LENGTH; |
| 3148 | } |
| 3149 | else |
| 3150 | { |
| 3151 | pattern_y--; |
| 3152 | src -= VGA_LINE_LENGTH; |
| 3153 | if(pattern_y < 0) |
| 3154 | { |
| 3155 | pattern_y = 7; |
| 3156 | src += (VGA_LINE_LENGTH * 8); // move src pointer back to bottom of pattern |
| 3157 | } |
| 3158 | offset -= VGA_LINE_LENGTH; |
| 3159 | } |
| 3160 | } |
3121 | 3161 | s3.state = S3_IDLE; |
3122 | 3162 | s3.gpbusy = false; |
3123 | 3163 | logerror("S3: Command (%04x) - Pattern Fill - source %i,%i dest %i,%i Width: %i Height: %i\n",s3.current_cmd, |
r17576 | r17577 | |
3378 | 3418 | s3_write_bg(off % vga.svga_intf.vram_size); |
3379 | 3419 | } |
3380 | 3420 | } |
3381 | | off++; |
3382 | | s3.wait_rect_x++; |
3383 | | if(s3.wait_rect_x > s3.curr_x + s3.rect_width) |
| 3421 | if(s3.current_cmd & 0x0020) |
3384 | 3422 | { |
3385 | | s3.wait_rect_x = s3.curr_x; |
3386 | | s3.wait_rect_y++; |
3387 | | if(s3.wait_rect_y > s3.curr_y + s3.rect_height) |
| 3423 | off++; |
| 3424 | s3.wait_rect_x++; |
| 3425 | if(s3.wait_rect_x > s3.curr_x + s3.rect_width) |
3388 | 3426 | { |
3389 | | s3.state = S3_IDLE; |
3390 | | s3.gpbusy = false; |
| 3427 | s3.wait_rect_x = s3.curr_x; |
| 3428 | if(s3.current_cmd & 0x0080) |
| 3429 | { |
| 3430 | s3.wait_rect_y++; |
| 3431 | if(s3.wait_rect_y > s3.curr_y + s3.rect_height) |
| 3432 | { |
| 3433 | s3.state = S3_IDLE; |
| 3434 | s3.gpbusy = false; |
| 3435 | } |
| 3436 | } |
| 3437 | else |
| 3438 | { |
| 3439 | s3.wait_rect_y--; |
| 3440 | if(s3.wait_rect_y < s3.curr_y - s3.rect_height) |
| 3441 | { |
| 3442 | s3.state = S3_IDLE; |
| 3443 | s3.gpbusy = false; |
| 3444 | } |
| 3445 | } |
| 3446 | return; |
3391 | 3447 | } |
3392 | | return; |
3393 | 3448 | } |
| 3449 | else |
| 3450 | { |
| 3451 | off--; |
| 3452 | s3.wait_rect_x--; |
| 3453 | if(s3.wait_rect_x < s3.curr_x - s3.rect_width) |
| 3454 | { |
| 3455 | s3.wait_rect_x = s3.curr_x; |
| 3456 | if(s3.current_cmd & 0x0080) |
| 3457 | { |
| 3458 | s3.wait_rect_y++; |
| 3459 | if(s3.wait_rect_y > s3.curr_y + s3.rect_height) |
| 3460 | { |
| 3461 | s3.state = S3_IDLE; |
| 3462 | s3.gpbusy = false; |
| 3463 | } |
| 3464 | } |
| 3465 | else |
| 3466 | { |
| 3467 | s3.wait_rect_y--; |
| 3468 | if(s3.wait_rect_y < s3.curr_y - s3.rect_height) |
| 3469 | { |
| 3470 | s3.state = S3_IDLE; |
| 3471 | s3.gpbusy = false; |
| 3472 | } |
| 3473 | } |
| 3474 | return; |
| 3475 | } |
| 3476 | } |
3394 | 3477 | } |
3395 | 3478 | } |
3396 | 3479 | |
r17576 | r17577 | |
3429 | 3512 | WRITE16_HANDLER(s3_backmix_w) |
3430 | 3513 | { |
3431 | 3514 | s3.bgmix = data; |
| 3515 | logerror("S3: BG Mix write %04x\n",data); |
3432 | 3516 | } |
3433 | 3517 | |
3434 | 3518 | READ16_HANDLER(s3_foremix_r) |
r17576 | r17577 | |
3439 | 3523 | WRITE16_HANDLER(s3_foremix_w) |
3440 | 3524 | { |
3441 | 3525 | s3.fgmix = data; |
| 3526 | logerror("S3: FG Mix write %04x\n",data); |
3442 | 3527 | } |
3443 | 3528 | |
3444 | 3529 | READ16_HANDLER(s3_pixel_xfer_r) |