EGA: Correct register (non-)readability on the Compaq EGA and light pen registers.

This commit is contained in:
OBattler
2024-01-24 20:45:44 +01:00
parent 95bb3ae333
commit ac78275cb8
2 changed files with 22 additions and 13 deletions

View File

@@ -56,6 +56,8 @@ typedef struct ega_t {
uint8_t *vram;
uint16_t light_pen;
int vidclock;
int fast;
int extvram;

View File

@@ -295,22 +295,22 @@ ega_in(uint16_t addr, void *priv)
break;
case 0x3c0:
if (ega_type)
if (ega_type == 1)
ret = ega->attraddr | ega->attr_palette_enable;
break;
case 0x3c1:
if (ega_type)
if (ega_type == 1)
ret = ega->attrregs[ega->attraddr];
break;
case 0x3c2:
ret = (egaswitches & (8 >> egaswitchread)) ? 0x10 : 0x00;
break;
case 0x3c4:
if (ega_type)
if (ega_type == 1)
ret = ega->seqaddr;
break;
case 0x3c5:
if (ega_type)
if (ega_type == 1)
ret = ega->seqregs[ega->seqaddr & 0xf];
break;
case 0x3c6:
@@ -318,24 +318,24 @@ ega_in(uint16_t addr, void *priv)
ret = ega->ctl_mode;
break;
case 0x3c8:
if (ega_type)
if (ega_type == 1)
ret = 2;
break;
case 0x3cc:
if (ega_type)
if (ega_type == 1)
ret = ega->miscout;
break;
case 0x3ce:
if (ega_type)
if (ega_type == 1)
ret = ega->gdcaddr;
break;
case 0x3cf:
if (ega_type)
if (ega_type == 1)
ret = ega->gdcreg[ega->gdcaddr & 0xf];
break;
case 0x3d0:
case 0x3d4:
if (ega_type)
if (ega_type == 1)
ret = ega->crtcreg;
break;
case 0x3d1:
@@ -349,14 +349,21 @@ ega_in(uint16_t addr, void *priv)
break;
case 0x10:
case 0x11:
/* TODO: Return light pen address once implemented. */
if (ega_type)
if (ega_type == 1)
ret = ega->crtc[ega->crtcreg];
else
ret = ega->light_pen >> 8;
break;
case 0x11:
if (ega_type == 1)
ret = ega->crtc[ega->crtcreg];
else
ret = ega->light_pen & 0xff;
break;
default:
if (ega_type)
if (ega_type == 1)
ret = ega->crtc[ega->crtcreg];
break;
}