                        BSAVING AND BLOADING IN QBASIC
                            a tutorial by Mallard
                            Revision 2 - 7/5/1997

            ******CODE FROM THIS TUTORIAL IS IN GRAPHICS2.ZIP******

            [ note - this tutorial assumes you have read my ]
            [ first graphics tutorial, GRAPHICS.TXT.        ]

            This tutorial is intended for intermediate programmers
               who are proficient with standard QBasic commands.

               taken from The QBasic Page at http://qbasic.com


[table of contents]

(1)  so what are BSAVE and BLOAD?
(2)  making excellent graphics in EGA/VGA



[so what are BSAVE and BLOAD?]

        BSAVE and BLOAD are two commands in the QBasic environment to allow
   you to save graphics created using the method I explained in GRAPHICS.TXT
   in a file.  The file can then be loaded instantaneously from a program,
   eliminating many of the delays created using the GRAPHICS.TXT method.
        Both of these commands save part of memory to a file - they don't
   just have to be used for graphics.  This tutorial focuses on graphics.
   To point BSAVE and BLOAD to the right memory address to start saving
   from, you must use the DEF SEG statement in this form:

        DEF SEG = VARSEG(arrayname(0))

        arrayname is the name of the array you stored the graphic name
   in using the GET command.  After you are done BSAVEing or BLOADing,
   use a solitary DEF SEG command to point memory back to where it should
   be.
        BSAVE is the next command you will learn in this tutorial.  Its
   basic syntax is:

        BSAVE "graphic.ext", offset, length

        "graphic.ext" is the filename of the graphic you want to save.  You
   can have any filename and any extension - for clarity, in my programs I
   use the .GFX extension, though this is totally arbitrary.
        length is the size of the array you DIMmed to store the graphic in
   using the GET command.  Be sure to get the EXACT number.  The actual file
   will be seven bytes larger than the length you specify here.
        offset is the byte address of where to start saving.  For the purp-
   oses of this tutorial, offset will ALWAYS be zero.  You can manipulate
   these commands so as to save more than one graphic in a single file,
   though I'll probably address this in another tutorial.
        Now, on to the BLOAD command.  Assuming you've already created and
   saved a graphic using BSAVE, it's time to BLOAD the graphic into a
   program.  It's rather simple, really:

        DIM arrayname(length)

        SCREEN screenmode

        DEF SEG = VARSEG(arrayname(0))
        BLOAD "graphic.ext", 0
        DEF SEG

        PUT (0, 0), arrayname

        Of course, you'll need to stick your arrayname and length into this
   program along with the name of the file.  I have attached with this tut-
   orial an example of this, BSAVE.BAS, in which I BSAVE and BLOAD a picture
   of a planet successfully.  Look at this and experiment before moving on
   to the next section.
        Be sure to use the same SCREEN mode when you BSAVE and when you
   BLOAD a graphic.  For instance, if you BSAVEd a graphic in SCREEN 7,
   you *must* BLOAD the graphic in SCREEN 7, too.  BSAVE files are not
   screen-mode interchangeable.

---------------------------------------

[making excellent graphics in EGA/VGA]

        Your best bet for making good graphics in EGA mode is just to
  practice using the technique I explained in GRAPHICS.TXT.  VGA mode
  graphics can be created using a different method which will yield
  better results.
        For VGA graphics, it's best to create sprites in a paint program
  (for example, CorelDRAW! or Autodesk Animator) and save them in .GIF
  mode.  Use the .GIF loading code attached to this tutorial to load the
  .GIF in QBasic, then GET it into an array and BSAVE it into QBasic
  format.  An example of this is also attached to the tutorial.



        The code above can be modified to whatever your needs.  If you need
  more help with using the graphic techniques explained in this tutorial,
  please feel free to e-mail Mallard at mallard@qbasic.com or visit The QBasic
  Page at http://qbasic.com.

[End of Document.]
