PowerBASIC Console Compiler

Ever wished for a BASIC Windows Compiler? One with the straightforward DOS text mode interface but megabytes and megabytes of memory? Ever wished for a Windows compiler that's truly easy to use? Well, now it's here. Today. The PowerBASIC Console Compiler for Windows. With PB/CC, it's a whole new Windows! Text mode every version of Windows from Win95 to Vista and Win10.


Text-Mode Compiler
for WIndows


This newest version of PB/CC sports a number of exciting new features. Total support for both ANSI and Unicode strings with automatic conversion. Simplified resource support. You can add resource data inline, right in your basic source code. There is no need to create a resource file, compile it, and then link it into your source. All this done automatically. Dead code removal. Unreferenced code will be removed from the compiled program to minimize the executable file size. Create client COM applications using Dispatch, Direct, Automation, or Dual interfaces. A complete graphics engine, a printer package for Windows-Only printers, dynamic pointers, and thread local storage, to name just a few. But more about them later.


PB/CC supports INPUT, PRINT, LOCATE, LINE INPUT, INKEY$, INSTAT, CLS, COLOR, KEY, KEY$, and LPRINT. All of the standard text functions. But then we added more. CONSHNDL, CURSOR, INSHIFT, PAGE, PAGEACTIVE, PAGEVISIBLE, SCREENATTR, PCOPY, WAITKEY$ and WAITSTAT. A complete set of mouse handling routines. SCROLL any region of the screen in any direction. STDIN, STDOUT, and STDERR. Even a PARSE statement and PARSE$ function to extract delimited fields, and new options for the EXTRACT$ function, too. All the text tools you'll ever need.


What is a Console?

The Console is a text mode interface connected right to the heart of Windows. It looks and acts just like a text mode DOS program, but it's actually a True Windows application! With a console application, there's no fluff, no animated puppets, just intense computing power. Port existing Basic code from DOS to Windows today! Access a flat memory model that's practically unlimited. Boost performance with true Windows code. Launch multiple concurrent threads. Use the CPU and numeric coprocessor directly with Inline Assembler. Choose Register Variables for your most critical code. With PB/CC, size and performance are the prime factors.



Since the console device is a text-only window, can a console compiler offer graphics? Of course! Just open one or more graphic windows and you're ready to go! You'll use GRAPHIC PRINT to draw plain text or fancy text... Any font. Any size. Any color. Bold. Underline. Italic and strikeout. Mix any combination of fonts on any window. Print just about anything, just about anywhere, even on private bitmaps that aren't yet visible. You'll copy or stretch bitmaps. Shrink them or change them. Circles, ovals, lines and boxes. Fat lines, skinny lines, stylized lines. Arcs, circles, rounded rectangles. Ellipses, pie sections, polygons, polylines. Even get or set pixels -- one by one. Filled forms or empty. Colors or not. The choices are endless. You can mix new colors with those which exist, and measure proportional text size before you print it. Then create a custom scaling system, even with fractional floating point coordinates! Of course, once you've built that work of art, you need to load and save it. So load from a resource, load and save a BMP on disk! Create a virtual graphic window that displays the contents of a larger virtual window. Scroll bars are added so the user can move the viewport to the desired section. There is even an option to allow the user to "drag" the edges of a graphic window to a new size.


Another interesting point is that graphics are extensible. Using the DC (Device Context) from PowerBASIC, you can call the Windows API, your own custom code, even third-party code for special graphic functions. With GRAPHIC GET/SET BITS, you can even manipulate the bitmap directly... each pixel is stored in succession as a long integer color value.


And then there's printing. Access to printers has always been something of an issue, but not any more. We've added extended printing (XPRINT), even for "Windows-Only" printers! Just like GRAPHIC for the screen, XPRINT offers it all on the printer. Print plain text or fancy text -- any font, any size, any color. Bitmaps and images, lines and boxes, circles and polygons, virtually all the features of the GRAPHIC screen are there for printers, too! You can retrieve the size of the printer page, the printable area, the margins, even the number of points per inch. Select landscape or portrait mode, even the print quality setting. The PRINTER$() function returns the name and port of every available printer. You can attach a printer by its name, by default, or just display a printer dialog to let the user decide. It's all in there.


So, can you get here from DOS? But of course! PB/CC's high degree of compatibility with PowerBASIC, QuickBasic, GW-BASIC and BASICA means that you can port existing DOS applications to Windows with ease. Stop CHAINing from module to module in DOS when you can create a single Windows machine code executable up to 2 gigabytes in size. And creating an array that uses 50 megabytes of RAM is as simple as:


   Dim x%(0 To 26214400)



