GWBASIC Source Code Libraries of General Purpose Routines

placed in the public domain by Gary Peek
from Gary Peek's BASIC Source Code Archive

As I was writing DOS based BASIC programs over the years I found the need, (as many programmers who used BASIC did), for general purpose subroutines that could be used with the programs I was writing. At one time I even packaged a well documented set of routines for sale. The result of this work was ROUTINES.BAS.

It has features that you have seen on many older DOS programs like shadowed boxes with selectable color combinations. I actually put too much effort into putting all these features in it, because I reverted to using (and still use) just a monochrome subset of these routines in ROUTSMAL.BAS. I also continue to make slight improvements to ROUTSMAL when I have the need.

I recommend ROUTSMAL over ROUTINES except to learn how to do something or to copy a routine you need that is not in ROUTINES. Also, the line numbers between the two are different. Keep in mind that some of the test programs and other complete programs described on other pages may use some of these routines in a way that demonstrate them better or better provides a way to extract them for your uses.

The subroutine that started it all was EDITSUB.BAS, a replacement for BASIC's INPUT statement, and is still useful if you need something small.

Note: Some of the programs in the Miscellaneous section use some of these subroutines or earlier and simpler versions of them. The assembly language interface subroutine is the only place where it was necessary to have different commands for GWBASIC and QuickBASIC, and it is commented.

ROUTSMAL contains only the following:

ROUTINES contains the following:

The following require the assembly language interface:

This is the assembly language interface:

ROUTINES is so large that there is not enough room in the GWBASIC interpreter to include demo code to show how to use it, so I broke it apart into files that include parts of ROUTINES and demo code. They are as follows:

ROUTDEMI.BAS, assembly language interface, mouse support. This is a crude EGA graphics drawing program. (However, a better graphics program can be found in the graphics program area.)

ROUTDEMF.BAS, file selection. (However, ROUTSMAL has monochrome file selection routines with more features.)

ROUTDEMD.BAS, display and data entry.

ROUTDEMG.BAS, block graphics, bar charts. All of these work on monochrome monitors.

ROUTDEMM.BAS, menus and menu selection. "Point and shoot", toggle lists of items, etc.

log file