Re: Need help

 BBS: Inland Empire Archive
Date: 03-06-93 (08:44)             Number: 318
From: BOB PERKINS                  Refer#: NONE
  To: DANNY ROBINSON                Recvd: NO  
Subj: Re: Need help                  Conf: (2) Quik_Bas
 DR> Does anybody have a routine that uses BIOS calls to get
 DR> the current screen color attribute?  Would appreciate any help.  Thanks.

  Here's one I whipped up just now.

 '$INCLUDE: 'qb.bi'
 DIM regs AS regtype
 CLS : LOCATE 10, 10: COLOR 3, 4
 PRINT "A"; : LOCATE 10, 10: COLOR 7, 0
 'get the attribute at the current cursor position
 '
 regs.AX = &H800                           'load function into ah
 regs.BX = 0                               'page number 0
 interrupt &H10, regs, regs
 '
 attribute% = (regs.AX AND &HFF00) \ 256  'attribute is in ah
 IF attribute% AND 128 THEN blink$ = "ON" ELSE blink$ = "OFF"
 background% = (attribute% AND 112) \ 16  'background is bits 4, 5 and 6.
 foreground% = attribute% AND 15          'foreground is bits 0 thru 3.
 character% = regs.AX AND &HFF            'this also returns the character
 'The foreground and background color values are the same as for QB COLOR
 'statements.
 FOR x% = 0 TO background%
  READ background$
 NEXT x%
 RESTORE
 FOR x% = 0 TO foreground%
  READ foreground$
 NEXT x%
 PRINT
 PRINT "Foreground = "; foreground$
 PRINT "Background = "; background$
 END

 DATA "black","blue","green","cyan","red","magenta","brown","light gray"
 DATA "dark gray","light blue","light green","light cyan","light red"
 DATA "light magenta", "yellow", "white"



--- Msg V4.5
 * Origin: Reciprocity Failure  (1:124/4115.236)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET