Blinking text

DOS specific questions.
Post Reply
Posts: 2329
Joined: Jun 21, 2005 19:04

Blinking text

Post by angros47 »

As some of you might remember from QuickBasic, under DOS it was possible to have blinking text, by adding 16 to the foreground color in the COLOR statement. The trick worked in pure DOS, or in the DOS under Windows as long as it was in full screen move; in windowed mode, the text didn't blink, and instead had a brighter background color.

Under FreeBasic, that trick doesn't work, not even in pure DOS: in fact, the text mode under VGA allows to have either 8 background colors and the blinking text, or 16 background colors but no blinking: QuickBasic operated by default in the first mode, FreeBasic in the second. In fact, under QuickBasic in text mode it was impossible to have bright background colors, colors 8-15 for background were just replaced with colors 0-7, while in FreeBasic it's possible to use all the 16 colors for background. In QuickBasic it was possible to change that behavior with a CALL INTERRUPT, and the same can be achieved in FreeBasic using a dpmi int:

Code: Select all

#include "dos/"

Dim regs As __dpmi_regs = &H1003
regs.x.bx = 1            '1 to enable blinking, 0 to disable it
__dpmi_int(&H10, @regs)

COLOR 7, 8
PRINT "hello"

Posts: 334
Joined: May 09, 2014 21:19
Location: Argentina

Re: Blinking text

Post by xlucas »

Neat! I remember having used this interrupt many times for the opposite purpose. Since real DOS normally defaulted to blinking, I would call the interrupt function to enable bright backgrounds. This was in real mode, though. Nice to see it can be called via DPMI in FreeBasic
Post Reply