344 |
printf("vga: write CR%x = 0x%02x\n", s->cr_index, val); |
printf("vga: write CR%x = 0x%02x\n", s->cr_index, val); |
345 |
#endif |
#endif |
346 |
/* handle CR0-7 protection */ |
/* handle CR0-7 protection */ |
347 |
if ((s->cr[11] & 0x80) && s->cr_index <= 7) { |
if ((s->cr[0x11] & 0x80) && s->cr_index <= 7) { |
348 |
/* can always write bit 4 of CR7 */ |
/* can always write bit 4 of CR7 */ |
349 |
if (s->cr_index == 7) |
if (s->cr_index == 7) |
350 |
s->cr[7] = (s->cr[7] & ~0x10) | (val & 0x10); |
s->cr[7] = (s->cr[7] & ~0x10) | (val & 0x10); |
1346 |
disp_width = width; |
disp_width = width; |
1347 |
|
|
1348 |
shift_control = (s->gr[0x05] >> 5) & 3; |
shift_control = (s->gr[0x05] >> 5) & 3; |
1349 |
double_scan = (s->cr[0x09] & 0x80); |
double_scan = (s->cr[0x09] >> 7); |
1350 |
if (shift_control > 1) { |
if (shift_control != 1) { |
1351 |
multi_scan = (s->cr[0x09] & 0x1f); |
multi_scan = (((s->cr[0x09] & 0x1f) + 1) << double_scan) - 1; |
1352 |
} else { |
} else { |
1353 |
multi_scan = 0; |
/* in CGA modes, multi_scan is ignored */ |
1354 |
|
/* XXX: is it correct ? */ |
1355 |
|
multi_scan = double_scan; |
1356 |
} |
} |
1357 |
multi_run = multi_scan; |
multi_run = multi_scan; |
1358 |
if (shift_control != s->shift_control || |
if (shift_control != s->shift_control || |
1419 |
|
|
1420 |
line_offset = s->line_offset; |
line_offset = s->line_offset; |
1421 |
#if 0 |
#if 0 |
1422 |
printf("w=%d h=%d v=%d line_offset=%d double_scan=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=%02x\n", |
printf("w=%d h=%d v=%d line_offset=%d cr[0x09]=0x%02x cr[0x17]=0x%02x linecmp=%d sr[0x01]=0x%02x\n", |
1423 |
width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); |
width, height, v, line_offset, s->cr[9], s->cr[0x17], s->line_compare, s->sr[0x01]); |
1424 |
#endif |
#endif |
1425 |
addr1 = (s->start_addr * 4); |
addr1 = (s->start_addr * 4); |
1470 |
} |
} |
1471 |
} |
} |
1472 |
if (!multi_run) { |
if (!multi_run) { |
1473 |
if (!double_scan || (y & 1) != 0) { |
mask = (s->cr[0x17] & 3) ^ 3; |
1474 |
if (y1 == s->line_compare) { |
if ((y1 & mask) == mask) |
1475 |
addr1 = 0; |
addr1 += line_offset; |
1476 |
} else { |
y1++; |
|
mask = (s->cr[0x17] & 3) ^ 3; |
|
|
if ((y1 & mask) == mask) |
|
|
addr1 += line_offset; |
|
|
} |
|
|
y1++; |
|
|
} |
|
1477 |
multi_run = multi_scan; |
multi_run = multi_scan; |
1478 |
} else { |
} else { |
1479 |
multi_run--; |
multi_run--; |
|
y1++; |
|
1480 |
} |
} |
1481 |
|
/* line compare acts on the displayed lines */ |
1482 |
|
if (y == s->line_compare) |
1483 |
|
addr1 = 0; |
1484 |
d += linesize; |
d += linesize; |
1485 |
} |
} |
1486 |
if (y_start >= 0) { |
if (y_start >= 0) { |