Computing: DOS, OS/2 & Windows Programming

Installing and running PowerBASIC on FreeDOS.

Some time ago, I've written a tutorial about Installing and running FreeBASIC on FreeDOS. FreeBASIC is a free 32-bit compiler for the BASIC language. It is open source and licensed under the GPL. It is designed to be syntax compatible with QuickBASIC, while expanding on the language and capabilities. It can create programs for MS-Windows, DOS and Linux, and is being ported to other platforms. FreeBASIC is relatively new (in my tutorial, I use version 1.07.1a from 2019), so it has been created long after the glorious DOS days. On the other hand, FreeBASIC for DOS continues to be developed.

There is a BASIC compiler, that from the point of view features and performance, is similar to FreeBASIC: PowerBASIC. "PowerBASIC offers a selection of compilers and other tools for software development. Perfect for all programmers, whether you’re a novice, an expert, or somewhere in between", they say on the product's website. To add, that PowerBASIC is commercial, so if you want to run the actual version (on Windows, or on DOS 16-bit), you'll have to pay. However, as a difference with FreeBASIC, PowerBASIC exists since the 1990s. It's a continuation of Borland TurboBasic, and was originally notable as a BASIC compiler, when most BASIC environments were interpreted. The old DOS versions have become abandonware, so we can legally use them free of charge.

You can download PowerBASIC 3.5 from the PowerBASIC 3.x page on the WinWorld website. The download includes three 3.5" 1.44 MB floppy diskettes. Only the first of them is needed for the installation; the other two contain the documentation in PDF format.

The diskette only contains three files. Run INSTALL.EXE to start the installation. The screenshot shows the first screen displayed by the setup program.

PowerBASIC on FreeDOS: Installation - Program version and copyright info

After acceptance of the license, you are asked for the installation directory (I chose C:\PB35) (screenshot on the left), then you are asked if you want to add the EMM386 driver to CONFIG.SYS in order to make it possible to store arrays into EMS (screenshot on the right). You can answer this question with "No", as the standard FreeDOS boot configuration already supports EMS.

PowerBASIC on FreeDOS: Installation - Choosing the installation directory
PowerBASIC on FreeDOS: Installation - EMM386 driver not needed on FreeDOS

You can view the readme file, if you want. Installation is finished now. If you want, you can copy the PDF files from disk 2 and 3 to your PowerBASIC directory on FreeDOS (this way you'll have all together).

The screenshot below shows the content of the directory C:\PB35. Among the files, note PB.EXE, the IDE, and PBC.EXE, the compiler; for the other executables, have a look at the manuals.

PowerBASIC on FreeDOS: Content of the installation directory

As for all my development software on FreeDOS, I have created a custom batch file (placed in a directory that is in the executables path), that does the following: 1. Adding the PowerBASIC directory to the PATH environment variable. 2. Setting the directory with my PowerBASIC source files (D:\DEVEL\PB35) as current directory. 3. Launching the PB IDE.
Note that %PATH0% is a custom variable on my system, set equal to %PATH% in FDAUTO.BAT; just use %PATH% instead. You may ignore (comment out, or delete)the environment variable DEVEL, specific to my system.

Here is the content of my PM#.BAT:
    @echo off
    set path=%path0%;C:\PB35
    set DEVEL=pb
    D:
    cd \DEVEL\PB35
    C:\PB35\pb.exe

The screenshot shows the startup of the IDE.

PowerBASIC on FreeDOS: Startup of the PB IDE

Use the menu command Options to configure the IDE.

You should change some of the Compiler settings:

PowerBASIC on FreeDOS: PB IDE configuration - Compile target = 80386 processor
PowerBASIC on FreeDOS: PB IDE configuration - Using the math-coprocessor for floating point operations

In the Environment section, you might want to set Tab size to 2. Be sure to save the new settings. The default filename is PBCONFIG.PB. Saving it into the directory containing the sources (D:\DEVEL\PB35, in my case) is fine.

I copied the file BALL.BAS (included with the PowerBASIC installation files) into my source directory and loaded it into the IDE editor using the menu command File > Open. To build the program, use the commands from the Command menu. Except if you don't want to create an executable, be sure that Destination = EXE file (by default, the program is built to memory without creating an executable file!) is checked (screenshot on the left). Use the command Compile > Compile Main/IDE to build the program. If everything is ok, you'll get a "Success" message, as shown on the screenshot on the right.

PowerBASIC on FreeDOS: Building a program in PB IDE - Compiling with destination = EXE file
PowerBASIC on FreeDOS: Building a program in PB IDE - Successful compilation

The screenshot below has been taken during the execution of BALL.EXE. To note that the program not simply draws this circle, but lets bound the "ball" around on the screen.

PowerBASIC on FreeDOS: Running the included sample program BALL.EXE

If you find this text helpful, please, support me and this website by signing my guestbook.