• Please review our updated Terms and Rules here

SCREEN (Graphics) OPTIONS IN BASIC PROGRAM RUNNING ON IBM5155 COMPUTER

Hugo Holden

Veteran Member
Joined
Dec 23, 2015
Messages
4,776
Location
Australia
I have an IBM5155 running normally with its IBM CGA graphics card & a CGA monitor. Running the DOS utility CGACAL at the DOS prompt, there is a normal result showing the 16 possible "colors" on the colorbar test pattern. The 5155 computer is running DOS version 3.3 and comes with the BASIC program, it says version A3.3.

Using a modern computer running basic I was able to write a simple BASIC program in Screen 9 mode which pretty well replicates the DOS utility's video image, however when I went to run this simple program in the 5155 in BASIC it reported an illegal function. When I checked I found that the the 5155's BASIC reports an illegal function with any other command entry than screen 0, screen 1 or screen 2. This is pretty limiting for graphics as screen 0 is text only, screen 1 has only 4 "colors" (pink, green white & black) and screen 2 is monochrome.

Since the computer itself & the CGA card & the monitor is capable of supporting 16 colors, why would say "screen 9" or more of the advanced screen options not be allowed from within the BASIC program running on the 5155 ? Could it be the version of BASIC that came with the DOS 3.3? but that seems unlikely since its last listed date is 1987, and is there anything I can do to fix this ? Its odd because these screen commands go back to GW-BASIC. I tried loading QBASIC to the 5155, and it locked it up.

(the other graphics related problem I have, though probably not related, is that the Windows V1.0 I also have running on the 5155 appears in monochrome only and when I adjust the color on the windows preferences panel, it resets the color to zero always and won't produce a color screen image)
 
If the information I have is correct, SCREEN MODE 9 requires EGA with the Enhanced Display and you need the 256kB model to get 16 colors at the same time. This mode goes for 640 x 350 which CGA can't do.

All the early versions of Windows only ran CGA displays in monochrome 640 x 200 mode.

Sorry, you will need a better graphics card and display if you want to have more colors at higher resolutions.
 
Under "normal" operation CGA only supports 4 colors in graphics mode, which is why you are limited to screen 0-2 in BASIC. But you can get 16 colors in text mode, which is what CGACAL does (40x25). Screen 0 and then width 40,25 should do it. There is probably something you need to do to enable high intensity background colors but I don't know off the top of my head.
 
Thanks, I did not know that the CGACAL did its image in text mode alone, I had assumed it was in a graphics mode, so that explains it.
 
krebizfan, Is there a vintage EGA graphics card (256kB model) you could recommend which is known to be suitable for a 5155 ? (I can always get an EGA compatible monitor)
 
Thank you for that link modem7. Very interesting to read about the screen flicker with the internal amber monitor when running an interlaced scan with an EGA card. The orange phosphor must have a shorter persistence than the usual green. I would be very reluctant to want to change it for a green or white crt as the amber gives the 5155 a lot of its character. Very early video arcade games like Atari pong 1972 used non interlaced scans too. The sync generators required far fewer IC's to implement it. By the time their Tank game came out in 1974 though, they had also gone to an interlaced scan for high resolution graphics.

On the topic of CGA monitors I have found something that might help others looking for a CGA compatible monitor. Sony made excellent professional studio video monitors with fine pitch phosphors and Trinitron CRT's (probably the best CRT of all) Some of their monitors have a DB9 connector labelled "Digital RGB" I had one of these monitors in my shed, a PVM 2042QM. Connecting it to the 5155 (required a male to female DB9 cable) gives an identical screen image on the CGACAL utility as an IBM CGA monitor and has no difficulty with the non interlaced scan. So this is an example of a "modern monitor" (probably late 1990's vintage) with a CGA compatible input.
 
....I'm not 100% sure if the digital RGB input on the Sony monitor makes use of the intensity control pin (the brown is a bit lighter), so it may not be exactly the same as CGI standard, but overall its very close comparing it to the IBM CGA monitor image.
 
....I'm not 100% sure if the digital RGB input on the Sony monitor makes use of the intensity control pin (the brown is a bit lighter), so it may not be exactly the same as CGI standard, but overall its very close comparing it to the IBM CGA monitor image.

The brown thing is an internal compensation done by IBM (and some other) CGA monitors. The graphics card is actually sending out a signal for dark yellow, which the monitor interprets and displays as brown. Your monitor probably doesn't have any issue with the intensity pin, it just doesn't have the hardware for conversion between dark yellow and brown.
 
Note that on the composite video output, color 6 is also displayed as dark yellow (gold). It is only on an IBM 5153 or compatible RGBI monitor (such as a Tandy CM-5 or CM-11) that color 6 is displayed as brown. In practice, the exact shade you get varies depending on the contrast and tint adjustment of the monitor, and given the abstract nature of CGA graphics, doesn't really matter that much.
 
Yes, I looked at the circuit for the IBM5153 monitor and it appears that the green level is reduced by Transistor Q206 and current via R252 when Brown is detected most likely. I would have to put the scope on it to confirm this. It is quite interesting that they built this feature into their monitor. It would be easy enough to add a similar tack on circuit inside the Sony monitor I think.
 
Yes, I looked at the circuit for the IBM5153 monitor and it appears that the green level is reduced by Transistor Q206 and current via R252 when Brown is detected most likely. I would have to put the scope on it to confirm this. It is quite interesting that they built this feature into their monitor. It would be easy enough to add a similar tack on circuit inside the Sony monitor I think.

FYI, this was discussed at length previously, with some schematics.

In practice, the exact shade you get varies depending on the contrast and tint adjustment of the monitor, and given the abstract nature of CGA graphics, doesn't really matter that much.

Oh, I beg to differ ;-)
 
Trixter,

What a great link and creative work done with the artifact colors, making a defect helpful.

I think the reason behind composite NTSC video being "a less than perfect encoding system" is that the new color video signal had to be backward compatible with existing monochrome TV sets in the early 1950's. They were stuck with a receiver bandwidth in the TV intermediate frequency amplifiers of about 4 MHz. So the burst/color frequency had to be in the frequency spectrum near the upper luminance signal frequencies. The color carrier frequency was chosen so the chrominance and luminance sidebands were interleaved to minimize interference, but there is still some.

After reading the write up I will study the CGA card more, before contemplating replacing it with an EGA card, especially the 160 x 100, 16 color mode. I just have to figure out how to program the mode and color registers properly.
 
Last edited:
Trixter, Thank you for the link. I can see the files are in Pascal. My 5155 only has BASIC installed on it currently, but I can write to the registers using the OUT command. I saw for sale Version 3 of Turbo Pascal on 5.25 floppys, do you know if that will run on the 5155 ?
 
Yes, you can run all version of Turbo Pascal on the 5155, but that's not why I posted the code. The code is very easy to read and understand, and you said you wanted to learn how to make your own 160x100x16 mode in BASIC, so here is some working source code for you to learn from and translate. There are other files in the archive that describe what the code does.

If you WANT to learn Turbo Pascal, I certainly won't stop you :) but it isn't a requirement for rolling your own 160x100x16 mode.
 
Back
Top