Dec 082017
DavisWARE Basic Formatter v1.3. The ULTIMATE Basic formatting tool of the 90's. Converts GW-Basic to QB & PB format, as well as, formatting QB/PB code as well.

Full Description of File

DavisWARE Basic Formatter v1.3! The ULTIMATE
Basic formatting tool of the 90's! Converts
GW-Basic to QB & PB format, as well as,
formatting QB/PB code as well. Expands or
Compresses source code lines, types untyped
variables, 2 types of cross ref files,
continue long lines, strip hard tabs &
remarks, cases everything in upper, lower, or
capitalized, and improves source code! All
this in only 3 passes! Major Upgrade Release!

File BASFRM13.ZIP from The Programmer’s Corner in
Category BASIC Language
DavisWARE Basic Formatter v1.3. The ULTIMATE Basic formatting tool of the 90’s. Converts GW-Basic to QB & PB format, as well as, formatting QB/PB code as well.
File Name File Size Zip Size Zip Type
BASFRM.DOC 30519 9908 deflated
BASFRM.EXE 123138 52942 deflated
DWARE.DOC 15734 6087 deflated
FILES.LST 1045 546 deflated
FILE_ID.DIZ 470 299 deflated
HISTORY.DOC 4827 1814 deflated
ORDER.FRM 9988 3487 deflated
PC-MAZE.NEW 8494 2378 deflated
PC-MAZE.OLD 6718 2331 deflated
TPCREAD.ME 199 165 deflated

Download File BASFRM13.ZIP Here

Contents of the BASFRM.DOC file

DavisWARE Basic Formatter Version 1.3
(C) Copyright 1992 - James R. Davis
All Rights Reserved!


Well it happened again. I got so tired of using three different programs
to do the job of one program. One of them had a pause in it (shareware
version) that made it take forever to format a source file. In addition to
the long delay at the begining, it also took FOUR passes, no less, and without
taking into account tabulation, or indentation. That required the use of yet
another program on the processed file, just to make it look halfway decent!
Then if I wanted a cross reference of all my variables, labels, etc, I had to
run yet ANOTHER program to do it. Three different programs, for one job???
Naaaa... I can do better than that! That is what spawned BASFRM!


Those of you who know what programs I am talking about will find this one
a delightful change, and also a completed product for making your programming
jobs easier and less frustrating.

What BASFRM does is this:

It will take practically ANY ASCII basic source code and format it into
a good looking, fully functional program. It doesn't just handle Quick Basic
or Power Basic source, but also GW-Basic source. And all in, get this, THREE
passes! Not to mention that it will also generate a cross reference of all
the data once it's finished if you want it to!


Well, let's look at a concrete example.

You've been working on this great program. It works, but...

A) Your programming style, leaves much to be desired.

B) You use un-typed variables (by un-typed I mean, you use X instead of
X% which takes up more time in processing in the long run).

C) You use alot of DEFINT commands so you don't have to worry about your
un-typed variables.

D) You never tabulate your commands to follow the nesting level of your
loops or conditional blocks.

E) You tend to use a lot of colons in your source, often using 300
characters on one line making it hard to follow your program's logic.

F) You mix your structure and spacing making it hard to follow

G) You lose track of what variables you use, or what subroutine you last
called, producing lots of spagetti code.

If you use any, or all of the aforementioned programming no-no's, then
BASFRM is for you.


This program will take your source code, and then separate the
commands, leaving exactly one command on each line of code. Then, it will
format your code to make it look good by indenting the commands between your
loops, like FOR/NEXT blocks, WHILE/WEND loops, DO/LOOP blocks, etc. It will
then go through each command, taking the variables and basic keywords and
formatting them in UPPERCASE, lowercase, or Capitalized. Then again, if you
want, it will leave them the way they are. It will also find un-typed
variables, and assign a variable type (and senses your DEFtyped variables as
well!). It will generate two different kinds of cross reference files, once
it's finished, so you can track down where all your variables are used. You
can change the defaults easily by using the /I switch. All defaults can be
saved to the program, by cloning, for future use. There's no need for a
configuration file. Included with the program is an old GW-Basic program
called PC-Maze that was converted to QB/PB format using BASFRM! PC-MAZE.OLD
is the original program, and PC-MAZE.NEW is the improved version after running
through just once! Give it a try to see what actually occurs during the
formatting process. You'll be amazed at the speed!

