Issues with EGA emulation

Discussion of development and patch submission.
Post Reply
teppic
Posts: 53
Joined: Tue 20 Jun, 2017 12:31 pm

Issues with EGA emulation

Post by teppic »

When I run pcem 12 on my desktop (Haswell i7) I can use EGA. It takes a long time to start up but then presents colour tests and boots.

But on my laptop (Kaby Lake i7) it freezes, and just shows an empty grey window and uses 100% CPU until killed. The config is identical in both cases and the rom files are identical. This is on Windows 10 64bit. There doesn't seem to be an issue with any other graphics emulation.

The other difference is that on my laptop it is HiDPI (3200x1800) so it could be to do with the scaling -- though disabling scaling doesn't help.
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Issues with EGA emulation

Post by omarsis81 »

Are you using Intel's graphics on both? I suspect either is a dedicated GPU
If that the case: try changing the output: Direct3D or Direct Draw.
teppic
Posts: 53
Joined: Tue 20 Jun, 2017 12:31 pm

Re: Issues with EGA emulation

Post by teppic »

On the desktop (where it works) I have nvidia graphics. On the laptop where it freezes it is Intel integrated. I'll try switching them.

The thing is others work without issue - CGA, VGA are fine.
teppic
Posts: 53
Joined: Tue 20 Jun, 2017 12:31 pm

Re: Issues with EGA emulation

Post by teppic »

Ok, with Direct3D selected it will now boot on the IBM XT model, but on the IBM AT is still freezes forever. On other machines pcem just crashes.
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: Issues with EGA emulation

Post by ecksemmess »

This is actually a very old bug--I reported it years ago, before this forum even existed. PCem's EGA support has always been semi-functional and lag/crash prone for me, whether using DirectDraw or Direct3D. As you point out, this is entirely exclusive to EGA and has never affected CGA, VGA, or any other emulated video card. I haven't had time to really dig into it, but something is clearly badly broken, and it must be something quite simple, like an improper pointer somewhere. Whatever it is must be somewhere in vid_ega.c or vid_ega.h, and shouldn't be too hard to track down.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Issues with EGA emulation

Post by Battler »

It's not the emulation that's broken per se but the IBM EGA BIOS that does weird things to probe the card. I have tried implementing the Chips & Technology SuperEGA (with its own BIOS) on top of the same EGA emulation code, and it doesn't have the same problem.
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: Issues with EGA emulation

Post by ecksemmess »

That's interesting, but still suggests something like an improper pointer or improperly defined/allocated memory or I/O somewhere in vid_ega.c or vid_ega.h, I would think. The weird probing that the IBM EGA BIOS does is likely hitting some rarely used port or memory edge case or something that the SuperEGA BIOS doesn't, thus making the IBM BIOS a more effective torture test of the underlying EGA emulation.
Battler
Posts: 793
Joined: Sun 06 Jul, 2014 7:05 pm

Re: Issues with EGA emulation

Post by Battler »

- ecksemmess: That's most probably the case, yes. IBM's BIOS'es liked probing undocumented or rarely used parts of the hardware.
teppic
Posts: 53
Joined: Tue 20 Jun, 2017 12:31 pm

Re: Issues with EGA emulation

Post by teppic »

Yeah I had more problems on both PCs so realised it wasn't just the OS/host system.

Hopefully the issues can be sorted out, but I guess it's low priority since VGA replaced it.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Issues with EGA emulation

Post by SarahWalker »

I think rev 801 should fix this.
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

Re: Issues with EGA emulation

Post by basic2004 »

I modified EGA monochrome palettes like this URL, palettes bring from HGC/MDA/CGA monochrome monitor type.
https://pcem-emulator.co.uk/phpBB3/view ... =723#p5478

before
egamono-before.png
egamono-before.png (27.79 KiB) Viewed 8642 times
after
egamono-after.png
egamono-after.png (28.1 KiB) Viewed 8642 times
Here is a patch.
vid_ega.c.patch
(3.67 KiB) Downloaded 376 times
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Issues with EGA emulation

Post by SarahWalker »

Committed at rev 807.
Post Reply