trunk/src/emu/video/pc_vga.c
| r17649 | r17650 | |
| 213 | 213 | INT16 prev_y; |
| 214 | 214 | UINT16 src_x; |
| 215 | 215 | UINT16 src_y; |
| 216 | | UINT16 line_axial_step; |
| 217 | | UINT16 line_diagonal_step; |
| 218 | | UINT16 line_errorterm; |
| 216 | INT16 line_axial_step; |
| 217 | INT16 line_diagonal_step; |
| 218 | INT16 line_errorterm; |
| 219 | 219 | UINT16 rect_width; |
| 220 | 220 | UINT16 rect_height; |
| 221 | 221 | UINT32 fgcolour; |
| r17649 | r17650 | |
| 2519 | 2519 | { |
| 2520 | 2520 | switch(index) |
| 2521 | 2521 | { |
| 2522 | // case 0x2e: |
| 2523 | // res = 0x11; // Trio64 |
| 2524 | // break; |
| 2525 | // case 0x2f: |
| 2526 | // res = 0x00; |
| 2527 | // break; |
| 2522 | 2528 | case 0x30: // CR30 Chip ID/REV register |
| 2523 | | res = 0xc0; // TODO: hardcoded to Vision 86c864 |
| 2529 | res = 0xc0; // BIOS is from a card with the 764 chipset (Trio64) |
| 2524 | 2530 | break; |
| 2525 | 2531 | case 0x31: |
| 2526 | 2532 | res = s3.memory_config; |
| r17649 | r17650 | |
| 2978 | 2984 | |
| 2979 | 2985 | WRITE16_HANDLER(s3_line_error_w) |
| 2980 | 2986 | { |
| 2981 | | s3.line_errorterm = data & 0x3fff; |
| 2987 | s3.line_errorterm = data; |
| 2982 | 2988 | logerror("S3: Line Parameter/Error Term write %04x\n",data); |
| 2983 | 2989 | } |
| 2984 | 2990 | |
| r17649 | r17650 | |
| 3122 | 3128 | case 0x2000: // Line |
| 3123 | 3129 | s3.state = S3_IDLE; |
| 3124 | 3130 | s3.gpbusy = false; |
| 3125 | | logerror("S3: Command (%04x) - Line\n",s3.current_cmd); |
| 3131 | if(data & 0x0008) |
| 3132 | { |
| 3133 | // TODO |
| 3134 | logerror("S3: Command (%04x) - Line (Vector) - %i,%i \n",s3.current_cmd,s3.curr_x,s3.curr_y); |
| 3135 | } |
| 3136 | else |
| 3137 | { |
| 3138 | // Not perfect, but will do for now. |
| 3139 | INT16 dx = s3.rect_width; |
| 3140 | INT16 dy = s3.line_axial_step >> 1; |
| 3141 | INT16 err = s3.line_errorterm; |
| 3142 | int sx = (data & 0x0020) ? 1 : -1; |
| 3143 | int sy = (data & 0x0080) ? 1 : -1; |
| 3144 | int count = 0; |
| 3145 | INT16 temp; |
| 3146 | |
| 3147 | logerror("S3: Command (%04x) - Line (Bresenham) - %i,%i Axial %i, Diagonal %i, Error %i, Major Axis %i, Minor Axis %i\n",s3.current_cmd, |
| 3148 | s3.curr_x,s3.curr_y,s3.line_axial_step,s3.line_diagonal_step,s3.line_errorterm,s3.rect_width,s3.rect_height); |
| 3149 | |
| 3150 | if((data & 0x0040)) |
| 3151 | { |
| 3152 | temp = dx; dx = dy; dy = temp; |
| 3153 | } |
| 3154 | for(;;) |
| 3155 | { |
| 3156 | s3_write(s3.curr_x + (s3.curr_y * VGA_LINE_LENGTH),s3.curr_x + (s3.curr_y * VGA_LINE_LENGTH)); |
| 3157 | if (count > s3.rect_width) break; |
| 3158 | count++; |
| 3159 | if((err*2) > -dy) |
| 3160 | { |
| 3161 | err -= dy; |
| 3162 | s3.curr_x += sx; |
| 3163 | } |
| 3164 | if((err*2) < dx) |
| 3165 | { |
| 3166 | err += dx; |
| 3167 | s3.curr_y += sy; |
| 3168 | } |
| 3169 | } |
| 3170 | } |
| 3126 | 3171 | break; |
| 3127 | 3172 | case 0x4000: // Rectangle Fill |
| 3128 | 3173 | if(data & 0x0100) // WAIT (for read/write of PIXEL TRANSFER (E2E8)) |
| r17649 | r17650 | |
| 3134 | 3179 | s3.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour); |
| 3135 | 3180 | break; |
| 3136 | 3181 | } |
| 3182 | logerror("S3: Command (%04x) - Rectangle Fill %i,%i Width: %i Height: %i Colour: %08x\n",s3.current_cmd,s3.curr_x, |
| 3183 | s3.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour); |
| 3137 | 3184 | offset = 0; |
| 3138 | 3185 | offset += (VGA_LINE_LENGTH * s3.curr_y); |
| 3139 | 3186 | offset += s3.curr_x; |
| r17649 | r17650 | |
| 3179 | 3226 | } |
| 3180 | 3227 | s3.state = S3_IDLE; |
| 3181 | 3228 | s3.gpbusy = false; |
| 3182 | | logerror("S3: Command (%04x) - Rectangle Fill %i,%i Width: %i Height: %i Colour: %08x\n",s3.current_cmd,s3.curr_x, |
| 3183 | | s3.curr_y,s3.rect_width,s3.rect_height,s3.fgcolour); |
| 3184 | 3229 | break; |
| 3185 | 3230 | case 0xc000: // BitBLT |
| 3231 | logerror("S3: Command (%04x) - BitBLT from %i,%i to %i,%i Width: %i Height: %i\n",s3.current_cmd, |
| 3232 | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
| 3186 | 3233 | offset = 0; |
| 3187 | 3234 | offset += (VGA_LINE_LENGTH * s3.dest_y); |
| 3188 | 3235 | offset += s3.dest_x; |
| r17649 | r17650 | |
| 3237 | 3284 | } |
| 3238 | 3285 | s3.state = S3_IDLE; |
| 3239 | 3286 | s3.gpbusy = false; |
| 3240 | | logerror("S3: Command (%04x) - BitBLT from %i,%i to %i,%i Width: %i Height: %i\n",s3.current_cmd, |
| 3241 | | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
| 3242 | 3287 | break; |
| 3243 | 3288 | case 0xe000: // Pattern Fill |
| 3289 | logerror("S3: Command (%04x) - Pattern Fill - source %i,%i dest %i,%i Width: %i Height: %i\n",s3.current_cmd, |
| 3290 | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
| 3244 | 3291 | offset = 0; |
| 3245 | 3292 | offset += (VGA_LINE_LENGTH * s3.dest_y); |
| 3246 | 3293 | offset += s3.dest_x; |
| r17649 | r17650 | |
| 3306 | 3353 | } |
| 3307 | 3354 | s3.state = S3_IDLE; |
| 3308 | 3355 | s3.gpbusy = false; |
| 3309 | | logerror("S3: Command (%04x) - Pattern Fill - source %i,%i dest %i,%i Width: %i Height: %i\n",s3.current_cmd, |
| 3310 | | s3.curr_x,s3.curr_y,s3.dest_x,s3.dest_y,s3.rect_width,s3.rect_height); |
| 3311 | 3356 | break; |
| 3312 | 3357 | default: |
| 3313 | 3358 | s3.state = S3_IDLE; |
| r17649 | r17650 | |
| 3338 | 3383 | |
| 3339 | 3384 | WRITE16_HANDLER( s3_8ae8_w ) |
| 3340 | 3385 | { |
| 3341 | | s3.line_axial_step = data & 0x3fff; |
| 3386 | s3.line_axial_step = data; |
| 3342 | 3387 | s3.dest_y = data; |
| 3343 | 3388 | logerror("S3: Line Axial Step / Destination Y write %04x\n",data); |
| 3344 | 3389 | } |
| r17649 | r17650 | |
| 3363 | 3408 | |
| 3364 | 3409 | WRITE16_HANDLER( s3_8ee8_w ) |
| 3365 | 3410 | { |
| 3366 | | s3.line_diagonal_step = data & 0x3fff; |
| 3411 | s3.line_diagonal_step = data; |
| 3367 | 3412 | s3.dest_x = data; |
| 3368 | 3413 | logerror("S3: Line Diagonal Step / Destination X write %04x\n",data); |
| 3369 | 3414 | } |