Here's an example program before running BASFRM on it:


FOR X=1 TO 15 'Start a loop
for y=1 TO 10
select case X 'Get the loop going
case 1
case 15 'make it look good
end select
line Input#1,a$
print"'ello" 'Okay here's another

'Now let's go for it again!

call TestSub(X)
if x=1 then a=1
print#2,"There are"x"people here."

SUB TestSub(X)
if ThiS=ThaT then 'Test this sucker out!
end IF

Now here's what the same program looks like after running BASFRM on it:

DEFLNG A-C <--- Note #1a

FOR X%=1 TO 15 'Start a loop
FOR Y%=1 TO 10
SELECT CASE X% 'Get the loop going
CASE 15 'make it look good
PRINT "'ello" 'Okay here's another
NEXT X%,Y% ^----------------------------- Note #2

'Now let's go for it again!

A=RINSTR(A$,"X") <--- Note #3
CALL TestSub(X%)
IF X%=1 THEN A=1 <--- Note #1b
PRINT #2,"There are";X%;"people here." <--- Note #4

SUB TestSub(X%)
IF This%=That% THEN'Test this sucker out!

Note #1: Notice that at the beginning of the program we DEFtyped a series
of variables that began with the letters A through C as long
integers in Note #1a. As you can see in note #1b, the A
variable is not touched by the unassigned variable typing
routines. This makes your compiler happy because it won't have
to load the routines to handle them later, thus optimizing your
source code further. (This was added in version 1.3)

Note #2: When a embedded remark is encountered, it is stripped from the
processing, and replaced in the exact same position it was
located on the source line, unless the source line has been
expanded past the point where it originally had been placed. In
that case, it is placed directly after the last command on the
source line.

Note #3: Notice that the subroutine that was called [RINSTR()] is not
mistaken for a variable, even though it is not in the source.
If an $INCLUDE statement is encountered in the first pass, then
the included file is searched for sub/fn names and excludes them
from the typing routines. This also occurs if a CALL statement
is encountered in the second pass.

Note #4: If the program encounters an improper PRINT statement, even
though it is a valid command, it will correct it in the second
pass so that it is more readable and easily debugged later.

Now if you don't see the difference this program makes on your source
code, then you've got to be blind! Notice how much easier it is to follow the
loop structure, and how uniform the whole program is now. It's easier to spot
your variables, and generally makes it appear to be done by a professional!


First Pass: What occurs here is that all the labels will be grabbed for use
in separating the lines in the next pass. It will also look in
any $INCLUDEd files for SUB or FUNCTION names so they won't be
treated as regular variables. If an include file given does
not contain a drive and a path, the program will looks at the
environment variable BFINC. You can set this yourself as a
default directory before invoking the program. It must end in
a backslash (\). (e.g.: SET BFINC=C:\BASIC\INCLUDE\)

Second Pass: In this pass, most of the work is done. What happens here is
that the IF/THEN/ELSE statments are expanded to
IF/THEN/ELSE/END IF and the source code is tabulated
occordingly. All printed statements are corrected to proper
format in the following manner

PRINT TAB(5)"Help"X+1 and PRINT "Help"STRING$(14,"-")"me"


PRINT TAB(5);"Help";X+1 and PRINT "Help";STRING$(14,"-");"me"

If you are converting a GW-Basic program over to QB/PB format,
all the labels are cross checked and standardized. This may
not sound like much, but believe me... it's the biggest routine
in the program!

Third Pass: In this final pass, what occurs is that all the syntax is
checked, all the variables, SUBs, FNs, Labels, and keywords are
cased occordingly, and all 'REMarks are removed if so desired.
Your lines are either expanded the way that Quick Basic does,
or compressed taking out all those unnecessary spaces. All
un-typed variables are typed with your default and any default
contained within the DEFtype command as well, and when
finished, you will have a completely over-hauled piece of
source code, ready to go!

