Removed palettised blitting code.
This commit is contained in:
parent
3d69f092c9
commit
3c514a445f
18 changed files with 572 additions and 1079 deletions
|
|
@ -137,7 +137,7 @@ void cga_poll(void *p)
|
|||
int oldvc;
|
||||
uint8_t chr, attr;
|
||||
uint16_t dat;
|
||||
int cols[4];
|
||||
uint32_t cols[4];
|
||||
int col;
|
||||
int oldsc;
|
||||
|
||||
|
|
@ -158,20 +158,15 @@ void cga_poll(void *p)
|
|||
// printf("Firstline %i\n",firstline);
|
||||
}
|
||||
cga->lastline = cga->displine;
|
||||
|
||||
cols[0] = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15);
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
if ((cga->cgamode & 0x12) == 0x12)
|
||||
{
|
||||
buffer->line[cga->displine][c] = 0;
|
||||
if (cga->cgamode & 1) buffer->line[cga->displine][c + (cga->crtc[1] << 3) + 8] = 0;
|
||||
else buffer->line[cga->displine][c + (cga->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
((uint32_t *)buffer32->line[cga->displine])[c] = cols[0];
|
||||
if (cga->cgamode & 1)
|
||||
((uint32_t *)buffer32->line[cga->displine])[c + (cga->crtc[1] << 3) + 8] = cols[0];
|
||||
else
|
||||
{
|
||||
buffer->line[cga->displine][c] = (cga->cgacol & 15) + 16;
|
||||
if (cga->cgamode & 1) buffer->line[cga->displine][c + (cga->crtc[1] << 3) + 8] = (cga->cgacol & 15) + 16;
|
||||
else buffer->line[cga->displine][c + (cga->crtc[1] << 4) + 8] = (cga->cgacol & 15) + 16;
|
||||
}
|
||||
((uint32_t *)buffer32->line[cga->displine])[c + (cga->crtc[1] << 4) + 8] = cols[0];
|
||||
}
|
||||
if (cga->cgamode & 1)
|
||||
{
|
||||
|
|
@ -182,25 +177,25 @@ void cga_poll(void *p)
|
|||
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
|
||||
if (cga->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
cols[1] = attr & 15;
|
||||
cols[0] = (attr >> 4) & 7;
|
||||
if ((cga->cgablink & 8) && (attr & 0x80) && !cga->drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = attr & 15;
|
||||
cols[0] = attr >> 4;
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[cga->displine][(x << 3) + c + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 0xffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[cga->displine][(x << 3) + c + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
cga->ma++;
|
||||
}
|
||||
|
|
@ -214,32 +209,35 @@ void cga_poll(void *p)
|
|||
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron);
|
||||
if (cga->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
if ((cga->cgablink & 8) && (attr & 0x80)) cols[1] = cols[0];
|
||||
cols[1] = attr & 15;
|
||||
cols[0] = (attr >> 4) & 7;
|
||||
if ((cga->cgablink & 8) && (attr & 0x80) && !cga->drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = attr & 15;
|
||||
cols[0] = attr >> 4;
|
||||
}
|
||||
cga->ma++;
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[cga->displine][(x << 4)+(c << 1) + 8] = buffer->line[cga->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4)+(c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 0xffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[cga->displine][(x << 4) + (c << 1) + 8] = buffer->line[cga->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][cga->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(cga->cgamode & 16))
|
||||
{
|
||||
cols[0] = (cga->cgacol & 15) | 16;
|
||||
col = (cga->cgacol & 16) ? 24 : 16;
|
||||
cols[0] = cga->cgacol & 15;
|
||||
col = (cga->cgacol & 16) ? 8 : 0;
|
||||
if (cga->cgamode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
|
|
@ -264,22 +262,23 @@ void cga_poll(void *p)
|
|||
cga->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[cga->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[cga->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[0] = 0; cols[1] = (cga->cgacol & 15) + 16;
|
||||
cols[0] = 0;
|
||||
cols[1] = cga->cgacol & 15;
|
||||
for (x = 0; x < cga->crtc[1]; x++)
|
||||
{
|
||||
dat = (cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000)] << 8) | cga->vram[((cga->ma << 1) & 0x1fff) + ((cga->sc & 1) * 0x2000) + 1];
|
||||
cga->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[cga->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
((uint32_t *)buffer32->line[cga->displine])[(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -287,9 +286,9 @@ void cga_poll(void *p)
|
|||
}
|
||||
else
|
||||
{
|
||||
cols[0] = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15) + 16;
|
||||
if (cga->cgamode & 1) hline(buffer, 0, cga->displine, (cga->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, cga->displine, (cga->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15);
|
||||
if (cga->cgamode & 1) hline(buffer32, 0, cga->displine, (cga->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, cga->displine, (cga->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
|
||||
if (cga->cgamode & 1) x = (cga->crtc[1] << 3) + 16;
|
||||
|
|
@ -298,10 +297,15 @@ void cga_poll(void *p)
|
|||
if (cga->composite)
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
buffer32->line[cga->displine][c] = buffer->line[cga->displine][c] & 0xf;
|
||||
buffer32->line[cga->displine][c] = ((uint32_t *)buffer32->line[cga->displine])[c] & 0xf;
|
||||
|
||||
Composite_Process(cga->cgamode, 0, x >> 2, buffer32->line[cga->displine]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
((uint32_t *)buffer32->line[cga->displine])[c] = cgapal[((uint32_t *)buffer32->line[cga->displine])[c] & 0xf];
|
||||
}
|
||||
|
||||
cga->sc = oldsc;
|
||||
if (cga->vc == cga->crtc[7] && !cga->sc)
|
||||
|
|
@ -380,10 +384,7 @@ void cga_poll(void *p)
|
|||
updatewindowsize(xsize, (ysize << 1) + 16);
|
||||
}
|
||||
|
||||
if (cga->composite)
|
||||
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, cga->firstline - 4, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
video_blit_memtoscreen(0, cga->firstline - 4, 0, (cga->lastline - cga->firstline) + 8, xsize, (cga->lastline - cga->firstline) + 8);
|
||||
frames++;
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
|
|
@ -101,10 +101,10 @@ void colorplus_poll(void *p)
|
|||
int cols[4];
|
||||
int col;
|
||||
int oldsc;
|
||||
static const int cols16[16] = { 0x10,0x12,0x14,0x16,
|
||||
0x18,0x1A,0x1C,0x1E,
|
||||
0x11,0x13,0x15,0x17,
|
||||
0x19,0x1B,0x1D,0x1F };
|
||||
static const int cols16[16] = { 0x0,0x2,0x4,0x6,
|
||||
0x8,0xA,0xC,0xE,
|
||||
0x1,0x3,0x5,0x7,
|
||||
0x9,0xB,0xD,0xF };
|
||||
uint8_t *plane0 = colorplus->cga.vram;
|
||||
uint8_t *plane1 = colorplus->cga.vram + 0x4000;
|
||||
|
||||
|
|
@ -137,8 +137,8 @@ void colorplus_poll(void *p)
|
|||
/* Left / right border */
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[colorplus->cga.displine][c] =
|
||||
buffer->line[colorplus->cga.displine][c + (colorplus->cga.crtc[1] << 4) + 8] = (colorplus->cga.cgacol & 15) + 16;
|
||||
((uint32_t *)buffer32->line[colorplus->cga.displine])[c] =
|
||||
((uint32_t *)buffer32->line[colorplus->cga.displine])[c + (colorplus->cga.crtc[1] << 4) + 8] = cgapal[colorplus->cga.cgacol & 15];
|
||||
}
|
||||
if (colorplus->control & COLORPLUS_320x200_MODE)
|
||||
{
|
||||
|
|
@ -151,9 +151,9 @@ void colorplus_poll(void *p)
|
|||
colorplus->cga.ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[colorplus->cga.displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[colorplus->cga.displine][(x << 4) + (c << 1) + 1 + 8] =
|
||||
cols16[(dat0 >> 14) | ((dat1 >> 14) << 2)];
|
||||
((uint32_t *)buffer32->line[colorplus->cga.displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[colorplus->cga.displine])[(x << 4) + (c << 1) + 1 + 8] =
|
||||
cgapal[cols16[(dat0 >> 14) | ((dat1 >> 14) << 2)]];
|
||||
dat0 <<= 2;
|
||||
dat1 <<= 2;
|
||||
}
|
||||
|
|
@ -161,25 +161,25 @@ void colorplus_poll(void *p)
|
|||
}
|
||||
else if (colorplus->control & COLORPLUS_640x200_MODE)
|
||||
{
|
||||
cols[0] = (colorplus->cga.cgacol & 15) | 16;
|
||||
col = (colorplus->cga.cgacol & 16) ? 24 : 16;
|
||||
cols[0] = cgapal[colorplus->cga.cgacol & 15];
|
||||
col = (colorplus->cga.cgacol & 16) ? 8 : 0;
|
||||
if (colorplus->cga.cgamode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else if (colorplus->cga.cgacol & 32)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 5;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 5];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = col | 2;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 6;
|
||||
cols[1] = cgapal[col | 2];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 6];
|
||||
}
|
||||
for (x = 0; x < colorplus->cga.crtc[1]; x++)
|
||||
{
|
||||
|
|
@ -190,7 +190,7 @@ void colorplus_poll(void *p)
|
|||
colorplus->cga.ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[colorplus->cga.displine][(x << 4) + c + 8] =
|
||||
((uint32_t *)buffer32->line[colorplus->cga.displine])[(x << 4) + c + 8] =
|
||||
cols[(dat0 >> 15) | ((dat1 >> 15) << 1)];
|
||||
dat0 <<= 1;
|
||||
dat1 <<= 1;
|
||||
|
|
@ -200,8 +200,8 @@ void colorplus_poll(void *p)
|
|||
}
|
||||
else /* Top / bottom border */
|
||||
{
|
||||
cols[0] = (colorplus->cga.cgacol & 15) + 16;
|
||||
hline(buffer, 0, colorplus->cga.displine, (colorplus->cga.crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = cgapal[colorplus->cga.cgacol & 15];
|
||||
hline(buffer32, 0, colorplus->cga.displine, (colorplus->cga.crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
|
||||
x = (colorplus->cga.crtc[1] << 4) + 16;
|
||||
|
|
@ -283,7 +283,7 @@ void colorplus_poll(void *p)
|
|||
updatewindowsize(xsize, (ysize << 1) + 16);
|
||||
}
|
||||
|
||||
video_blit_memtoscreen_8(0, colorplus->cga.firstline - 4, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
||||
video_blit_memtoscreen(0, colorplus->cga.firstline - 4, 0, (colorplus->cga.lastline - colorplus->cga.firstline) + 8, xsize, (colorplus->cga.lastline - colorplus->cga.firstline) + 8);
|
||||
frames++;
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ typedef struct genius_t
|
|||
uint8_t *vram;
|
||||
} genius_t;
|
||||
|
||||
static uint32_t genius_pal[4];
|
||||
|
||||
/* Mapping of attributes to colours, in MDA emulation mode */
|
||||
static int mdacols[256][2][2];
|
||||
|
||||
|
|
@ -265,7 +267,7 @@ void genius_textline(genius_t *genius, uint8_t background)
|
|||
uint16_t ma = (genius->mda_crtc[13] | (genius->mda_crtc[12] << 8)) & 0x3fff;
|
||||
uint16_t ca = (genius->mda_crtc[15] | (genius->mda_crtc[14] << 8)) & 0x3fff;
|
||||
unsigned char *framebuf = genius->vram + 0x10000;
|
||||
uint8_t col;
|
||||
uint32_t col;
|
||||
|
||||
/* Character height is 12-15 */
|
||||
charh = 15 - (genius->genius_charh & 3);
|
||||
|
|
@ -317,13 +319,13 @@ void genius_textline(genius_t *genius, uint8_t background)
|
|||
|
||||
if (genius->genius_control & 0x20)
|
||||
{
|
||||
col ^= 15;
|
||||
col ^= 0xffffff;
|
||||
}
|
||||
|
||||
for (c = 0; c < cw; c++)
|
||||
{
|
||||
if (col != background)
|
||||
buffer->line[genius->displine][(x * cw) + c] = col;
|
||||
((uint32_t *)buffer32->line[genius->displine])[(x * cw) + c] = col;
|
||||
}
|
||||
}
|
||||
else /* Draw 8 pixels of character */
|
||||
|
|
@ -337,33 +339,35 @@ void genius_textline(genius_t *genius, uint8_t background)
|
|||
|
||||
if (genius->genius_control & 0x20)
|
||||
{
|
||||
col ^= 15;
|
||||
col ^= 0xffffff;
|
||||
}
|
||||
if (col != background)
|
||||
{
|
||||
buffer->line[genius->displine][(x * cw) + c] = col;
|
||||
((uint32_t *)buffer32->line[genius->displine])[(x * cw) + c] = col;
|
||||
}
|
||||
}
|
||||
/* The ninth pixel column... */
|
||||
if ((chr & ~0x1f) == 0xc0)
|
||||
{
|
||||
/* Echo column 8 for the graphics chars */
|
||||
col = buffer->line[genius->displine][(x * cw) + 7];
|
||||
if (col != background) buffer->line[genius->displine][(x * cw) + 8] = col;
|
||||
col = ((uint32_t *)buffer32->line[genius->displine])[(x * cw) + 7];
|
||||
if (col != background)
|
||||
((uint32_t *)buffer32->line[genius->displine])[(x * cw) + 8] = col;
|
||||
}
|
||||
else /* Otherwise fill with background */
|
||||
{
|
||||
col = mdacols[attr][blink][0];
|
||||
if (genius->genius_control & 0x20)
|
||||
{
|
||||
col ^= 15;
|
||||
col ^= 0xffffff;
|
||||
}
|
||||
if (col != background) buffer->line[genius->displine][(x * cw) + 8] = col;
|
||||
if (col != background)
|
||||
((uint32_t *)buffer32->line[genius->displine])[(x * cw) + 8] = col;
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < cw; c++)
|
||||
buffer->line[genius->displine][(x * cw) + c] ^= mdacols[attr][0][1];
|
||||
((uint32_t *)buffer32->line[genius->displine])[(x * cw) + c] ^= mdacols[attr][0][1];
|
||||
}
|
||||
++ma;
|
||||
}
|
||||
|
|
@ -378,10 +382,10 @@ void genius_cgaline(genius_t *genius)
|
|||
{
|
||||
int x, c;
|
||||
uint32_t dat;
|
||||
uint8_t ink;
|
||||
uint32_t ink;
|
||||
uint32_t addr;
|
||||
|
||||
ink = (genius->genius_control & 0x20) ? 16 : 16+15;
|
||||
ink = (genius->genius_control & 0x20) ? genius_pal[0] : genius_pal[3];
|
||||
/* We draw the CGA at row 600 */
|
||||
if (genius->displine < 600)
|
||||
{
|
||||
|
|
@ -402,7 +406,7 @@ void genius_cgaline(genius_t *genius)
|
|||
{
|
||||
if (dat & 0x80)
|
||||
{
|
||||
buffer->line[genius->displine][x*8 + c] = ink;
|
||||
((uint32_t *)buffer32->line[genius->displine])[x*8 + c] = ink;
|
||||
}
|
||||
dat = dat << 1;
|
||||
}
|
||||
|
|
@ -420,7 +424,7 @@ void genius_hiresline(genius_t *genius)
|
|||
uint8_t ink;
|
||||
uint32_t addr;
|
||||
|
||||
ink = (genius->genius_control & 0x20) ? 16 : 16+15;
|
||||
ink = (genius->genius_control & 0x20) ? genius_pal[0] : genius_pal[3];
|
||||
/* The first 512 lines live at A0000 */
|
||||
if (genius->displine < 512)
|
||||
{
|
||||
|
|
@ -440,7 +444,7 @@ void genius_hiresline(genius_t *genius)
|
|||
{
|
||||
if (dat & 0x80)
|
||||
{
|
||||
buffer->line[genius->displine][x*8 + c] = ink;
|
||||
((uint32_t *)buffer32->line[genius->displine])[x*8 + c] = ink;
|
||||
}
|
||||
dat = dat << 1;
|
||||
}
|
||||
|
|
@ -466,11 +470,11 @@ void genius_poll(void *p)
|
|||
{
|
||||
if (genius->genius_control & 0x20)
|
||||
{
|
||||
background = 16 + 15;
|
||||
background = genius_pal[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
background = 16;
|
||||
background = genius_pal[0];
|
||||
}
|
||||
if (genius->displine == 0)
|
||||
{
|
||||
|
|
@ -479,7 +483,7 @@ void genius_poll(void *p)
|
|||
/* Start off with a blank line */
|
||||
for (x = 0; x < GENIUS_XSIZE; x++)
|
||||
{
|
||||
buffer->line[genius->displine][x] = background;
|
||||
((uint32_t *)buffer32->line[genius->displine])[x] = background;
|
||||
}
|
||||
/* If graphics display enabled, draw graphics on top
|
||||
* of the blanked line */
|
||||
|
|
@ -536,7 +540,7 @@ void genius_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
video_blit_memtoscreen_8(0, 0, xsize, ysize);
|
||||
video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize);
|
||||
|
||||
frames++;
|
||||
/* Fixed 728x1008 resolution */
|
||||
|
|
@ -566,27 +570,32 @@ void *genius_init()
|
|||
io_sethandler(0x03b0, 0x000C, genius_in, NULL, NULL, genius_out, NULL, NULL, genius);
|
||||
io_sethandler(0x03d0, 0x0010, genius_in, NULL, NULL, genius_out, NULL, NULL, genius);
|
||||
|
||||
genius_pal[0] = makecol(0x00, 0x00, 0x00);
|
||||
genius_pal[1] = makecol(0x55, 0x55, 0x55);
|
||||
genius_pal[2] = makecol(0xaa, 0xaa, 0xaa);
|
||||
genius_pal[3] = makecol(0xff, 0xff, 0xff);
|
||||
|
||||
/* MDA attributes */
|
||||
/* I don't know if the Genius's MDA emulation actually does
|
||||
* emulate bright / non-bright. For the time being pretend it does. */
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16;
|
||||
if (c & 8) mdacols[c][0][1] = 15 + 16;
|
||||
else mdacols[c][0][1] = 7 + 16;
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = genius_pal[0];
|
||||
if (c & 8) mdacols[c][0][1] = genius_pal[3];
|
||||
else mdacols[c][0][1] = genius_pal[2];
|
||||
}
|
||||
mdacols[0x70][0][1] = 16;
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = 16 + 15;
|
||||
mdacols[0xF0][0][1] = 16;
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = 16 + 15;
|
||||
mdacols[0x78][0][1] = 16 + 7;
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = 16 + 15;
|
||||
mdacols[0xF8][0][1] = 16 + 7;
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = 16 + 15;
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = 16;
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = 16;
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16;
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16;
|
||||
mdacols[0x70][0][1] = genius_pal[0];
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = genius_pal[3];
|
||||
mdacols[0xF0][0][1] = genius_pal[0];
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = genius_pal[3];
|
||||
mdacols[0x78][0][1] = genius_pal[2];
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = genius_pal[3];
|
||||
mdacols[0xF8][0][1] = genius_pal[2];
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = genius_pal[3];
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = genius_pal[0];
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = genius_pal[0];
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = genius_pal[0];
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = genius_pal[0];
|
||||
|
||||
/* Start off in 80x25 text mode */
|
||||
genius->cga_stat = 0xF4;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ typedef struct hercules_t
|
|||
uint8_t *vram;
|
||||
} hercules_t;
|
||||
|
||||
static int mdacols[256][2][2];
|
||||
static uint32_t mdacols[256][2][2];
|
||||
|
||||
void hercules_recalctimings(hercules_t *hercules);
|
||||
void hercules_write(uint32_t addr, uint8_t val, void *p);
|
||||
|
|
@ -153,7 +153,7 @@ void hercules_poll(void *p)
|
|||
dat = (hercules->vram[((hercules->ma << 1) & 0x1fff) + ca] << 8) | hercules->vram[((hercules->ma << 1) & 0x1fff) + ca + 1];
|
||||
hercules->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
buffer->line[hercules->displine][(x << 4) + c] = (dat & (32768 >> c)) ? 7 : 0;
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x << 4) + c] = (dat & (32768 >> c)) ? 0xffffff : 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -167,20 +167,22 @@ void hercules_poll(void *p)
|
|||
if (hercules->sc == 12 && ((attr & 7) == 1))
|
||||
{
|
||||
for (c = 0; c < 9; c++)
|
||||
buffer->line[hercules->displine][(x * 9) + c] = mdacols[attr][blink][1];
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x * 9) + c] = mdacols[attr][blink][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[hercules->displine][(x * 9) + c] = mdacols[attr][blink][(fontdatm[chr][hercules->sc] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
if ((chr & ~0x1f) == 0xc0) buffer->line[hercules->displine][(x * 9) + 8] = mdacols[attr][blink][fontdatm[chr][hercules->sc] & 1];
|
||||
else buffer->line[hercules->displine][(x * 9) + 8] = mdacols[attr][blink][0];
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x * 9) + c] = mdacols[attr][blink][(fontdatm[chr][hercules->sc] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
if ((chr & ~0x1f) == 0xc0)
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x * 9) + 8] = mdacols[attr][blink][fontdatm[chr][hercules->sc] & 1];
|
||||
else
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x * 9) + 8] = mdacols[attr][blink][0];
|
||||
}
|
||||
hercules->ma++;
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 9; c++)
|
||||
buffer->line[hercules->displine][(x * 9) + c] ^= mdacols[attr][0][1];
|
||||
((uint32_t *)buffer32->line[hercules->displine])[(x * 9) + c] ^= mdacols[attr][0][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +270,7 @@ void hercules_poll(void *p)
|
|||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
|
||||
video_blit_memtoscreen_8(0, hercules->firstline, xsize, ysize);
|
||||
video_blit_memtoscreen(0, hercules->firstline, 0, ysize, xsize, ysize);
|
||||
|
||||
frames++;
|
||||
if ((hercules->ctrl & 2) && (hercules->ctrl2 & 1))
|
||||
|
|
@ -317,22 +319,22 @@ void *hercules_init()
|
|||
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16;
|
||||
if (c & 8) mdacols[c][0][1] = 15 + 16;
|
||||
else mdacols[c][0][1] = 7 + 16;
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = makecol32(0, 0, 0);
|
||||
if (c & 8) mdacols[c][0][1] = makecol32(0xff, 0xff, 0xff);
|
||||
else mdacols[c][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
}
|
||||
mdacols[0x70][0][1] = 16;
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = 16 + 15;
|
||||
mdacols[0xF0][0][1] = 16;
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = 16 + 15;
|
||||
mdacols[0x78][0][1] = 16 + 7;
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = 16 + 15;
|
||||
mdacols[0xF8][0][1] = 16 + 7;
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = 16 + 15;
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = 16;
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = 16;
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16;
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16;
|
||||
mdacols[0x70][0][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0xF0][0][1] = makecol32(0, 0, 0);
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0x78][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0xF8][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = makecol32(0, 0, 0);
|
||||
|
||||
return hercules;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ typedef struct mda_t
|
|||
uint8_t *vram;
|
||||
} mda_t;
|
||||
|
||||
static int mdacols[256][2][2];
|
||||
static uint32_t mdacols[256][2][2];
|
||||
|
||||
void mda_recalctimings(mda_t *mda);
|
||||
|
||||
|
|
@ -135,20 +135,22 @@ void mda_poll(void *p)
|
|||
if (mda->sc == 12 && ((attr & 7) == 1))
|
||||
{
|
||||
for (c = 0; c < 9; c++)
|
||||
buffer->line[mda->displine][(x * 9) + c] = mdacols[attr][blink][1];
|
||||
((uint32_t *)buffer32->line[mda->displine])[(x * 9) + c] = mdacols[attr][blink][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[mda->displine][(x * 9) + c] = mdacols[attr][blink][(fontdatm[chr][mda->sc] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
if ((chr & ~0x1f) == 0xc0) buffer->line[mda->displine][(x * 9) + 8] = mdacols[attr][blink][fontdatm[chr][mda->sc] & 1];
|
||||
else buffer->line[mda->displine][(x * 9) + 8] = mdacols[attr][blink][0];
|
||||
((uint32_t *)buffer32->line[mda->displine])[(x * 9) + c] = mdacols[attr][blink][(fontdatm[chr][mda->sc] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
if ((chr & ~0x1f) == 0xc0)
|
||||
((uint32_t *)buffer32->line[mda->displine])[(x * 9) + 8] = mdacols[attr][blink][fontdatm[chr][mda->sc] & 1];
|
||||
else
|
||||
((uint32_t *)buffer32->line[mda->displine])[(x * 9) + 8] = mdacols[attr][blink][0];
|
||||
}
|
||||
mda->ma++;
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 9; c++)
|
||||
buffer->line[mda->displine][(x * 9) + c] ^= mdacols[attr][0][1];
|
||||
((uint32_t *)buffer32->line[mda->displine])[(x * 9) + c] ^= mdacols[attr][0][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +235,7 @@ void mda_poll(void *p)
|
|||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
|
||||
video_blit_memtoscreen_8(0, mda->firstline, xsize, mda->lastline - mda->firstline);
|
||||
video_blit_memtoscreen(0, mda->firstline, 0, ysize, xsize, ysize);
|
||||
|
||||
frames++;
|
||||
video_res_x = mda->crtc[1];
|
||||
|
|
@ -273,22 +275,22 @@ void *mda_init()
|
|||
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16;
|
||||
if (c & 8) mdacols[c][0][1] = 15 + 16;
|
||||
else mdacols[c][0][1] = 7 + 16;
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = makecol32(0, 0, 0);
|
||||
if (c & 8) mdacols[c][0][1] = makecol32(0xff, 0xff, 0xff);
|
||||
else mdacols[c][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
}
|
||||
mdacols[0x70][0][1] = 16;
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = 16 + 15;
|
||||
mdacols[0xF0][0][1] = 16;
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = 16 + 15;
|
||||
mdacols[0x78][0][1] = 16 + 7;
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = 16 + 15;
|
||||
mdacols[0xF8][0][1] = 16 + 7;
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = 16 + 15;
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = 16;
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = 16;
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16;
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16;
|
||||
mdacols[0x70][0][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0xF0][0][1] = makecol32(0, 0, 0);
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0x78][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0xF8][0][1] = makecol32(0xaa, 0xaa, 0xaa);
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = makecol32(0xff, 0xff, 0xff);
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = makecol32(0, 0, 0);
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = makecol32(0, 0, 0);
|
||||
|
||||
return mda;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ void m24_poll(void *p)
|
|||
int oldvc;
|
||||
uint8_t chr, attr;
|
||||
uint16_t dat, dat2;
|
||||
int cols[4];
|
||||
uint32_t cols[4];
|
||||
int col;
|
||||
int oldsc;
|
||||
if (!m24->linepos)
|
||||
|
|
@ -167,15 +167,15 @@ void m24_poll(void *p)
|
|||
{
|
||||
if ((m24->cgamode & 0x12) == 0x12)
|
||||
{
|
||||
buffer->line[m24->displine][c] = 0;
|
||||
if (m24->cgamode & 1) buffer->line[m24->displine][c + (m24->crtc[1] << 3) + 8] = 0;
|
||||
else buffer->line[m24->displine][c + (m24->crtc[1] << 4) + 8] = 0;
|
||||
((uint32_t *)buffer32->line[m24->displine])[c] = cgapal[0];
|
||||
if (m24->cgamode & 1) ((uint32_t *)buffer32->line[m24->displine])[c + (m24->crtc[1] << 3) + 8] = cgapal[0];
|
||||
else ((uint32_t *)buffer32->line[m24->displine])[c + (m24->crtc[1] << 4) + 8] = cgapal[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->line[m24->displine][c] = (m24->cgacol & 15) + 16;
|
||||
if (m24->cgamode & 1) buffer->line[m24->displine][c + (m24->crtc[1] << 3) + 8] = (m24->cgacol & 15) + 16;
|
||||
else buffer->line[m24->displine][c + (m24->crtc[1] << 4) + 8] = (m24->cgacol & 15) + 16;
|
||||
((uint32_t *)buffer32->line[m24->displine])[c] = cgapal[m24->cgacol & 15];
|
||||
if (m24->cgamode & 1) ((uint32_t *)buffer32->line[m24->displine])[c + (m24->crtc[1] << 3) + 8] = cgapal[m24->cgacol & 15];
|
||||
else ((uint32_t *)buffer32->line[m24->displine])[c + (m24->crtc[1] << 4) + 8] = cgapal[m24->cgacol & 15];
|
||||
}
|
||||
}
|
||||
if (m24->cgamode & 1)
|
||||
|
|
@ -187,25 +187,25 @@ void m24_poll(void *p)
|
|||
drawcursor = ((m24->ma == ca) && m24->con && m24->cursoron);
|
||||
if (m24->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[(attr >> 4) & 7];
|
||||
if ((m24->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[attr >> 4];
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[m24->displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 0xffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[m24->displine][(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 3) + c + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
m24->ma++;
|
||||
}
|
||||
|
|
@ -219,52 +219,52 @@ void m24_poll(void *p)
|
|||
drawcursor = ((m24->ma == ca) && m24->con && m24->cursoron);
|
||||
if (m24->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[(attr >> 4) & 7];
|
||||
if ((m24->blink & 16) && (attr & 0x80))
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[attr >> 4];
|
||||
}
|
||||
m24->ma++;
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0] ^ 0xffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdatm[chr][((m24->sc & 7) << 1) | m24->lineff] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(m24->cgamode & 16))
|
||||
{
|
||||
cols[0] = (m24->cgacol & 15) | 16;
|
||||
col = (m24->cgacol & 16) ? 24 : 16;
|
||||
cols[0] = cgapal[m24->cgacol & 15];
|
||||
col = (m24->cgacol & 16) ? 8 : 0;
|
||||
if (m24->cgamode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else if (m24->cgacol & 32)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 5;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 5];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = col | 2;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 6;
|
||||
cols[1] = cgapal[col | 2];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 6];
|
||||
}
|
||||
for (x = 0; x < m24->crtc[1]; x++)
|
||||
{
|
||||
|
|
@ -273,8 +273,8 @@ void m24_poll(void *p)
|
|||
m24->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[m24->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -284,12 +284,14 @@ void m24_poll(void *p)
|
|||
if (m24->ctrl & 1)
|
||||
{
|
||||
dat2 = ((m24->sc & 1) * 0x4000) | (m24->lineff * 0x2000);
|
||||
cols[0] = 0; cols[1] = /*(m24->cgacol & 15)*/15 + 16;
|
||||
cols[0] = cgapal[0];
|
||||
cols[1] = cgapal[15];
|
||||
}
|
||||
else
|
||||
{
|
||||
dat2 = (m24->sc & 1) * 0x2000;
|
||||
cols[0] = 0; cols[1] = (m24->cgacol & 15) + 16;
|
||||
cols[0] = cgapal[0];
|
||||
cols[1] = cgapal[m24->cgacol & 15];
|
||||
}
|
||||
for (x = 0; x < m24->crtc[1]; x++)
|
||||
{
|
||||
|
|
@ -297,7 +299,7 @@ void m24_poll(void *p)
|
|||
m24->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[m24->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
((uint32_t *)buffer32->line[m24->displine])[(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -305,9 +307,9 @@ void m24_poll(void *p)
|
|||
}
|
||||
else
|
||||
{
|
||||
cols[0] = ((m24->cgamode & 0x12) == 0x12) ? 0 : (m24->cgacol & 15) + 16;
|
||||
if (m24->cgamode & 1) hline(buffer, 0, m24->displine, (m24->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, m24->displine, (m24->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = cgapal[((m24->cgamode & 0x12) == 0x12) ? 0 : (m24->cgacol & 15)];
|
||||
if (m24->cgamode & 1) hline(buffer32, 0, m24->displine, (m24->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, m24->displine, (m24->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
|
||||
if (m24->cgamode & 1) x = (m24->crtc[1] << 3) + 16;
|
||||
|
|
@ -396,7 +398,7 @@ void m24_poll(void *p)
|
|||
updatewindowsize(xsize, ysize + 16);
|
||||
}
|
||||
|
||||
video_blit_memtoscreen_8(0, m24->firstline - 8, xsize, (m24->lastline - m24->firstline) + 16);
|
||||
video_blit_memtoscreen(0, m24->firstline - 8, 0, (m24->lastline - m24->firstline) + 16, xsize, (m24->lastline - m24->firstline) + 16);
|
||||
frames++;
|
||||
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
|
|
@ -187,15 +187,15 @@ static void pc1512_poll(void *p)
|
|||
{
|
||||
if ((pc1512->cgamode & 0x12) == 0x12)
|
||||
{
|
||||
buffer->line[pc1512->displine][c] = (pc1512->border & 15) + 16;
|
||||
if (pc1512->cgamode & 1) buffer->line[pc1512->displine][c + (pc1512->crtc[1] << 3) + 8] = 0;
|
||||
else buffer->line[pc1512->displine][c + (pc1512->crtc[1] << 4) + 8] = 0;
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[c] = cgapal[pc1512->border & 15];
|
||||
if (pc1512->cgamode & 1) ((uint32_t *)buffer32->line[pc1512->displine])[c + (pc1512->crtc[1] << 3) + 8] = 0;
|
||||
else ((uint32_t *)buffer32->line[pc1512->displine])[c + (pc1512->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->line[pc1512->displine][c] = (pc1512->cgacol & 15) + 16;
|
||||
if (pc1512->cgamode & 1) buffer->line[pc1512->displine][c + (pc1512->crtc[1] << 3) + 8] = (pc1512->cgacol & 15) + 16;
|
||||
else buffer->line[pc1512->displine][c + (pc1512->crtc[1] << 4) + 8] = (pc1512->cgacol & 15) + 16;
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[c] = cgapal[pc1512->cgacol & 15];
|
||||
if (pc1512->cgamode & 1) ((uint32_t *)buffer32->line[pc1512->displine])[c + (pc1512->crtc[1] << 3) + 8] = cgapal[pc1512->cgacol & 15];
|
||||
else ((uint32_t *)buffer32->line[pc1512->displine])[c + (pc1512->crtc[1] << 4) + 8] = cgapal[pc1512->cgacol & 15];
|
||||
}
|
||||
}
|
||||
if (pc1512->cgamode & 1)
|
||||
|
|
@ -207,25 +207,25 @@ static void pc1512_poll(void *p)
|
|||
drawcursor = ((pc1512->ma == ca) && pc1512->con && pc1512->cursoron);
|
||||
if (pc1512->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[(attr >> 4) & 7];
|
||||
if ((pc1512->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[attr >> 4];
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pc1512->displine][(x << 3) + c + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pc1512->displine][(x << 3) + c + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
pc1512->ma++;
|
||||
}
|
||||
|
|
@ -239,52 +239,52 @@ static void pc1512_poll(void *p)
|
|||
drawcursor = ((pc1512->ma == ca) && pc1512->con && pc1512->cursoron);
|
||||
if (pc1512->cgamode & 0x20)
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = ((attr >> 4) & 7) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[(attr >> 4) & 7];
|
||||
if ((pc1512->blink & 16) && (attr & 0x80))
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = (attr & 15) + 16;
|
||||
cols[0] = (attr >> 4) + 16;
|
||||
cols[1] = cgapal[attr & 15];
|
||||
cols[0] = cgapal[attr >> 4];
|
||||
}
|
||||
pc1512->ma++;
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 15;
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0] ^ 0xffffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pc1512->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(pc1512->cgamode&16))
|
||||
{
|
||||
cols[0] = (pc1512->cgacol & 15) | 16;
|
||||
col = (pc1512->cgacol & 16) ? 24 : 16;
|
||||
cols[0] = cgapal[pc1512->cgacol & 15];
|
||||
col = (pc1512->cgacol & 16) ? 8 : 0;
|
||||
if (pc1512->cgamode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else if (pc1512->cgacol & 32)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 5;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 5];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = col | 2;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 6;
|
||||
cols[1] = cgapal[col | 2];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 6];
|
||||
}
|
||||
for (x = 0; x < 40; x++)
|
||||
{
|
||||
|
|
@ -292,8 +292,8 @@ static void pc1512_poll(void *p)
|
|||
pc1512->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pc1512->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ static void pc1512_poll(void *p)
|
|||
pc1512->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[pc1512->displine][(x << 4) + c + 8] = (((dat >> 15) | ((dat2 >> 15) << 1) | ((dat3 >> 15) << 2) | ((dat4 >> 15) << 3)) & (pc1512->cgacol & 15)) + 16;
|
||||
((uint32_t *)buffer32->line[pc1512->displine])[(x << 4) + c + 8] = cgapal[((dat >> 15) | ((dat2 >> 15) << 1) | ((dat3 >> 15) << 2) | ((dat4 >> 15) << 3)) & (pc1512->cgacol & 15)];
|
||||
dat <<= 1;
|
||||
dat2 <<= 1;
|
||||
dat3 <<= 1;
|
||||
|
|
@ -322,9 +322,9 @@ static void pc1512_poll(void *p)
|
|||
}
|
||||
else
|
||||
{
|
||||
cols[0] = ((pc1512->cgamode & 0x12) == 0x12) ? 0 : (pc1512->cgacol & 15) + 16;
|
||||
if (pc1512->cgamode & 1) hline(buffer, 0, pc1512->displine, (pc1512->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, pc1512->displine, (pc1512->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = cgapal[((pc1512->cgamode & 0x12) == 0x12) ? 0 : (pc1512->cgacol & 15)];
|
||||
if (pc1512->cgamode & 1) hline(buffer32, 0, pc1512->displine, (pc1512->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, pc1512->displine, (pc1512->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
|
||||
pc1512->sc = oldsc;
|
||||
|
|
@ -402,7 +402,7 @@ static void pc1512_poll(void *p)
|
|||
updatewindowsize(xsize, (ysize << 1) + 16);
|
||||
}
|
||||
|
||||
video_blit_memtoscreen_8(0, pc1512->firstline - 4, xsize, (pc1512->lastline - pc1512->firstline) + 8);
|
||||
video_blit_memtoscreen(0, pc1512->firstline - 4, 0, (pc1512->lastline - pc1512->firstline) + 8, xsize, (pc1512->lastline - pc1512->firstline) + 8);
|
||||
// blit(buffer,vbuf,0,firstline-4,0,0,xsize,(lastline-firstline)+8+1);
|
||||
// if (vid_resize) stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,winsizex,winsizey);
|
||||
// else stretch_blit(vbuf,screen,0,0,xsize,(lastline-firstline)+8+1,0,0,xsize,((lastline-firstline)<<1)+16+2);
|
||||
|
|
|
|||
130
src/vid_pcjr.c
130
src/vid_pcjr.c
|
|
@ -206,12 +206,12 @@ void pcjr_poll(void *p)
|
|||
video_wait_for_buffer();
|
||||
}
|
||||
pcjr->lastline = pcjr->displine;
|
||||
cols[0] = (pcjr->array[2] & 0xf) + 16;
|
||||
cols[0] = pcjr->array[2] & 0xf;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[pcjr->displine][c] = cols[0];
|
||||
if (pcjr->array[0] & 1) buffer->line[pcjr->displine][c + (pcjr->crtc[1] << 3) + 8] = cols[0];
|
||||
else buffer->line[pcjr->displine][c + (pcjr->crtc[1] << 4) + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[c] = cols[0];
|
||||
if (pcjr->array[0] & 1) ((uint32_t *)buffer32->line[pcjr->displine])[c + (pcjr->crtc[1] << 3) + 8] = cols[0];
|
||||
else ((uint32_t *)buffer32->line[pcjr->displine])[c + (pcjr->crtc[1] << 4) + 8] = cols[0];
|
||||
}
|
||||
|
||||
switch (pcjr->addr_mode)
|
||||
|
|
@ -235,14 +235,14 @@ void pcjr_poll(void *p)
|
|||
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
|
||||
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
|
||||
pcjr->ma++;
|
||||
buffer->line[pcjr->displine][(x << 3) + 8] =
|
||||
buffer->line[pcjr->displine][(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 3) + 10] =
|
||||
buffer->line[pcjr->displine][(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 3) + 12] =
|
||||
buffer->line[pcjr->displine][(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 3) + 14] =
|
||||
buffer->line[pcjr->displine][(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 8] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 9] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 10] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 11] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 12] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 13] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 14] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 15] = pcjr->array[(dat & pcjr->array[1]) + 16];
|
||||
}
|
||||
break;
|
||||
case 0x12: /*160x200x16*/
|
||||
|
|
@ -251,22 +251,22 @@ void pcjr_poll(void *p)
|
|||
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
|
||||
pcjr->vram[((pcjr->ma << 1) & mask) + offset + 1];
|
||||
pcjr->ma++;
|
||||
buffer->line[pcjr->displine][(x << 4) + 8] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 9] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 10] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 4) + 12] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 13] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 14] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 4) + 16] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 17] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 18] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16] + 16;
|
||||
buffer->line[pcjr->displine][(x << 4) + 20] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 21] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 22] =
|
||||
buffer->line[pcjr->displine][(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 8] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 9] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 10] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 11] = pcjr->array[((dat >> 12) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 12] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 13] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 14] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 15] = pcjr->array[((dat >> 8) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 16] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 17] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 18] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 19] = pcjr->array[((dat >> 4) & pcjr->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 20] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 21] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 22] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + 23] = pcjr->array[(dat & pcjr->array[1]) + 16];
|
||||
}
|
||||
break;
|
||||
case 0x03: /*640x200x4*/
|
||||
|
|
@ -279,7 +279,7 @@ void pcjr_poll(void *p)
|
|||
{
|
||||
chr = (dat >> 7) & 1;
|
||||
chr |= ((dat >> 14) & 2);
|
||||
buffer->line[pcjr->displine][(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + 8 + c] = pcjr->array[(chr & pcjr->array[1]) + 16];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -292,31 +292,31 @@ void pcjr_poll(void *p)
|
|||
drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron);
|
||||
if (pcjr->array[3] & 4)
|
||||
{
|
||||
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16] + 16;
|
||||
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16] + 16;
|
||||
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16];
|
||||
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16];
|
||||
if ((pcjr->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16] + 16;
|
||||
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16;
|
||||
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16];
|
||||
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16];
|
||||
}
|
||||
if (pcjr->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pcjr->displine][(x << 3) + c + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + c + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pcjr->displine][(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma);
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pcjr->displine][(x << 3) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 3) + c + 8] ^= 15;
|
||||
}
|
||||
pcjr->ma++;
|
||||
}
|
||||
|
|
@ -329,41 +329,41 @@ void pcjr_poll(void *p)
|
|||
drawcursor = ((pcjr->ma == ca) && pcjr->con && pcjr->cursoron);
|
||||
if (pcjr->array[3] & 4)
|
||||
{
|
||||
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16] + 16;
|
||||
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16] + 16;
|
||||
cols[1] = pcjr->array[ ((attr & 15) & pcjr->array[1]) + 16];
|
||||
cols[0] = pcjr->array[(((attr >> 4) & 7) & pcjr->array[1]) + 16];
|
||||
if ((pcjr->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16] + 16;
|
||||
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16] + 16;
|
||||
cols[1] = pcjr->array[((attr & 15) & pcjr->array[1]) + 16];
|
||||
cols[0] = pcjr->array[((attr >> 4) & pcjr->array[1]) + 16];
|
||||
}
|
||||
pcjr->ma++;
|
||||
if (pcjr->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][pcjr->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
buffer->line[pcjr->displine][(x << 4) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + c + 8] ^= 15;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x02: /*320x200x4*/
|
||||
cols[0] = pcjr->array[0 + 16] + 16;
|
||||
cols[1] = pcjr->array[1 + 16] + 16;
|
||||
cols[2] = pcjr->array[2 + 16] + 16;
|
||||
cols[3] = pcjr->array[3 + 16] + 16;
|
||||
cols[0] = pcjr->array[0 + 16];
|
||||
cols[1] = pcjr->array[1 + 16];
|
||||
cols[2] = pcjr->array[2 + 16];
|
||||
cols[3] = pcjr->array[3 + 16];
|
||||
for (x = 0; x < pcjr->crtc[1]; x++)
|
||||
{
|
||||
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
|
||||
|
|
@ -371,15 +371,15 @@ void pcjr_poll(void *p)
|
|||
pcjr->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[pcjr->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x102: /*640x200x2*/
|
||||
cols[0] = pcjr->array[0 + 16] + 16;
|
||||
cols[1] = pcjr->array[1 + 16] + 16;
|
||||
cols[0] = pcjr->array[0 + 16];
|
||||
cols[1] = pcjr->array[1 + 16];
|
||||
for (x = 0; x < pcjr->crtc[1]; x++)
|
||||
{
|
||||
dat = (pcjr->vram[((pcjr->ma << 1) & mask) + offset] << 8) |
|
||||
|
|
@ -387,7 +387,7 @@ void pcjr_poll(void *p)
|
|||
pcjr->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[pcjr->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -398,15 +398,15 @@ void pcjr_poll(void *p)
|
|||
{
|
||||
if (pcjr->array[3] & 4)
|
||||
{
|
||||
if (pcjr->array[0] & 1) hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, (pcjr->array[2] & 0xf) + 16);
|
||||
else hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, (pcjr->array[2] & 0xf) + 16);
|
||||
if (pcjr->array[0] & 1) hline(buffer32, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, pcjr->array[2] & 0xf);
|
||||
else hline(buffer32, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, pcjr->array[2] & 0xf);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cols[0] = ((pcjr->mode & 0x12) == 0x12) ? 0 : (pcjr->col & 0xf) + 16;
|
||||
cols[0] = pcjr->array[0 + 16] + 16;
|
||||
if (pcjr->array[0] & 1) hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = pcjr->array[0 + 16];
|
||||
if (pcjr->array[0] & 1) hline(buffer32, 0, pcjr->displine, (pcjr->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, pcjr->displine, (pcjr->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
}
|
||||
if (pcjr->array[0] & 1) x = (pcjr->crtc[1] << 3) + 16;
|
||||
|
|
@ -414,10 +414,15 @@ void pcjr_poll(void *p)
|
|||
if (pcjr->composite)
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
buffer32->line[pcjr->displine][c] = buffer->line[pcjr->displine][c] & 0xf;
|
||||
buffer32->line[pcjr->displine][c] = ((uint32_t *)buffer32->line[pcjr->displine])[c] & 0xf;
|
||||
|
||||
Composite_Process(pcjr->array[0], 0, x >> 2, buffer32->line[pcjr->displine]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
((uint32_t *)buffer32->line[pcjr->displine])[c] = cgapal[((uint32_t *)buffer32->line[pcjr->displine])[c] & 0xf];
|
||||
}
|
||||
pcjr->sc = oldsc;
|
||||
if (pcjr->vc == pcjr->crtc[7] && !pcjr->sc)
|
||||
{
|
||||
|
|
@ -514,10 +519,7 @@ void pcjr_poll(void *p)
|
|||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
|
||||
if (pcjr->composite)
|
||||
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, pcjr->firstline-4, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||
video_blit_memtoscreen(0, pcjr->firstline-4, 0, (pcjr->lastline - pcjr->firstline) + 8, xsize, (pcjr->lastline - pcjr->firstline) + 8);
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
138
src/vid_tandy.c
138
src/vid_tandy.c
|
|
@ -223,26 +223,26 @@ void tandy_poll(void *p)
|
|||
// printf("Firstline %i\n",firstline);
|
||||
}
|
||||
tandy->lastline = tandy->displine;
|
||||
cols[0] = (tandy->array[2] & 0xf) + 16;
|
||||
cols[0] = tandy->array[2] & 0xf;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
if (tandy->array[3] & 4)
|
||||
{
|
||||
buffer->line[tandy->displine][c] = cols[0];
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = cols[0];
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = cols[0];
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = cols[0];
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = cols[0];
|
||||
}
|
||||
else if ((tandy->mode & 0x12) == 0x12)
|
||||
{
|
||||
buffer->line[tandy->displine][c] = 0;
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = 0;
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = 0;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = 0;
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = 0;
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->line[tandy->displine][c] = (tandy->col & 15) + 16;
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = (tandy->col & 15) + 16;
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = (tandy->col & 15) + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = tandy->col & 15;
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = tandy->col & 15;
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = tandy->col & 15;
|
||||
}
|
||||
}
|
||||
// printf("X %i %i\n",c+(crtc[1]<<4)+8,c+(crtc[1]<<3)+8);
|
||||
|
|
@ -254,14 +254,14 @@ void tandy_poll(void *p)
|
|||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000)] << 8) |
|
||||
tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000) + 1];
|
||||
tandy->ma++;
|
||||
buffer->line[tandy->displine][(x << 3) + 8] =
|
||||
buffer->line[tandy->displine][(x << 3) + 9] = tandy->array[((dat >> 12) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 10] =
|
||||
buffer->line[tandy->displine][(x << 3) + 11] = tandy->array[((dat >> 8) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 12] =
|
||||
buffer->line[tandy->displine][(x << 3) + 13] = tandy->array[((dat >> 4) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 14] =
|
||||
buffer->line[tandy->displine][(x << 3) + 15] = tandy->array[(dat & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 9] = tandy->array[((dat >> 12) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 10] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 11] = tandy->array[((dat >> 8) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 12] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 13] = tandy->array[((dat >> 4) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 14] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 15] = tandy->array[(dat & tandy->array[1]) + 16];
|
||||
}
|
||||
}
|
||||
else if (tandy->array[3] & 0x10) /*160x200x16*/
|
||||
|
|
@ -271,22 +271,22 @@ void tandy_poll(void *p)
|
|||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000)] << 8) |
|
||||
tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000) + 1];
|
||||
tandy->ma++;
|
||||
buffer->line[tandy->displine][(x << 4) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + 9] =
|
||||
buffer->line[tandy->displine][(x << 4) + 10] =
|
||||
buffer->line[tandy->displine][(x << 4) + 11] = tandy->array[((dat >> 12) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 12] =
|
||||
buffer->line[tandy->displine][(x << 4) + 13] =
|
||||
buffer->line[tandy->displine][(x << 4) + 14] =
|
||||
buffer->line[tandy->displine][(x << 4) + 15] = tandy->array[((dat >> 8) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 16] =
|
||||
buffer->line[tandy->displine][(x << 4) + 17] =
|
||||
buffer->line[tandy->displine][(x << 4) + 18] =
|
||||
buffer->line[tandy->displine][(x << 4) + 19] = tandy->array[((dat >> 4) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 20] =
|
||||
buffer->line[tandy->displine][(x << 4) + 21] =
|
||||
buffer->line[tandy->displine][(x << 4) + 22] =
|
||||
buffer->line[tandy->displine][(x << 4) + 23] = tandy->array[(dat & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 9] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 10] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 11] = tandy->array[((dat >> 12) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 12] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 13] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 14] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 15] = tandy->array[((dat >> 8) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 16] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 17] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 18] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 19] = tandy->array[((dat >> 4) & tandy->array[1]) + 16];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 20] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 21] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 22] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 23] = tandy->array[(dat & tandy->array[1]) + 16];
|
||||
}
|
||||
}
|
||||
else if (tandy->array[3] & 0x08) /*640x200x4 - this implementation is a complete guess!*/
|
||||
|
|
@ -300,7 +300,7 @@ void tandy_poll(void *p)
|
|||
{
|
||||
chr = (dat >> 7) & 1;
|
||||
chr |= ((dat >> 14) & 2);
|
||||
buffer->line[tandy->displine][(x << 3) + 8 + c] = tandy->array[(chr & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 8 + c] = tandy->array[(chr & tandy->array[1]) + 16];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -314,31 +314,31 @@ void tandy_poll(void *p)
|
|||
drawcursor = ((tandy->ma == ca) && tandy->con && tandy->cursoron);
|
||||
if (tandy->mode & 0x20)
|
||||
{
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16];
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16];
|
||||
if ((tandy->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16];
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16];
|
||||
}
|
||||
if (tandy->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma);
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] ^= 0xffffff;
|
||||
}
|
||||
tandy->ma++;
|
||||
}
|
||||
|
|
@ -352,40 +352,40 @@ void tandy_poll(void *p)
|
|||
drawcursor = ((tandy->ma == ca) && tandy->con && tandy->cursoron);
|
||||
if (tandy->mode & 0x20)
|
||||
{
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16];
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16];
|
||||
if ((tandy->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16];
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16];
|
||||
}
|
||||
tandy->ma++;
|
||||
if (tandy->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + c + 8] ^= 0xffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(tandy->mode& 16))
|
||||
else if (!(tandy->mode & 16))
|
||||
{
|
||||
cols[0] = (tandy->col & 15) | 16;
|
||||
col = (tandy->col & 16) ? 24 : 16;
|
||||
cols[0] = tandy->col & 15;
|
||||
col = (tandy->col & 16) ? 8 : 0;
|
||||
if (tandy->mode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
|
|
@ -411,8 +411,8 @@ void tandy_poll(void *p)
|
|||
tandy->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ void tandy_poll(void *p)
|
|||
else
|
||||
{
|
||||
cols[0] = 0;
|
||||
cols[1] = tandy->array[(tandy->col & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = tandy->array[(tandy->col & tandy->array[1]) + 16];
|
||||
for (x = 0; x < tandy->crtc[1]; x++)
|
||||
{
|
||||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 1) * 0x2000)] << 8) |
|
||||
|
|
@ -428,7 +428,7 @@ void tandy_poll(void *p)
|
|||
tandy->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[tandy->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -438,14 +438,14 @@ void tandy_poll(void *p)
|
|||
{
|
||||
if (tandy->array[3] & 4)
|
||||
{
|
||||
if (tandy->mode & 1) hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, (tandy->array[2] & 0xf) + 16);
|
||||
else hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, (tandy->array[2] & 0xf) + 16);
|
||||
if (tandy->mode & 1) hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, tandy->array[2] & 0xf);
|
||||
else hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, tandy->array[2] & 0xf);
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[0] = ((tandy->mode & 0x12) == 0x12) ? 0 : (tandy->col & 0xf) + 16;
|
||||
if (tandy->mode & 1) hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = ((tandy->mode & 0x12) == 0x12) ? 0 : (tandy->col & 0xf);
|
||||
if (tandy->mode & 1) hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
}
|
||||
if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16;
|
||||
|
|
@ -454,10 +454,15 @@ void tandy_poll(void *p)
|
|||
if (tandy->composite)
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
buffer32->line[tandy->displine][c] = buffer->line[tandy->displine][c] & 0xf;
|
||||
buffer32->line[tandy->displine][c] = ((uint32_t *)buffer32->line[tandy->displine])[c] & 0xf;
|
||||
|
||||
Composite_Process(tandy->mode, 0, x >> 2, buffer32->line[tandy->displine]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < x; c++)
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = cgapal[((uint32_t *)buffer32->line[tandy->displine])[c] & 0xf];
|
||||
}
|
||||
|
||||
tandy->sc = oldsc;
|
||||
if (tandy->vc == tandy->crtc[7] && !tandy->sc)
|
||||
|
|
@ -553,10 +558,7 @@ void tandy_poll(void *p)
|
|||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
|
||||
if (tandy->composite)
|
||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
else
|
||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
|
|
@ -287,26 +287,26 @@ static void tandysl_poll(void *p)
|
|||
// printf("Firstline %i\n",firstline);
|
||||
}
|
||||
tandy->lastline = tandy->displine;
|
||||
cols[0] = (tandy->array[2] & 0xf) + 16;
|
||||
cols[0] = cgapal[tandy->array[2] & 0xf];
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
if (tandy->array[3] & 4)
|
||||
{
|
||||
buffer->line[tandy->displine][c] = cols[0];
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = cols[0];
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = cols[0];
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = cols[0];
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = cols[0];
|
||||
}
|
||||
else if ((tandy->mode & 0x12) == 0x12)
|
||||
{
|
||||
buffer->line[tandy->displine][c] = 0;
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = 0;
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = 0;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = cgapal[0];
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = cgapal[0];
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = cgapal[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->line[tandy->displine][c] = (tandy->col & 15) + 16;
|
||||
if (tandy->mode & 1) buffer->line[tandy->displine][c + (tandy->crtc[1] << 3) + 8] = (tandy->col & 15) + 16;
|
||||
else buffer->line[tandy->displine][c + (tandy->crtc[1] << 4) + 8] = (tandy->col & 15) + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[c] = cgapal[tandy->col & 15];
|
||||
if (tandy->mode & 1) ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 3) + 8] = cgapal[tandy->col & 15];
|
||||
else ((uint32_t *)buffer32->line[tandy->displine])[c + (tandy->crtc[1] << 4) + 8] = cgapal[tandy->col & 15];
|
||||
}
|
||||
}
|
||||
if (tandy->array[5] & 1) /*640x200x16*/
|
||||
|
|
@ -316,10 +316,10 @@ static void tandysl_poll(void *p)
|
|||
dat = (tandy->vram[(tandy->ma << 1) & 0xffff] << 8) |
|
||||
tandy->vram[((tandy->ma << 1) + 1) & 0xffff];
|
||||
tandy->ma++;
|
||||
buffer->line[tandy->displine][(x << 2) + 8] = tandy->array[((dat >> 12) & 0xf)/*tandy->array[1])*/ + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 2) + 9] = tandy->array[((dat >> 8) & 0xf)/*tandy->array[1])*/ + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 2) + 10] = tandy->array[((dat >> 4) & 0xf)/*tandy->array[1])*/ + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 2) + 11] = tandy->array[(dat & 0xf)/*tandy->array[1])*/ + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 2) + 8] = cgapal[tandy->array[((dat >> 12) & 0xf)/*tandy->array[1])*/ + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 2) + 9] = cgapal[tandy->array[((dat >> 8) & 0xf)/*tandy->array[1])*/ + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 2) + 10] = cgapal[tandy->array[((dat >> 4) & 0xf)/*tandy->array[1])*/ + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 2) + 11] = cgapal[tandy->array[(dat & 0xf)/*tandy->array[1])*/ + 16]];
|
||||
}
|
||||
}
|
||||
else if ((tandy->array[3] & 0x10) && (tandy->mode & 1)) /*320x200x16*/
|
||||
|
|
@ -329,14 +329,14 @@ static void tandysl_poll(void *p)
|
|||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000)] << 8) |
|
||||
tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 3) * 0x2000) + 1];
|
||||
tandy->ma++;
|
||||
buffer->line[tandy->displine][(x << 3) + 8] =
|
||||
buffer->line[tandy->displine][(x << 3) + 9] = tandy->array[((dat >> 12) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 10] =
|
||||
buffer->line[tandy->displine][(x << 3) + 11] = tandy->array[((dat >> 8) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 12] =
|
||||
buffer->line[tandy->displine][(x << 3) + 13] = tandy->array[((dat >> 4) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 3) + 14] =
|
||||
buffer->line[tandy->displine][(x << 3) + 15] = tandy->array[(dat & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 9] = cgapal[tandy->array[((dat >> 12) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 10] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 11] = cgapal[tandy->array[((dat >> 8) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 12] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 13] = cgapal[tandy->array[((dat >> 4) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 14] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 15] = cgapal[tandy->array[(dat & tandy->array[1]) + 16]];
|
||||
}
|
||||
}
|
||||
else if (tandy->array[3] & 0x10) /*160x200x16*/
|
||||
|
|
@ -346,22 +346,22 @@ static void tandysl_poll(void *p)
|
|||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 1) * 0x2000)] << 8) |
|
||||
tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 1) * 0x2000) + 1];
|
||||
tandy->ma++;
|
||||
buffer->line[tandy->displine][(x << 4) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + 9] =
|
||||
buffer->line[tandy->displine][(x << 4) + 10] =
|
||||
buffer->line[tandy->displine][(x << 4) + 11] = tandy->array[((dat >> 12) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 12] =
|
||||
buffer->line[tandy->displine][(x << 4) + 13] =
|
||||
buffer->line[tandy->displine][(x << 4) + 14] =
|
||||
buffer->line[tandy->displine][(x << 4) + 15] = tandy->array[((dat >> 8) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 16] =
|
||||
buffer->line[tandy->displine][(x << 4) + 17] =
|
||||
buffer->line[tandy->displine][(x << 4) + 18] =
|
||||
buffer->line[tandy->displine][(x << 4) + 19] = tandy->array[((dat >> 4) & tandy->array[1]) + 16] + 16;
|
||||
buffer->line[tandy->displine][(x << 4) + 20] =
|
||||
buffer->line[tandy->displine][(x << 4) + 21] =
|
||||
buffer->line[tandy->displine][(x << 4) + 22] =
|
||||
buffer->line[tandy->displine][(x << 4) + 23] = tandy->array[(dat & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 9] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 10] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 11] = cgapal[tandy->array[((dat >> 12) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 12] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 13] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 14] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 15] = cgapal[tandy->array[((dat >> 8) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 16] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 17] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 18] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 19] = cgapal[tandy->array[((dat >> 4) & tandy->array[1]) + 16]];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 20] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 21] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 22] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + 23] = cgapal[tandy->array[(dat & tandy->array[1]) + 16]];
|
||||
}
|
||||
}
|
||||
else if (tandy->array[3] & 0x08) /*640x200x4 - this implementation is a complete guess!*/
|
||||
|
|
@ -375,7 +375,7 @@ static void tandysl_poll(void *p)
|
|||
{
|
||||
chr = (dat >> 7) & 1;
|
||||
chr |= ((dat >> 14) & 2);
|
||||
buffer->line[tandy->displine][(x << 3) + 8 + c] = tandy->array[(chr & tandy->array[1]) + 16] + 16;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + 8 + c] = cgapal[tandy->array[(chr & tandy->array[1]) + 16]];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -389,31 +389,31 @@ static void tandysl_poll(void *p)
|
|||
drawcursor = ((tandy->ma == ca) && tandy->con && tandy->cursoron);
|
||||
if (tandy->mode & 0x20)
|
||||
{
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = cgapal[tandy->array[ ((attr & 15) & tandy->array[1]) + 16]];
|
||||
cols[0] = cgapal[tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16]];
|
||||
if ((tandy->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = cgapal[tandy->array[((attr & 15) & tandy->array[1]) + 16]];
|
||||
cols[0] = cgapal[tandy->array[((attr >> 4) & tandy->array[1]) + 16]];
|
||||
}
|
||||
if (tandy->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
// if (!((ma^(crtc[15]|(crtc[14]<<8)))&0x3FFF)) printf("Cursor match! %04X\n",ma);
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 3) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 3) + c + 8] ^= 0xffffff;
|
||||
}
|
||||
tandy->ma++;
|
||||
}
|
||||
|
|
@ -427,57 +427,57 @@ static void tandysl_poll(void *p)
|
|||
drawcursor = ((tandy->ma == ca) && tandy->con && tandy->cursoron);
|
||||
if (tandy->mode & 0x20)
|
||||
{
|
||||
cols[1] = tandy->array[ ((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = cgapal[tandy->array[ ((attr & 15) & tandy->array[1]) + 16]];
|
||||
cols[0] = cgapal[tandy->array[(((attr >> 4) & 7) & tandy->array[1]) + 16]];
|
||||
if ((tandy->blink & 16) && (attr & 0x80) && !drawcursor)
|
||||
cols[1] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = tandy->array[((attr & 15) & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = tandy->array[((attr >> 4) & tandy->array[1]) + 16] + 16;
|
||||
cols[1] = cgapal[tandy->array[((attr & 15) & tandy->array[1]) + 16]];
|
||||
cols[0] = cgapal[tandy->array[((attr >> 4) & tandy->array[1]) + 16]];
|
||||
}
|
||||
tandy->ma++;
|
||||
if (tandy->sc & 8)
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = 0; c < 8; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[(fontdat[chr][tandy->sc & 7] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
}
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
buffer->line[tandy->displine][(x << 4) + c + 8] ^= 15;
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + c + 8] ^= 0xffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(tandy->mode& 16))
|
||||
else if (!(tandy->mode & 16))
|
||||
{
|
||||
cols[0] = (tandy->col & 15) | 16;
|
||||
col = (tandy->col & 16) ? 24 : 16;
|
||||
cols[0] = cgapal[tandy->col & 15];
|
||||
col = (tandy->col & 16) ? 8 : 0;
|
||||
if (tandy->mode & 4)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else if (tandy->col & 32)
|
||||
{
|
||||
cols[1] = col | 3;
|
||||
cols[2] = col | 5;
|
||||
cols[3] = col | 7;
|
||||
cols[1] = cgapal[col | 3];
|
||||
cols[2] = cgapal[col | 5];
|
||||
cols[3] = cgapal[col | 7];
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[1] = col | 2;
|
||||
cols[2] = col | 4;
|
||||
cols[3] = col | 6;
|
||||
cols[1] = cgapal[col | 2];
|
||||
cols[2] = cgapal[col | 4];
|
||||
cols[3] = cgapal[col | 6];
|
||||
}
|
||||
for (x = 0; x < tandy->crtc[1]; x++)
|
||||
{
|
||||
|
|
@ -486,16 +486,16 @@ static void tandysl_poll(void *p)
|
|||
tandy->ma++;
|
||||
for (c = 0; c < 8; c++)
|
||||
{
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 8] =
|
||||
buffer->line[tandy->displine][(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 8] =
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + (c << 1) + 1 + 8] = cols[dat >> 14];
|
||||
dat <<= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[0] = 0;
|
||||
cols[1] = tandy->array[(tandy->col & tandy->array[1]) + 16] + 16;
|
||||
cols[0] = cgapal[0];
|
||||
cols[1] = cgapal[tandy->array[(tandy->col & tandy->array[1]) + 16]];
|
||||
for (x = 0; x < tandy->crtc[1]; x++)
|
||||
{
|
||||
dat = (tandy->vram[((tandy->ma << 1) & 0x1fff) + ((tandy->sc & 1) * 0x2000)] << 8) |
|
||||
|
|
@ -503,7 +503,7 @@ static void tandysl_poll(void *p)
|
|||
tandy->ma++;
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
buffer->line[tandy->displine][(x << 4) + c + 8] = cols[dat >> 15];
|
||||
((uint32_t *)buffer32->line[tandy->displine])[(x << 4) + c + 8] = cols[dat >> 15];
|
||||
dat <<= 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -513,14 +513,14 @@ static void tandysl_poll(void *p)
|
|||
{
|
||||
if (tandy->array[3] & 4)
|
||||
{
|
||||
if (tandy->mode & 1) hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, (tandy->array[2] & 0xf) + 16);
|
||||
else hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, (tandy->array[2] & 0xf) + 16);
|
||||
if (tandy->mode & 1) hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, cgapal[tandy->array[2] & 0xf]);
|
||||
else hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, cgapal[tandy->array[2] & 0xf]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[0] = ((tandy->mode & 0x12) == 0x12) ? 0 : (tandy->col & 0xf) + 16;
|
||||
if (tandy->mode & 1) hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, cols[0]);
|
||||
cols[0] = cgapal[((tandy->mode & 0x12) == 0x12) ? 0 : (tandy->col & 0xf)];
|
||||
if (tandy->mode & 1) hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 3) + 16, cols[0]);
|
||||
else hline(buffer32, 0, tandy->displine, (tandy->crtc[1] << 4) + 16, cols[0]);
|
||||
}
|
||||
}
|
||||
if (tandy->mode & 1) x = (tandy->crtc[1] << 3) + 16;
|
||||
|
|
@ -631,7 +631,7 @@ static void tandysl_poll(void *p)
|
|||
// printf("Blit %i %i\n",firstline,lastline);
|
||||
//printf("Xsize is %i\n",xsize);
|
||||
|
||||
video_blit_memtoscreen_8(0, tandy->firstline-4, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
video_blit_memtoscreen(0, tandy->firstline-4, 0, (tandy->lastline - tandy->firstline) + 8, xsize, (tandy->lastline - tandy->firstline) + 8);
|
||||
|
||||
frames++;
|
||||
video_res_x = xsize - 16;
|
||||
|
|
|
|||
175
src/vid_wy700.c
175
src/vid_wy700.c
|
|
@ -149,6 +149,7 @@ static uint8_t mode_40x24[] =
|
|||
0x0f, /* Maximum raster address */
|
||||
};
|
||||
|
||||
static uint32_t wy700_pal[4];
|
||||
|
||||
/* Font ROM: Two fonts, each containing 256 characters, 16x16 pixels */
|
||||
extern uint8_t fontdatw[512][32];
|
||||
|
|
@ -553,7 +554,7 @@ void wy700_textline(wy700_t *wy700)
|
|||
if (sc == 14 && mda && ((attr & 7) == 1))
|
||||
{
|
||||
for (c = 0; c < cw; c++)
|
||||
buffer->line[wy700->displine][(x * cw) + c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[(x * cw) + c] =
|
||||
mdacols[attr][blink][1];
|
||||
}
|
||||
else /* Draw 16 pixels of character */
|
||||
|
|
@ -565,21 +566,23 @@ void wy700_textline(wy700_t *wy700)
|
|||
int col;
|
||||
if (c < 8)
|
||||
col = (mda ? mdacols : cgacols)[attr][blink][(bitmap[0] & (1 << (c ^ 7))) ? 1 : 0];
|
||||
else col = (mda ? mdacols : cgacols)[attr][blink][(bitmap[1] & (1 << ((c & 7) ^ 7))) ? 1 : 0];
|
||||
else
|
||||
col = (mda ? mdacols : cgacols)[attr][blink][(bitmap[1] & (1 << ((c & 7) ^ 7))) ? 1 : 0];
|
||||
if (!(wy700->enabled) || !(wy700->cga_ctrl & 8))
|
||||
col = mdacols[0][0][0];
|
||||
if (w == 40)
|
||||
{
|
||||
buffer->line[wy700->displine][(x * cw) + 2*c] = col;
|
||||
buffer->line[wy700->displine][(x * cw) + 2*c + 1] = col;
|
||||
((uint32_t *)buffer32->line[wy700->displine])[(x * cw) + 2*c] = col;
|
||||
((uint32_t *)buffer32->line[wy700->displine])[(x * cw) + 2*c + 1] = col;
|
||||
}
|
||||
else buffer->line[wy700->displine][(x * cw) + c] = col;
|
||||
else
|
||||
((uint32_t *)buffer32->line[wy700->displine])[(x * cw) + c] = col;
|
||||
}
|
||||
|
||||
if (drawcursor)
|
||||
{
|
||||
for (c = 0; c < cw; c++)
|
||||
buffer->line[wy700->displine][(x * cw) + c] ^= (mda ? mdacols : cgacols)[attr][0][1];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[(x * cw) + c] ^= (mda ? mdacols : cgacols)[attr][0][1];
|
||||
}
|
||||
++ma;
|
||||
}
|
||||
|
|
@ -592,7 +595,7 @@ void wy700_cgaline(wy700_t *wy700)
|
|||
{
|
||||
int x, c;
|
||||
uint32_t dat;
|
||||
uint8_t ink = 0;
|
||||
uint32_t ink = 0;
|
||||
uint16_t addr;
|
||||
|
||||
uint16_t ma = (wy700->cga_crtc[13] | (wy700->cga_crtc[12] << 8)) & 0x3fff;
|
||||
|
|
@ -614,11 +617,11 @@ void wy700_cgaline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 32; c++)
|
||||
{
|
||||
ink = (dat & 0x80000000) ? 16 + 15: 16 + 0;
|
||||
ink = (dat & 0x80000000) ? wy700_pal[3]: wy700_pal[0];
|
||||
if (!(wy700->enabled) || !(wy700->cga_ctrl & 8))
|
||||
ink = 16;
|
||||
buffer->line[wy700->displine][x*64 + 2*c] =
|
||||
buffer->line[wy700->displine][x*64 + 2*c+1] =
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 2*c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 2*c+1] =
|
||||
ink;
|
||||
dat = dat << 1;
|
||||
}
|
||||
|
|
@ -627,19 +630,13 @@ void wy700_cgaline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
switch ((dat >> 30) & 3)
|
||||
{
|
||||
case 0: ink = 16 + 0; break;
|
||||
case 1: ink = 16 + 8; break;
|
||||
case 2: ink = 16 + 7; break;
|
||||
case 3: ink = 16 + 15; break;
|
||||
}
|
||||
ink = wy700_pal[(dat >> 30) & 3];
|
||||
if (!(wy700->enabled) || !(wy700->cga_ctrl & 8))
|
||||
ink = 16;
|
||||
buffer->line[wy700->displine][x*64 + 4*c] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+1] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+2] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+3] =
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+1] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+2] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+3] =
|
||||
ink;
|
||||
dat = dat << 2;
|
||||
}
|
||||
|
|
@ -652,7 +649,7 @@ void wy700_medresline(wy700_t *wy700)
|
|||
{
|
||||
int x, c;
|
||||
uint32_t dat;
|
||||
uint8_t ink = 0;
|
||||
uint32_t ink = 0;
|
||||
uint32_t addr;
|
||||
|
||||
addr = (wy700->displine >> 1) * 80 + 4 * wy700->wy700_base;
|
||||
|
|
@ -669,19 +666,14 @@ void wy700_medresline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
switch ((dat >> 30) & 3)
|
||||
{
|
||||
case 0: ink = 16 + 0; break;
|
||||
case 1: ink = 16 + 8; break;
|
||||
case 2: ink = 16 + 7; break;
|
||||
case 3: ink = 16 + 15; break;
|
||||
}
|
||||
ink = wy700_pal[(dat >> 30) & 3];
|
||||
/* Display disabled? */
|
||||
if (!(wy700->wy700_mode & 8)) ink = 16;
|
||||
buffer->line[wy700->displine][x*64 + 4*c] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+1] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+2] =
|
||||
buffer->line[wy700->displine][x*64 + 4*c+3] =
|
||||
if (!(wy700->wy700_mode & 8))
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+1] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+2] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 4*c+3] =
|
||||
ink;
|
||||
dat = dat << 2;
|
||||
}
|
||||
|
|
@ -690,11 +682,12 @@ void wy700_medresline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 32; c++)
|
||||
{
|
||||
ink = (dat & 0x80000000) ? 16 + 15: 16 + 0;
|
||||
ink = (dat & 0x80000000) ? wy700_pal[3]: wy700_pal[0];
|
||||
/* Display disabled? */
|
||||
if (!(wy700->wy700_mode & 8)) ink = 16;
|
||||
buffer->line[wy700->displine][x*64 + 2*c] =
|
||||
buffer->line[wy700->displine][x*64 + 2*c+1] =
|
||||
if (!(wy700->wy700_mode & 8))
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 2*c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*64 + 2*c+1] =
|
||||
ink;
|
||||
dat = dat << 1;
|
||||
}
|
||||
|
|
@ -710,7 +703,7 @@ void wy700_hiresline(wy700_t *wy700)
|
|||
{
|
||||
int x, c;
|
||||
uint32_t dat;
|
||||
uint8_t ink = 0;
|
||||
uint32_t ink = 0;
|
||||
uint32_t addr;
|
||||
|
||||
addr = (wy700->displine >> 1) * 160 + 4 * wy700->wy700_base;
|
||||
|
|
@ -731,17 +724,12 @@ void wy700_hiresline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 16; c++)
|
||||
{
|
||||
switch ((dat >> 30) & 3)
|
||||
{
|
||||
case 0: ink = 16 + 0; break;
|
||||
case 1: ink = 16 + 8; break;
|
||||
case 2: ink = 16 + 7; break;
|
||||
case 3: ink = 16 + 15; break;
|
||||
}
|
||||
ink = wy700_pal[(dat >> 30) & 3];
|
||||
/* Display disabled? */
|
||||
if (!(wy700->wy700_mode & 8)) ink = 16;
|
||||
buffer->line[wy700->displine][x*32 + 2*c] =
|
||||
buffer->line[wy700->displine][x*32 + 2*c+1] =
|
||||
if (!(wy700->wy700_mode & 8))
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*32 + 2*c] =
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*32 + 2*c+1] =
|
||||
ink;
|
||||
dat = dat << 2;
|
||||
}
|
||||
|
|
@ -750,10 +738,11 @@ void wy700_hiresline(wy700_t *wy700)
|
|||
{
|
||||
for (c = 0; c < 32; c++)
|
||||
{
|
||||
ink = (dat & 0x80000000) ? 16 + 15: 16 + 0;
|
||||
ink = (dat & 0x80000000) ? wy700_pal[3]: wy700_pal[0];
|
||||
/* Display disabled? */
|
||||
if (!(wy700->wy700_mode & 8)) ink = 16;
|
||||
buffer->line[wy700->displine][x*32 + c] = ink;
|
||||
if (!(wy700->wy700_mode & 8))
|
||||
ink = wy700_pal[0];
|
||||
((uint32_t *)buffer32->line[wy700->displine])[x*32 + c] = ink;
|
||||
dat = dat << 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -845,7 +834,7 @@ void wy700_poll(void *p)
|
|||
if (ysize < 32) ysize = 200;
|
||||
updatewindowsize(xsize, ysize);
|
||||
}
|
||||
video_blit_memtoscreen_8(0, 0, xsize, ysize);
|
||||
video_blit_memtoscreen(0, 0, 0, ysize, xsize, ysize);
|
||||
|
||||
frames++;
|
||||
/* Fixed 1280x800 resolution */
|
||||
|
|
@ -888,72 +877,78 @@ void *wy700_init()
|
|||
io_sethandler(0x03b0, 0x000C, wy700_in, NULL, NULL, wy700_out, NULL, NULL, wy700);
|
||||
io_sethandler(0x03d0, 0x0010, wy700_in, NULL, NULL, wy700_out, NULL, NULL, wy700);
|
||||
|
||||
wy700_pal[0] = makecol(0x00, 0x00, 0x00);
|
||||
wy700_pal[1] = makecol(0x55, 0x55, 0x55);
|
||||
wy700_pal[2] = makecol(0xaa, 0xaa, 0xaa);
|
||||
wy700_pal[3] = makecol(0xff, 0xff, 0xff);
|
||||
|
||||
/* Set up the emulated attributes.
|
||||
* CGA is done in four groups: 00-0F, 10-7F, 80-8F, 90-FF */
|
||||
for (c = 0; c < 0x10; c++)
|
||||
{
|
||||
cgacols[c][0][0] = cgacols[c][1][0] = cgacols[c][1][1] = 16;
|
||||
if (c & 8) cgacols[c][0][1] = 15 + 16;
|
||||
else cgacols[c][0][1] = 7 + 16;
|
||||
cgacols[c][0][0] = cgacols[c][1][0] = cgacols[c][1][1] = wy700_pal[0];
|
||||
if (c & 8) cgacols[c][0][1] = wy700_pal[3];
|
||||
else cgacols[c][0][1] = wy700_pal[2];
|
||||
}
|
||||
for (c = 0x10; c < 0x80; c++)
|
||||
{
|
||||
cgacols[c][0][0] = cgacols[c][1][0] = cgacols[c][1][1] = 16 + 7;
|
||||
if (c & 8) cgacols[c][0][1] = 15 + 16;
|
||||
else cgacols[c][0][1] = 0 + 16;
|
||||
cgacols[c][0][0] = cgacols[c][1][0] = cgacols[c][1][1] = wy700_pal[2];
|
||||
if (c & 8) cgacols[c][0][1] = wy700_pal[3];
|
||||
else cgacols[c][0][1] = wy700_pal[0];
|
||||
|
||||
if ((c & 0x0F) == 8) cgacols[c][0][1] = 8 + 16;
|
||||
if ((c & 0x0F) == 8)
|
||||
cgacols[c][0][1] = wy700_pal[1];
|
||||
}
|
||||
/* With special cases for 00, 11, 22, ... 77 */
|
||||
cgacols[0x00][0][1] = cgacols[0x00][1][1] = 16;
|
||||
cgacols[0x00][0][1] = cgacols[0x00][1][1] = wy700_pal[0];
|
||||
for (c = 0x11; c <= 0x77; c += 0x11)
|
||||
{
|
||||
cgacols[c][0][1] = cgacols[c][1][1] = 16 + 7;
|
||||
cgacols[c][0][1] = cgacols[c][1][1] = wy700_pal[2];
|
||||
}
|
||||
for (c = 0x80; c < 0x90; c++)
|
||||
{
|
||||
cgacols[c][0][0] = 16 + 8;
|
||||
if (c & 8) cgacols[c][0][1] = 15 + 16;
|
||||
else cgacols[c][0][1] = 7 + 16;
|
||||
cgacols[c][0][0] = wy700_pal[1];
|
||||
if (c & 8) cgacols[c][0][1] = wy700_pal[3];
|
||||
else cgacols[c][0][1] = wy700_pal[2];
|
||||
cgacols[c][1][0] = cgacols[c][1][1] = cgacols[c-0x80][0][0];
|
||||
}
|
||||
for (c = 0x90; c < 0x100; c++)
|
||||
{
|
||||
cgacols[c][0][0] = 16 + 15;
|
||||
if (c & 8) cgacols[c][0][1] = 8 + 16;
|
||||
else cgacols[c][0][1] = 7 + 16;
|
||||
if ((c & 0x0F) == 0) cgacols[c][0][1] = 16;
|
||||
cgacols[c][0][0] = wy700_pal[3];
|
||||
if (c & 8) cgacols[c][0][1] = wy700_pal[1];
|
||||
else cgacols[c][0][1] = wy700_pal[2];
|
||||
if ((c & 0x0F) == 0) cgacols[c][0][1] = wy700_pal[0];
|
||||
cgacols[c][1][0] = cgacols[c][1][1] = cgacols[c-0x80][0][0];
|
||||
}
|
||||
/* Also special cases for 99, AA, ..., FF */
|
||||
for (c = 0x99; c <= 0xFF; c += 0x11)
|
||||
{
|
||||
cgacols[c][0][1] = 16 + 15;
|
||||
cgacols[c][0][1] = wy700_pal[3];
|
||||
}
|
||||
/* Special cases for 08, 80 and 88 */
|
||||
cgacols[0x08][0][1] = 16 + 8;
|
||||
cgacols[0x80][0][1] = 16;
|
||||
cgacols[0x88][0][1] = 16 + 8;
|
||||
cgacols[0x08][0][1] = wy700_pal[1];
|
||||
cgacols[0x80][0][1] = wy700_pal[0];
|
||||
cgacols[0x88][0][1] = wy700_pal[1];
|
||||
|
||||
/* MDA attributes */
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = 16;
|
||||
if (c & 8) mdacols[c][0][1] = 15 + 16;
|
||||
else mdacols[c][0][1] = 7 + 16;
|
||||
mdacols[c][0][0] = mdacols[c][1][0] = mdacols[c][1][1] = wy700_pal[0];
|
||||
if (c & 8) mdacols[c][0][1] = wy700_pal[3];
|
||||
else mdacols[c][0][1] = wy700_pal[2];
|
||||
}
|
||||
mdacols[0x70][0][1] = 16;
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = 16 + 15;
|
||||
mdacols[0xF0][0][1] = 16;
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = 16 + 15;
|
||||
mdacols[0x78][0][1] = 16 + 7;
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = 16 + 15;
|
||||
mdacols[0xF8][0][1] = 16 + 7;
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = 16 + 15;
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = 16;
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = 16;
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = 16;
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = 16;
|
||||
mdacols[0x70][0][1] = wy700_pal[0];
|
||||
mdacols[0x70][0][0] = mdacols[0x70][1][0] = mdacols[0x70][1][1] = wy700_pal[3];
|
||||
mdacols[0xF0][0][1] = wy700_pal[0];
|
||||
mdacols[0xF0][0][0] = mdacols[0xF0][1][0] = mdacols[0xF0][1][1] = wy700_pal[3];
|
||||
mdacols[0x78][0][1] = wy700_pal[2];
|
||||
mdacols[0x78][0][0] = mdacols[0x78][1][0] = mdacols[0x78][1][1] = wy700_pal[3];
|
||||
mdacols[0xF8][0][1] = wy700_pal[2];
|
||||
mdacols[0xF8][0][0] = mdacols[0xF8][1][0] = mdacols[0xF8][1][1] = wy700_pal[3];
|
||||
mdacols[0x00][0][1] = mdacols[0x00][1][1] = wy700_pal[0];
|
||||
mdacols[0x08][0][1] = mdacols[0x08][1][1] = wy700_pal[0];
|
||||
mdacols[0x80][0][1] = mdacols[0x80][1][1] = wy700_pal[0];
|
||||
mdacols[0x88][0][1] = mdacols[0x88][1][1] = wy700_pal[0];
|
||||
|
||||
/* Start off in 80x25 text mode */
|
||||
wy700->cga_stat = 0xF4;
|
||||
|
|
|
|||
62
src/video.c
62
src/video.c
|
|
@ -245,7 +245,6 @@ int video_timing_b, video_timing_w, video_timing_l;
|
|||
int video_res_x, video_res_y, video_bpp;
|
||||
|
||||
void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
|
||||
void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
|
||||
|
||||
void video_init()
|
||||
{
|
||||
|
|
@ -314,7 +313,7 @@ void video_init()
|
|||
}
|
||||
|
||||
|
||||
BITMAP *buffer, *buffer32;
|
||||
BITMAP *buffer32;
|
||||
|
||||
uint8_t fontdat[256][8];
|
||||
uint8_t fontdatm[256][16];
|
||||
|
|
@ -323,8 +322,6 @@ uint8_t fontdat8x12[256][16]; /* MDSI Genius font */
|
|||
|
||||
int xsize=1,ysize=1;
|
||||
|
||||
PALETTE cgapal;
|
||||
|
||||
void loadfont(char *s, int format)
|
||||
{
|
||||
FILE *f=romfopen(s,"rb");
|
||||
|
|
@ -419,7 +416,7 @@ void loadfont(char *s, int format)
|
|||
|
||||
static struct
|
||||
{
|
||||
int x, y, y1, y2, w, h, blit8;
|
||||
int x, y, y1, y2, w, h;
|
||||
int busy;
|
||||
int buffer_in_use;
|
||||
|
||||
|
|
@ -431,29 +428,14 @@ static struct
|
|||
|
||||
static void blit_thread(void *param);
|
||||
|
||||
uint32_t cgapal[16];
|
||||
|
||||
void initvideo()
|
||||
{
|
||||
int c, d, e;
|
||||
|
||||
buffer32 = create_bitmap(2048, 2048);
|
||||
|
||||
buffer = create_bitmap(2048, 2048);
|
||||
|
||||
for (c = 0; c < 64; c++)
|
||||
{
|
||||
cgapal[c + 64].r = (((c & 4) ? 2 : 0) | ((c & 0x10) ? 1 : 0)) * 21;
|
||||
cgapal[c + 64].g = (((c & 2) ? 2 : 0) | ((c & 0x10) ? 1 : 0)) * 21;
|
||||
cgapal[c + 64].b = (((c & 1) ? 2 : 0) | ((c & 0x10) ? 1 : 0)) * 21;
|
||||
if ((c & 0x17) == 6)
|
||||
cgapal[c + 64].g >>= 1;
|
||||
}
|
||||
for (c = 0; c < 64; c++)
|
||||
{
|
||||
cgapal[c + 128].r = (((c & 4) ? 2 : 0) | ((c & 0x20) ? 1 : 0)) * 21;
|
||||
cgapal[c + 128].g = (((c & 2) ? 2 : 0) | ((c & 0x10) ? 1 : 0)) * 21;
|
||||
cgapal[c + 128].b = (((c & 1) ? 2 : 0) | ((c & 0x08) ? 1 : 0)) * 21;
|
||||
}
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
{
|
||||
e = c;
|
||||
|
|
@ -484,6 +466,23 @@ void initvideo()
|
|||
for (c = 0; c < 65536; c++)
|
||||
video_16to32[c] = ((c & 31) << 3) | (((c >> 5) & 63) << 10) | (((c >> 11) & 31) << 19);
|
||||
|
||||
cgapal[0x0] = makecol(0x00, 0x00, 0x00);
|
||||
cgapal[0x1] = makecol(0x00, 0x00, 0xaa);
|
||||
cgapal[0x2] = makecol(0x00, 0xaa, 0x00);
|
||||
cgapal[0x3] = makecol(0x00, 0xaa, 0xaa);
|
||||
cgapal[0x4] = makecol(0xaa, 0x00, 0x00);
|
||||
cgapal[0x5] = makecol(0xaa, 0x00, 0xaa);
|
||||
cgapal[0x6] = makecol(0xaa, 0x55, 0x00);
|
||||
cgapal[0x7] = makecol(0xaa, 0xaa, 0xaa);
|
||||
cgapal[0x8] = makecol(0x55, 0x55, 0x55);
|
||||
cgapal[0x9] = makecol(0x55, 0x55, 0xff);
|
||||
cgapal[0xa] = makecol(0x55, 0xff, 0x55);
|
||||
cgapal[0xb] = makecol(0x55, 0xff, 0xff);
|
||||
cgapal[0xc] = makecol(0xff, 0x55, 0x55);
|
||||
cgapal[0xd] = makecol(0xff, 0x55, 0xff);
|
||||
cgapal[0xe] = makecol(0xff, 0xff, 0x55);
|
||||
cgapal[0xf] = makecol(0xff, 0xff, 0xff);
|
||||
|
||||
blit_data.wake_blit_thread = thread_create_event();
|
||||
blit_data.blit_complete = thread_create_event();
|
||||
blit_data.buffer_not_in_use = thread_create_event();
|
||||
|
|
@ -499,7 +498,6 @@ void closevideo()
|
|||
|
||||
free(video_15to32);
|
||||
free(video_16to32);
|
||||
destroy_bitmap(buffer);
|
||||
destroy_bitmap(buffer32);
|
||||
}
|
||||
|
||||
|
|
@ -511,10 +509,7 @@ static void blit_thread(void *param)
|
|||
thread_wait_event(blit_data.wake_blit_thread, -1);
|
||||
thread_reset_event(blit_data.wake_blit_thread);
|
||||
|
||||
if (blit_data.blit8)
|
||||
video_blit_memtoscreen_8_func(blit_data.x, blit_data.y, blit_data.w, blit_data.h);
|
||||
else
|
||||
video_blit_memtoscreen_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
||||
video_blit_memtoscreen_func(blit_data.x, blit_data.y, blit_data.y1, blit_data.y2, blit_data.w, blit_data.h);
|
||||
|
||||
blit_data.busy = 0;
|
||||
thread_set_event(blit_data.blit_complete);
|
||||
|
|
@ -551,18 +546,5 @@ void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
blit_data.y2 = y2;
|
||||
blit_data.w = w;
|
||||
blit_data.h = h;
|
||||
blit_data.blit8 = 0;
|
||||
thread_set_event(blit_data.wake_blit_thread);
|
||||
}
|
||||
|
||||
void video_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
video_wait_for_blit();
|
||||
blit_data.busy = 1;
|
||||
blit_data.x = x;
|
||||
blit_data.y = y;
|
||||
blit_data.w = w;
|
||||
blit_data.h = h;
|
||||
blit_data.blit8 = 1;
|
||||
thread_set_event(blit_data.wake_blit_thread);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ typedef RGB PALETTE[256];
|
|||
|
||||
#endif
|
||||
|
||||
extern BITMAP *buffer, *buffer32;
|
||||
extern BITMAP *buffer32;
|
||||
|
||||
int video_card_available(int card);
|
||||
char *video_card_getname(int card);
|
||||
|
|
@ -74,10 +74,8 @@ extern int readflash;
|
|||
extern void (*video_recalctimings)();
|
||||
|
||||
void video_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
void video_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
|
||||
extern void (*video_blit_memtoscreen_func)(int x, int y, int y1, int y2, int w, int h);
|
||||
extern void (*video_blit_memtoscreen_8_func)(int x, int y, int w, int h);
|
||||
|
||||
extern int video_timing_b, video_timing_w, video_timing_l;
|
||||
extern int video_speed;
|
||||
|
|
@ -99,3 +97,5 @@ void video_updatetiming();
|
|||
void hline(BITMAP *b, int x1, int y, int x2, int col);
|
||||
|
||||
void destroy_bitmap(BITMAP *b);
|
||||
|
||||
extern uint32_t cgapal[16];
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ extern "C" void device_force_redraw();
|
|||
static void d3d_fs_init_objects();
|
||||
static void d3d_fs_close_objects();
|
||||
static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
|
||||
extern "C" void video_blit_complete();
|
||||
|
||||
|
|
@ -37,31 +36,6 @@ struct CUSTOMVERTEX
|
|||
FLOAT tu, tv;
|
||||
};
|
||||
|
||||
static PALETTE cgapal=
|
||||
{
|
||||
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
|
||||
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
|
||||
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
|
||||
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
|
||||
|
||||
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
|
||||
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
|
||||
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
|
||||
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
|
||||
|
||||
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
|
||||
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
|
||||
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
|
||||
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
|
||||
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
};
|
||||
|
||||
static uint32_t pal_lookup[256];
|
||||
|
||||
static CUSTOMVERTEX d3d_verts[] =
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 1.0f, 0xffffff, 0.0f, 0.0f},
|
||||
|
|
@ -83,13 +57,9 @@ static CUSTOMVERTEX d3d_verts[] =
|
|||
|
||||
void d3d_fs_init(HWND h)
|
||||
{
|
||||
int c;
|
||||
d3d_fs_w = GetSystemMetrics(SM_CXSCREEN);
|
||||
d3d_fs_h = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
|
||||
|
||||
d3d_hwnd = h;
|
||||
|
||||
d3d_device_window = CreateWindowEx (
|
||||
|
|
@ -130,7 +100,6 @@ void d3d_fs_init(HWND h)
|
|||
d3d_fs_init_objects();
|
||||
|
||||
video_blit_memtoscreen_func = d3d_fs_blit_memtoscreen;
|
||||
video_blit_memtoscreen_8_func = d3d_fs_blit_memtoscreen_8;
|
||||
}
|
||||
|
||||
static void d3d_fs_close_objects()
|
||||
|
|
@ -406,123 +375,3 @@ static void d3d_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
||||
PostMessage(ghwnd, WM_RESETD3D, 0, 0);
|
||||
}
|
||||
|
||||
static void d3d_fs_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
HRESULT hr = D3D_OK;
|
||||
VOID* pVoid;
|
||||
D3DLOCKED_RECT dr;
|
||||
RECT window_rect;
|
||||
int xx, yy;
|
||||
double l, t, r, b;
|
||||
|
||||
if (!h)
|
||||
{
|
||||
video_blit_complete();
|
||||
return; /*Nothing to do*/
|
||||
}
|
||||
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
RECT lock_rect;
|
||||
|
||||
lock_rect.top = 0;
|
||||
lock_rect.left = 0;
|
||||
lock_rect.bottom = 2047;
|
||||
lock_rect.right = 2047;
|
||||
|
||||
if (FAILED(d3dTexture->LockRect(0, &dr, &lock_rect, 0)))
|
||||
fatal("LockRect failed\n");
|
||||
|
||||
for (yy = 0; yy < h; yy++)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)((uintptr_t)dr.pBits + (yy * dr.Pitch));
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||
{
|
||||
for (xx = 0; xx < w; xx++)
|
||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
||||
}
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
|
||||
d3dTexture->UnlockRect(0);
|
||||
}
|
||||
else
|
||||
video_blit_complete();
|
||||
|
||||
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;
|
||||
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;
|
||||
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2048.0;
|
||||
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2048.0;
|
||||
d3d_verts[0].color = d3d_verts[1].color = d3d_verts[2].color =
|
||||
d3d_verts[3].color = d3d_verts[4].color = d3d_verts[5].color =
|
||||
d3d_verts[6].color = d3d_verts[7].color = d3d_verts[8].color =
|
||||
d3d_verts[9].color = d3d_verts[10].color = d3d_verts[11].color = 0xffffff;
|
||||
|
||||
GetClientRect(d3d_device_window, &window_rect);
|
||||
d3d_fs_size(window_rect, &l, &t, &r, &b, w, h);
|
||||
|
||||
d3d_verts[0].x = l;
|
||||
d3d_verts[0].y = t;
|
||||
d3d_verts[1].x = r;
|
||||
d3d_verts[1].y = b;
|
||||
d3d_verts[2].x = l;
|
||||
d3d_verts[2].y = b;
|
||||
d3d_verts[3].x = l;
|
||||
d3d_verts[3].y = t;
|
||||
d3d_verts[4].x = r;
|
||||
d3d_verts[4].y = t;
|
||||
d3d_verts[5].x = r;
|
||||
d3d_verts[5].y = b;
|
||||
d3d_verts[6].x = d3d_verts[8].x = d3d_verts[9].x = r - 40.5;
|
||||
d3d_verts[6].y = d3d_verts[9].y = d3d_verts[10].y = t + 8.5;
|
||||
d3d_verts[7].x = d3d_verts[10].x = d3d_verts[11].x = r - 8.5;
|
||||
d3d_verts[7].y = d3d_verts[8].y = d3d_verts[11].y = t + 14.5;
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0);
|
||||
if (hr == D3D_OK)
|
||||
memcpy(pVoid, d3d_verts, sizeof(d3d_verts));
|
||||
if (hr == D3D_OK)
|
||||
hr = v_buffer->Unlock();
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->BeginScene();
|
||||
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
if (hr == D3D_OK)
|
||||
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0, 0);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetTexture(0, d3dTexture);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetTexture(0, NULL);
|
||||
|
||||
if (hr == D3D_OK && readflash && vid_disc_indicator)
|
||||
{
|
||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 2);
|
||||
readflash = 0;
|
||||
}
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->EndScene();
|
||||
}
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->Present(NULL, NULL, d3d_device_window, NULL);
|
||||
|
||||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
||||
PostMessage(ghwnd, WM_RESETD3D, 0, 0);
|
||||
}
|
||||
|
|
|
|||
142
src/win-d3d.cc
142
src/win-d3d.cc
|
|
@ -15,7 +15,6 @@ extern "C" void video_blit_complete();
|
|||
void d3d_init_objects();
|
||||
void d3d_close_objects();
|
||||
void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
void d3d_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
|
||||
static LPDIRECT3D9 d3d = NULL;
|
||||
static LPDIRECT3DDEVICE9 d3ddev = NULL;
|
||||
|
|
@ -32,31 +31,6 @@ struct CUSTOMVERTEX
|
|||
FLOAT tu, tv;
|
||||
};
|
||||
|
||||
static PALETTE cgapal=
|
||||
{
|
||||
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
|
||||
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
|
||||
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
|
||||
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
|
||||
|
||||
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
|
||||
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
|
||||
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
|
||||
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
|
||||
|
||||
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
|
||||
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
|
||||
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
|
||||
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
|
||||
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
};
|
||||
|
||||
static uint32_t pal_lookup[256];
|
||||
|
||||
static CUSTOMVERTEX d3d_verts[] =
|
||||
{
|
||||
{ 0.0f, 0.0f, 1.0f, 1.0f, 0xffffff, 0.0f, 0.0f},
|
||||
|
|
@ -78,11 +52,6 @@ static CUSTOMVERTEX d3d_verts[] =
|
|||
|
||||
void d3d_init(HWND h)
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
|
||||
|
||||
d3d_hwnd = h;
|
||||
|
||||
d3d = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
|
|
@ -108,7 +77,6 @@ void d3d_init(HWND h)
|
|||
d3d_init_objects();
|
||||
|
||||
video_blit_memtoscreen_func = d3d_blit_memtoscreen;
|
||||
video_blit_memtoscreen_8_func = d3d_blit_memtoscreen_8;
|
||||
}
|
||||
|
||||
void d3d_close_objects()
|
||||
|
|
@ -239,7 +207,7 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
RECT r;
|
||||
int yy;
|
||||
|
||||
if (y1 == y2)
|
||||
if (y1 == y2 || h <= 0)
|
||||
{
|
||||
video_blit_complete();
|
||||
return; /*Nothing to do*/
|
||||
|
|
@ -256,7 +224,10 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
fatal("LockRect failed\n");
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
{
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h)
|
||||
memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4);
|
||||
}
|
||||
|
||||
video_blit_complete();
|
||||
d3dTexture->UnlockRect(0);
|
||||
|
|
@ -326,106 +297,3 @@ void d3d_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
||||
PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0);
|
||||
}
|
||||
|
||||
void d3d_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
VOID* pVoid;
|
||||
D3DLOCKED_RECT dr;
|
||||
RECT r;
|
||||
int yy, xx;
|
||||
HRESULT hr = D3D_OK;
|
||||
|
||||
if (h == 0)
|
||||
{
|
||||
video_blit_complete();
|
||||
return; /*Nothing to do*/
|
||||
}
|
||||
|
||||
r.top = 0;
|
||||
r.left = 0;
|
||||
r.bottom = h;
|
||||
r.right = 2047;
|
||||
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
if (FAILED(d3dTexture->LockRect(0, &dr, &r, 0)))
|
||||
fatal("LockRect failed\n");
|
||||
|
||||
for (yy = 0; yy < h; yy++)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)((uintptr_t)dr.pBits + (yy * dr.Pitch));
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||
{
|
||||
for (xx = 0; xx < w; xx++)
|
||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
||||
}
|
||||
}
|
||||
video_blit_complete();
|
||||
|
||||
d3dTexture->UnlockRect(0);
|
||||
}
|
||||
else
|
||||
video_blit_complete();
|
||||
|
||||
d3d_verts[0].tu = d3d_verts[2].tu = d3d_verts[3].tu = 0;//0.5 / 2048.0;
|
||||
d3d_verts[0].tv = d3d_verts[3].tv = d3d_verts[4].tv = 0;//0.5 / 2048.0;
|
||||
d3d_verts[1].tu = d3d_verts[4].tu = d3d_verts[5].tu = (float)w / 2048.0;
|
||||
d3d_verts[1].tv = d3d_verts[2].tv = d3d_verts[5].tv = (float)h / 2048.0;
|
||||
d3d_verts[0].color = d3d_verts[1].color = d3d_verts[2].color =
|
||||
d3d_verts[3].color = d3d_verts[4].color = d3d_verts[5].color =
|
||||
d3d_verts[6].color = d3d_verts[7].color = d3d_verts[8].color =
|
||||
d3d_verts[9].color = d3d_verts[10].color = d3d_verts[11].color = 0xffffff;
|
||||
|
||||
GetClientRect(d3d_hwnd, &r);
|
||||
d3d_verts[0].x = d3d_verts[2].x = d3d_verts[3].x = -0.5;
|
||||
d3d_verts[0].y = d3d_verts[3].y = d3d_verts[4].y = -0.5;
|
||||
d3d_verts[1].x = d3d_verts[4].x = d3d_verts[5].x = (r.right - r.left) - 0.5;
|
||||
d3d_verts[1].y = d3d_verts[2].y = d3d_verts[5].y = (r.bottom - r.top) - 0.5;
|
||||
d3d_verts[6].x = d3d_verts[8].x = d3d_verts[9].x = (r.right - r.left) - 40.5;
|
||||
d3d_verts[6].y = d3d_verts[9].y = d3d_verts[10].y = 8.5;
|
||||
d3d_verts[7].x = d3d_verts[10].x = d3d_verts[11].x = (r.right - r.left) - 8.5;
|
||||
d3d_verts[7].y = d3d_verts[8].y = d3d_verts[11].y = 14.5;
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = v_buffer->Lock(0, 0, (void**)&pVoid, 0); // lock the vertex buffer
|
||||
if (hr == D3D_OK)
|
||||
memcpy(pVoid, d3d_verts, sizeof(d3d_verts)); // copy the vertices to the locked buffer
|
||||
if (hr == D3D_OK)
|
||||
hr = v_buffer->Unlock(); // unlock the vertex buffer
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->BeginScene();
|
||||
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetTexture(0, d3dTexture);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->SetTexture(0, NULL);
|
||||
|
||||
if (hr == D3D_OK && readflash && vid_disc_indicator)
|
||||
{
|
||||
hr = d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 2);
|
||||
readflash = 0;
|
||||
}
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->EndScene();
|
||||
}
|
||||
|
||||
if (hr == D3D_OK)
|
||||
hr = d3ddev->Present(NULL, NULL, d3d_hwnd, NULL);
|
||||
|
||||
if (hr == D3DERR_DEVICELOST || hr == D3DERR_INVALIDCALL)
|
||||
PostMessage(d3d_hwnd, WM_RESETD3D, 0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ extern "C" void ddraw_fs_close();
|
|||
extern "C" void video_blit_complete();
|
||||
|
||||
static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
|
||||
static LPDIRECTDRAW lpdd = NULL;
|
||||
static LPDIRECTDRAW4 lpdd4 = NULL;
|
||||
|
|
@ -29,41 +28,11 @@ static DDSURFACEDESC2 ddsd;
|
|||
static HWND ddraw_hwnd;
|
||||
static int ddraw_w, ddraw_h;
|
||||
|
||||
static PALETTE cgapal =
|
||||
{
|
||||
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
|
||||
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
|
||||
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
|
||||
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
|
||||
|
||||
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
|
||||
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
|
||||
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
|
||||
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
|
||||
|
||||
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
|
||||
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
|
||||
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
|
||||
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
|
||||
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
};
|
||||
|
||||
static uint32_t pal_lookup[256];
|
||||
|
||||
void ddraw_fs_init(HWND h)
|
||||
{
|
||||
int c;
|
||||
|
||||
ddraw_w = GetSystemMetrics(SM_CXSCREEN);
|
||||
ddraw_h = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
|
||||
|
||||
if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))
|
||||
fatal("DirectDrawCreate failed\n");
|
||||
|
||||
|
|
@ -108,7 +77,6 @@ void ddraw_fs_init(HWND h)
|
|||
pclog("DDRAW_INIT complete\n");
|
||||
ddraw_hwnd = h;
|
||||
video_blit_memtoscreen_func = ddraw_fs_blit_memtoscreen;
|
||||
video_blit_memtoscreen_8_func = ddraw_fs_blit_memtoscreen_8;
|
||||
}
|
||||
|
||||
void ddraw_fs_close()
|
||||
|
|
@ -260,77 +228,3 @@ static void ddraw_fs_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h
|
|||
lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
|
||||
}
|
||||
}
|
||||
|
||||
static void ddraw_fs_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
RECT r_src;
|
||||
RECT r_dest;
|
||||
RECT window_rect;
|
||||
int xx, yy;
|
||||
HRESULT hr;
|
||||
DDBLTFX ddbltfx;
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
hr = lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_back->Restore();
|
||||
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
device_force_redraw();
|
||||
}
|
||||
if (!ddsd.lpSurface)
|
||||
{
|
||||
video_blit_complete();
|
||||
return;
|
||||
}
|
||||
for (yy = 0; yy < h; yy++)
|
||||
{
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||
{
|
||||
uint32_t *p = (uint32_t *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch));
|
||||
for (xx = 0; xx < w; xx++)
|
||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
||||
}
|
||||
}
|
||||
video_blit_complete();
|
||||
lpdds_back->Unlock(NULL);
|
||||
|
||||
window_rect.left = 0;
|
||||
window_rect.top = 0;
|
||||
window_rect.right = ddraw_w;
|
||||
window_rect.bottom = ddraw_h;
|
||||
ddraw_fs_size(window_rect, &r_dest, w, h);
|
||||
|
||||
r_src.left = 0;
|
||||
r_src.top = 0;
|
||||
r_src.right = w;
|
||||
r_src.bottom = h;
|
||||
|
||||
ddbltfx.dwSize = sizeof(ddbltfx);
|
||||
ddbltfx.dwFillColor = 0;
|
||||
|
||||
lpdds_back2->Blt(&window_rect, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
|
||||
|
||||
hr = lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_back2->Restore();
|
||||
lpdds_back2->Blt(&r_dest, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (readflash && vid_disc_indicator)
|
||||
{
|
||||
RECT r;
|
||||
r.left = window_rect.right - 40;
|
||||
r.right = window_rect.right - 8;
|
||||
r.top = 8;
|
||||
r.bottom = 14;
|
||||
ddbltfx.dwFillColor = 0xffffff;
|
||||
lpdds_back2->Blt(&r, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
|
||||
}
|
||||
|
||||
lpdds_pri->Flip(NULL, DDFLIP_NOVSYNC);
|
||||
}
|
||||
|
|
|
|||
121
src/win-ddraw.cc
121
src/win-ddraw.cc
|
|
@ -16,7 +16,6 @@ extern "C" void ddraw_close();
|
|||
extern "C" void video_blit_complete();
|
||||
|
||||
static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
|
||||
static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h);
|
||||
|
||||
static LPDIRECTDRAW lpdd = NULL;
|
||||
static LPDIRECTDRAW4 lpdd4 = NULL;
|
||||
|
|
@ -28,38 +27,8 @@ static DDSURFACEDESC2 ddsd;
|
|||
|
||||
static HWND ddraw_hwnd;
|
||||
|
||||
static PALETTE cgapal=
|
||||
{
|
||||
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
|
||||
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
|
||||
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
|
||||
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
|
||||
|
||||
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
|
||||
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
|
||||
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
|
||||
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
|
||||
|
||||
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
|
||||
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
|
||||
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
|
||||
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
|
||||
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
|
||||
};
|
||||
|
||||
static uint32_t pal_lookup[256];
|
||||
|
||||
void ddraw_init(HWND h)
|
||||
{
|
||||
int c;
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
|
||||
|
||||
if (FAILED(DirectDrawCreate(NULL, &lpdd, NULL)))
|
||||
fatal("DirectDrawCreate failed\n");
|
||||
|
||||
|
|
@ -112,7 +81,6 @@ void ddraw_init(HWND h)
|
|||
pclog("DDRAW_INIT complete\n");
|
||||
ddraw_hwnd = h;
|
||||
video_blit_memtoscreen_func = ddraw_blit_memtoscreen;
|
||||
video_blit_memtoscreen_8_func = ddraw_blit_memtoscreen_8;
|
||||
}
|
||||
|
||||
void ddraw_close()
|
||||
|
|
@ -154,6 +122,9 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
HRESULT hr;
|
||||
// pclog("Blit memtoscreen %i,%i %i %i %i,%i\n", x, y, y1, y2, w, h);
|
||||
|
||||
if (h <= 0)
|
||||
return;
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
|
|
@ -171,7 +142,7 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
}
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer32->h)
|
||||
memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4);
|
||||
}
|
||||
video_blit_complete();
|
||||
|
|
@ -223,87 +194,3 @@ static void ddraw_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
|
|||
lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void ddraw_blit_memtoscreen_8(int x, int y, int w, int h)
|
||||
{
|
||||
RECT r_src;
|
||||
RECT r_dest;
|
||||
int xx, yy;
|
||||
POINT po;
|
||||
uint32_t *p;
|
||||
HRESULT hr;
|
||||
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
|
||||
hr = lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_back->Restore();
|
||||
lpdds_back->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
device_force_redraw();
|
||||
}
|
||||
if (!ddsd.lpSurface)
|
||||
{
|
||||
video_blit_complete();
|
||||
return;
|
||||
}
|
||||
for (yy = 0; yy < h; yy++)
|
||||
{
|
||||
if ((y + yy) >= 0 && (y + yy) < buffer->h)
|
||||
{
|
||||
p = (uint32_t *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch));
|
||||
for (xx = 0; xx < w; xx++)
|
||||
p[xx] = pal_lookup[buffer->line[y + yy][x + xx]];
|
||||
}
|
||||
}
|
||||
p = (uint32_t *)((uintptr_t)ddsd.lpSurface + (4 * ddsd.lPitch));
|
||||
lpdds_back->Unlock(NULL);
|
||||
video_blit_complete();
|
||||
|
||||
po.x = po.y = 0;
|
||||
|
||||
ClientToScreen(ddraw_hwnd, &po);
|
||||
GetClientRect(ddraw_hwnd, &r_dest);
|
||||
OffsetRect(&r_dest, po.x, po.y);
|
||||
|
||||
r_src.left = 0;
|
||||
r_src.top = 0;
|
||||
r_src.right = w;
|
||||
r_src.bottom = h;
|
||||
|
||||
hr = lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_back2->Restore();
|
||||
lpdds_back2->Blt(&r_src, lpdds_back, &r_src, DDBLT_WAIT, NULL);
|
||||
}
|
||||
|
||||
if (readflash && vid_disc_indicator)
|
||||
{
|
||||
readflash = 0;
|
||||
hr = lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_back2->Restore();
|
||||
lpdds_back2->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
|
||||
device_force_redraw();
|
||||
}
|
||||
if (!ddsd.lpSurface) return;
|
||||
for (yy = 8; yy < 14; yy++)
|
||||
{
|
||||
p = (uint32_t *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch));
|
||||
for (xx = (w - 40); xx < (w - 8); xx++)
|
||||
p[xx] = 0xffffffff;
|
||||
}
|
||||
lpdds_back2->Unlock(NULL);
|
||||
}
|
||||
|
||||
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
|
||||
if (hr == DDERR_SURFACELOST)
|
||||
{
|
||||
lpdds_pri->Restore();
|
||||
hr = lpdds_pri->Blt(&r_dest, lpdds_back2, &r_src, DDBLT_WAIT, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@ BITMAP *screen;
|
|||
|
||||
void hline(BITMAP *b, int x1, int y, int x2, int col)
|
||||
{
|
||||
if (y < 0 || y >= buffer->h)
|
||||
if (y < 0 || y >= buffer32->h)
|
||||
return;
|
||||
|
||||
if (b == buffer)
|
||||
memset(&b->line[y][x1], col, x2 - x1);
|
||||
else
|
||||
memset(&((uint32_t *)b->line[y])[x1], col, (x2 - x1) * 4);
|
||||
for (; x1 < x2; x1++)
|
||||
((uint32_t *)b->line[y])[x1] = col;
|
||||
}
|
||||
|
||||
void blit(BITMAP *src, BITMAP *dst, int x1, int y1, int x2, int y2, int xs, int ys)
|
||||
|
|
|
|||
Loading…
Reference in a new issue