So just how fast is PB/CC anyway? We thought you'd never ask! This tiny example may give you some idea of the power of PB/CC.


  x## = 1
  y## = 1.000001
  t! = Timer
  For i& = 1 To 100000000  
     x## = x## * y##
  t! = Timer - t!


What do we have here? 100,000,000 iterations of a simple floating point operation. On an AMD 64 CPU, PowerBASIC 3.5 for DOS runs this loop in 1.977 seconds. Pretty respectable, we think. PB3 has been benchmarked favorably against every sort of compiler... C++, Pascal, QuickBasic, you name it. It's always competitive.


So what about the PowerBASIC Console Compiler? Same computer. Same operating system (WinXP Pro). Same source code, line for line. No attempt to minimize any background tasks. Elapsed time: 0.209 seconds. May we repeat that? Elapsed time: 0.209 seconds. That's an instant gain of around 945%! Windows versions of PowerBASIC are more than nine times faster than the best DOS Basic around!


So why the big difference? A number of reasons... Attention to detail. Attention to results. A philosophy that requires us to provide the very best possible code generation. We simply don't believe that sloppy coding can always be overcome by ever faster hardware. At some point, every programmer (ours included!) must take on the obligation to write quality code... and we take that obligation very seriously. That's why our entire compiler, including all the library code to be linked, occupies less than 300K! Compare that to multi-megabyte compilers that seem more like dinosaurs! That's a simple example of the attention we pay to careful programming.


I recently bought the PowerBASIC Console Compiler for Windows. Great deal, and what a powerful package. I like it!"
- Ron Schwartz
Pension Actuary, RKS Consultants, Inc.


Register Variables
Of course, performance is a factor of technical design issues, too. Like Register Variables. Normally, every time a variable is altered, assigned, or retrieved, memory must be accessed. That's a relatively slow process, as compared to accessing CPU and FPU registers. So PowerBASIC stores 4 float variables and 2 integer variables from each Sub/Function in a register instead of memory. Simple concept, but very effective. If those variables are referenced frequently, the improvement can be dramatic. Moreover, we let the programmer decide which variables should be register variables... that way, you can decide which will be most helpful. And if you still decline to choose, PowerBASIC will try to pick the best candidates for you, from those at hand.


Just like PowerBASIC for DOS, our console compiler creates text mode applications. They just run faster, deal with gigabytes of memory, and offer access to the Windows API. And since the source code is so similar to PB3 and QB45, it's incredibly easy porting DOS code to Windows today!



A complete Macro facility is provided. That's something seldom seen in a high level language. Essentially, a Macro invokes a text substitution engine which allows you to extend the PowerBASIC language in ways not seen before. PowerBASIC supports single line macros, multi-line macros, even function macros which return a result. And they don't occupy one byte of code space unless actually used. Each macro may take up to 240 arguments, so capacity shouldn't be an issue. MACROTEMP may even be used to specify identifiers which are made unique to each macro expansion, thus avoiding name conflicts. With PowerBASIC macros, you can design your own unique, personal language!


Mix Unicode and ANSI in the same program. Convert strings to and from OEM, Unicode, ANSI, and UTF-8. Display Unicode characters. Print Unicode characters. Read and write to Unicode files. Conversions from Unicode and ANSI are automatic. You can even select to have a complete Unicode emulation package in your executable to allow them to run properly on Windows 95, 98, and ME or select to have the runtime only use ANSI API routines.


Thread Safe Code
PowerBASIC is entirely thread-safe, so multi-threaded applications are a breeze. Isn't it good to know your program can handle 2, 3, or 5000 tasks, all at the same time? You can print a report, while still allowing data entry. Watch for a hardware signal, while calculating data services. All the power you need is packed right into the PowerBASIC Thread Statement, along with its simple extensions. There is even a built-in THREAD object that offers a collection of methods which allow you to easily create and maintain additional threads of execution in your programs. Functions, Subroutines, Methods, and Properties can even be marked as THREADSAFE. When a procedure is declared THREADSAFE, PowerBASIC automatically establishes a semaphore which allows only one thread to execute it at a time. Others must wait until the first thread exits the THREADSAFE procedure before they are allowed to begin. This is important to protect global data (global, threaded, static, and instance variables) from corruption by interaction of the threads. PowerBASIC even offers THREADED variables for "Thread Local Storage" -- each THREAD get its own unique copy of the variable -- automatically.


