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



The information in this article applies to:

  • Microsoft QuickBASIC 4.5
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q50896

SYMPTOMS

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.

STATUS

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).

MORE INFORMATION

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&
   NEXT
   FOR X = 1 TO 16
       LINE (X * 10, 0)-(X * 10 + 20, 350), X, BF
   NEXT
				

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB50896