[GEM Development] Weird SDCGA8.CGA bug

John Elliott jce at seasip.demon.co.uk
Tue Apr 12 01:47:14 PDT 2005


  Here's a little BASIC2 program to try. 

CLS
FOR e = 0 TO 7
PRINT
PRINT EFFECTS(e);e;".    ";ANGLE(180);"abcd"
PRINT
PRINT
NEXT

  If you run this using the CGA driver SDCGA8.CGA or the mono driver
SDPSM8.VGA, two of the lines of text (numbers 1 and 3, boldface and grey
boldface) don't display. If you use SDPSC9.VGA, they do.
  I know more or less why this is happening. When GEM prints a character
upside-down, it rotates the character in a temporary character cell. In the
case of a boldface character, the character is 8 pixels wide and the cell is
16 pixels wide so the character ends up in the right-hand half of the cell
and the left-hand half is what's displayed. 
  So why's the cell 8 pixels wider than the character? I think it's because
of this: In opttext.c, we have the lines

        if (SPECIAL & THICKEN)
            CHAR_DEL = WEIGHT = FONT_INF.thicken;

  which implies that bold characters should be FONT_INF.thicken pixels 
wider than non-bold ones (this is done by setting CHAR_DEL). In the case
of the test program above, FONT_INF.thicken is 1, so the character cell
is forced to be able to hold at least 9 pixels. But in opttxt1.a86: 

spec_bold:
                test    SPECIAL, THICKEN
                jz      spec_grey
                call    text_bold
                test    MONO_STA, 0ffffh        ; is this a monospaced font?
                jnz     spec_grey
                add     si, WEIGHT              ; bump width
                add     dx, WEIGHT              ; bump offset to next char
spec_grey:

  the character width is not increased to match, because the font is
monospaced.

  What I don't know, though, is why it works in SDPSC9.VGA. 

-- 
John Elliott


More information about the gem-dev mailing list