Thursday, January 7, 2016

Displaying DOSBox Screenshots on Real Hardware

DOSBox is an excellent program for taking screenshots of DOS games, it saves them losslessly in the Portable Network Graphics format.  But what if you want to view these screenshots on real hardware, especially low-end hardware?  Suppose there is a particular screen you really want to see on older hardware, can it be done?  The answer is surprisingly yes, for the most part, and it's pretty easy.

Once upon a time, there existed a picture viewer program for DOS called CompuShow.  The last numbered version released is 9.0.4, and can be downloaded here :  CompuShow can load most of the major image formats from the mid-1990s, including PNG, GIF, PCX, BMP and JPG and many others that are rarely encountered today.  It can also convert picture files to these formats and more.

CompuShow has the benefit of working on any PC compatible, from an IBM PC with an 8088 CPU to a Generic Windows 98SE machine.  The program can fit on a 360KB floppy with room for some images, so it is small.  Loading speed is decent even on the IBM PC.  For a program of the later 80s to mid 90s, it supports a wide variety of graphics adapters.

I have personally tested the program with an IBM PC with IBM CGA and Hercules Graphics Cards and the modes work as they should.  I have also tested the program with my Tandy 1000 SX and Tandy 1000 TL and it works well with them.  Finally I have tested the program with my 486 PC with a Cirrus Logic VLB card with 2MB of RAM and a GD-5429 chipset.  All modes work as expected except as noted below.

Graphics Modes CompuShow can display

CGA 160x100x16

Driver required to be loaded.  Will work on a real CGA card or a pre Tandy 1000 TLs and SLs, but not on the later 1000s.  CGA games that use this effective resolution include Styx, Round 42 and Moon Bugs.

CGA Mode 04/05 320x200x4

Limitations include no cyan/red/white palette, no tweaked capabilities (background/border color, mid-frame palette changes).  Use Tandy, EGA or better 320x200x16 modes to show the cyan/red/white palette and tweaks.  Border colors will never be shown.

CGA Mode 06 640x200x2

No support for changing foreground color with real CGA or entering color composite mode.  Use Tandy 1000 Mode 640x200x4, Tandy TL/SL or EGA Mode 640x200x16 for showing foreground colors other than white. Not many games use a pure CGA 640x200x2 mode, some can choose it as an option like Wizardry and SimCity.

Tandy 1000/PCjr. Mode 09 320x200x16

Should be used for Tandy 1000/PCjr. Mode 08 160x200x16 as well, use /J1 as a command line argument to gain access to this mode.  EGA Mode 320x200x16 can show these 160x200x16 and 320x200x16 screenshots.

Tandy 1000/PCjr. Mode 0A 640x200x4

Rarely used, use /J1 as a command line argument to gain access to this mode.  Great if you want to show off graphic screenshots in PCjr. ColorPaint or Tandy Personal Deskmate 1-2, but otherwise almost never used.

Hercules Graphics 720x348x2

Available on Hercules monochrome graphics adapters.  Better adapters do not tend to show this mode well.

Tandy 1000 TL/SL 640x200x16

Driver required to be loaded, can display EGA Mode 0E 640x200x16 graphics perfectly and CGA Mode 06 640x200x2 graphics with a colored foreground.  Very few games use this mode directly and it is never ideal.  Sargon III and Star Trek 25th Anniversary allow it to be selected.

EGA Mode 0D 320x200x16

Can be used for displaying  Tandy 1000/PCjr. Mode 08 & 09 graphics

EGA Mode 0E 640x200x16

Can display Tandy 1000 TL/SL 640x200x16 graphics perfectly and CGA Mode 06 640x200x2 graphics with a colored foreground.  Use this mode to display CGA Mode 06 640x200x2 properly with a VGA card.   Mainly used by ports of Japanese PC games and some LucasArts and Sierra games for those few people without VGA cards.

EGA Mode 0F 640x350x2

Will be available only on a EGA card attached to a monochrome TTL monitor.  Rarely used, but SimCity and Microsoft Flight Simulator 3.0 do support it.

EGA Mode 10 640x350x16

Will be available only on an EGA card attached to a 350-line color TTL monitor or by using a VGA card.  The original SimCity's best graphics mode and also used for the title and menu screens in the early Lemmings games.

MCGA/VGA Mode 11 640x480x2

