• Please review our updated Terms and Rules here

Trixter: Preventing CGA Snow

i don't own any CGA cards, but i have noticed some minor snow on my monochrome ibm card sometimes, during screen updates. it's independent of what program i'm running. is this normal?
 
i don't own any CGA cards, but i have noticed some minor snow on my monochrome ibm card sometimes, during screen updates. it's independent of what program i'm running. is this normal?

Monochrome cards and monitors don't have a snow problem, unless your "monochrome" system is emulating CGA. My Panasonic Sr. Partner does this (monochrome monitor but it does CGA with shades of green) as well as my PC 6300 with a mono monitor.

If your system truly is mono (ie. video base is $b000 instead of $b800) then your monitor is starting to develop a problem :(
 
Monochrome cards and monitors don't have a snow problem, unless your "monochrome" system is emulating CGA. My Panasonic Sr. Partner does this (monochrome monitor but it does CGA with shades of green) as well as my PC 6300 with a mono monitor.

If your system truly is mono (ie. video base is $b000 instead of $b800) then your monitor is starting to develop a problem :(

maybe i was imagining things. it might have just been QB refreshing the scroll bar, becuase thats the only place i've noticed it. the computer is just so slow that you can actually watch it refresh lol. i hope that's it anyway.

and yeah it's a real mono card at b8000. i don't feel opening the computer up to check, but i think it says (c)1984 on it. it's as old as me. wow.....

if i'm not mistaken, hercules cards work on b8000 right?
 
if i'm not mistaken, hercules cards work on b8000 right?

Mono cards are at B000.
Color cards are at B800

Real mono is black, white, hi-intensity white, underline, and reverse video. That's it. If your QBASIC programs draw in color, to B800, and you are seeing it in different shades of gray/green/whatever, then guess what: You have a card that is emulating CGA for you. That's neither monochrome nor Hercules.

If you have a Hercules card, it is monochrome and the base is B000 although you do have RAM at B800 because the card has 32K of RAM. This is why programs like SIMCGA work on Hercules, because CGA writes to B800 and the SIMCGA program copies it to B000 a few times a second.

The best SIMCGA-type program I ever saw was one that simply set the graphics mode active page to B800 and reprogramed the MC6845 so that the memory produced a 640-pixel-wide image. It was squashed a bit (200 lines displayed instead of 348) but there was no copying of memory and as such all games ran at full speed.

So: What do you have?
 
my bad, that was a typo on my part last night. i had a little bit too much to drink. i meant to say real mono card at b000h.

in fact, this is a pic of the card i took a while back. it looks like a geniune IBM. next to my forearm to show how gargantuan that card is. it takes up the entire depth of the case lol. end to end.

monocard.jpg


last night i went ahead and added automatic card detection to leetIRC and it will be there when i put out v1.2, instead of just always using b800h... it leaves the monochrome XT guys with no way to use it. i'm sure there is a better way to do this, but this is the code i came up with.

Code:
SUB VidDetect
SCREEN 0: COLOR 0, 0: CLS : LOCATE 1, 1: PRINT "VIDEO TEST";
DEF SEG = &HB800
chk1$ = ""
FOR nchk = 0 TO 9
	chk1$ = chk1$ + CHR$(PEEK(nchk * 2))
NEXT nchk

DEF SEG = &HB000
chk2$ = ""
FOR nchk = 0 TO 9
	chk2$ = chk2$ + CHR$(PEEK(nchk * 2))
NEXT nchk

IF chk1$ = "VIDEO TEST" THEN vidtype = 1
IF chk2$ = "VIDEO TEST" THEN vidtype = 2

COLOR 7,0: CLS
END SUB

QB just sends everything through the "CON" pipe when PRINT is used of course, so it's a simple matter of checking both of those base addresses for the text.

i also added an option to completely disable color, and use PRINTs instead of POKEs to memory for screen refreshes. it is about 3 times faster, and actually useable on my XT so that's kinda nice.
 
Last edited:
That's not a real IBM board. The true IBM MDA says "Black & White / Parallel" on it (and the real IBM CGA board says "Color Graphics"). If it was a real IBM board you would also see an IBM copyright on the character generator ROM chip.
 
I'm sure there is a better way to do this, but this is the code i came up with.

Your method would seem to work except what if there's another board at one of those locations, also with RAM? You could end up borking the machine.

The proper way is Int 10/AH=0Fh so that you can detect the mode you're already in at startup and work within that.

If you want to set the mode yourself and need to know what you're using, do Int 11 and check the list that comes back.

If you want to blatantly cheat, you can peek at the display table maintained by most display card BIOSes with something like:

Code:
  If Mem[$0000:$0449]=7 Then
    VideoSegment:=$b000
  Else
    VideoSegment:=$b800

If you want the full assembler routine to determine if you are running on CGA, mono, or herc, let me know.
 
There is another problem too - on a dual head machine you need to sense which mode is active so that you use the monitor that the user has already selected.

Here is some Turbo C++ code to detect the current screen mode:

Code:
  // What video mode are we in?

  union REGS inregs, outregs;

  inregs.h.ah = 0x0f;
  uint16_t ax = int86( 0x10, &inregs, &outregs );

  uint8_t mode = ax & 0xFF;

  if ( mode == MONO ) {
    // Monochrome is current
    colorCard = 0;
    Screen_base = (uint8_t far *)MK_FP( 0xb000, 0 );
  }
  else {
    colorCard = 1;
    Screen_base = (uint8_t far *)MK_FP( 0xb800, 0 );

    if ( mode == BW40 ) {
      // If in BW40 then go to BW80
      textmode( BW80 );
    }
    else {
      // You are in CO40 or an unknown mode (but we know you are not MONO)
      textmode( C80 );
    }
  }

You can see from this code that first I detect which display is active, and then if it is a CGA I'm going to force it to 80 cols. Note that I honor and preserve the color/BW mode and don't just force a color mode.

And as Trixter pointed out, you can usually just cheat and read the BIOS memory location that stores the current screen mode directly. The BIOS call is perfectly appropriate here because this code only runs once, so performance is not important.
 
Back
Top