Bload, Bsave

 BBS: Inland Empire Archive
Date: 07-02-92 (21:14)             Number: 2162
From: MATT HART                    Refer#: NONE
  To: ERIC FORD                     Recvd: NO  
Subj: Bload, Bsave                   Conf: (2) Quik_Bas
 > MH> ' BPSET.BAS  Matt Hart

 EF> Hey, how do I do this for SVGA?

You just change this:

 > MH>     InRegs.AX = &H10           ' EGA 640x350x16

To the mode listed in your SVGA manual for hi-res modes.
On my SVGA with Oak Technologies BIOS, I can get
1024x768x256 by using:

     InRegs.AX = &H59

 EF> How many colors can I get?

How ever many your graphics card will support.  There is also an interrupt
call to change the palette colors.  The "Colors" are
actually "Palettes".  A color is assigned to a palette.  If
you want 256 palettes, you can trick QB into doing it for
you with:
     SCREEN 13                ' VGA 320x200x256
     InRegs.AX = &H59         ' Oak SVGA 1024x768x256
     CALL InterruptX ....     ' Switch to SVGA mode
     PALETTE 255,ColorNum&

The PALETTE command works because BASIC thinks it is in
320x200x256, when in reality the computer is in a higher
res mode.  But the PALETTE command just calls the BIOS
interrupt (probably - there are other ways of changing the
palettes) and it still works no matter the mode - just pick
a BASIC supported screen mode that has the same number of
colors as the extended mode that you want.

 EF> Can I do things other than a point?

Yes, you can do a LOCATE Row,Col,CursorON/OFF,StartScan,EndScan.  If you
tried a LOCATE in a mode BASIC doesn't recognize, you'd
quickly find that it doesn't work quite right.  But all of
the services are available through Interrupt 10h.  You can
scroll the screen (or just part of it) up and down, read a
character (like a Char = SCREEN(Row,Col) command), print a
character (which no longer works through BASIC since it
thinks it's in a different mode), change video pages, and
on later versions of video BIOS, write an entire string
(rather than one character at a time).  Some BIOS's also
have other commands, such as scroll left and right, smooth
scrolling, etc...

 EF> This should be faster, too?

The BPSET routine is probably faster than a regular PSET,
but the stuff required to do a LINE, CIRCLE, PAINT, etc...
doing only PSETs would be far slower than native QB

  Do you have an alogarithm (so I won't have
 EF> to make one) to do lines or circles using this thing?

I haven't written any in at least 8 years - the last time was on an Apple ][
and on a TRS-80 Model I.  The best routines are direct
video writes rather than BIOS calls.  I suggest a couple of
books - Power Graphics Programming by Michael Abrash, and
Programmer's Guide to the EGA and VGA w/Super VGA - I don't
remember the author (I'll try to remember to get it next
time I'm at work if you need it).  Both have routines for
LINE and CIRCLE drawing.  Unfortunately, they are either in
Assembly or C, and at least a small understanding of the
languages are needed.  There are some SVGA libraries
available that are compatible with QB, including at least
one Shareware I've heard mention of.  Personally, I'd try
finding one of those rather than try and write a line or
circle algorithm myself.  Specialty needs are the only
thing I've tackled in assembly for SVGA.
 * 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