NOTE: If you option for a cross reference file to be generated, an extra
pass will be performed on the code.


This program has been through a rigorous beta testing! I have never had a
program go through as much testing as this one has, and I thank all those
involved in doing so, but I cannot guarentee that ALL quirks of the language
have been compensated for, but I do believe I have gotten 95% of them covered.
Depending on your programming style and preference, will greatly modify this
programs performance. The sloppier and more inprecise the code you run
through this program, the longer it may take to process. Whereas the better
the program you run through this program, the faster it will be. You can more
or less use this program as a gradient to test just how good your programming
style is! Another hidden feature! 🙂


To begin with, you need to change the defaults, unless of course you feel
comfortable with them the way they are. The current defaults are set up

The original file is BAKed up and kept.
The indent width in spaces is 2.
The length of hard tabs (ASCII 9) is 1 space.
The indent width for Labels, SUBs, and FN is 0.
'REMarks are placed flush left, unless they are embedded.
Source code lines are expanded.
Long lines are not continued with an underscore (_).
The ELSE, ELSEIF, and CASE commands are indented 1 space.
Basic Keyword commands are placed in UPPERcase.
Labels, SUBs, and FNs are not cased at all, and left alone.
Variables are Capitalized.
Un-typed variables are given the % (integer) declaration.

You can change any of these defaults by using its complimentary command
line switch. You can further use the /I switch on the command line to take
you to the internal default editor:


The internal default editor will look like this:

