https://www.os2museum.com/wp/fantasyland-on-vga/ OS/2 Museum OS/2, vintage PC computing, and random musings [os2floppy] Skip to content * Home * About + Wanted List * OS/2 History + OS/2 Beginnings + OS/2 1.0 + OS/2 1.1 + OS/2 1.2 and 1.3 + OS/2 16-bit Server + OS/2 2.0 + OS/2 2.1 and 2.11 + OS/2 Warp + OS/2 Warp, PowerPC Edition + OS/2 Warp 4 + OS/2 Timeline + OS/2 Library o OS/2 1.x SDK o OS/2 1.x Programming o OS/2 2.0 Technical Library + OS/2 Videos, 1987 * DOS History + DOS Beginnings + DOS 1.0 and 1.1 + DOS 2.0 and 2.1 + DOS 3.0, 3.1, and 3.2 + DOS 3.3 + DOS 4.0 + DOS Library * NetWare History + NetWare Timeline + NetWare Library * Windows History + Windows Library * PC UNIX History + Solaris 2.1 for x86 - Reconstructing the EGA BIOS FantasyLand on VGA Posted on April 3, 2022 by Michal Necasek 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. [fland-ati-1-640x356]The FantasyLand EGA demo 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. Font Size 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 8x8 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 8x8 characters. That is enough to get FantasyLand looking mostly right on a VGA system. But only mostly. Split Screen 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. Irreconcilable Differences 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! [fland-ati-vga-640x356]ATI Graphics Vantage in VGA mode 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. Compatibility Fun 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. [fland-ati-ega-640x356]ATI Graphics Vantage in EGA emulation mode 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. This entry was posted in IBM, PC hardware, PC history, VGA. Bookmark the permalink. - Reconstructing the EGA BIOS Leave a Reply Your email address will not be published. Required fields are marked * [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment * [ ] Name * [ ] Email * [ ] Website [ ] [Post Comment] [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] This site uses Akismet to reduce spam. Learn how your comment data is processed. * Archives + April 2022 + March 2022 + February 2022 + January 2022 + December 2021 + November 2021 + October 2021 + September 2021 + August 2021 + July 2021 + June 2021 + May 2021 + April 2021 + March 2021 + February 2021 + January 2021 + December 2020 + November 2020 + October 2020 + September 2020 + August 2020 + July 2020 + June 2020 + May 2020 + April 2020 + March 2020 + February 2020 + January 2020 + December 2019 + November 2019 + October 2019 + September 2019 + August 2019 + July 2019 + June 2019 + May 2019 + April 2019 + March 2019 + February 2019 + January 2019 + December 2018 + November 2018 + October 2018 + August 2018 + July 2018 + June 2018 + May 2018 + April 2018 + March 2018 + February 2018 + January 2018 + December 2017 + November 2017 + October 2017 + August 2017 + July 2017 + June 2017 + May 2017 + April 2017 + March 2017 + February 2017 + January 2017 + December 2016 + November 2016 + October 2016 + September 2016 + August 2016 + July 2016 + June 2016 + May 2016 + April 2016 + March 2016 + February 2016 + January 2016 + December 2015 + November 2015 + October 2015 + September 2015 + August 2015 + July 2015 + June 2015 + May 2015 + April 2015 + March 2015 + February 2015 + January 2015 + December 2014 + November 2014 + October 2014 + September 2014 + August 2014 + July 2014 + June 2014 + May 2014 + April 2014 + March 2014 + February 2014 + January 2014 + December 2013 + November 2013 + October 2013 + September 2013 + August 2013 + July 2013 + June 2013 + May 2013 + April 2013 + March 2013 + February 2013 + January 2013 + December 2012 + November 2012 + October 2012 + September 2012 + August 2012 + July 2012 + June 2012 + May 2012 + April 2012 + March 2012 + February 2012 + January 2012 + December 2011 + November 2011 + October 2011 + September 2011 + August 2011 + July 2011 + June 2011 + May 2011 + April 2011 + March 2011 + January 2011 + November 2010 + October 2010 + August 2010 + July 2010 * Categories + 286 + 386 + 3Com + 3Dfx + 486 + 8086/8088 + Adaptec + AGP + AMD + AMD64 + Apple + Archiving + Assembler + ATi + BIOS + Books + Borland + BSD + Bugs + BusLogic + C + C&T + CD-ROM + Cirrus Logic + CompactFlash + Compaq + Compression + Conner + Corrections + CP/M + Creative Labs + Crystal Semi + Cyrix + DDR RAM + Debugging + DEC + Development + Digital Research + Documentation + DOS + DOS Extenders + Dream + E-mu + Editors + EISA + Ensoniq + ESDI + Ethernet + Fakes + Fixes + Floppies + Graphics + Hardware Hacks + I18N + IBM + IDE + Intel + Internet + Keyboard + Kryoflux + Kurzweil + LAN Manager + Legal + Linux + MCA + Microsoft + MIDI + NetWare + Networking + NeXTSTEP + NFS + Novell + NT + OS X + OS/2 + PC architecture + PC hardware + PC history + PC press + PCI + PCMCIA + Pentium + Pentium 4 + Pentium II + Pentium III + Pentium Pro + Plug and Play + PowerPC + Pre-release + PS/2 + QNX + Quantum + Random Thoughts + RDRAM + Roland + Ryzen + S3 + SCO + SCSI + Seagate + Security + Site Management + SMP + Software Hacks + Solaris + Sound + Sound Blaster + Source code + Standards + Storage + Supermicro + TCP/IP + ThinkPad + Trident + UltraSound + Uncategorized + Undocumented + UNIX + UnixWare + USB + VGA + VirtualBox + Virtualization + VLB + Watcom + Wave Blaster + Western Digital + Windows + Windows 95 + Windows XP + Wireless + WordStar + x86 + Xenix + Xeon + Yamaha OS/2 Museum Proudly powered by WordPress.