Takes the place of CGA Mode 6 640x200.  Supported by SimCity and not much else.

VGA Mode 12 640x480x16

Not very popular due to the color limitations, Supported mainly by Syndicate.

MCGA/VGA Mode 13 320x200x256

VGA Mode-X 320x400x256, 360x480x256

320x400 had some popularity, System Shock supports it, but 320x240 was a more common non-standard resolution.  360x480 was pretty much the maximum resolution vanilla VGA could support, but was used by shareware and freeware games.

VESA Modes Supported by CL GD-5429 Driver :
Resolution / Color Depths
640x480 : 256, 32K, 64K, 16M
800x600 : 16, 256, 32K, 64K
1024x768 : 16, 256, 32K, 64K

If you have a 320x240x256 VGA Mode-X screenshot, you should be able to set perfect results using 640x480x256.

The program supports many SVGA chipsets as well as the usual VESA modes.  It identified my VLB card's chipset accurately and was able to display all the above resolutions and color depths in the setup test program.

General Tips and Observations

I found that CompuShow really preferred interlaced GIFs.  It would show minor drawing errors if it displayed PNGs, GIFs or PCX files using the Tandy graphics adapters.  With interlaced GIFs, pictures will display correctly every time.  Many, many programs can convert PNGs to GIFs.  I use InfranView to perform the conversion, and the program will allow you to convert to the interlaced GIF format.  While CompuShow will also convert PNGs to interlaced GIFs, InfranView can do so with the horsepower of a modern machine and can do multiple files in batches with ease.

DOSBox will save a 640x200 resolution or 160x100 CGA screenshot as 640x400 pixels.  Similarly, Tandy/PCjr. 160x200 resolution screenshots are saved as 320x200.  Unusual VGA screenshots tend to be saved in aspect ratios that will give the image a squarish aspect ratio.  You do not need resize the images, CompuShow will automagically disregard unnecessary duplicate lines and show the image as it was meant to be shown.

When using the CGA display modes, it is important to know what the original palette colors were.  The program gives you four palette options :

1 - Light Green/Light Red/Yellow
2 - Green/Red/Brown
3 - Light Cyan/Light Magenta/Intensified White
4 - Cyan/Magenta/White

On a real CGA adapter, if your screenshot uses the alternate palette colors, use the corresponding intense or non-intense cyan/magenta/white palette.  If you select the wrong palette choice, the screen may draw very slowly as the program tried to interpolate colors and often the pixels will not look correct even with the wrong colors.

If you are trying to display a screen capture of a text mode with colored text, EGA, VGA and Tandy TL/SLs have a graphics mode that is sufficiently colorful to handle the effective text resolution with 16 colors.  Tandy/PCjr. can handle 40-column text modes in full color, but not 80-column text modes.  CGA is too limited to handle either column width with full color.  Hercules may be able to offer a passable rendition of text mode in graphics mode.

Note that true VGA text modes have a 360x400 and 720x400 effective resolutions for for 40-column and 80-column text modes.  DOSBox will save screenshots of VGA text modes in 320x400 and 640x400 resolutions, respectively, unless using the vgaonly machine type.  These are the effective text resolutions of the MCGA adapter, which is a VGA offshoot.

Even though Hercules has a 720x348 graphics mode, it will not show monochrome text very well, even though the monochrome text Mode 07 has an effective resolution of 720x350.  Also, monochrome text can use intense and non-intense characters, but monochome Hercules graphics can only show non-intense pixels.

Ironically, while CompuShow works very well with all sorts of hardware (I did not test it with the PCjr. yet), it does not work in DOSBox.  It will complain that it cannot find its README.EXE, SETUP.EXE and CSHOW.DRV files, even though they are present in the same directory as CSHOW.EXE.  Even booting real MS-DOS 6.22 will not prevent the error, which prevents the program from starting.

Although the monochrome selections, A-G, are supposed to allow for light to dark shades of the color, it seems to have no effect in every system I tried.  Maybe it is for a special type of CGA display.

