trunk/src/emu/video/pc_vga.c
r17549 | r17550 | |
3005 | 3005 | { |
3006 | 3006 | if(s3.enable_8514 != 0) |
3007 | 3007 | { |
3008 | | int x,y,count; |
| 3008 | int x,y; |
3009 | 3009 | int dir_x; |
| 3010 | // int pattern_x,pattern_y; |
3010 | 3011 | UINT32 offset,src; |
3011 | | UINT8* buffer; // for bitblt operations |
3012 | 3012 | |
3013 | 3013 | s3.current_cmd = data; |
3014 | 3014 | switch(data & 0xe000) |
r17549 | r17550 | |
3064 | 3064 | offset += s3.dest_x; |
3065 | 3065 | src = VGA_START_ADDRESS; |
3066 | 3066 | src += (VGA_LINE_LENGTH * s3.curr_y); |
3067 | | if(s3.curr_x & 0x0800) |
3068 | | src -= s3.curr_x & 0x7ff; |
3069 | | else |
3070 | | src += s3.curr_x; |
3071 | | buffer = (UINT8*)malloc((s3.rect_height+1)*(s3.rect_width+1)); |
3072 | | count = 0; |
3073 | | // copy to temporary buffer |
| 3067 | src += s3.curr_x; |
3074 | 3068 | for(y=0;y<=s3.rect_height;y++) |
3075 | 3069 | { |
3076 | 3070 | for(x=0;x<=s3.rect_width;x++) |
3077 | 3071 | { |
3078 | 3072 | if(data & 0x0020) |
3079 | | buffer[count++] = vga.memory[(src+x) % vga.svga_intf.vram_size]; |
| 3073 | vga.memory[(offset+x) % vga.svga_intf.vram_size] = vga.memory[(src+x) % vga.svga_intf.vram_size]; |
3080 | 3074 | else |
3081 | | buffer[count++] = vga.memory[(src-x) % vga.svga_intf.vram_size]; |
| 3075 | vga.memory[(offset-x) % vga.svga_intf.vram_size] = vga.memory[(src-x) % vga.svga_intf.vram_size]; |
3082 | 3076 | } |
3083 | 3077 | if(data & 0x0080) |
| 3078 | { |
3084 | 3079 | src += VGA_LINE_LENGTH; |
| 3080 | offset += VGA_LINE_LENGTH; |
| 3081 | } |
3085 | 3082 | else |
| 3083 | { |
3086 | 3084 | src -= VGA_LINE_LENGTH; |
3087 | | } |
3088 | | // write from buffer to screen |
3089 | | count = 0; |
3090 | | for(y=0;y<=s3.rect_height;y++) |
3091 | | { |
3092 | | for(x=0;x<=s3.rect_width;x++) |
3093 | | { |
3094 | | if(data & 0x0020) |
3095 | | vga.memory[(offset+x) % vga.svga_intf.vram_size] = buffer[count++]; |
3096 | | else |
3097 | | vga.memory[(offset-x) % vga.svga_intf.vram_size] = buffer[count++]; |
| 3085 | offset -= VGA_LINE_LENGTH; |
3098 | 3086 | } |
3099 | | if(data & 0x0080) |
3100 | | offset += VGA_LINE_LENGTH; |
3101 | | else |
3102 | | offset -= VGA_LINE_LENGTH; |
3103 | 3087 | } |
3104 | | free(buffer); |
3105 | 3088 | s3.state = S3_IDLE; |
3106 | 3089 | s3.gpbusy = false; |
3107 | 3090 | logerror("S3: Command (%04x) - BitBLT from %i,%i to %i,%i Width: %i Height: %i\n",s3.current_cmd, |
3108 | 3091 | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
3109 | 3092 | break; |
3110 | 3093 | 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 | // } |
3111 | 3121 | s3.state = S3_IDLE; |
3112 | 3122 | s3.gpbusy = false; |
3113 | | logerror("S3: Command (%04x) - Pattern Fill\n",s3.current_cmd); |
| 3123 | logerror("S3: Command (%04x) - Pattern Fill - source %i,%i dest %i,%i Width: %i Height: %i\n",s3.current_cmd, |
| 3124 | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
3114 | 3125 | break; |
3115 | 3126 | default: |
3116 | 3127 | s3.state = S3_IDLE; |
r17549 | r17550 | |
3337 | 3348 | int x,data_size = 0; |
3338 | 3349 | UINT32 off,xfer = 0; |
3339 | 3350 | |
3340 | | // the data in the pixel transfer register masks the rectangle output(?) |
| 3351 | // the data in the pixel transfer register or written to VRAM masks the rectangle output |
3341 | 3352 | if(s3.bus_size == 0) // 8-bit |
3342 | 3353 | data_size = 8; |
3343 | 3354 | if(s3.bus_size == 1) // 16-bit |
r17549 | r17550 | |
3354 | 3365 | // check clipping rectangle |
3355 | 3366 | if(s3.wait_rect_x >= s3.scissors_left && s3.wait_rect_x <= s3.scissors_right && s3.wait_rect_y >= s3.scissors_top && s3.wait_rect_y <= s3.scissors_bottom) |
3356 | 3367 | { |
3357 | | if(s3.current_cmd & 0x1000) |
| 3368 | if((s3.current_cmd & 0x1000) && (data_size != 8)) |
3358 | 3369 | { |
3359 | 3370 | xfer = ((s3.pixel_xfer & 0x000000ff) << 8) | ((s3.pixel_xfer & 0x0000ff00) >> 8) |
3360 | 3371 | | ((s3.pixel_xfer & 0x00ff0000) << 8) | ((s3.pixel_xfer & 0xff000000) >> 8); |
r17549 | r17550 | |
3378 | 3389 | s3.state = S3_IDLE; |
3379 | 3390 | s3.gpbusy = false; |
3380 | 3391 | } |
| 3392 | return; |
3381 | 3393 | } |
3382 | 3394 | } |
3383 | 3395 | } |