mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 18:08:20 -07:00
(S)VGA: Implement odd pel shifts in 256-color modes.
This commit is contained in:
@@ -141,6 +141,7 @@ typedef struct svga_t {
|
||||
int render_line_offset;
|
||||
int start_retrace_latch;
|
||||
int vga_mode;
|
||||
int half_pixel;
|
||||
|
||||
/*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 :
|
||||
0MB-1MB - VRAM
|
||||
|
||||
@@ -1480,6 +1480,7 @@ svga_poll(void *priv)
|
||||
svga->scanline = 0;
|
||||
if (svga->attrregs[0x10] & 0x20) {
|
||||
svga->scrollcache = 0;
|
||||
svga->half_pixel = 0;
|
||||
svga->x_add = svga->left_overscan;
|
||||
}
|
||||
}
|
||||
@@ -1580,11 +1581,15 @@ svga_poll(void *priv)
|
||||
if (svga->scrollcache > 8)
|
||||
svga->scrollcache = 0;
|
||||
}
|
||||
svga->half_pixel = 0;
|
||||
} else if ((svga->render == svga_render_2bpp_lowres) || (svga->render == svga_render_2bpp_highres) ||
|
||||
(svga->render == svga_render_4bpp_lowres) || (svga->render == svga_render_4bpp_highres))
|
||||
(svga->render == svga_render_4bpp_lowres) || (svga->render == svga_render_4bpp_highres)) {
|
||||
svga->half_pixel = 0;
|
||||
svga->scrollcache &= 0x07;
|
||||
else
|
||||
} else {
|
||||
svga->half_pixel = svga->scrollcache & 0x01;
|
||||
svga->scrollcache = (svga->scrollcache & 0x06) >> 1;
|
||||
}
|
||||
|
||||
if ((svga->seqregs[1] & 8) || (svga->render == svga_render_8bpp_lowres))
|
||||
svga->scrollcache <<= 1;
|
||||
|
||||
@@ -805,6 +805,8 @@ svga_render_indexed_gfx(svga_t *svga, bool highres, bool combine8bits)
|
||||
uint32_t incr_counter = 0;
|
||||
uint32_t load_counter = 0;
|
||||
uint32_t edat = 0;
|
||||
uint32_t col = 0;
|
||||
uint32_t col2 = 0;
|
||||
for (x = 0; x <= (svga->hdisp + svga->scrollcache); x += charwidth) {
|
||||
if (load_counter == 0) {
|
||||
/* Find our address */
|
||||
@@ -923,8 +925,19 @@ svga_render_indexed_gfx(svga_t *svga, bool highres, bool combine8bits)
|
||||
}
|
||||
} else if (combine8bits) {
|
||||
if (svga->packed_4bpp) {
|
||||
uint32_t p0 = svga->map8[c0 & svga->dac_mask];
|
||||
uint32_t p1 = svga->map8[c1 & svga->dac_mask];
|
||||
uint32_t p0;
|
||||
uint32_t p1;
|
||||
if (svga->half_pixel) {
|
||||
col |= (c0 >> 4) & 0xff;
|
||||
col2 = (c0 << 4) & 0xff;
|
||||
col2 |= (c1 >> 4) & 0xff;
|
||||
p0 = svga->map8[col & svga->dac_mask];
|
||||
p1 = svga->map8[col2 & svga->dac_mask];
|
||||
col = (c1 << 4) & 0xff;
|
||||
} else {
|
||||
p0 = svga->map8[c0 & svga->dac_mask];
|
||||
p1 = svga->map8[c1 & svga->dac_mask];
|
||||
}
|
||||
const int outoffs = i << dwshift;
|
||||
for (int subx = 0; subx < dotwidth; subx++)
|
||||
p[outoffs + subx] = p0;
|
||||
@@ -932,7 +945,13 @@ svga_render_indexed_gfx(svga_t *svga, bool highres, bool combine8bits)
|
||||
p[outoffs + subx + dotwidth] = p1;
|
||||
} else {
|
||||
uint32_t ccombined = (c0 << 4) | c1;
|
||||
uint32_t p0 = svga->map8[ccombined & svga->dac_mask];
|
||||
uint32_t p0;
|
||||
if (svga->half_pixel) {
|
||||
col |= (ccombined >> 4) & 0xff;
|
||||
p0 = svga->map8[col & svga->dac_mask];
|
||||
col = (ccombined << 4) & 0xff;
|
||||
} else
|
||||
p0 = svga->map8[ccombined & svga->dac_mask];
|
||||
const int outoffs = (i >> 1) << dwshift;
|
||||
for (int subx = 0; subx < dotwidth; subx++)
|
||||
p[outoffs + subx] = p0;
|
||||
|
||||
Reference in New Issue
Block a user