• Please review our updated Terms and Rules here

EGA video corruption?

Hi,

I looked at unpacked keen4 and code looks similar to keen dreams. But I totally cannot understand what it's trying to do pre-crtc start. I've attached a dosbox tracelog of the area.

Could someone explain it to me better? Thanks
 

Attachments

  • keen4.txt
    14.5 KB · Views: 1
Ok, they are using a three-way timing sensitive routine to determine the vertical blanking start. Using multiple I/O reads to determine if the display still generates visible scanlines.
a) depending a bit on CPU speed
b) depending on bus speed -> PCI card
c) depending on the horizontal frequency of the display (VGA and EGA differ by factor 2 here)

So it's not really related to differences in the register latching in the EGA/VGA.

There would be a lot of room to use an own routine. My suggestion, if Keen doesn't reprogram it, to use the system timer 0 to wait and check for a defined timespan. EGA scanline is 64µs, VGA 31µs. I guess we should watch for like 20µs...
 

Attachments

  • keen4_commented.txt
    15.2 KB · Views: 1
Basically the latching is in the way of all kinds of cool effects. But with the trick that reenigne developed for 8088 MPH, we may be able to get around it. He figured out that you can create frames of 2 scanlines high, with no vblank at all, so you can 'stack' them... 100 of these frames construct an image of 200 scanlines high. This allows you to set a new display start every 2 scanlines.
On EGA/VGA it should even be possible at every scanline, because the 2-scanline thing is a 6845 limitation with the even and odd bitplanes (it only supports 127 rows, because it was never meant for graphics, only text).

That one "letterboxed" picture of the demo's developers that is in 8088 MPH and that's only half as high as the screen, did that use this and 1-scanline increments?
 
Commander Keen 4, 5 & 6 show the same kind of stuttering in their intros with an EGA card and if the game is run on a system outside a narrow speed range. I bet you won't see that stuttering if you run the game with a VGA card in the same system.

That holy grail of smooth-scrolling in 1 frame... so easy on most 80s systems, yet so difficult on early PCs :)

Which is why even though Commander Keen didn't do everything perfect throughout, as shown by this thread, its initial release (Vorticons) was still enough of a quantum leap at the time to launch a multi-million dollar company.

But GH is probably right insofar as that by the time Keen 4 was out most people probably had VGA clones.
 
I figured that EGA was very rare as a stock-option in clone PCs (it seems that quite a few of them used an ATi Graphics Solution/Small Wonder), so most EGA cards out there would have been original IBM cards in original IBM PCs.
There was only a small window of opportunity for upgrading a CGA/MDA/Hercules machine to EGA, because VGA arrived on the scene only shortly after third-party EGA cards did, so in my experience, EGA aftermarket was never big.
Then again, as I say, it could be a geographical thing. In my part of the world, PC gaming didn't take off until the early 90s anyway (386SX-16 with Trident VGA seemed to be an early 'standard', around the time that Wolfenstein 3D became popular). So there weren't many people who had a PC at home, let alone that they were interested in upgrading the graphics capabilities.

You are correct, for several reasons.

One, the IBM PC was released in 1981, but that was in the States, and by the time they had sorted everything out with a supply chain to Europe and different power supplies, etc, 1983 had rolled around, so the PC market in Europe only really started two years late. The EGA card came out the next year, too soon for Europeans to upgrade their only-just-purchased MDA/Hercules/CGA PCs and clones.

Two, IBM-compatibles at the time were a lot more expensive in Europe than in the US. Actually, they were also not exactly cheap in the US, but the bigger country had a bigger market of people who could afford them, and then economies of scale started to kick in.
In Europe, a lot of personal computing was still done in the realm of more affordable home computers, which is why your C64/Speccy/Amstrad/Atari ST/Amiga type of machines had much more of a run there. So the PC market also moved slower.

Even as late as the very early nineties, a full decade after the initial introduction of the IBM PC in the Land of the Free, you could still walk into a high street computer shop in Europe and purchase a new XT clone. That's at a time when the first 486 machines were hitting the market at the opposite end of the price list.

VGA came out in 1987, just as some of Europe's early (i.e. 1983+) adopters of IBM-compatible PCs were getting ready to upgrade.

Once again, you are correct. While EGA software support was not rare, EGA hardware was significantly rarer than CGA/Hercules or VGA. Just try and find an IBM 5153 CGA display. You'll probably find one if you're persistent. Look for a VGA monitor. No problemo. Now try and search for an IBM 5154 EGA monitor. See what I mean? Exactly. So you are entirely correct, certainly for Europe, but probably, to a lesser extent, also for the United States.

A final note on EGA software support: Note that Commander Keen was released long after the advent of VGA hardware, but it officially only required EGA. Many developers made the same choice, because apart from any technical reasons, targeting EGA was "good enough" and gave them support for two hardware generations for the price of one. Yay backwards compatibility.
 
That one "letterboxed" picture of the demo's developers that is in 8088 MPH and that's only half as high as the screen, did that use this and 1-scanline increments?

IIRC that one didn't require 'stacking' the frames - just a single frame for the entire image, with 100 rows of 1 scanline each.
"Stacked" frames of 2 scanlines each were mostly used for the static 1024-color screens, since that helped us repeat the same scanline of the same character rows in two consecutive sub-frames, and thereby allowed another set of 512 "solid" colors.

A final note on EGA software support: Note that Commander Keen was released long after the advent of VGA hardware, but it officially only required EGA. Many developers made the same choice, because apart from any technical reasons, targeting EGA was "good enough" and gave them support for two hardware generations for the price of one. Yay backwards compatibility.

Except that, for the purposes of smooth scrolling, VGA really wasn't backwards compatible with EGA - for one, there's the native 70Hz refresh rate compared to EGA's 60, and the number of actual scanlines is doubled as well. So any code that's timed to the vertical and/or horizontal refresh is going to be wonky.
I think Keen only relied on the former, but there's been some evidence to the effect that it was developed/tested on VGA hardware rather than EGA (maybe even in this thread? haven't looked back much.)
 
Back
Top