Microsoft KB Archive/50943

From BetaArchive Wiki
Knowledge Base

Article ID: 50943

Article Last Modified on 11/21/2006


  • 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


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.


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: ''   ' 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%)
INPUT "enter screen mode: "; smode% = &HF00       ' BIOS interrupt to return video mode
CALL interrupt(&H10, inregs, outregs)
smode% = AND &HFF   ' mask off contents of AL register
PRINT "Current screen mode = "; 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

To demonstrate this program from an .EXE program, compile and link as follows:


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:


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


Additional query words: QuickBas BasicCom

Keywords: KB50943