DAC Registers

 BBS: Inland Empire Archive
Date: 05-26-92 (16:32)             Number: 155
From: MATT HART                    Refer#: NONE
  To: BRETT LEVIN                   Recvd: NO  
Subj: DAC Registers                  Conf: (2) Quik_Bas
 BL>     Does anybody have a way to get the colors in the VGA
 BL> register (mode 13)? Possibly an INP?  Thanks.

You can do it with an interrupt call.

     DEFINT A-Z
     '$INCLUDE:'QBX.BI'      ' Or QB.BI   Load with C:\>qb /l to
                             ' load the QBX.QLB or QB.QLB library
     DIM InRegs AS RegTypeX

     DIM OutRegs AS RegTypeX
     SELECT CASE Mode
         CASE 11 : NumPal = 2
         CASE 12 : NumPal = 16
         CASE 13 : NumPal = 256
         CASE ELSE : NumPal = 0
     END SELECT
     IF NumPal > 0 THEN
         REDIM PalInfo&(0 TO NumPal-1)
         FOR i = 0 TO NumPal-1
             InRegs.ax = &H1015
             InRegs.bx = i
             CALL INTERRUPTX (&H10, InRegs, OutRegs)
             A& = (OutRegs.cx AND &HFF00) \ &HFF
             B& = (OutRegs.cx AND &HFF)
             C& = (OutRegs.dx AND &HFF00) \ &HFF
             PalInfo&(i) = 65536& * B& + 256& * A& + C&
         NEXT i
     ENDIF

Interrupt 10h function 15h returns the current color
information for a specified palette, split into red, green,
and blue portions.
---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
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