With my IBM PC and IBM EGA graphics adapter (upgraded to 256KB), the wrong colors would appear when using the 16-color EGA modes.  The program did not detect an EGA card, and I believe this is because I was using a 200-line monitor with the card.  So it can look like a CGA card.  I had to force the program to use the EGA modes using the /Ae command line argument, but I got color errors.  I got the same color errors when I forced the program to EGA on a VGA card.  When I used the EGA modes without the forcing command line argument, the pictures displayed correctly.  Therefore, I suggest that EGA will display these graphics properly on a 350-line EGA monitor and with the card configured for full EGA capabilities.  I do not have a 350-line color monitor to test with unfortunately.  When connected to my MDA display, the 640x350x2 graphics mode was available and displayed the screenshot correctly.


bleuge* said...

Hi, good post as usual.
Have you read about a special EGA mode old Amstrad PC 1640 had?
If i can recall correctly, when i run a game with CGA and EGA support, the game goes CGA, also trying to run EGA gave errors... But then someday i discovered that if i run at commandline, > display EGA (i can't recall exactly, maybe i typed more options...) then suddenly the games displayed EGA 16 colours. It was amazing. As far i can remember this was a 320x200x16 mode
Unfortunatley i don't have my old Amstrad here to test...


idspispopd said...

The EGA modes of the PC1640 were not special. (There was a Paradise EGA chipset on the mainboard.)
EGA modes are 320x200x16, 640x200x16 and 640x350x16.
We had a PC1640 with the CD monitor (basically a CGA monitor).
With that monitor you could use 320x200 and 640x200 but not 640x350.

EGA has 6 TTL lines compared to the 4 CGA has. This way it can select from a palette of 64 colors. But this only works in 640x350. In the lower resolutions it is restricted to the 16 CGA colors for compatibility reasons. Maybe this is the reason for the color problems on the IBM PC with the 200-line monitor? (All of this is well known, Great Hierophant knows about this.)

bleuge* said...

thanks for comment! great memories of my old Amstrad! I wonder if the emulation in mess or in PCem correctly support this (i am sure it is)

Great Hierophant said...

I should mention that CompuShow does support the Amstrad PC1512 640x200x16 mode, so you can probably display 320x200x16 and 640x200x16 pictures with it. The 640x200x16 mode is a special enhanced CGA mode, but very little software supported it. I cannot tell for sure because I do not own a PC1512, they really aren't available on my side of the great pond.

idspispopd, there may be some relationship between the palette entries CompuShow would like to display and what it is actually displaying, I think it is highly likely that these problems would not appear with a real 350-line monitor. Cheap Multisync anyone?

Slim Shady said...

Your blog always puts a smile on my face. cshow really was the swiss army knife of viewers, but I have some fond memories of the CL GD VLB cards too. Somehow I got my hands on some 1" thick technical books on those cards. I'm sure I have those somewhere. I managed to use Linux Slackware (pre Red Hat) and setup custom timings on the CL. Somehow pushed 1600x1200 on a 14" SVGA CRT back then. Higher than the claimed max for both the monitor and the card. Dot pitch was useless, but man was it neat.

idspispopd said...

@Great Hierophant: I don't think that bleuge* referred to the PC1512 since he mentioned the display ECD200 command. I was also quite surprised that after having run the command automatically for the GEM GUI, LSL1 would suddenly look much more colorful. You could also set this mode with the dip switches, but then there was no full CGA compatibility for booter games.
I am surprised that CompuShow supports the PC1512, but for an image viewer software it's probably worth it. I suppose it's more work to support this in a game.

I don't know what's up with the wrong colors. With the PC1640 programs detected EGA fine. Programs using Borland's BGI correctly used the 640x200x16 mode, and most games obviously didn't use 640x350. There were some programs which tried 640x350 which lead to an unreadable display.
How do other programs behave with the IBM EGA?
I don't get exactly what happens when you force or not force an EGA mode. I could imagine that the program has a bug so it tries to set the palette in 640x200x16 in the same way as in 640x350x16 which wouldn't work.

bleuge* said...

@idspispopd: yes, you explained it better, and maybe that was the command i discovered? (myself, with 12 years, no manual reading... it was luck? i can't remember...)
And yes, it was Amstrad 1640 with color monitor.
The thing is, typing a msdos command, suddenly, software detected an EGA card (or ega mode?), games displaying more colorfurl. I never understood why Amstrad didn't include that by default it the hardware was able to do it?.

It's like having a 2TB Hard disk, and by default it shows 1TB, if you run a special command, then you can access the full 2TB :D