Tentatively implemented the vertical scrolling part of EGA and (S)VGA CRTC register 8;

PCap devices list generator now aborts if WinPcap is not present;
Fixed the CD-ROM START STOP UNIT command;
More preparations for SCSI removable hard disks.
This commit is contained in:
OBattler
2017-05-19 04:35:59 +02:00
parent d5a65e6e57
commit 1ad94224ca
8 changed files with 286 additions and 119 deletions

View File

@@ -243,6 +243,8 @@ void ega_recalctimings(ega_t *ega)
ega->hdisp++;
ega->rowoffset = ega->crtc[0x13];
ega->rowcount = ega->crtc[9] & 0x1f;
overscan_y = (ega->rowcount + 1) << 1;
if (ega->vidclock) crtcconst = (ega->seqregs[1] & 1) ? MDACONST : (MDACONST * (9.0 / 8.0));
else crtcconst = (ega->seqregs[1] & 1) ? CGACONST : (CGACONST * (9.0 / 8.0));
@@ -254,6 +256,11 @@ void ega_recalctimings(ega_t *ega)
{
disptime*=2;
_dispontime*=2;
overscan_y <<= 1;
}
if (overscan_y < 16)
{
overscan_y = 16;
}
_dispofftime = disptime - _dispontime;
_dispontime *= crtcconst;
@@ -263,6 +270,19 @@ void ega_recalctimings(ega_t *ega)
ega->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT));
}
int ega_display_line(ega_t *ega)
{
int y_add = (enable_overscan) ? (overscan_y >> 1) : 0;
unsigned int dl = ega->displine;
if (ega->crtc[9] & 0x1f)
{
dl -= (ega->crtc[8] & 0x1f);
}
dl += y_add;
dl &= 0x7ff;
return dl;
}
void ega_poll(void *p)
{
ega_t *ega = (ega_t *)p;
@@ -273,12 +293,13 @@ void ega_poll(void *p)
int offset;
uint8_t edat[4];
int drawcursor = 0;
int y_add = enable_overscan ? 14 : 0;
int y_add = enable_overscan ? (overscan_y >> 1) : 0;
int x_add = enable_overscan ? 8 : 0;
int y_add_ex = enable_overscan ? 28 : 0;
int y_add_ex = enable_overscan ? overscan_y : 0;
int x_add_ex = enable_overscan ? 16 : 0;
uint32_t *q, *r, i, j;
uint32_t *q, i, j;
int wx = 640, wy = 350;
int dl = ega_display_line(ega);
if (!ega->linepos)
{
@@ -302,16 +323,16 @@ void ega_poll(void *p)
switch (ega->seqregs[1] & 9)
{
case 0:
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[ega->displine + y_add])[(x * 9) + xx + 32 + x_add] = 0;
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[dl])[(x * 9) + xx + 32 + x_add] = 0;
break;
case 1:
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[ega->displine + y_add])[(x * 8) + xx + 32 + x_add] = 0;
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[dl])[(x * 8) + xx + 32 + x_add] = 0;
break;
case 8:
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[ega->displine + y_add])[(x * 18) + xx + 32 + x_add] = 0;
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[dl])[(x * 18) + xx + 32 + x_add] = 0;
break;
case 9:
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[ega->displine + y_add])[(x * 16) + xx + 32 + x_add] = 0;
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[dl])[(x * 16) + xx + 32 + x_add] = 0;
break;
}
}
@@ -352,20 +373,20 @@ void ega_poll(void *p)
if (ega->seqregs[1] & 1)
{
for (xx = 0; xx < 8; xx++)
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x << 4) + 32 + (xx << 1)) & 2047) + x_add] =
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x << 4) + 33 + (xx << 1)) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x << 4) + 32 + (xx << 1)) & 2047) + x_add] =
((uint32_t *)buffer32->line[dl])[(((x << 4) + 33 + (xx << 1)) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
}
else
{
for (xx = 0; xx < 8; xx++)
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 32 + (xx << 1)) & 2047) + x_add] =
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 33 + (xx << 1)) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x * 18) + 32 + (xx << 1)) & 2047) + x_add] =
((uint32_t *)buffer32->line[dl])[(((x * 18) + 33 + (xx << 1)) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
if ((chr & ~0x1f) != 0xc0 || !(ega->attrregs[0x10] & 4))
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 32 + 16) & 2047) + x_add] =
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 32 + 17) & 2047) + x_add] = bg;
((uint32_t *)buffer32->line[dl])[(((x * 18) + 32 + 16) & 2047) + x_add] =
((uint32_t *)buffer32->line[dl])[(((x * 18) + 32 + 17) & 2047) + x_add] = bg;
else
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 32 + 16) & 2047) + x_add] =
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 18) + 32 + 17) & 2047) + x_add] = (dat & 1) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x * 18) + 32 + 16) & 2047) + x_add] =
((uint32_t *)buffer32->line[dl])[(((x * 18) + 32 + 17) & 2047) + x_add] = (dat & 1) ? fg : bg;
}
}
else
@@ -373,16 +394,16 @@ void ega_poll(void *p)
if (ega->seqregs[1] & 1)
{
for (xx = 0; xx < 8; xx++)
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x << 3) + 32 + xx) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x << 3) + 32 + xx) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
}
else
{
for (xx = 0; xx < 8; xx++)
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 9) + 32 + xx) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x * 9) + 32 + xx) & 2047) + x_add] = (dat & (0x80 >> xx)) ? fg : bg;
if ((chr & ~0x1f) != 0xc0 || !(ega->attrregs[0x10] & 4))
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 9) + 32 + 8) & 2047) + x_add] = bg;
((uint32_t *)buffer32->line[dl])[(((x * 9) + 32 + 8) & 2047) + x_add] = bg;
else
((uint32_t *)buffer32->line[ega->displine + y_add])[(((x * 9) + 32 + 8) & 2047) + x_add] = (dat & 1) ? fg : bg;
((uint32_t *)buffer32->line[dl])[(((x * 9) + 32 + 8) & 2047) + x_add] = (dat & 1) ? fg : bg;
}
}
ega->ma += 4;
@@ -418,17 +439,17 @@ void ega_poll(void *p)
ega->ma &= ega->vrammask;
dat = edatlookup[edat[0] & 3][edat[1] & 3] | (edatlookup[edat[2] & 3][edat[3] & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 14 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 15 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 12 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 13 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 14 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 15 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 12 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 13 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[(edat[0] >> 2) & 3][(edat[1] >> 2) & 3] | (edatlookup[(edat[2] >> 2) & 3][(edat[3] >> 2) & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 10 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 11 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 8 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 9 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 10 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 11 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 8 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 9 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[(edat[0] >> 4) & 3][(edat[1] >> 4) & 3] | (edatlookup[(edat[2] >> 4) & 3][(edat[3] >> 4) & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 6 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 7 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 4 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 5 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 6 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 7 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 4 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 5 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[edat[0] >> 6][edat[1] >> 6] | (edatlookup[edat[2] >> 6][edat[3] >> 6] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 2 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 3 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 1 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 2 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 3 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 4) + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 1 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
}
}
else
@@ -454,17 +475,17 @@ void ega_poll(void *p)
ega->ma &= ega->vrammask;
dat = edatlookup[edat[0] & 3][edat[1] & 3] | (edatlookup[edat[2] & 3][edat[3] & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 7 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 6 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 7 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 6 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[(edat[0] >> 2) & 3][(edat[1] >> 2) & 3] | (edatlookup[(edat[2] >> 2) & 3][(edat[3] >> 2) & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 5 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 4 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 5 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 4 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[(edat[0] >> 4) & 3][(edat[1] >> 4) & 3] | (edatlookup[(edat[2] >> 4) & 3][(edat[3] >> 4) & 3] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 3 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 2 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 3 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 2 + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
dat = edatlookup[edat[0] >> 6][edat[1] >> 6] | (edatlookup[edat[2] >> 6][edat[3] >> 6] << 2);
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + 1 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 3) + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + 1 + offset + x_add] = ega->pallook[ega->egapal[(dat & 0xf) & ega->attrregs[0x12]]];
((uint32_t *)buffer32->line[dl])[(x << 3) + offset + x_add] = ega->pallook[ega->egapal[(dat >> 4) & ega->attrregs[0x12]]];
}
}
break;
@@ -485,14 +506,14 @@ void ega_poll(void *p)
ega->ma += 4;
ega->ma &= ega->vrammask;
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 14 + offset + x_add]= ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 15 + offset + x_add] = ega->pallook[ega->egapal[edat[1] & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 12 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 13 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 2) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 10 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 11 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 4) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 8 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 9 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 6) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 6 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 7 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 0) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 4 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 5 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 2) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 2 + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 3 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 4) & 3]];
((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + offset + x_add] = ((uint32_t *)buffer32->line[ega->displine + y_add])[(x << 4) + 1 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 6) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 14 + offset + x_add]= ((uint32_t *)buffer32->line[dl])[(x << 4) + 15 + offset + x_add] = ega->pallook[ega->egapal[edat[1] & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 12 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 13 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 2) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 10 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 11 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 4) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 8 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 9 + offset + x_add] = ega->pallook[ega->egapal[(edat[1] >> 6) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 6 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 7 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 0) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 4 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 5 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 2) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + 2 + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 3 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 4) & 3]];
((uint32_t *)buffer32->line[dl])[(x << 4) + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 4) + 1 + offset + x_add] = ega->pallook[ega->egapal[(edat[0] >> 6) & 3]];
}
break;
}
@@ -570,7 +591,7 @@ void ega_poll(void *p)
y_add_ex = enable_overscan ? 28 : 0;
x_add_ex = enable_overscan ? 16 : 0;
if ((xsize > 2032) || (ysize > 2032))
if ((xsize > 2032) || ((ysize + y_add_ex) > 2048))
{
x_add = x_add_ex = 0;
y_add = y_add_ex = 0;
@@ -591,21 +612,31 @@ void ega_poll(void *p)
{
if ((x >= 160) && ((ega->lastline - ega->firstline) >= 120))
{
for (i = 0; i < y_add; i++)
/* Draw (overscan_size - scroll size) lines of overscan on top. */
for (i = 0; i < (y_add - (ega->crtc[8] & 0x1f)); i++)
{
q = &((uint32_t *)buffer32->line[i])[32];
r = &((uint32_t *)buffer32->line[ysize + y_add + i])[32];
q = &((uint32_t *)buffer32->line[i & 0x7ff])[32];
for (j = 0; j < (xsize + x_add_ex); j++)
{
q[j] = ega->pallook[ega->attrregs[0x11]];
r[j] = ega->pallook[ega->attrregs[0x11]];
}
}
for (i = y_add; i < (ysize + y_add); i ++)
/* Draw (overscan_size + scroll size) lines of overscan on the bottom. */
for (i = 0; i < (y_add + (ega->crtc[8] & 0x1f)); i++)
{
q = &((uint32_t *)buffer32->line[i])[32];
q = &((uint32_t *)buffer32->line[(ysize + y_add + i - (ega->crtc[8] & 0x1f)) & 0x7ff])[32];
for (j = 0; j < (xsize + x_add_ex); j++)
{
q[j] = ega->pallook[ega->attrregs[0x11]];
}
}
for (i = (y_add - (ega->crtc[8] & 0x1f)); i < (ysize + y_add - (ega->crtc[8] & 0x1f)); i ++)
{
q = &((uint32_t *)buffer32->line[(i - (ega->crtc[8] & 0x1f)) & 0x7ff])[32];
for (j = 0; j < x_add; j++)
{
@@ -615,6 +646,22 @@ void ega_poll(void *p)
}
}
}
else
{
if (ega->crtc[8] & 0x1f)
{
/* Draw (scroll size) lines of overscan on the bottom. */
for (i = 0; i < (ega->crtc[8] & 0x1f); i++)
{
q = &((uint32_t *)buffer32->line[(ysize + i - (ega->crtc[8] & 0x1f)) & 0x7ff])[32];
for (j = 0; j < xsize; j++)
{
q[j] = ega->pallook[ega->attrregs[0x11]];
}
}
}
}
video_blit_memtoscreen(32, 0, ega->firstline, ega->lastline + y_add_ex, xsize + x_add_ex, ega->lastline - ega->firstline + y_add_ex);
@@ -631,8 +678,7 @@ void ega_poll(void *p)
else
{
if (ega->crtc[9] & 0x80)
ega->video_res_y /= 2;
if (!(ega->crtc[0x17] & 1))
ega->video_res_y /= 2; if (!(ega->crtc[0x17] & 1))
ega->video_res_y *= 2;
ega->video_res_y /= (ega->crtc[9] & 31) + 1;
if (ega->seqregs[1] & 8)

View File

@@ -542,6 +542,7 @@ void svga_recalctimings(svga_t *svga)
{
if (svga->seqregs[1] & 8) /*40 column*/
{
#if 0
if (svga->hdisp == 120)
{
svga->render = svga_render_text_40_12;
@@ -549,12 +550,16 @@ void svga_recalctimings(svga_t *svga)
}
else
{
#endif
svga->render = svga_render_text_40;
svga->hdisp *= (svga->seqregs[1] & 1) ? 16 : 18;
#if 0
}
#endif
}
else
{
#if 0
if (svga->hdisp == 120)
{
svga->render = svga_render_text_80_12;
@@ -562,9 +567,12 @@ void svga_recalctimings(svga_t *svga)
}
else
{
#endif
svga->render = svga_render_text_80;
svga->hdisp *= (svga->seqregs[1] & 1) ? 8 : 9;
#if 0
}
#endif
}
svga->hdisp_old = svga->hdisp;
}
@@ -628,6 +636,16 @@ void svga_recalctimings(svga_t *svga)
svga->linedbl = svga->crtc[9] & 0x80;
svga->rowcount = svga->crtc[9] & 31;
overscan_y = (svga->rowcount + 1) << 1;
if (svga->seqregs[1] & 8) /*Low res (320)*/
{
overscan_y <<= 1;
}
if (overscan_y < 16)
{
overscan_y = 16;
}
/* pclog("SVGA row count: %i (scroll: %i)\n", svga->rowcount, svga->crtc[8] & 0x1f); */
if (svga->recalctimings_ex)
svga->recalctimings_ex(svga);
@@ -1210,12 +1228,14 @@ void svga_write(uint32_t addr, uint8_t val, void *p)
break;
}
#if 0
if (svga->render == svga_render_text_80_12)
{
FILE *f = fopen("hecon.dmp", "wb");
fwrite(svga->vram, 1, svga->vram_limit, f);
fclose(f);
}
#endif
}
uint8_t svga_read(uint32_t addr, void *p)
@@ -1555,9 +1575,9 @@ uint8_t svga_read_linear(uint32_t addr, void *p)
void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
{
int y_add = (enable_overscan) ? 32 : 0;
int y_add = (enable_overscan) ? overscan_y : 0;
int x_add = (enable_overscan) ? 16 : 0;
uint32_t *p, *q, i, j;
uint32_t *p, i, j;
svga->frames++;
@@ -1619,21 +1639,31 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
{
if ((wx >= 160) && ((wy + 1) >= 120))
{
for (i = 0; i < (y_add >> 1); i++)
/* Draw (overscan_size - scroll size) lines of overscan on top. */
for (i = 0; i < ((y_add >> 1) - (svga->crtc[8] & 0x1f)); i++)
{
p = &((uint32_t *)buffer32->line[i])[32];
q = &((uint32_t *)buffer32->line[ysize + (y_add >> 1) + i])[32];
p = &((uint32_t *)buffer32->line[i & 0x7ff])[32];
for (j = 0; j < (xsize + x_add); j++)
{
p[j] = svga_color_transform(svga->pallook[svga->attrregs[0x11]]);
q[j] = svga_color_transform(svga->pallook[svga->attrregs[0x11]]);
}
}
for (i = (y_add >> 1); i < (ysize + (y_add >> 1)); i ++)
/* Draw (overscan_size + scroll size) lines of overscan on the bottom. */
for (i = 0; i < ((y_add >> 1) + (svga->crtc[8] & 0x1f)); i++)
{
p = &((uint32_t *)buffer32->line[i])[32];
p = &((uint32_t *)buffer32->line[(ysize + (y_add >> 1) + i - (svga->crtc[8] & 0x1f)) & 0x7ff])[32];
for (j = 0; j < (xsize + x_add); j++)
{
p[j] = svga_color_transform(svga->pallook[svga->attrregs[0x11]]);
}
}
for (i = ((y_add >> 1) - (svga->crtc[8] & 0x1f)); i < (ysize + (y_add >> 1) - (svga->crtc[8] & 0x1f)); i ++)
{
p = &((uint32_t *)buffer32->line[i & 0x7ff])[32];
for (j = 0; j < 8; j++)
{
@@ -1643,6 +1673,22 @@ void svga_doblit(int y1, int y2, int wx, int wy, svga_t *svga)
}
}
}
else
{
if ((wx >= 160) && ((wy + 1) >= 120) && (svga->crtc[8] & 0x1f))
{
/* Draw (scroll size) lines of overscan on the bottom. */
for (i = 0; i < (svga->crtc[8] & 0x1f); i++)
{
p = &((uint32_t *)buffer32->line[(ysize + i - (svga->crtc[8] & 0x1f)) & 0x7ff])[32];
for (j = 0; j < xsize; j++)
{
p[j] = svga_color_transform(svga->pallook[svga->attrregs[0x11]]);
}
}
}
}
video_blit_memtoscreen(32, 0, y1, y2 + y_add, xsize + x_add, ysize + y_add);
}

View File

@@ -28,11 +28,25 @@ uint32_t svga_color_transform(uint32_t color)
return temp;
}
int svga_display_line(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
unsigned int dl = svga->displine;
if (svga->crtc[9] & 0x1f)
{
dl -= (svga->crtc[8] & 0x1f);
}
dl += y_add;
dl &= 0x7ff;
return dl;
}
void svga_render_blank(svga_t *svga)
{
int x, xx;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -43,16 +57,16 @@ void svga_render_blank(svga_t *svga)
switch (svga->seqregs[1] & 9)
{
case 0:
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 9; xx++) ((uint32_t *)buffer32->line[dl])[(x * 9) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 1:
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 8; xx++) ((uint32_t *)buffer32->line[dl])[(x * 8) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 8:
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 18; xx++) ((uint32_t *)buffer32->line[dl])[(x * 18) + xx + 32 + x_add] = svga_color_transform(0);
break;
case 9:
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[svga->displine + y_add])[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
for (xx = 0; xx < 16; xx++) ((uint32_t *)buffer32->line[dl])[(x * 16) + xx + 32 + x_add] = svga_color_transform(0);
break;
}
}
@@ -62,6 +76,7 @@ void svga_render_text_40(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -69,7 +84,7 @@ void svga_render_text_40(svga_t *svga)
if (svga->fullchange)
{
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[32 + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[32 + x_add];
int x, xx;
int drawcursor;
uint8_t chr, attr, dat;
@@ -124,10 +139,12 @@ void svga_render_text_40(svga_t *svga)
}
}
#if 0
void svga_render_text_40_12(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = (enable_overscan) ? 12 : 0;
int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -135,7 +152,7 @@ void svga_render_text_40_12(svga_t *svga)
if (svga->fullchange)
{
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[32 + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[32 + x_add];
int x, xx;
int drawcursor;
uint8_t chr, attr;
@@ -178,11 +195,13 @@ void svga_render_text_40_12(svga_t *svga)
}
}
}
#endif
void svga_render_text_80(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -190,7 +209,7 @@ void svga_render_text_80(svga_t *svga)
if (svga->fullchange)
{
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[32 + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[32 + x_add];
int x, xx;
int drawcursor;
uint8_t chr, attr, dat;
@@ -245,10 +264,12 @@ void svga_render_text_80(svga_t *svga)
}
}
#if 0
void svga_render_text_80_12(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = (enable_overscan) ? 12 : 0;
int dl = svga_display_line(svga);
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -256,7 +277,7 @@ void svga_render_text_80_12(svga_t *svga)
if (svga->fullchange)
{
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[32 + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[32 + x_add];
int x, xx;
int drawcursor;
uint8_t chr, attr;
@@ -300,12 +321,14 @@ void svga_render_text_80_12(svga_t *svga)
}
}
}
#endif
void svga_render_2bpp_lowres(svga_t *svga)
{
int changed_offset;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
changed_offset = (svga->ma << 1) >> 12;
@@ -316,7 +339,7 @@ void svga_render_2bpp_lowres(svga_t *svga)
{
int x;
int offset = ((8 - svga->scrollcache) << 1) + 16;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -358,6 +381,7 @@ void svga_render_2bpp_highres(svga_t *svga)
int changed_offset;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
changed_offset = ((svga->ma << 1) | 0x8000) >> 12;
@@ -368,7 +392,7 @@ void svga_render_2bpp_highres(svga_t *svga)
{
int x;
int offset = (8 - svga->scrollcache) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -409,12 +433,13 @@ void svga_render_4bpp_lowres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[(svga->ma >> 12) + 1] || svga->fullchange)
{
int x;
int offset = ((8 - svga->scrollcache) << 1) + 16;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -453,6 +478,7 @@ void svga_render_4bpp_highres(svga_t *svga)
int changed_offset2;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->sc & 1 && !(svga->crtc[0x17] & 1))
changed_offset = svga_mask_addr(svga->ma | 0x8000, svga) >> 12;
@@ -468,7 +494,7 @@ void svga_render_4bpp_highres(svga_t *svga)
{
int x;
int offset = (8 - svga->scrollcache) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -508,12 +534,13 @@ void svga_render_8bpp_lowres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - (svga->scrollcache & 6)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -539,12 +566,13 @@ void svga_render_8bpp_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -576,12 +604,13 @@ void svga_render_15bpp_lowres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - (svga->scrollcache & 6)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -608,12 +637,13 @@ void svga_render_15bpp_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -646,12 +676,13 @@ void svga_render_16bpp_lowres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - (svga->scrollcache & 6)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -678,12 +709,13 @@ void svga_render_16bpp_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -718,6 +750,7 @@ void svga_render_24bpp_lowres(svga_t *svga)
uint32_t fg;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
@@ -732,7 +765,7 @@ void svga_render_24bpp_lowres(svga_t *svga)
fg = svga->vram[svga->ma] | (svga->vram[svga_mask_addr(svga->ma + 1, svga)] << 8) | (svga->vram[svga_mask_addr(svga->ma + 2, svga)] << 16);
svga->ma += 3;
svga->ma = svga_mask_addr(svga->ma, svga);
((uint32_t *)buffer32->line[svga->displine + y_add])[(x << 1) + offset + x_add] = ((uint32_t *)buffer32->line[svga->displine + y_add])[(x << 1) + 1 + offset + x_add] = svga_color_transform(fg);
((uint32_t *)buffer32->line[dl])[(x << 1) + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 1) + 1 + offset + x_add] = svga_color_transform(fg);
}
}
}
@@ -741,12 +774,13 @@ void svga_render_24bpp_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -778,6 +812,7 @@ void svga_render_32bpp_lowres(svga_t *svga)
uint32_t fg;
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->fullchange)
{
@@ -792,7 +827,7 @@ void svga_render_32bpp_lowres(svga_t *svga)
fg = svga->vram[svga->ma] | (svga->vram[svga_mask_addr(svga->ma + 1, svga)] << 8) | (svga->vram[svga_mask_addr(svga->ma + 2, svga)] << 16);
svga->ma += 4;
svga->ma = svga_mask_addr(svga->ma, svga);
((uint32_t *)buffer32->line[svga->displine + y_add])[(x << 1) + offset + x_add] = ((uint32_t *)buffer32->line[svga->displine + y_add])[(x << 1) + 1 + offset + x_add] = svga_color_transform(fg);
((uint32_t *)buffer32->line[dl])[(x << 1) + offset + x_add] = ((uint32_t *)buffer32->line[dl])[(x << 1) + 1 + offset + x_add] = svga_color_transform(fg);
}
}
}
@@ -803,12 +838,13 @@ void svga_render_32bpp_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -828,12 +864,13 @@ void svga_render_ABGR8888_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;
@@ -853,12 +890,13 @@ void svga_render_RGBA8888_highres(svga_t *svga)
{
int y_add = (enable_overscan) ? 16 : 0;
int x_add = y_add >> 1;
int dl = svga_display_line(svga);
if (svga->changedvram[svga->ma >> 12] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 1, svga)] || svga->changedvram[svga_mask_changedaddr((svga->ma >> 12) + 2, svga)] || svga->fullchange)
{
int x;
int offset = (8 - ((svga->scrollcache & 6) >> 1)) + 24;
uint32_t *p = &((uint32_t *)buffer32->line[svga->displine + y_add])[offset + x_add];
uint32_t *p = &((uint32_t *)buffer32->line[dl])[offset + x_add];
if (svga->firstline_draw == 2000)
svga->firstline_draw = svga->displine;

View File

@@ -49,3 +49,5 @@ void update_status_bar_panes(HWND hwnds);
int fdd_type_to_icon(int type);
extern HWND hwndStatus;
void hard_disk_add_open(HWND hwnd, int is_existing);

View File

@@ -2219,6 +2219,8 @@ uint64_t selection = 127;
uint64_t spt, hpc, tracks, size;
wchar_t hd_file_name[512];
static hard_disk_t *hdc_ptr;
static int hdconf_initialize_hdt_combo(HWND hdlg)
{
HWND h;
@@ -2287,19 +2289,26 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
case WM_INITDIALOG:
memset(hd_file_name, 0, 512);
SetWindowText(hdlg, win_language_get_string_from_id(existing ? 2197 : 2196));
hdc_ptr = (existing & 2) ? hdc : temp_hdc;
if (existing & 2)
{
next_free_id = (existing & 0xf0) >> 4;
}
SetWindowText(hdlg, win_language_get_string_from_id((existing & 1) ? 2197 : 2196));
no_update = 1;
spt = existing ? 0 : 17;
spt = (existing & 1) ? 0 : 17;
set_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, spt);
hpc = existing ? 0 : 15;
hpc = (existing & 1) ? 0 : 15;
set_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, hpc);
tracks = existing ? 0 : 1023;
tracks = (existing & 1) ? 0 : 1023;
set_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, tracks);
size = (tracks * hpc * spt) << 9;
set_edit_box_contents(hdlg, IDC_EDIT_HD_SIZE, size >> 20);
hdconf_initialize_hdt_combo(hdlg);
if (existing)
if (existing & 1)
{
h = GetDlgItem(hdlg, IDC_EDIT_HD_SPT);
EnableWindow(h, FALSE);
@@ -2339,25 +2348,44 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
return TRUE;
}
get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &(temp_hdc[next_free_id].spt));
get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &(temp_hdc[next_free_id].hpc));
get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &(temp_hdc[next_free_id].tracks));
get_edit_box_contents(hdlg, IDC_EDIT_HD_SPT, &(hdc_ptr[next_free_id].spt));
get_edit_box_contents(hdlg, IDC_EDIT_HD_HPC, &(hdc_ptr[next_free_id].hpc));
get_edit_box_contents(hdlg, IDC_EDIT_HD_CYL, &(hdc_ptr[next_free_id].tracks));
spt = hdc_ptr[next_free_id].spt;
hpc = hdc_ptr[next_free_id].hpc;
tracks = hdc_ptr[next_free_id].tracks;
h = GetDlgItem(hdlg, IDC_COMBO_HD_BUS);
temp_hdc[next_free_id].bus = SendMessage(h, CB_GETCURSEL, 0, 0) + 1;
hdc_ptr[next_free_id].bus = SendMessage(h, CB_GETCURSEL, 0, 0) + 1;
h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL);
temp_hdc[next_free_id].mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
hdc_ptr[next_free_id].mfm_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_HD_ID);
temp_hdc[next_free_id].scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0);
hdc_ptr[next_free_id].scsi_id = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_HD_LUN);
temp_hdc[next_free_id].scsi_lun = SendMessage(h, CB_GETCURSEL, 0, 0);
hdc_ptr[next_free_id].scsi_lun = SendMessage(h, CB_GETCURSEL, 0, 0);
h = GetDlgItem(hdlg, IDC_COMBO_HD_CHANNEL_IDE);
temp_hdc[next_free_id].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
hdc_ptr[next_free_id].ide_channel = SendMessage(h, CB_GETCURSEL, 0, 0);
if (existing & 2)
{
#if 0
if (hdc[next_free_id].bus == 5)
{
memset(prev_hdd_fn[next_free_id], 0, 1024);
memcpy(prev_hdd_fn[next_free_id], hdd_fn[next_free_id], (wcslen(hdd_fn[next_free_id]) << 1) + 2);
}
#endif
memset(hdd_fn[next_free_id], 0, 1024);
memcpy(hdd_fn[next_free_id], hd_file_name, (wcslen(hd_file_name) << 1) + 2);
}
else
{
memset(temp_hdd_fn[next_free_id], 0, 1024);
memcpy(temp_hdd_fn[next_free_id], hd_file_name, (wcslen(hd_file_name) << 1) + 2);
}
sector_size = 512;
if (!existing && (wcslen(hd_file_name) > 0))
if (!(existing & 1) && (wcslen(hd_file_name) > 0))
{
f = _wfopen(hd_file_name, L"wb");
@@ -2414,6 +2442,14 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
msgbox_info(hwndParentDialog, 2059);
}
#if 0
if ((existing & 2) && (hdc[next_free_id].bus == 5))
{
scsi_hd_insert(id);
update_status_bar_icon_state(0x20 | next_free_id, 0);
}
#endif
hard_disk_added = 1;
EndDialog(hdlg, 0);
return TRUE;
@@ -2424,7 +2460,7 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
return TRUE;
case IDC_CFILE:
if (!file_dlg_w(hdlg, win_language_get_string_from_id(2172), L"", !existing))
if (!file_dlg_w(hdlg, win_language_get_string_from_id(2172), L"", !(existing & 1)))
{
if (!existing)
{
@@ -2439,13 +2475,13 @@ static BOOL CALLBACK win_settings_hard_disks_add_proc(HWND hdlg, UINT message, W
}
}
f = _wfopen(wopenfilestring, existing ? L"rb" : L"wb");
f = _wfopen(wopenfilestring, (existing & 1) ? L"rb" : L"wb");
if (f == NULL)
{
msgbox_error(hwndParentDialog, existing ? 2060 : 2057);
msgbox_error(hwndParentDialog, (existing & 1) ? 2060 : 2057);
return TRUE;
}
if (existing)
if (existing & 1)
{
if (image_is_hdi(wopenfilestring) || image_is_hdx(wopenfilestring, 1))
{
@@ -2672,7 +2708,7 @@ void hard_disk_add_open(HWND hwnd, int is_existing)
{
BOOL ret;
existing = !!is_existing;
existing = is_existing;
hard_disk_added = 0;
ret = DialogBox(hinstance, (LPCWSTR) CONFIGUREDLG_HARD_DISKS_ADD, hwnd, win_settings_hard_disks_add_proc);
}

View File

@@ -3100,7 +3100,7 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
break;
case GPCMD_START_STOP_UNIT:
switch(cdbufferb[4] & 3)
switch(cdb[4] & 3)
{
case 0: /* Stop the disc. */
if (cdrom_drives[id].handler->stop)

View File

@@ -220,6 +220,7 @@ int
network_devlist(netdev_t *list)
{
char errbuf[PCAP_ERRBUF_SIZE];
char *temp_dev;
pcap_if_t *devlist, *dev;
int i = 0;
@@ -228,6 +229,14 @@ network_devlist(netdev_t *list)
strcpy(list->description, "None");
list++; i++;
/* See if WinPcap is even present, and get out of here if it's not. */
temp_dev = (char *)pcap_lib_version();
if (temp_dev == NULL) {
/* Hmm, WinPcap doesn't seem to be alive.. */
pclog("PCAP: WinPcap library not found, not processing the networks list further!\n");
return(i);
}
/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&devlist, errbuf) == -1) {
pclog("NETWORK: error in pcap_findalldevs: %s\n", errbuf);

View File

@@ -906,16 +906,6 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
scsi_hd_command_complete(id);
break;
case GPCMD_PREVENT_REMOVAL:
if (hdc[id].bus != 5)
{
scsi_hd_illegal_opcode(id);
break;
}
scsi_hd_command_complete(id);
break;
case GPCMD_REZERO_UNIT:
shdc[id].sector_pos = shdc[id].sector_len = 0;
scsi_hd_seek(id, 0);
@@ -1072,7 +1062,7 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
break;
}
switch(cdbufferb[4] & 3)
switch(cdb[4] & 3)
{
case 0: /* Stop the disc. */
case 1: /* Start the disc and read the TOC. */