Microsoft KB Archive/50943

= Using CALL INTERRUPT to Get Current SCREEN Video Mode =

Article ID: 50943

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBASIC 1.0b
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q50943



SUMMARY
It is possible to get the current SCREEN mode using the CALL INTERRUPT statement in compiled Basic. This is useful if the program does not keep track of the current SCREEN mode, and the current video state needs to be saved.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, Microsoft Basic Compiler Versions 6.00, and 6.00b for MS-DOS, and to Microsoft Basic PDS Version 7.00 for MS-DOS.



MORE INFORMATION
The following Basic program allows you to change the video mode, then uses CALL INTERRUPT to return the current video mode. The return values from the CALL INTERRUPT are not the same as the Basic SCREEN modes, so the program creates an array that is used to translate the returned values back to Basic SCREEN modes.

Code Example: SCRMODE.BAS
REM $INCLUDE: 'qb.bi'  ' defines for CALL INTERRUPT ' For BC.EXE and QBX.EXE for Basic 7.00, use the include file 'QBX.BI' ' and the Quick library QBX.QLB. DIM inregs AS regtype DIM outregs AS regtype DIM screenarray(19) AS INTEGER FOR i% = 0 TO 19 READ screenarray(i%) NEXT INPUT &quot;enter screen mode: &quot;; smode% inregs.ax = &HF00      ' BIOS interrupt to return video mode CALL interrupt(&H10, inregs, outregs) smode% = outregs.ax AND &HFF  ' mask off contents of AL register PRINT &quot;Current screen mode = &quot;; screenarray(smode%) ' Define conversion array for SCREEN modes DATA 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 7, 8, 10, 9, 11, 12, 12 END To demonstrate this program from an .EXE program, compile and link as follows:

BC SCRMODE.BAS;

LINK SCRMODE,,,QB.LIB;

For Basic PDS 7.00, use QBX.LIB instead of QB.LIB.

If you run the program within the QuickBasic QB.EXE editor, the default Quick library QB.QLB must be loaded in, as follows:

QB SCRMODE /L

For QBX.EXE 7.00, the default Quick library QBX.QLB must be loaded in, as follows:

QBX SCRMODE /L

Additional query words: QuickBas BasicCom

Keywords: KB50943

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.