VOGONS


x86 software vs hardware clocks

Topic actions

Reply 20 of 26, by superfury

User metadata
Rank l33t++
Rank
l33t++

So, the ET3000 has the following clocks(converted from Dosbox-X VGA_tseng.cpp):
0:CLK_25=>25750kHz(UniPCemu: VGA standard clocks=25175kHz)
1:CLK_28=>28322kHz(UniPCemu: VGA standard clocks=28321kHz)
2:32400=>32514kHz?
3:35900=>36000kHz?
4:39900=>44900kHz?
5:44700=>44900kHz?
6:31400=>32514kHz?
7:37500=>44900kHz?

All UniPCemu's other ET3000/ET4000 clocks(everything but the VGA 25/28MHz clocks) match the ones at Dosbox-X.

Are those actual mappings correct? And what about the ET4000?

UniPCemu's VGA standard clocks are now:

//25MHz: VGA standard clock
//#define VGA25MHZ (25.2 / 1.001)*1000000.0
#define VGA25MHZ 25175000.0
//28MHz: VGA standard clock
//#define VGA28MHZ (28.35 / 1.001)*1000000.0
#define VGA28MHZ 28321000.0

The EGA(clock #1(0-based)/MDA clocks are their rounded values(16.257MHz). The EGA(clock #0)/CGA 14MHz clocks uses the cycle-accurate 14MHz BUS clock(which also times most hardware based on that clock directly).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 21 of 26, by elianda

User metadata
Rank l33t
Rank
l33t
superfury wrote:

Are those actual mappings correct? And what about the ET4000?

See numbers
http://retronn.de/imports/hwgal/hw_graphics_c … g_et4000ax.html

Retronn.de - Vintage Hardware Gallery, Drivers, Guides, Videos. Now with file search
Youtube Channel
FTP Server - Driver Archive and more
DVI2PCIe alignment and 2D image quality measurement tool

Reply 22 of 26, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie
superfury wrote:
UniPCemu's VGA standard clocks are now: […]
Show full quote

UniPCemu's VGA standard clocks are now:

#define VGA28MHZ 28321000.0

Why? Didn't we just went through a long discussion that the original and most widely used value is 28.322?
IBM VGA array was originally integrated on the motherboard of PS/2 models, so they were the first implementations, not VGA cards.
https://en.wikipedia.org/wiki/Video_Graphics_ … 941_on_PS55.jpg

superfury wrote:

The EGA(clock #1(0-based)/MDA clocks are their rounded values(16.257MHz). The EGA(clock #0)/CGA 14MHz clocks uses the cycle-accurate 14MHz BUS clock(which also times most hardware based on that clock directly).

The 16.257 is not rounded, it's exactly 16.257.
https://upload.wikimedia.org/wikipedia/common … ter_Adapter.jpg
https://upload.wikimedia.org/wikipedia/common … BM_EGA_card.jpg

Now, Hercules is another story. I think there are Hercules cards that have either 16.257 or 16.000 MHz clocks. I think Scali wrote a post on this some time ago.

Reply 23 of 26, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just adjusted the VGA to use 28.322 and 25.175Mhz. The rest is unchanged(ET3/4K still Dosbox-X clocks).

Anyone figured out the exact 8/16 clocks of those? Are the Dosbox-X clocks already accurate? Or do they need adjusting to be using the clocks in the photo's?

I see 6 onboard clocks, but 16 documented? Anyone?

(S)VGA is odd: 640x480@60Hz is actually 59.94Hz?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 24 of 26, by Jepael

User metadata
Rank Oldbie
Rank
Oldbie
superfury wrote:

Anyone figured out the exact 8/16 clocks of those? Are the Dosbox-X clocks already accurate? Or do they need adjusting to be using the clocks in the photo's?

Clocks for 8MHz and 16MHz formats in ET3000 and ET4000?
That depends wildly, but let's assume ideal case first.
According to pictures and datasheets, there would be a nominal 32.514 MHz oscillator that internally can be divided by two to get 16.257 MHz for EGA formats.
There is also mentions of using 28.322MHz divided by two to get CGA formats - most likely 14.161 MHz is close enough for CGA, and the line width may be fine tuned if necessary.

superfury wrote:

I see 6 onboard clocks, but 16 documented? Anyone?

In most ET3000 pictures, there really are separate oscillators for each frequency, so that's easy, just look at the pictures. However, the BIOS must know which oscillators are present and which frequencies they have to select correct oscillator for each mode, so which frequencies to emulate depends only on which video BIOS you are targeting.

In most ET4000 pictures, there are many different PLL chips used, so the actual frequency is whatever the PLL can do, so if you want to know the exact frequencies of a specific card you have in mind, you must look at what PLL chip it has and then read the PLL chip datasheet, and possibly also how the video BIOS sets up the PLL chip parameters. Although, many PLL chips had preprogrammed frequencies and ET4000 chip has three (four?) clock select wires, so it's possible that only the presets in the PLL are ever used.
As I explained in one of my previous posts, on a PLL-clocked ET4000 card, the clocks will not be exactly 25.175 and 28.322 for example, and can be far off.

So, There is no single answer to what frequencies are used and what are their exact values. Therefore, any approximation should be OK, or then just stick to emulating a single known card/bios combination.

superfury wrote:

(S)VGA is odd: 640x480@60Hz is actually 59.94Hz?

It really is and should not be a surprise as it is a standardized format. 25175000/(800*525) is indeed very close to 59.94Hz, but not exact.
Most of the other video resolutions of interest can be found in standards as well.

Reply 25 of 26, by superfury

User metadata
Rank l33t++
Rank
l33t++

Those clocks are already modified.

I've improved IPS clocking to loop pending BIU cycles when in that mode(exception is when it's not spending cycles due to hardware waitstates(resulting in an infinite loop otherwise, hanging the app)). This causes the emulator, when in IPS cycle mode, to run at much higher speeds, with a 50% speed increase(that's quite a lot).
So, instead of the BIU ticking 15 actual cycles and then notify the hardware whether to tick or not(CPU.executed instead of CPU.cycles in cycle units), causing all empty 0 cycle hardware to be reduced to 0 cycle ticks for each instruction phase only(instead of every phase 2 or more times, which isn't required during IPS cycle exe execution(since the CPU cycle output is zeroed by multiplication anyways during all but the final instruction cycle(since it uses the finished flag instead of the 1 cycle constant execution anyways, which is 0 most if each instruction(3 zeroes followed by one 1 for a 4-cycle NOP, so all phases(read(s),writeback(s) times plus the final execution phase giving the terminating 1 now being reduced to 1 check each read/writeback phase instead of e.g. x2 checks on a 286 or x4 on a 8088, since all phases and delays are reduced to one hardware update instead only(like Doxbox after each instruction(any read/write/delay phase in UniPCemu being reduced to 1 hardware check now)).
The i7 is now running the 8086 at 75% speed in IPS mode(50% in cycle-accurate mode). On Android it's 25% and 15% instead.

So it looks like the BIU is very heavy on the real CPU, even though Visual Studio profiling reports memory accesses themselves instead?

Last edited by superfury on 2017-12-12, 20:01. Edited 1 time in total.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 26 of 26, by Scali

User metadata
Rank l33t
Rank
l33t
Jepael wrote:

IBM VGA array was originally integrated on the motherboard of PS/2 models, so they were the first implementations, not VGA cards.

IBM also made a VGA ISA card, or as they call it, the "PS/2 feature adapter":
20150315_121234.jpg
Also 28.322 MHz crystal as you can see.

Jepael wrote:

Now, Hercules is another story. I think there are Hercules cards that have either 16.257 or 16.000 MHz clocks. I think Scali wrote a post on this some time ago.

Yes, I have a real Hercules GB102 card, which has a 16.000 MHz crystal.
I believe all real Hercules cards do.
Various Hercules clones however use 16.257 MHz.

http://scalibq.wordpress.com/just-keeping-it- … ro-programming/