Fixed the hardware cursor on the ET4000w32 and ET4000w32i.

This commit is contained in:
OBattler
2021-03-24 22:11:36 +01:00
parent 61f4a7f956
commit 18fd40f293

View File

@@ -92,12 +92,12 @@ typedef struct et4000w32p_t
uint32_t vram_mask; uint32_t vram_mask;
uint8_t banking, banking2; uint8_t banking, banking2;
uint8_t adjust_cursor;
uint8_t pci_regs[256]; uint8_t pci_regs[256];
int interleaved; int interleaved;
int bank; int bank;
int adjust_cursor;
/*Accelerator*/ /*Accelerator*/
struct struct
@@ -434,13 +434,19 @@ void et4000w32p_recalctimings(svga_t *svga)
} }
} }
et4000->adjust_cursor = 0;
switch (svga->bpp) switch (svga->bpp)
{ {
case 15: case 16: case 15: case 16:
svga->hdisp >>= 1; svga->hdisp >>= 1;
if (et4000->type <= ET4000W32I)
et4000->adjust_cursor = 1;
break; break;
case 24: case 24:
svga->hdisp /= 3; svga->hdisp /= 3;
if (et4000->type <= ET4000W32I)
et4000->adjust_cursor = 2;
break; break;
} }
@@ -1329,31 +1335,49 @@ void et4000w32p_blit(int count, uint32_t mix, uint32_t sdat, int cpu_input, et40
void et4000w32p_hwcursor_draw(svga_t *svga, int displine) void et4000w32p_hwcursor_draw(svga_t *svga, int displine)
{ {
et4000w32p_t *et4000 = (et4000w32p_t *)svga->p;
int x, offset; int x, offset;
uint8_t dat; int xx, shift = (et4000->adjust_cursor + 1);
int width = (svga->hwcursor_latch.xsize - svga->hwcursor_latch.xoff); int xx2, width = (svga->hwcursor_latch.xsize - svga->hwcursor_latch.xoff);
int pitch = (svga->hwcursor_latch.xsize == 128) ? 32 : 16; int pitch = (svga->hwcursor_latch.xsize == 128) ? 32 : 16;
offset = svga->hwcursor_latch.xoff; uint8_t dat;
offset = svga->hwcursor_latch.xoff / shift;
for (x = 0; x < width; x += 4) for (x = 0; x < width; x += 4) {
{
dat = svga->vram[svga->hwcursor_latch.addr + (offset >> 2)]; dat = svga->vram[svga->hwcursor_latch.addr + (offset >> 2)];
if (!(dat & 2)) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x] = (dat & 1) ? 0xFFFFFF : 0; xx = svga->hwcursor_latch.x + svga->x_add + x;
else if ((dat & 3) == 3) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x] ^= 0xFFFFFF; if (!(xx % shift)) {
xx2 = xx / shift;
if (!(dat & 2)) buffer32->line[displine][xx2] = (dat & 1) ? 0xFFFFFF : 0;
else if ((dat & 3) == 3) buffer32->line[displine][xx2] ^= 0xFFFFFF;
}
dat >>= 2; dat >>= 2;
if (!(dat & 2)) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 1] = (dat & 1) ? 0xFFFFFF : 0; xx++;
else if ((dat & 3) == 3) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 1] ^= 0xFFFFFF; if (!(xx % shift)) {
xx2 = xx / shift;
if (!(dat & 2)) buffer32->line[displine][xx2] = (dat & 1) ? 0xFFFFFF : 0;
else if ((dat & 3) == 3) buffer32->line[displine][xx2] ^= 0xFFFFFF;
}
dat >>= 2; dat >>= 2;
if (!(dat & 2)) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 2] = (dat & 1) ? 0xFFFFFF : 0; xx++;
else if ((dat & 3) == 3) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 2] ^= 0xFFFFFF; if (!(xx % shift)) {
xx2 = xx / shift;
if (!(dat & 2)) buffer32->line[displine][xx2] = (dat & 1) ? 0xFFFFFF : 0;
else if ((dat & 3) == 3) buffer32->line[displine][xx2] ^= 0xFFFFFF;
}
dat >>= 2; dat >>= 2;
if (!(dat & 2)) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 3] = (dat & 1) ? 0xFFFFFF : 0; xx++;
else if ((dat & 3) == 3) buffer32->line[displine][svga->hwcursor_latch.x + svga->x_add + x + 3] ^= 0xFFFFFF; if (!(xx % shift)) {
xx2 = xx / shift;
if (!(dat & 2)) buffer32->line[displine][xx2] = (dat & 1) ? 0xFFFFFF : 0;
else if ((dat & 3) == 3) buffer32->line[displine][xx2] ^= 0xFFFFFF;
}
dat >>= 2; dat >>= 2;
offset += 4; offset += 4;
} }
svga->hwcursor_latch.addr += pitch; svga->hwcursor_latch.addr += pitch;
} }