Build COM Components
Client COM services,and support for the Dispatch, Direct, Automation, and Dual Interfaces lets you tap the power of components. Invoke libraries and applications with ease, all controlled from your PowerBASIC client program. You'll find that the PowerBASIC object implementation is very efficient, with virtually no degradation of execution speed as compared to standard Subs and Functions. Invoke an instance of Microsoft Word, load and edit documents, all under the control of PowerBASIC? It's all there now, waiting for your command...


Integrated Development Editor

The PowerBASIC IDE has had some major improvements. Numerous improvements in the IDE have been made. The IDE is now based on tabs rather than MDI children. Up to 36 bookmarks are now supported. Improved undo handling. Quick context-sensitive syntax help is shown on the status bar. Find/Replace can now be set to wrap around the file. Project files have been enhanced to support a list of files, their scrolling position and caret position, a primary file, the active tab, breakpoints, bookmarks, and the debug Watch list. Backup files can now be created with a timestamp, numbered from 0 to 99, or even no backup file if you prefer. There's Print Preview and the new #PAGE metastatement for inserting a page break when printing from the IDE. Improved template files. The Open File dialog for source files now allows selecting multiple files at a time. And much more!


Debugging Tools
PowerBASIC shines with an array of built-in functions. PROFILE gives an overview. A list of every sub and function, how many times each was called, and the total time spent executing each of them. CALLSTK captures all stack frames above you. It answers, "How did I get here?". TRACE generates an execution log of each sub, function, label, and TRACE PRINT, as they're executed in sequence. It gives you parameter values, return values, even error codes. TRACE answers "Where have I been?", and "How did I get here?". With these tools, debugging might now be fun!


Data Types
You know, a quality compiler must offer data types to suit the needs. And PowerBASIC handles that with ease. Signed (to 64-bit) and unsigned integers. Single, double, and extended precision float. Two forms of currency. Dynamic strings, fixed strings, ASCIIZ strings. User-defined Types and Unions. Guids. Variants, pointers, and more. Now, we've added BIT and SIGNED BIT variables in TYPES and UNIONS. Each may be from 1 to 31 bits wide, packed one after another. Perfect for bit coding, or translation from C code. And FIELD variables? They work with the new FIELD statement, just like in DOS versions of BASIC. A FIELD is a string, mapped to a specific section of a file buffer, or even another string. They're allocated at run-time, so they can be changed as needed. Much like a TYPE that can be altered under program control. Best of all, a new internal design makes them fast, fast, fast!


Pointers are great, but sometimes the syntax is daunting, particularly for very simple tasks. So we implemented Dynamic Pointers, using the original PEEK/POKE as a model: xx# = PEEK(DOUBLE,addr&) This retrieves the double precision value stored at addr&, assigning it to xx#. Very straightforward and it works for all data types. And unlike the old PEEK and POKE, it's just as fast as a pointer variable! Speaking of simplification, LOCAL, STATIC, GLOBAL, and RESET can now use a list of variables, like: STATIC abc, bcd, xyz AS STRING And, ARRAY ASSIGN lets you assign values to every element of an array in a single statement!

Tired of the hassle of "drag and drop form designers"? Lost in a sea of API calls just to display text and numbers in a window? With PB/CC, it's a whole new Windows! Compile Basic code to sizzling text mode programs. For Windows 95, 98, Me, NT, 2000, or even WinXP. Put your programming effort where it belongs -- at the core of your code. And when your calculations are complete, it's a simple matter to PRINT, or even LPRINT, the results!


Internet Programming
Did you say Internet? Create CGI apps for your web server! It's the perfect tool. PB/CC offers Standard Input & Output for easy communication. Get standalone executables as small as 10K. All with no run-time requirements of any kind. Whether your program looks up names, or simply calculates a mortgage, it can take data from a web form, process as needed, then deliver the results right to the browser of a distant end user.


You know, a typical shopping cart program written in Visual Basic needs some 5 Megabytes of RAM. So, using VB, you may find you're limited to around 20 simultaneous connections. But use PB/CC instead, and memory needs plummet! To around 100K total! That means 1000 simultaneous connections on that very same Web Server!


TCP and UDP Support
Built-in support for TCP and UDP means that your application can now communicate with far-away servers on the Internet or local servers on your Intranet. Send email messages with SMTP. Download web pages using HTTP. Even create your own TCP or UDP server for communication with other applications.


Serial Port Support
High-speed Serial Communications means you can access modems or other serial devices without struggling with obscure API calls. Dial into remote computers that aren't connected to the internet with just a few lines of code.


New Features in PB/CC Version 6


Minimum System Requirements

  • Any version of Windows from Windows 95 through Windows 10
  • A hard disk with 23 Mb available for installation