Q22036: SCREEN 7,8,9 "Illegal Function Call" Using Foreground COLOR 0
Article: Q22036
Product(s): See article
Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | B_BasicCom | mspl13_basic
Last Modified: 15-JAN-1991
Executing the COLOR statement with a zero (0) as the foreground color
gives "Illegal Function Call" on the EGA SCREEN modes 7, 8, and 9. For
example:
10 SCREEN 9
20 COLOR 0,0 ' Gives "Illegal function call"
This is because zero (0) is not within the allowed range of attributes
with the EGA. The range of attributes is 1 to 3 for an EGA with 64K,
and 1 to 15 for an EGA with more than 64K of memory.
You can work around this behavior by using the PALETTE statement to
reassign the color of zero to another attribute number. This can be
accomplished by doing the following:
DIM Pal%(16)
SCREEN 7
Pal%(0) = 15
Pal%(15) = 0
PALETTE USING Pal%(0)
COLOR 15,1
CLS
This information applies to QuickBASIC versions 2.00, 2.01, 3.00,
4.00, 4.00b, and 4.50; to Microsoft BASIC Compiler versions 6.00 and
6.00b for MS-DOS, and to Microsoft BASIC Professional Development
System (PDS) versions 7.00 and 7.10 for MS-DOS.
Another way to simulate a foreground color of zero (0) in screen mode
9 or 12 is shown in a separate article in this Knowledge Base. To find
this article, query on the following words:
foreground and background and GET and PUT and 16 and simultaneously
(The graphics GET and PUT technique and sample program shown in this
separate article could be modified for QuickBASIC 2.0x and 3.00.)
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.