Vga programming

 BBS: Inland Empire Archive
Date: 11-11-92 (17:14)             Number: 390
From: MATT HART                    Refer#: NONE
  To: KENNY BINGHAM                 Recvd: NO  
Subj: Vga programming                Conf: (2) Quik_Bas
 KB> in order to access my Tandy 320x200x16 cga mode graphics. Can you
 KB> give an example of how to do this? Also by using this method,can
 KB> I still use the normal QB commands such as circle,paint,draw,etc?

You can't use the normal QB commands.  The first program is
how to switch modes.  The second is how to set the palette
and do a PSET equivilant.

'
' TANDYMOD.BAS  by Matt Hart
' Uses Interrupt 10H to change the video mode to Tandy/PCjr
' extended modes.
'
    DEFINT A-Z
    TYPE RegTypeX
        ax    AS INTEGER
        bx    AS INTEGER
        cx    AS INTEGER
        dx    AS INTEGER
        bp    AS INTEGER
        si    AS INTEGER
        di    AS INTEGER
        flags AS INTEGER
        ds    AS INTEGER
        es    AS INTEGER
    END TYPE
    CurMode = 8     ' 8  = 160x200x16
                    ' 9  = 320x200x16
                    ' 10 = 640x200x4
    Call TandyMode(CurMode)
    END
SUB TandyMode(CurMode)
    DIM InRegs as RegTypeX
    InRegs.AX = CurMode
    CALL InterruptX (&H10, Inregs, Inregs)
END SUB

'
' SETTANDY.BAS  by Matt Hart
' Uses Interrupt 10H to set pixels to Tandy/PCjr extended modes.
' Also, TandyPalette changes the palette for Tandy/PCjr's.
'
    DEFINT A-Z
    TYPE RegTypeX
        ax    AS INTEGER
        bx    AS INTEGER
        cx    AS INTEGER
        dx    AS INTEGER
        bp    AS INTEGER
        si    AS INTEGER
        di    AS INTEGER
        flags AS INTEGER
        ds    AS INTEGER
        es    AS INTEGER
    END TYPE
'    Call TandyMode (9)      ' Use this to change to mode 320x200x16
    SCREEN 1
    C=1                 ' Color  (1 to 16) in Tandy mode 8 and 9
    for x=0 to 319
        Call SetTandy (x,0,c)
    next x
    WHILE INKEY$="":WEND
    Call TandyPalette (1,2)
    WHILE INKEY$="":WEND
    END
SUB SetTandy (X,Y,C)
    DIM InRegs as RegTypeX
    InRegs.AX = &H0C00 + C
    InRegs.CX = X
    InRegs.DX = Y
    CALL InterruptX (&H10, InRegs, InRegs)
END SUB
SUB TandyPalette (P,C)
    DIM InRegs as RegTypeX
    InRegs.AX = &H0B00
    InRegs.BX = P*256 + C
    CALL InterruptX (&H10, InRegs, InRegs)
END SUB
---
 * 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