PCEm V14 great implementations and future capability suggestions

Support and general discussion.
Post Reply
dodleh
Posts: 6
Joined: Sat 02 Mar, 2019 2:15 pm

PCEm V14 great implementations and future capability suggestions

Post by dodleh » Sun 03 Mar, 2019 9:48 am

I have been using PCEM for quite a while and I would like to share some of its strengths and point at some further capability that could be introduced.

First of all, out of the many emulators available for the X86 Architecture, I consider PCEM to strike a very good balance between speed and compatibility. It is versatile, although I have tested only the 386/486/Pentium emulation with most concern being on the 486/Pentium. The videocard support is impressive and covers most of the popular cards of the era. The machine configuration is simple and logically organised.

In use, I noticed a large progress in accuracy and predictibility between version 12 and 14. I consider the MS-DOS support to be among the best with Windows 3.x a close second. In MS-DOS the best feature is the accurate font rendering with low keyboard input to video output. Soundcard emulation seems good although I haven't focused much on its accuracy. I was mostly concerned with the video output. Windows 3.x features seem very good. PCEM supports relatively complex feature sets as the ones required for IDE interfacing, making it possible to run native 32 bit disk access support which is a real achivement. Video handling seems good as well, with a much higher accuracy in any video mode (color accuracy and scaling capability) than Dosbox. CPU cycle consistent performance is especially impressive.

Although there are much more things to be said I would like to ask you about some details regarding potential implementations and current issues. First of all I would like to discuss with you what you think may be the cause for the following problems.

Issues:
1. Keyboard repeat rate does not seem to be handled properly (keyboard input may also have some lag but I can not reliably determine it). In comparison with any real (Pentium 1 era, Pentium III era) or emulated system (Virtualbox, Dosbox, VMWARE) set for a repeat rate of 31 in BIOS or through the mode dos command, PCEM v14 is very slow. In my opinion it seems half as slow or even a third slower than a real machine running DOS and using a typical text editor such as Edit in real mode DOS.

2. Windows 3.1/ 3.11 (also wfw) is quite a finicky system. In general, I would say that 98% of what you expect is already there. In testing with a Trio 64 card on a AMI 486 emulated system or a 430VX one, with or without SB16 drivers and WING or WIN32S installations, with no influence on processor or Dynamic recompilation, I noticed that the video emulation seems a bit inconsistent, probably due to a timing or caching issue. It is less visible in WinG demos but in standard GDI operations, a specific behavior is obvious.

For instance, run a Flying Windows screensaver in Win 3.1 in ehnanced mode or WFW 3.11 and notice how the animation is stable for a couple of seconds and then changes speed, having another stable interval again. Everything happens with a cycle length of around 5-8 seconds. In demanding graphics apps it seems that the effect is not easily reproduced since they may use custom drawing functions. A real machine does not seem to exhibit this behaviour. On an idling system, the CPU Speed history remains consistent but seems to have odd behavior when animations are on. A slight giveaway is also in Texas Instruments WinTach benchmark where the Paint test shows that some colored objects are drawn but they seem to be displayed in a choppy way while on real systems it is drawn at constant speed, slow or fast depending on system capability. Moving to a slower 486 DX 50 emulated CPU (which shows a 50%-60% max CPU usage on a Core 2 Duo 2,53 GHz CPU), shows no improvement. A Fast VLB setting with a 2MB Trio 64 Phoenix BIOS platform was configured although slower videocard settings such as fast 16 bit show similar results.

3. A slight mouse movement slowdown is noticeable in 640x480 or higher resolutions, running in DOS or Windows 3.x. Although no emulation can be perfect due to limitations in timing accuracy, PCEM seems to be consistently slower in reacting to mouse movements than other emulator. It does not matter how fast or slow the emulated PC is. Even on a 486 at 25MHz it still happens.

4. There seems to be a video compatibility issue in Warcraft 2 (Beyond the Dark Portal or Tides of Darkness). Although some video is output, there is no way to use the S3 Trio 64 emulated one properly, despite multiple uvconfig attempts, such as deactivating the linear frame buffer. It seems that video pages are not handled correctly. As it shows right now, the image is incomplete and split in 4 frames, crowded in the upper part of the screen with the rest of it being black.


--------------------------
Update on 14.03.2019

1. It is certain that there is an implementation issue as the fork of PCEM, 86BOX does not have this behavior and is fast enough. On the other side, 86BOX has other timing issues and, overall, the PCEM implementation is much more accurate. However, PCEM consistently responds slower to mouse and keyboard (lag and input rate).
2. This behaviour seems to be caused by a Windows 3.x multimedia timer issue and is not specific to the emulator. It does not matter if the soundcard is active or not at that specific moment (on playback or recording). If no soundcard is enabled on the emulated machine, the framerate remains largely stable (it is not perfect on a real machine either).
Last edited by dodleh on Thu 14 Mar, 2019 10:05 am, edited 2 times in total.

User avatar
leilei
Posts: 655
Joined: Fri 25 Apr, 2014 4:47 pm

Re: PCEm V14 great implementations and future capability suggestions

Post by leilei » Tue 05 Mar, 2019 1:54 am

Warcraft 2 works if you delete UNIVBE.DRV.

dodleh
Posts: 6
Joined: Sat 02 Mar, 2019 2:15 pm

Re: PCEm V14 great implementations and future capability suggestions

Post by dodleh » Thu 07 Mar, 2019 12:18 am

Thank you for your suggestion. I have noticed one other aspect that might explain the slight issue with the mouse movement.

The mouse in PCEM is implemented on the serial port. I assume this was due to compatibility but it poses certain issues with timing and also it may lag. As far as I remember the serial port communication on a real machine (from the mid 90s) was more CPU cycle consuming and with a rather slow polling rate even on good UART chips, compared with PS/2 (tested with a bi-standard mouse). The problem in PCEM may be due to this.

The keyboard lag and slow repeat rate, remain a mystery, since it relies, theoretically, on the AT standard that should offer satisfactory performance (and it did, as far as I remember even at the beginning of the 90s, no keyboard - PC combination ever resulted in very slow response in real-mode DOS applications).

dodleh
Posts: 6
Joined: Sat 02 Mar, 2019 2:15 pm

Re: PCEm V14 great implementations and future capability suggestions

Post by dodleh » Sat 09 Mar, 2019 7:37 pm

Regarding feature suggestions: besides the obvious improvements that may appear someday, such as state saving and recovery, I would like to propose the following:
--------------------------------------------------------
Bicubic filtering for the renderer (video output)
--------------------------------------------------------
It seems that this would offer the best compromise between quality and speed. Most videocards support bicubic filtering in hardware for more than 10 years, even Intel (PowerVR derived actually) IGP based ones, and the results are great looking compared to the murky, classic bilinear filter.

dodleh
Posts: 6
Joined: Sat 02 Mar, 2019 2:15 pm

Re: PCEm V14 great implementations and future capability suggestions

Post by dodleh » Sat 27 Apr, 2019 11:10 am

I made some previous mistakes and I thought it appropriate to make the corrections:

PCEM does have PS/2 mouse emulation although it is not sensibly better than a Serial Port mouse emulation in practical terms. For unknown reasons the lag is not much improved and the response time is clearly below the performance of a typical machine of the era (Intel 430VX with Pentium 100Mhz processor). On the previously tested system (AMI BIOS 486 PC), it was not obvious if PS/2 was available or not (some systems could have theoretically added such a feature late in manufacturing although first systems did not have it and PCEM is not specific to a certain model of PC that can be referenced, hence the mistake).

Post Reply