[1] Original is (K)ept/(D)eleted : K
[2] Indent width in spaces (0-40) : 2
[3] Hard TAB [ASCII 9] width in spaces (0-40) : 1
[4] Indent width for Labels, SUBs/FNs in spaces (0-40) : 0
[5] 'REMarks are (F)lush left/(I)ndented/(R)emoved : F
[6] Source code lines are (C)ompressed/(E)xpanded : E
[7] Continue_ long lines?: (Y)es/(N)o : N
[8] Indent ELSE/CASE/ELSEIF Statements?: (Y)es/(N)o : Y
[9] Keywords Case: (U)PPER/(l)ower/(C)apitol/(N)oNe : U
[0] Labels, SUBs, and FNs case: (U)P/(l)ow/(C)ap/(N)oNe : N
[A] Variables case: (U)P/(l)ow/(C)ap/(N)oNe : C
[B] Unassigned Variable Type: (%,&,&&,!,#,##,None) : % - Integer

------ Selections marked with are skipped in FAST mode ------

[C]ontinue without saving [Q]uit Install
[D] restore Defaults [R]egister this program
[F]AST mode, currently OFF [S]ave settings and end.

You change the defaults by pressing the related key within the square
brackets ([]) until your choice is displayed. Each valid choice is displayed
between the parenthesis. Each default is described below:

[1] Original is (K)ept/(D)eleted
This default tells the program wheather or not you wish to keep the
original file in a BAK file once the program is finished formatting.
The current default is K for (K)ept.

[2] Indent width in spaces (0-40)
This indent width is defined in spaces, not tabs. Each time a loop is
encountered within the code, the loop will be formatted with the
following formula: Position = Indent_Width * Current_Loop_Level.
If the current loop level is 4 levels deep, and the indent width is
set to 3 then the indentation of the command will be placed 12 spaces
from the beginning of the line. The current setting for this default
is 2, but can be any number from 0 to 40.

[3] Hard TAB [ASCII 9] width in spaces (0-40)
Hard tabs are produced by some text editors such as Q-EDIT that in all
actuality are tabs, but only take up 1 character within your file.
Some programmers tend to use text editors to do their programming in
and this can produce problems with this program. So, in order to
correct that problem, I have included this default which in all
actuality, strips out all ASCII 9 characters occured and replaces them
with the number of spaces you set this default with. If you are using
a text editor, you may wish to set this default to the size of tabs
you have set in your text editor. This default is currently set to 1

[4] Indent width for Labels, SUBs/FNs in spaces (0-40)
The indent width for Labels, Subs, and Fns is defined with this
default. The number of spaces you have this set to, will be the
number of spaces that will be placed in front of your Labels, Subs,
and Fns. This is currently set to 0.

[5] 'REMarks are (F)lush left/(I)ndented/(R)emoved
This default tells the program how you wish to handle remark lines.
They can be either Flush Left, Indented at the current indention
level, or Removed completely from the source code. This is currently
set to make your remarks Flush Left.

[6] Source code lines are (C)ompressed/(E)xpanded
This default tells the program how you would like you completed source
code lines to appear. In Compressed format, all unnecessary spaces
are removed, whereas in Expanded format, spaces are placed in between
all the operators, keywords, etc, in much the same way that the Quick
Basic's IDE (Integrated Developement Environment) does whenever you
move your cursor to a new line after typing in your code. This is
currently set to Expand all source code lines.

[7] Continue_ long lines?: (Y)es/(N)o
This default tells the program that you wish to conitue long lines of
source code with an underscore [_] so that all your source code
appears on the screen instead of having to move your cursor over to
the end of a long line so you can see what's going on. This is
currently set to No.

[8] Indent ELSE/CASE/ELSEIF Statements?: (Y)es/(N)o
This default will tell the program that if it occurs any ELSE, CASE,
or ELSEIF keywords, it will place 1 space in front of it to make you
loops look more unique. This is currently set to Yes.

[9] Keywords Case: (U)PPER/(l)ower/(C)apitol/(N)oNe
This default will tell the program to turn all keywords it encounters
into the case you specify. This can be set to put all keywords in
uppercase or lowercase, capitolize the first letter of each keyword,
or leave them alone completely. This is currently set to change
keywords into Uppercase. Note: This is skipped if FAST mode is

[0] Labels, SUBs, and FNs case: (U)P/(l)ow/(C)ap/(N)oNe
This works the same way that default 9 does, only in this case it
works on labels, sub and function names. See default 9 above for
further info. Currently set to None. Note: This is skipped if FAST
mode is utilized.

[A] Variables case: (U)P/(l)ow/(C)ap/(N)oNe : C
This works the same way that default 9 does, only in this case it
works on your variables. See default 9 above for further info.
Currently set to Capitolize. Note: This is skipped if FAST mode is

[B] Unassigned Variable Type: (%,&,&&,!,#,##,None) : % - Integer
This default tells the program that you wish to have your untyped
variables typed with the default you give it here. The following
describes what each selection in this default means, and various
compatibility with compilers:

Sym Definition Supported by
--- ---------- ------------
% - Integer Quick and PowerBASIC
& - Long Integer Quick and PowerBASIC
&& - Quad Integer PowerBASIC only
! - Single Precision Quick and PowerBASIC
# - Double Precision Quick and PowerBASIC
## - Extended Precision PowerBASIC only

Make sure your compiler supports the option you wish to use before
setting this default. If it is set to None, no typing is performed on
untyped variables. This is currently set to type untyped variables to
integer format. Note: This is skipped if FAST mode is utilized.

[C]ontinue without saving
By pressing [C] while at this menu, if you specified a file on the
command line along with the /I option, the program will continue to
format the file specified using the defaults the way they are set now,
without saving them at all. This can come in handy if you wish to
change only a few of your defaults, to format a file without saving

[D] restore Defaults
By pressing [D] at anytime in this menu, all the programs original
defaults will be restored. This can come in handy if you mess up and
want to start all over again.

[F]AST mode, currently OFF
By pressing [F] at this menu, you will notice the current setting of
the FAST mode change from OFF to ON. This comes in handy if you wish
to format in FAST mode on the file specified on the command line.

[Q]uit Install
By pressing [Q] at anytime, will return you to DOS without saving any
of your settings. Think of it as the quick abort.

[R]egister this program
By pressing [R] you will be taken to the registration screen, which
will allow you to register your copy of this program. This is only
useful for those who register this program.

[S]ave settings and end.
By pressing [S] in this menu, you will save your current setting
permanently to the EXE file for future use, and return to DOS. Once
saved the defaults you set will always be in use whenever the program
is invoked. (IMPORTANT NOTE: The EXE file must not be PKLITEd before
you invoke this command. Only after the defaults are saved the way
you would like them, can you PKLITE the EXE! If the original EXE was
over 100k in size, it should not be PKLITEd, if not, UN-PKLITE before
saving your defaults.)


To begin formatting a program, type the following command:

BASFRM [*]filespec[.ext] [switch]

Everything contained within the square brackets is optional. Anything
separated by a pipe [|] shows a selection of items that only one of which can
be used. Anytime you see a plus sign (+) it means that by using it with a
switch, you will turn that feature ON. Anytime you see a minus sign (-) it
means that by using it with a switch, you will turn that feature OFF. Here is
a listing of all the available command line switches:

* - Placing a asterisk [*] in front of the filename tells the
program that you wish to run in FAST mode. This is optional.
(See selection [F] in installation above for further info on
FAST mode.)

filespec - This is the name of the file you wish to process. The file
must be in ASCII text. If you wish to convert from GW-Basic,
you must save the file using the ,A command.

.ext - You can include the extention, but if you omit it from the
filename, .BAS is assumed. This is optional.

/XL - By specifying this command line switch, you tell the program
that you wish to generate a cross reference file that will be
referenced by labels occured within the program, when the
first three passes are finished.

/XN - By specifying this command line switch, you tell the program
that you wish to generate a cross reference file that will be
referenced by source line numbers in the program, when the
first three passes are finished.

/XXL - Will tell the program to skip the first three passes and
generate a cross reference file on the filename specified.
If this option is selected to process a file that has not
been formatted by this program, the results can be
unpredictable. (See the /XL option above.)

/XXN - Will tell the program to skip the first three passes and
generate a cross reference file on the filename specified.
If this option is selected to process a file that has not
been formatted by this program, the results can be
unpredictable. (See the /XN option above.)

/BAK[+|-] - Turn the baking up of the original file ON or OFF.

/REM[F|I|R] - Set the 'REMark handling to place the remarks either (F)lush
left, (I)ndented, or (R)emove them all together.

/INDxx - Set the indent width of your source code lines in spaces,
where xx is a number from 0-40

/TABxx - Set the Hard TAB (ASCII 9) width in spaces, where xx is a
number from 0-40. This is the number of spaces that will
be replacing any (ASCII 9) characters found in your code.
Usually, most text editors default to 4,6,8 spaces.

/LBIxx - Set the Labels/Subs/FNs indent width in spaces, where xx is a
number from 0-40.

/CPR or /EXP - Set the source code handling to either compressing (CPR) the
source code (by taking out all the spaces) or expanding (EXP)
the source code (puts all the spaces in between operators,
must the way that QB's IDE does it automatically).

/CNT[+|-] - Set the continuing_ of lines longer then 78 characters ON or

/IEL[+|-] - Set the indenting of ELSE/ELSEIF/CASE statements one
tabulation space more (as set with the -INDxx switch above)
ON or OFF.

/KEY[U|L|C|N] - Change the casing of basic keywords to (U)ppercase,
(L)owercase, (C)apitolized, or (N)ot changed.

/LAB[U|L|C|N] - Change the casing of Labels/Subs/FNs to (U)ppercase,
(L)owercase, (C)apitolized, or (N)ot changed.

/VAR[U|L|C|N] - Change the casing of Variables to (U)ppercase, (L)owercase,
(C)apitolized, or (N)ot changed.

/TYP[xx|N] - Change Unassigned Variable Type where xx is %,&,&&,!,#,##, or
(N)ot Changed. (See [B] previously under INSTALLATION for an
explaination of what each symbol here represents.)


When the program is operating correctly, you will see the following

Formatting filename : TEST.BAS Backup original file: Yes
Line handling : Expanded Hard TAB space width: 1
Indent ELSE/CASE? : Yes Width of tab spaces : 2
BASIC Keywords case : Upper case Position of Labels : 0
Variable case : Capitolized 'REMark handling : Flush Left
Labels/SUBs/FNs case: Not Changed Continue_ long lines: No
Unassigned variables: % - Integer Generate Cross Ref? : Yes
------------------------[ Current Processing Status ]-----------------------
Current Pass : 1st Remarks Processed : 0
Percent Complete : 0.00% Lines Continued : 0
Current Line Number : 1 Sub/Fn's Found : 0
New File Line Number: 0 Keywords Found : 0
Labels Found : 0 Variables Found : 0
Labels Changed : 0 Opened Files Found : 0
-------------------------[ Current Processing Time ]------------------------
Time Process Started: 12:20:37.93 Current Process Time: 12:20:39.13
------------------------[ Current Processing Comment ]----------------------
- Grabbing Labels and $INCLUDEd Sub/Fn's

The display is broken up into four sections. The first section displays
what the current defaults contain. The second section displays the current
process that is taking place and what is occuring. The third section displays
the programs timer and how long the entire program will take to complete it's
task. The fourth and final section tells you what actually is occuring in the
program at any particular time. You can press ESC at any time during
processing to abort the process. Your original file will not be touched, and
all work files will be deleted.


What occurs in FAST mode is that all variable, label, keyword, sub/fn
casing, and untyped variable typing is bypassed, thus speeding up the program
in it's final pass. There are also some source code plugs that you can place
directly into your source code for processing. Take a look at the example
below and read the description that follows:

FOR x%=1 to 10
gosub Jump
next X
PRINT "This part of the code has already been processed!"
print"Process me"

Would become:

FOR X%=1 TO 10
PRINT "This part of the code has already been processed!"
PRINT "Process me"

By stratigically placing a 'BASFRM+ or a 'BASFRM- in already processed
source code, you can skip over large chunks of code, thus speeding up the
program processing. One thing that is necessary though is that the 'BASFRM+
plug must be placed after the first label in the code unless, the 'BASFRM-
switch is placed before the first label. Otherwise, unpredictable tabulations
may occur.

Here's a list of all the source code plugs:

'BASFRM KEYCASE [UPPER|lower|Capitol|NoNe|Default]
'BASFRM LABCASE [UPPER|lower|Capitol|NoNe|Default]
'BASFRM VARCASE [UPPER|lower|Capitol|NoNe|Default]
'BASFRM VARTYPE [%|&|&&|!|#|##|None|Default]

They should be pretty self explainitory. By using the DEFAULT switch, you
will be using the program's last saved defaults. You don't have to type out
the full switch word either, you can just use U,L,C,N, or D, except for the
VARTYPE switch. Any of these commands can be in upper, lower or mixed case in
the source code (it's not picky).


I'd like to thanks the following individuals for they're exceptional help
in finding all the little bugs and the suggestions they have given in testing
this program out thoroughly:

Dave Navarro for introducing me to PowerBASIC and all it's power.

Lloyd Smith for all his enthusiasm and complete confidence in the success
of this program.

Joe Negron for his exemplery work in finding bugs and his excellent
reporting of things I could never have expected!

Alan Earnshaw for providing many suggestions that were implemented in this

Max Bernard for helping out in many ways, all of which I could not
possibly list at this time.

Thanks to all of you, this program has become a reality! Without your
help and support, I probably would have given up long ago.


This program is Shareware, meaning... IT'S NOT FREE... BUT it is not
disabled in any way either. No hidden pauses, features, or other hype like
some authors so frustrating do these days. If you find that you use this
program (more then 5 times) then send for registration.

The registration fee for this program is $20.

That's a very reasonable price considering all the work that I have put
into this sucker! If you would like to register this program, use the
inclosed ORDER.FRM... Read it's instructions... It should be clear enough!
Shareware is a TRY-BEFORE-YOU-BUY concept that remains alive because of people
like you who do register software. If everyone didn't register, us authors
would probably end up totally discouraged and completely broke! I do hope
that you like this program and find it worthy of your programming tool
collection. Until the next version...

-=> James "The Garf!" Davis! <=-

 December 8, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>