Microsoft KB Archive/50945

From BetaArchive Wiki
Knowledge Base


How to Get Blinking Text in Basic SCREEN Modes 7, 8, 9, 12, 13

Article ID: 50945

Article Last Modified on 8/16/2005



APPLIES TO

  • Microsoft Visual Basic for MS-DOS
  • 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
  • Microsoft BASIC Professional Development System 7.1



This article was previously published under Q50945

SUMMARY

The program example included below demonstrates how to use the CALL INTERRUPT statement to enable blinking text in screen modes 7, 8, 9, 12, and 13.

MORE INFORMATION

Interrupt 10h, with function 10h and subfunction 03h, can be used to toggle the blink/intensity bit on the video card. This determines whether the most-significant bit of the character attribute selects a blinking or intensified display. The default is for this bit to signify intensified display.

After this interrupt has been called, anything displayed in colors 0 through 7 is displayed normally, but anything displayed in colors 8 through 15 is displayed blinking. This is because colors 8 through 15 have the most-significant bit of the character attribute set.

The registers to load for the interrupt call are as follows:

Interrupt 10h
AH = 10h
AL = 03h
BL = 0 = enable intensity (turns off blinking)

1 = enable blinking (turns off intensity)


Running the following program, BLINK.BAS, enables and disables blinking characters:

' To try this example in VBDOS.EXE:
' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.

' To run this program in the environment, you must invoke the
' environment with the /L switch to load the default Quick library:
'    VBDOS.EXE /L          for Visual Basic 1.0 for MS-DOS

' Use the following include file for Visual Basic 1.0 for MS-DOS:
REM $INCLUDE: 'VBDOS.BI'
' Use the following include file for QuickBasic for MS-DOS:
REM $INCLUDE: 'qb.bi'
' Use the following include file for BC.EXE and QBX.EXE in Basic PDS
' 7.0 or 7.1:
REM $INCLUDE: 'QBX.BI'

DIM inregs AS regtype
DIM outregs AS regtype
SCREEN 9
FOR x% = 1 TO 15
   COLOR x%
   PRINT "this is color: "; x%
NEXT
COLOR 7
LOCATE 24, 1
PRINT "Press any key to enable blinking";
WHILE INKEY$ = "": WEND
inregs.ax = &H1003
inregs.bx = 1
CALL interrupt(&H10, inregs, outregs)
LOCATE 24, 1
PRINT "Press any key to turn off blinking";
WHILE INKEY$ = "": WEND
inregs.ax = &H1003
inregs.bx = 0
CALL interrupt(&H10, inregs, outregs)
                

Compile and link with Microsoft QuickBasic fodr MS-DOS, versions 4.0, 4.0b, and 4.5 or with Microsoft Basic Compiler for MS-DOS, versions 6.0 and 6.0b as follows:

   BC Blink.bas;
   LINK Blink.bas,,,BRUNxx.Lib+QB.Lib;
                

The "xx" in the library name is for the current version of the product you are using (40, 41, 45, 60, or 61). For Microsoft Basic Compiler for MS-DOS versions 6.0 and 6.0b, use BRUNxxER.Lib (emulation math package) or BRUNxxAR.Lib (alternate math package). For the alternate math library, you must compile with the BC /FPa switch. If you compile with BC /O, link with BCOMxx.LIB instead of BRUNxx.LIB.

To run this program in the QB.EXE environment, you must load the Quick library QB.QLB: QB /L QB.QLB.

For Basic PDS for MS-DOS, version 7.0 or 7.1, compile and link as follows:

   BC Blink.bas;
   LINK Blink.bas,,,BRT70ENR.Lib+QBX.Lib;
                

The above example is for the math emulation, near strings, and real mode run-time library. The other possible run-time libraries and their corresponding compiler switches are as follows:

   Library Name   Compiler Switches     Comments
   ------------   -----------------     --------

   BRT70ENR.LIB   [The default mode]    Emulation math, near strings
   BRT70ANR.LIB   /FPa                  Alternate math, near strings
   BRT70EFR.LIB        /Fs              Emulation math, far strings
   BRT70AFR.LIB   /FPa /Fs              Alternate math, far strings
                

To use stand-alone libraries, use BCL70xxx.Lib instead of BRT70xxx.Lib and add the compiler switch BC /O.

For the QBX.EXE version 7.0 or 7.1 environment, use QBX.QLB: QBX /L QBX.QLB.

Note: This interrupt can be used to accomplish the same effect in SCREEN 0. Usually this in not needed because the COLOR statement can be used to control the intensity and blinking. However, if a program is directly accessing the hardware (through the POKE statement, for example), this interrupt might be needed. This will have no effect for video cards that are NOT in a color mode (for example, MODE CO80). For example, if a program is running on a dual-monitor system (Hercules and VGA) and the current mode is monochrome, this interrupt will not affect the color card.


Additional query words: VBmsdos QuickBas BasicCom 1.00 4.00 4.00b 4.50 6.00 6.00b 7.00 7.10

Keywords: KB50945