- Timestamp:
- Oct 27, 2010 1:57:33 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r33501 r33511 376 376 } 377 377 378 #ifdef LOG_ENABLED379 //#define DEBUG_VGA380 //#define DEBUG_VGA_MEM381 //#define DEBUG_VGA_REG382 383 #define DEBUG_BOCHS_VBE384 385 #endif386 387 378 /* force some bits to zero */ 388 379 static const uint8_t sr_mask[8] = { … … 534 525 case 0x3c5: 535 526 val = s->sr[s->sr_index]; 536 #ifdef DEBUG_VGA_REG 537 Log(("vga: read SR%x = 0x%02x\n", s->sr_index, val)); 538 #endif 527 Log2(("vga: read SR%x = 0x%02x\n", s->sr_index, val)); 539 528 break; 540 529 case 0x3c7: … … 562 551 case 0x3cf: 563 552 val = s->gr[s->gr_index]; 564 #ifdef DEBUG_VGA_REG 565 Log(("vga: read GR%x = 0x%02x\n", s->gr_index, val)); 566 #endif 553 Log2(("vga: read GR%x = 0x%02x\n", s->gr_index, val)); 567 554 break; 568 555 case 0x3b4: … … 573 560 case 0x3d5: 574 561 val = s->cr[s->cr_index]; 575 #ifdef DEBUG_VGA_REG 576 Log(("vga: read CR%x = 0x%02x\n", s->cr_index, val)); 577 #endif 562 Log2(("vga: read CR%x = 0x%02x\n", s->cr_index, val)); 578 563 break; 579 564 case 0x3ba: … … 589 574 } 590 575 } 591 #if defined(DEBUG_VGA)592 576 Log(("VGA: read addr=0x%04x data=0x%02x\n", addr, val)); 593 #endif594 577 return val; 595 578 } … … 600 583 int index; 601 584 602 #ifdef DEBUG_VGA603 585 Log(("VGA: write addr=0x%04x data=0x%02x\n", addr, val)); 604 #endif605 586 606 587 /* check port range access depending on color/monochrome mode */ … … 651 632 break; 652 633 case 0x3c5: 653 #ifdef DEBUG_VGA_REG 654 Log(("vga: write SR%x = 0x%02x\n", s->sr_index, val)); 655 #endif 634 Log2(("vga: write SR%x = 0x%02x\n", s->sr_index, val)); 656 635 s->sr[s->sr_index] = val & sr_mask[s->sr_index]; 657 636 … … 691 670 break; 692 671 case 0x3cf: 693 #ifdef DEBUG_VGA_REG 694 Log(("vga: write GR%x = 0x%02x\n", s->gr_index, val)); 695 #endif 672 Log2(("vga: write GR%x = 0x%02x\n", s->gr_index, val)); 696 673 s->gr[s->gr_index] = val & gr_mask[s->gr_index]; 697 674 … … 715 692 case 0x3b5: 716 693 case 0x3d5: 717 #ifdef DEBUG_VGA_REG 718 Log(("vga: write CR%x = 0x%02x\n", s->cr_index, val)); 719 #endif 694 Log2(("vga: write CR%x = 0x%02x\n", s->cr_index, val)); 720 695 /* handle CR0-7 protection */ 721 696 if ((s->cr[0x11] & 0x80) && s->cr_index <= 7) { … … 794 769 val = 0; 795 770 } 796 #ifdef DEBUG_BOCHS_VBE797 771 Log(("VBE: read index=0x%x val=0x%x\n", s->vbe_index, val)); 798 #endif799 772 return val; 800 773 } … … 845 818 846 819 if (s->vbe_index <= VBE_DISPI_INDEX_NB) { 847 #ifdef DEBUG_BOCHS_VBE848 820 Log(("VBE: write index=0x%x val=0x%x\n", s->vbe_index, val)); 849 #endif850 821 switch(s->vbe_index) { 851 822 case VBE_DISPI_INDEX_ID: … … 1113 1084 uint32_t ret; 1114 1085 1115 #ifdef DEBUG_VGA_MEM 1116 Log(("vga: read [0x%x] -> ", addr)); 1117 #endif 1086 Log3(("vga: read [0x%x] -> ", addr)); 1118 1087 /* convert to VGA memory offset */ 1119 1088 memory_map_mode = (s->gr[6] >> 2) & 3; … … 1183 1152 } 1184 1153 } 1185 #ifdef DEBUG_VGA_MEM 1186 Log((" 0x%02x\n", ret)); 1187 #endif 1154 Log3((" 0x%02x\n", ret)); 1188 1155 return ret; 1189 1156 } … … 1196 1163 uint32_t write_mask, bit_mask, set_mask; 1197 1164 1198 #ifdef DEBUG_VGA_MEM 1199 Log(("vga: [0x%x] = 0x%02x\n", addr, val)); 1200 #endif 1165 Log3(("vga: [0x%x] = 0x%02x\n", addr, val)); 1201 1166 /* convert to VGA memory offset */ 1202 1167 memory_map_mode = (s->gr[6] >> 2) & 3; … … 1243 1208 VERIFY_VRAM_WRITE_OFF_RETURN(s, addr); 1244 1209 s->CTX_SUFF(vram_ptr)[addr] = val; 1245 #ifdef DEBUG_VGA_MEM 1246 Log(("vga: chain4: [0x%x]\n", addr)); 1247 #endif 1210 Log3(("vga: chain4: [0x%x]\n", addr)); 1248 1211 s->plane_updated |= mask; /* only used to detect font change */ 1249 1212 vga_set_dirty(s, addr); … … 1262 1225 VERIFY_VRAM_WRITE_OFF_RETURN(s, addr); 1263 1226 s->CTX_SUFF(vram_ptr)[addr] = val; 1264 #ifdef DEBUG_VGA_MEM 1265 Log(("vga: odd/even: [0x%x]\n", addr)); 1266 #endif 1227 Log3(("vga: odd/even: [0x%x]\n", addr)); 1267 1228 s->plane_updated |= mask; /* only used to detect font change */ 1268 1229 vga_set_dirty(s, addr); … … 1377 1338 (((uint32_t *)s->CTX_SUFF(vram_ptr))[addr] & ~write_mask) | 1378 1339 (val & write_mask); 1379 #ifdef DEBUG_VGA_MEM 1380 Log(("vga: latch: [0x%x] mask=0x%08x val=0x%08x\n", 1340 Log3(("vga: latch: [0x%x] mask=0x%08x val=0x%08x\n", 1381 1341 addr * 4, write_mask, val)); 1382 #endif1383 1342 vga_set_dirty(s, (addr << 2)); 1384 1343 } … … 5211 5170 /* Clear the VRAM ourselves. */ 5212 5171 if (pThis->vram_ptrR3 && pThis->vram_size) 5213 {5214 #ifdef LOG_ENABLED /** @todo separate function. */5215 /* First dump the textmode contents to the log; handy for capturing Windows blue screens. */5216 uint8_t graphic_mode;5217 VGAState *s = pThis;5218 5219 if (!(s->ar_index & 0x20)) {5220 graphic_mode = GMODE_BLANK;5221 } else {5222 graphic_mode = s->gr[6] & 1;5223 }5224 switch(graphic_mode)5225 case GMODE_TEXT:5226 {5227 int cw, height, width, cheight, cx_min, cx_max, cy, cx;5228 int x_incr;5229 uint8_t *s1, *src, ch, cattr;5230 int line_offset;5231 uint16_t ch_attr;5232 5233 line_offset = s->line_offset;5234 s1 = s->CTX_SUFF(vram_ptr) + (s->start_addr * 4);5235 5236 /* total width & height */5237 cheight = (s->cr[9] & 0x1f) + 1;5238 cw = 8;5239 if (!(s->sr[1] & 0x01))5240 cw = 9;5241 if (s->sr[1] & 0x08)5242 cw = 16; /* NOTE: no 18 pixel wide */5243 x_incr = cw * ((s->pDrv->cBits + 7) >> 3);5244 width = (s->cr[0x01] + 1);5245 if (s->cr[0x06] == 100) {5246 /* ugly hack for CGA 160x100x16 - explain me the logic */5247 height = 100;5248 } else {5249 height = s->cr[0x12] |5250 ((s->cr[0x07] & 0x02) << 7) |5251 ((s->cr[0x07] & 0x40) << 3);5252 height = (height + 1) / cheight;5253 }5254 if ((height * width) > CH_ATTR_SIZE) {5255 /* better than nothing: exit if transient size is too big */5256 break;5257 }5258 RTLogPrintf("VGA textmode BEGIN (%dx%d):\n\n", height, width);5259 for(cy = 0; cy < height; cy++) {5260 src = s1;5261 cx_min = width;5262 cx_max = -1;5263 for(cx = 0; cx < width; cx++) {5264 ch_attr = *(uint16_t *)src;5265 if (cx < cx_min)5266 cx_min = cx;5267 if (cx > cx_max)5268 cx_max = cx;5269 # ifdef WORDS_BIGENDIAN5270 ch = ch_attr >> 8;5271 cattr = ch_attr & 0xff;5272 # else5273 ch = ch_attr & 0xff;5274 cattr = ch_attr >> 8;5275 # endif5276 RTLogPrintf("%c", ch);5277 5278 src += 8; /* Every second byte of a plane is used in text mode. */5279 }5280 if (cx_max != -1)5281 RTLogPrintf("\n");5282 5283 s1 += line_offset;5284 }5285 RTLogPrintf("VGA textmode END:\n\n");5286 }5287 5288 #endif /* LOG_ENABLED */5289 5172 memset(pThis->vram_ptrR3, 0, pThis->vram_size); 5290 }5291 5173 5292 5174 /*
Note:
See TracChangeset
for help on using the changeset viewer.