TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: All
from: Greg Easthom
date: 2004-03-15 16:23:26
subject: Code FAQ [14/15

'>>> Page  14  of Code FAQ begins here.


12) CAN I USE VESA SCREEN MODES IN QB?

   Most definitely.  The problem is not in getting INTO these
   screen modes; it's what you can actually DO when you're there.
   Once you have overstepped QB's regular screen modes, you can't
   use the built in graphics functions, so you have to write your
   own.  And that's where the fun part comes in.  Sticking a pixel
   on the screen is the main problem, as using INTERRUPTs seems to
   be the only standard way to do it so far, and INTERRUPT pixel-
   plotting is ridiculously slow.  But since that seems to be the
   only universally-working method, here's code for it.  Code by
   Dave Shea.

[begin]
   ' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
   ' SVGA.BAS  by  Dave Shea
   ' Released to Public Domain on January 18th, 1997
   '
   ' Compile: MicroSoft QuickBasic 4.5, PDS 7.1
   '
   ' Desc: Beginnings of a QB SVGA library. Allows you to change
   '       screen mode to 640x400x256, 640x480x256, 800x600x256,
   '       1024x768x256 etc. Pixel routine is incredibly slow,
   '       unfortunatly.
   '
   ' (Use at your own risk)
   ' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

   DECLARE SUB Pixel (x%, y%, Col%)
   DECLARE SUB ScreenMode (SM%)

   ' $INCLUDE: 'qb.bi'                            'Required to use
   DIM SHARED InReg AS RegType, OutReg AS RegType 'CALL INTERRUPT

   DEFINT A-Z                   'Defines all variables as Integers

   ScreenMode &H101             'Call sub ScreenMode
   FOR a = 1 TO 640             'Begins "a" FOR-NEXT Loop
    Col = Col + 1               'Increases variable Col
    IF Col = 256 THEN Col = 1   'If Col is bigger than 256,
                                'then set it to 1
    FOR b = 1 TO 480            'Begins "b" FOR-NEXT Loop
     Pixel a, b, Col            'Call sub Pixel
    NEXT                        'Ends "b" FOR-NEXT Loop
   NEXT                         'Ends "a" FOR-NEXT Loop

   SLEEP 1                      'Waits for 1 second or user input
   ScreenMode 3                 'Return to text mode

   END                          'La fin!

   SUB Pixel (x, y, Col)

    InReg.Ax = &HC00 + Col             'Sticks your color into AX
    InReg.Cx = x                       'Sticks x value in CX
    InReg.Dx = y                       'Sticks y value in DX
    CALL INTERRUPT(&H10, InReg, OutReg)'Calls Int 10h, which places
                                       'a pixel at (x, y) with an
                                       'attribute of Col
   END SUB

   SUB ScreenMode (SM)

    'SM (ScreenMode) may be any one of the following:
    '3 = Text Mode
    '&H100 = 640x400x256
    '&H101 = 640x480x256
    '&H102 = 800x600x16
    '&H103 = 800x600x256
    '&H104 = 1024x768x16
    '&H105 = 1024x768x256

    InReg.Ax = &H4F02                      'Sticks 4F02h in AX
    InReg.Bx = SM                          'Sticks ScreenMode in BX
    CALL INTERRUPT(&H10, InReg, OutReg)    'Using InRegisters,
                                           'calls Int 10h and
                                           'sticks output (none in
                                           'this case) into
                                           'OutRegisters
   END SUB
[end]

13) CAN I CREATE A TSR IN QB?

   The real question is, do you want to use external libraries, or
   do you want to use a language other than QuickBasic?  If your

'>>> Page  14  of Code FAQ ends here. Continued in next message.

 * Brought to you by Greg's Little QBasic Auto-Poster *

--- Maximus 3.01
* Origin: The BandMaster, Vancouver, B.C., Canada (1:153/7715)
SEEN-BY: 633/267 270
@PATH: 153/7715 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.