PowerBASIC
| Company type | Private |
|---|---|
| Industry | Software development |
| Predecessor | Turbo Basic (Borland) |
| Founded | 1989 |
| Founder | Robert "Bob" Zale |
| Fate | Acquired source code by Drake Software in 2017 |
| Headquarters | United States |
| Products | PowerBASIC compilers (PBDOS, PBCC, PBWIN) |
| Owner | Adam Drake (since 2017) |
PowerBASIC, initially known as Turbo Basic, represents a series of commercial compilers developed by PowerBASIC Inc. These compilers translate a variant of the BASIC programming language. They are available for both MS-DOS and Windows platforms, with Windows editions offered in both Console and Windows versions. The MS-DOS version's syntax is similar to that of QBasic and QuickBASIC, whereas the Windows versions enhance the BASIC syntax by incorporating numerous Windows-specific functions and enabling calls to the Windows API.
History
The origin of this compiler traces back to BASIC/Z, recognized as the first interactive compiler designed for CP/M and MDOS, which was subsequently adapted for MS-DOS. In 1987, it was marketed by Borland under the name Turbo Basic. Created by Robert "Bob" Zale (1945–2012), Borland discontinued its distribution in 1989; thereafter, Zale regained ownership, rebranded it as PowerBASIC, and established PowerBASIC Inc. to oversee its further development, initially releasing it under the name PBDOS.
PowerBASIC expanded its offerings to include Windows BASIC compilers, with PBWIN serving as their primary product alongside PBCC. Following Bob Zale’s death in 2012, the company’s future became uncertain. Nevertheless, his widow Vivian Zale affirmed in 2014 that operations would continue and announced ongoing development efforts in 2015.
In 2016, Vivian Zale sought a purchaser for the company. By January 2017, Adam Drake of Drake Software had acquired PowerBASIC’s source code with plans to update and enhance the software—a transition publicly confirmed by Vivian Zale.
At the time of Bob Zale’s passing, PBWin11 and PBCC7 were in beta testing phases, while 64-bit compilers and PB/Pro (a combined version of PBWin and CC) were in early alpha development. Despite this progress, development has since ceased; no new releases have appeared since version 10.03 (which was over thirteen years ago as of May 2024), no 64-bit or beta versions have been launched, and no recent updates or bug fixes have been provided. Nonetheless, PowerBASIC Tools LLC continues to offer licenses for the existing 32-bit Windows compilers.
Compilers
Programs written in PowerBASIC are standalone and do not depend on external runtime files. Every compiler edition produces executables that function independently without requiring additional libraries, although they can interface with such libraries if necessary. The PBDOS compiler generates 16-bit DOS MZ executable files, whereas PBWIN and PBCC create 32-bit Portable Executable (PE) format files.
Turbo Basic
Borland's Turbo Basic builds upon traditional BASIC—retaining backward compatibility—by adding features such as a graphics API and mouse interaction capabilities. Unlike many BASIC variants from that era, Turbo Basic was a true compiler, generating native MS-DOS machine code instead of relying on interpretation or runtime environments. Its integrated development environment (IDE) allowed developers to execute BASIC programs internally for debugging purposes or compile them into independent executable files that operate without Turbo Basic or any runtime dependencies.
Code example
The sample below demonstrates Turbo Basic’s ALGOL-inspired BASIC dialect, which supports structured programming elements including optional line numbers, control flow constructs, and subroutine definitions—features not typically found in conventional BASIC dialects.
<syntaxhighlight lang="qbasic"> INPUT "What is your name?: ", n$ PRINT "Hello "; n$ DO
s$ = "" INPUT "How many stars do you want to print"; s FOR i = 1 TO s s$ = s$ + "*" NEXT i PRINT s$ DO INPUT "Do you want to print more stars"; q$ LOOP WHILE LEN(q$) = 0 q$ = LCASE$(LEFT$(q$, 1))
LOOP WHILE q$ = "y" PRINT "Goodbye "; n$ </syntaxhighlight>
(Note: s$ represents a string variable; s is a single-precision floating-point number.)
PowerBASIC for DOS (PBDos)
PBDOS comes with an integrated development environment (IDE) and is compatible with DOS versions starting from 3.30 onward.
PowerBASIC Console Compiler (PBCC)
PBCC is a 32-bit compiler designed for the Windows 9x and Windows NT platforms, including Windows XP, Windows Vista, Windows 7, and Windows Server 2008. Applications built with PBCC can leverage DLL functionality. The compiler offers an IDE that incorporates both an editor and a stepping debugger.
Developers do not need prior Windows programming knowledge to build either character-based or graphical applications using PBCC. Executables produced by PBCC are also suitable for use as Common Gateway Interface (CGI) programs on web servers.
PBCC exclusively compiles executable files and does not support DLL creation; this capability is provided by PBWIN.
PowerBASIC Compiler for Windows (PBWin)
PBWin is a 32-bit compiler compatible with Windows 9x and the Windows NT family, including Windows XP, Server 2008, Vista, 7, 8 (8.1), 10, and 11. It supports the creation and reading of dynamic-link libraries (DLLs) and includes a compiler, an integrated development environment (IDE) with an editor, plus a stepping debugger.
Dynamic Dialog Tools (DDT)
DDT consists of BASIC statements that encapsulate Windows API functions to facilitate the creation and management of dialog boxes and controls. This toolset streamlines GUI development compared to direct interaction with the Windows API. Developers can combine DDT usage with traditional SDK-style Windows API calls.
Trial versions of compilers
Starting November 1, 2016, PowerBASIC made PBWin version 9.07 ("Classic PBWin") and PB/CC version 5.07 ("Classic PB/CC") available as free, no-nag trial editions through their online store for a limited period, alongside PBForms version 1.0.
PB Forms
PowerBASIC Forms is an additional GUI design utility sold separately for PBWin that automatically generates source code using DDT to build Windows forms.
COM Browser
Bundled with PBWin, the PowerBASIC COM Browser displays interfaces, methods, and properties of COM objects derived from type-library files. It allows exporting interface structures for early binding in PowerBASIC programs and provides syntax references along with contextual help for COM interface elements.
Characteristics
PowerBASIC is a native-code BASIC compiler recognized for its ease of use and performance advantages over many other languages. While its compiled output runs efficiently in most scenarios, the compilers also permit inline assembler code to optimize critical sections. The Windows-targeted compilers (PBWin & PBCC) support nearly all instructions in the x86 instruction set, including those for the FPU, SIMD, and MMX, except for a small subset mainly relevant to system-level programmers. Instructions not natively supported can be injected using their respective opcodes via "db", "dw", and "dd" directives. Assembler instructions may be intermixed within BASIC code as long as their interactions are managed appropriately.
Hello world
The traditional "Hello, World!" example illustrates PowerBASIC's syntax and minimal program layout.
Sample PBCC console program (which pauses awaiting user input to prevent immediate termination):
<syntaxhighlight lang="vbscript"> Function PBMain
Print "Hello, World!" Waitkey$
End Function </syntaxhighlight>
Sample PBWin program showing a Windows message box:
<syntaxhighlight lang="vbscript"> Function PBMain
MsgBox "Hello, World!"
End Function </syntaxhighlight>
Structured control statements
PowerBASIC offers structured control constructs designed to minimize the use of GOTO statements and labels:
- iterate – advances to the subsequent iteration within loops (iterate do, iterate loop, iterate for), functioning similarly to the continue statement
- exit – terminates loops (exit for, exit do, exit loop), conditional structures (exit if, exit select), or procedures (exit function, exit sub), comparable to the break statement
Object-oriented programming
Both PBWin and PBCC support object-oriented programming through COM classes, although employing OOP is optional. These compilers enable the creation of both in-process and out-of-process COM Servers.
Graphics
The Console and Windows Compilers facilitate the development of graphic windows using GRAPHIC statements, which provide a more abstracted interface compared to Windows' native Graphics Device Interface (GDI) functions.
Elements of the GRAPHIC statements
GRAPHIC WINDOWS are dialog boxes containing a single control that occupies the entire client area. GRAPHIC controls are child windows equipped with identical drawing capabilities. GRAPHIC BITMAPS serve as memory objects analogous to Windows bitmaps or DIB sections. Integrated keyboard and mouse event handling is provided, with font settings specified via the FONT NEW statement.
Creating a GRAPHIC WINDOW application
A GRAPHIC WINDOW operates similarly to a Windows dialog box featuring a static control designated for rendering graphics. The window can be instantiated using a single BASIC statement that sets its dimensions, position, and title without requiring a custom WNDPROC. For example: <syntaxhighlight lang="vbnet">
- Compile Exe ' compatible with PBCC6 or PBWIN10 compilers
- Dim All
Function PBMain
Local GW As Dword ' initialize a GRAPHIC WINDOW Graphic Window New "graphic window", 100, 100, 200, 200 to GW ' draw a filled ellipse Graphic Ellipse (10, 10)-(190, 190), %rgb_Red, %rgb_SeaGreen, 0 ' await key input Graphic Waitkey$
End Function </syntaxhighlight>
Comparison of PB GRAPHIC statements with the GDI API
Unlike the GDI API which requires specifying the Device Context handle for every drawing call, PB GRAPHIC statements select a GRAPHIC target (WINDOW, BITMAP, or control) once to perform multiple operations.
PB GRAPHIC removes the necessity to create separate brushes or pens and eliminates redrawing triggered by Windows messages such as WM_PAINT. GRAPHIC targets maintain their drawn content persistently.
When used with the REDRAW option, drawing commands are buffered and only rendered upon explicit request, minimizing flicker similarly to rendering on memory DCs in GDI.
Pixel-level access is available through GRAPHIC GET|SET PIXEL commands. Additionally, the entire bitmap can be retrieved as a dynamic string using GRAPHIC GET BITS for manipulation and restored with GRAPHIC SET BITS.
Complementarity of GRAPHIC statements and the Windows GDI API
GRAPHIC statements encompass frequently used GDI API functions; however, developers retain the option to directly access the hDC of any GRAPHIC target to invoke additional GDI API functions when necessary.
User community
PowerBASIC hosts an online forum dedicated to user assistance and the exchange of knowledge. By July 2012, this community had grown to include 5,623 registered members, featuring over 50,000 discussion threads and 400,000 posts since its inception in 1998. Among these, the Source Code section alone contained close to 3,800 threads.
In early 2024, the primary PowerBASIC website was taken offline and displayed a message indicating it was "under construction," which generated considerable conversation within user forums. The current rights holder has confirmed that the website will not be reinstated.
External links
- PowerBASIC official company website
- PowerBASIC Peer Support Community forum
- Börje Hagsten's collection of files
- Don Dickinson's PowerBASIC source code
- Gary Beene's gbSnippets resource
- TheirCorp's PowerBASIC projects hosted on SourceForge
- PowerBASIC for Beginners YouTube channel