Microsoft KB Archive/50896

From BetaArchive Wiki
Knowledge Base

If WIDTH 80,60 in SCREEN 12, then PALETTE Can Give Wrong Color

Article ID: 50896

Article Last Modified on 11/21/2006


  • Microsoft QuickBasic 4.5 for MS-DOS
  • Microsoft BASIC Professional Development System 7.0

This article was previously published under Q50896


In SCREEN 12, if the WIDTH 80, 60 statement is used to set the screen to 60-line mode and then the PALETTE statement is used to set attributes and colors, the palette can give erroneous colors. The problem can be worked around by changing the WIDTH statement to WIDTH , 30 to set the screen to 30-line mode instead of 60.

The code fragment given below demonstrates the problem in QuickBasic version 4.5. The same code fragment runs correctly in QuickBasic versions 4.0 and 4.0b.


Microsoft has confirmed this to be a bug in QuickBasic version 4.5 and in Microsoft Basic Professional Development System (PDS) version 7.0 (buglist7.00). This problem was corrected in Basic PDS version 7.1 (fixlist7.10).


The program below reproduces the problem on SCREEN 12, which requires a VGA. It should produce bands of shades of gray going from black to white across the screen. Instead, it produces bands of the same set of incorrect colors each time it is run.

   SCREEN 12
   WIDTH 80, 60            'WIDTH 80, 30 gives correct results
   FOR X = 4 TO 60 STEP 4
       A& = 65536 * X + 256 * X + X
       B = X / 4
       PALETTE B, A&
   FOR X = 1 TO 16
       LINE (X * 10, 0)-(X * 10 + 20, 350), X, BF

Additional query words: QuickBas BasicCom 4.50 7.00 7.10 buglist4.50 B_BasicCom

Keywords: KB50896