Skip to content

Commit

Permalink
Fix EGA port 3C2h readback of switches for machine=ega200 [#5036]
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Jun 6, 2024
1 parent 15f8e94 commit e507ae5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Next:
- Correct EGA switch readback from port 3C2h to reflect a value of 0x8
instead of 0x9 when machine=ega200 (joncampbell123).
- Correct BIOS data area value that holds the "EGA switches" to reflect
200-line EGA "emulation" when machine=ega200. Value 0x08 instead of 0x09.
200-line EGA "emulation" when machine=ega200. Value 0x08 instead of 0x09
(joncampbell123).
- Correct mode parameters for CGA 640x200 2-color mode when using
machine=ega200 so that it displays correctly. (joncampbell123)
Expand Down
13 changes: 5 additions & 8 deletions src/hardware/vga_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ static Bitu read_p3c8(Bitu port,Bitu iolen) {
return 0x10;
}

extern bool ega200;

static Bitu read_p3c2(Bitu port,Bitu iolen) {
(void)port;//UNUSED
(void)iolen;//UNUSED
Expand All @@ -168,14 +170,9 @@ static Bitu read_p3c2(Bitu port,Bitu iolen) {
else if (IS_VGA_ARCH) retval = 0x60;

if(IS_EGAVGA_ARCH) {
switch((vga.misc_output>>2)&3) {
case 0:
case 3:
retval |= 0x10; // 0110 switch positions
break;
default:
break;
}
uint8_t setting = ~((!IS_VGA_ARCH && ega200)?0x08:0x09)/*bits are inverted*/;
const uint8_t bit = (vga.misc_output>>2)&3;
if (setting & (1 << bit)) retval |= 0x10;
}

if (vga.draw.vret_triggered) retval |= 0x80;
Expand Down

0 comments on commit e507ae5

Please sign in to comment.