src/emu/video/pc_vga.c
| r13996 | r13997 | |
| 54 | 54 | |
| 55 | 55 | UINT8 *memory; |
| 56 | 56 | UINT8 *fontdirty; |
| 57 | | UINT16 pens[16]; /* the current 16 pens */ |
| 57 | UINT32 pens[16]; /* the current 16 pens */ |
| 58 | 58 | |
| 59 | 59 | UINT8 miscellaneous_output; |
| 60 | 60 | UINT8 feature_control; |
| r13996 | r13997 | |
| 184 | 184 | pc_current_width = -1; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | | static void vga_vh_text(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 187 | static void vga_vh_text(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 188 | 188 | { |
| 189 | 189 | UINT8 ch, attr; |
| 190 | 190 | UINT8 bits; |
| 191 | 191 | UINT8 *font; |
| 192 | | UINT16 *bitmapline; |
| 192 | UINT32 *bitmapline; |
| 193 | 193 | int width=CHAR_WIDTH, height=CRTC_CHAR_HEIGHT; |
| 194 | 194 | int pos, line, column, mask, w, h, addr; |
| 195 | 195 | pen_t pen; |
| r13996 | r13997 | |
| 214 | 214 | |
| 215 | 215 | for (h = MAX(-line, 0); (h < height) && (line+h < MIN(TEXT_LINES, bitmap.height())); h++) |
| 216 | 216 | { |
| 217 | | bitmapline = &bitmap.pix16(line+h); |
| 217 | bitmapline = &bitmap.pix32(line+h); |
| 218 | 218 | bits = font[h<<2]; |
| 219 | 219 | |
| 220 | 220 | assert(bitmapline); |
| r13996 | r13997 | |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | | static void vga_vh_ega(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 254 | static void vga_vh_ega(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 255 | 255 | { |
| 256 | 256 | int pos, line, column, c, addr, i; |
| 257 | 257 | int height = CRTC_CHAR_HEIGHT; |
| 258 | | UINT16 *bitmapline; |
| 259 | | UINT16 *newbitmapline; |
| 258 | UINT32 *bitmapline; |
| 259 | UINT32 *newbitmapline; |
| 260 | 260 | pen_t pen; |
| 261 | 261 | |
| 262 | 262 | for (addr=EGA_START_ADDRESS, pos=0, line=0; line<LINES; |
| 263 | 263 | line += height, addr=(addr+EGA_LINE_LENGTH)&0x3ffff) |
| 264 | 264 | { |
| 265 | | bitmapline = &bitmap.pix16(line); |
| 265 | bitmapline = &bitmap.pix32(line); |
| 266 | 266 | |
| 267 | 267 | for (pos=addr, c=0, column=0; column<EGA_COLUMNS; column++, c+=8, pos=(pos+4)&0x3ffff) |
| 268 | 268 | { |
| r13996 | r13997 | |
| 290 | 290 | if (line + i >= LINES) |
| 291 | 291 | break; |
| 292 | 292 | |
| 293 | | newbitmapline = &bitmap.pix16(line+i); |
| 293 | newbitmapline = &bitmap.pix32(line+i); |
| 294 | 294 | memcpy(newbitmapline, bitmapline, EGA_COLUMNS * 8 * sizeof(UINT16)); |
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | | static void vga_vh_vga(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 299 | static void vga_vh_vga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 300 | 300 | { |
| 301 | 301 | int pos, line, column, c, addr, curr_addr; |
| 302 | | UINT16 *bitmapline; |
| 302 | UINT32 *bitmapline; |
| 303 | 303 | UINT16 mask_comp; |
| 304 | 304 | |
| 305 | 305 | /* line compare is screen sensitive */ |
| r13996 | r13997 | |
| 314 | 314 | curr_addr = addr; |
| 315 | 315 | if(line == (vga.line_compare & mask_comp)) |
| 316 | 316 | curr_addr = 0; |
| 317 | | bitmapline = &bitmap.pix16(line); |
| 317 | bitmapline = &bitmap.pix32(line); |
| 318 | 318 | addr %= vga.svga_intf.vram_size; |
| 319 | 319 | for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x20) |
| 320 | 320 | { |
| r13996 | r13997 | |
| 339 | 339 | curr_addr = addr; |
| 340 | 340 | if(line == (vga.line_compare & mask_comp)) |
| 341 | 341 | curr_addr = 0; |
| 342 | | bitmapline = &bitmap.pix16(line); |
| 342 | bitmapline = &bitmap.pix32(line); |
| 343 | 343 | addr %= vga.svga_intf.vram_size; |
| 344 | 344 | for (pos=curr_addr, c=0, column=0; column<VGA_COLUMNS; column++, c+=8, pos+=0x08) |
| 345 | 345 | { |
| r13996 | r13997 | |
| 422 | 422 | return 0; |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | | SCREEN_UPDATE_IND16( pc_video ) |
| 425 | SCREEN_UPDATE_RGB32( pc_video ) |
| 426 | 426 | { |
| 427 | 427 | UINT8 cur_mode = 0; |
| 428 | 428 | int w = 0, h = 0; |
| r13996 | r13997 | |
| 451 | 451 | switch(cur_mode) |
| 452 | 452 | { |
| 453 | 453 | case 0: bitmap.fill(get_black_pen(screen.machine()), cliprect);break; |
| 454 | | case 1: vga_vh_text(bitmap,cliprect); break; |
| 455 | | case 2: vga_vh_vga(bitmap,cliprect); break; |
| 456 | | case 3: vga_vh_ega(bitmap,cliprect); break; |
| 454 | case 1: vga_vh_text(screen.machine(), bitmap,cliprect); break; |
| 455 | case 2: vga_vh_vga (screen.machine(), bitmap,cliprect); break; |
| 456 | case 3: vga_vh_ega (screen.machine(), bitmap,cliprect); break; |
| 457 | 457 | /* Nothing uses this so far, to be nuked */ |
| 458 | 458 | case 4: vga.svga_intf.choosevideomode(vga.sequencer.data, vga.crtc.data, vga.gc.data, &w, &h); break; |
| 459 | 459 | } |