Skip to content

Commit 3f65aed

Browse files
authored
Merge pull request 86Box#4181 from Cacodemon345/chips_69000_black_cursor_64x64_fix
C&T 69000: Fix black cursor on Red Hat Linux 8
2 parents 49b7c61 + 80adef5 commit 3f65aed

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

src/video/vid_chips_69000.c

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,14 +2287,46 @@ chips_69000_vblank_start(svga_t *svga)
22872287
chips_69000_interrupt(chips);
22882288
}
22892289

2290+
static void
2291+
chips_69000_hwcursor_draw_64x64(svga_t *svga, int displine)
2292+
{
2293+
chips_69000_t *chips = (chips_69000_t *) svga->priv;
2294+
uint64_t dat[2];
2295+
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
2296+
2297+
if (svga->interlace && svga->hwcursor_oddeven)
2298+
svga->hwcursor_latch.addr += 16;
2299+
2300+
dat[1] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr]));
2301+
dat[0] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr + 8]));
2302+
svga->hwcursor_latch.addr += 16;
2303+
2304+
for (uint8_t x = 0; x < 64; x++) {
2305+
if (!(dat[1] & (1ULL << 63)))
2306+
svga->monitor->target_buffer->line[displine][(offset + svga->x_add) & 2047] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, chips->cursor_pallook[5]) : svga_lookup_lut_ram(svga, chips->cursor_pallook[4]);
2307+
else if (dat[0] & (1ULL << 63))
2308+
svga->monitor->target_buffer->line[displine][(offset + svga->x_add) & 2047] ^= 0xffffff;
2309+
2310+
offset++;
2311+
dat[0] <<= 1;
2312+
dat[1] <<= 1;
2313+
}
2314+
2315+
if (svga->interlace && !svga->hwcursor_oddeven)
2316+
svga->hwcursor_latch.addr += 16;
2317+
}
2318+
22902319
static void
22912320
chips_69000_hwcursor_draw(svga_t *svga, int displine)
22922321
{
22932322
chips_69000_t *chips = (chips_69000_t *) svga->priv;
22942323
uint64_t dat[2];
22952324
int offset = svga->hwcursor_latch.x - svga->hwcursor_latch.xoff;
22962325

2297-
if (svga->interlace && (chips->ext_regs[0xa0] & 7) == 0b1) {
2326+
if ((chips->ext_regs[0xa0] & 7) == 0b101)
2327+
return chips_69000_hwcursor_draw_64x64(svga, displine);
2328+
2329+
if (svga->interlace) {
22982330
dat[1] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr]));
22992331
dat[0] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr + 8]));
23002332
svga->hwcursor_latch.addr += 16;
@@ -2315,10 +2347,7 @@ chips_69000_hwcursor_draw(svga_t *svga, int displine)
23152347
return;
23162348
}
23172349

2318-
if (svga->interlace && svga->hwcursor_oddeven)
2319-
svga->hwcursor_latch.addr += 16;
2320-
2321-
if ((svga->hwcursor_on & 1) && (chips->ext_regs[0xa0] & 7) == 0b1) {
2350+
if ((svga->hwcursor_on & 1)) {
23222351
dat[1] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr - 16]));
23232352
dat[0] = bswap64(*(uint64_t *) (&svga->vram[(svga->hwcursor_latch.addr - 16) + 8]));
23242353
dat[1] <<= 32ULL;
@@ -2329,27 +2358,17 @@ chips_69000_hwcursor_draw(svga_t *svga, int displine)
23292358
dat[0] = bswap64(*(uint64_t *) (&svga->vram[svga->hwcursor_latch.addr + 8]));
23302359
svga->hwcursor_latch.addr += 16;
23312360
}
2332-
switch (chips->ext_regs[0xa0] & 7) {
2333-
case 0b1:
2334-
case 0b101:
2335-
for (uint8_t x = 0; x < (((chips->ext_regs[0xa0] & 7) == 0b1) ? 32 : 64); x++) {
2336-
if (!(dat[1] & (1ULL << 63)))
2337-
svga->monitor->target_buffer->line[displine & 2047][(offset + svga->x_add) & 2047] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, chips->cursor_pallook[5]) : svga_lookup_lut_ram(svga, chips->cursor_pallook[4]);
2338-
else if (dat[0] & (1ULL << 63))
2339-
svga->monitor->target_buffer->line[displine & 2047][(offset + svga->x_add) & 2047] ^= 0xffffff;
2340-
2341-
offset++;
2342-
dat[0] <<= 1;
2343-
dat[1] <<= 1;
2344-
}
2345-
break;
23462361

2347-
default:
2348-
break;
2349-
}
2362+
for (uint8_t x = 0; x < 32; x++) {
2363+
if (!(dat[1] & (1ULL << 63)))
2364+
svga->monitor->target_buffer->line[displine & 2047][(offset + svga->x_add) & 2047] = (dat[0] & (1ULL << 63)) ? svga_lookup_lut_ram(svga, chips->cursor_pallook[5]) : svga_lookup_lut_ram(svga, chips->cursor_pallook[4]);
2365+
else if (dat[0] & (1ULL << 63))
2366+
svga->monitor->target_buffer->line[displine & 2047][(offset + svga->x_add) & 2047] ^= 0xffffff;
23502367

2351-
if (svga->interlace && !svga->hwcursor_oddeven)
2352-
svga->hwcursor_latch.addr += 16;
2368+
offset++;
2369+
dat[0] <<= 1;
2370+
dat[1] <<= 1;
2371+
}
23532372
}
23542373

23552374
static float

0 commit comments

Comments
 (0)