In 1984, Joel Gould of IBM Cambridge (that is Cambridge, Massachusetts rather than Cambridge, UK) Scientific Center wrote a demo program named FantasyLand. This demo was meant to show off the capabilities of IBM’s brand new Enhanced Graphics Adapter, or EGA.
The demo was strictly a demo and was never sold. A few years ago, the demo resurfaced and perhaps the best way to experience it is PCjs, because PCjs faithfully emulates an EGA card. That last bit is important.
I’ve attempted to run the FantasyLand demo on a number of VGA cards and in the end concluded that it cannot run properly. Even though the VGA is in general highly backwards compatible with the EGA, the FantasyLand demo exposes a couple of minor points where that’s not the case.
The first problem with the FantasyLand demo is actually something that affects EGA systems as well. The FantasyLand demo assumes that the system is using 200-line text modes with 8×8 pixel character box. That is no doubt an accident of history—FantasyLand was written in 1984, before the 350-line capable EGA monitors became available. To use color with an EGA, the only option was a 200-line CGA monitor at the time when FantasyLand was written.
On EGA systems equipped with an Enhanced (i.e. EGA) monitor, it is necessary to flip the switches on the back of the EGA card to the “compatible” setting.
On VGA systems it’s actually easier: The video BIOS function INT 10h/12h with BL=30h can be called to request text modes with 200 lines. The next mode set will establish a CGA compatible text mode with 8×8 characters.
That is enough to get FantasyLand looking mostly right on a VGA system. But only mostly.
The FantasyLand demo makes heavy use of split screen, a new feature IBM introduced with the EGA. But when run on a VGA… there is no split screen at all. The reason for that is interesting.
On the EGA, the line compare field which controls split screen is a 9-bit value. The low 8 bits (i.e. bits 7:0) are in CRTC register CR18 and bit 8 is stored in bit 4 of CR7, the overflow register. That allows the line compare field to represent values in the 0 to 511 range (a necessity since some EGA modes use 350 scan lines).
On the VGA, IBM extended the line compare field; bit 9 is stored in bit 6 of register CR9, which primarily controls the character cell height. Thus the line compare field on the VGA can represent values in the 0 to 1,023 range. Yet software written for the EGA knows nothing about the additional bit.
When the VGA BIOS sets a text mode, the line compare field is set to 1,023 (the maximum value). That is a problem for EGA software, because it will never clear the high bit it doesn’t know about. Even if software written for the EGA tries to set the line compare field to zero, it will in reality still be 512, and no split screen will be in effect.
It’s possible to work around this issue by modifying the mode parameters. All it takes is creating a copy of the mode parameter table plus the video save pointer table, and modifying the BDA to reference the customized pointer table. The parameter table for mode 3 needs just one bit changed; the new-on-VGA bit 6 of register CR9 has to be zeroed so that EGA software can effectively manipulate the line compare field.
And with that change… FantasyLand still does not look right.
As it turns out, FantasyLand exposes a subtle hardware incompatibility between EGA and VGA related to split screens.
The line compare field determines the scan line after which the image will be displayed from the start of video memory. That sounds simple enough… except it’s not in those 200-line CGA compatible modes. The thing is that an EGA card attached to either CGA or EGA monitor actually displays 200 scan lines. But the VGA does not; it instead displays 400 scan lines and sets bit 7 of register CR9 to “double scan”, i.e. display each scan line twice.
When FantasyLand initially sets the line compare field to 199, there will be no split screen on an EGA, since 199 is the last displayed scan line. But on a VGA, the screen will be split right in the middle when it shouldn’t be, because the image is in reality composed of 400 scan lines!
In theory, the double scan bit could have influenced the line compare functionality on the VGA. But all the VGA cards I’ve tried agree that it does not.
Do Not Interrupt
There is yet another problem with many VGA cards. FantasyLand uses vertical retrace interrupts to achieve smooth animation, with the split screen nicely sliding up and down. On many VGA cards, vertical retrace interrupts do not work.
I’m not sure of the exact history there. What I know is that for example my Cirrus Logic CL-GD5442 based ISA card could support vertical retrace interrupts, since the Cirrus Logic chip implements them. But the card does not even have the corresponding pin on the ISA slot populated.
Some ISA VGA cards have a jumper that can be used to enable interrupts. This is often disabled by default.
On PCI based VGA cards, it’s extremely unlikely that interrupts would be routed to IRQ9/IRQ2, even if the card did generate interrupts (enough of them do).
The reality is that many if not most VGA cards do not support interrupts—either not at all or not in a manner compatible with IBM EGA/VGA.
I did find one card in my junk pile that can display FantasyLand very well: An ATI Graphics Vantage, an ISA VGA card with a Mach8 accelerator.
In the default VGA mode, the Graphics Vantage has the same problem as other VGA cards—the screen is split in the middle when it shouldn’t be. But the card can be switched to an EGA emulation mode, and then FantasyLand works properly, with interrupts (and hence smooth animation) and all.
My experience is that EGA emulation modes are rare on VGA cards and only found on older models if at all.
At any rate… FantasyLand is a very interesting piece of software, obscure enough that even though it was written at IBM, it’s too much even for IBM’s own VGA and exposes minor incompatibilities with the EGA.