Keyword Differences



PB/DOS and previous versions of PB/CC used the Dollar sign ($) to indicate a metastatement.  This has been changed to a Number symbol (#).  For example, $INCLUDE should be changed to #INCLUDE.  The current version of PB/CC will still support the use of a leading Dollar sign for supported metastatements, but this feature will be eliminated in future versions.


Because Windows programs no longer have 64 Kb segment limitations, the $ALIAS, $CODE and $SEGMENT metastatements are no longer necessary and need to be removed when converting your code.


The $COM metastatement and OPEN COM statement are no longer supported.  All serial communications is done through the COMM statement.


PB/CC always compiles to native 32-bit flat mode machine code, so the $CPU metastatement is not supported.


All arrays in PB/CC are created dynamically, so $DYNAMIC is no longer necessary.

$LINK Units and Libraries

The $LINK metastatement is no longer supported.  You cannot link .OBJ files, units (.PBU) or static libraries (.PBL).  You can use the DECLARE statement for linking to Dynamic Link Libraries (DLLs).  The PowerBASIC GUI Compiler for Windows (PB/Win) can be used to compile common code into .DLLs, which can then be linked to your application.


The PB/DOS ASCII function is replaced by the ASC function.


For compatibility with Visual Basic, The ATTRIB statement was changed to SETATTR.  The ATTRIB function was changed to GETATTR.


BLOAD and BSAVE are not supported.  To load data to or from a file and a specified memory address, use GET$/PUT$ for the disk I/O and POKE$ and PEEK$ or Pointer variables to read/write the data to the memory location.  As a benefit, these techniques can handle data sizes up to 4 Gb, rather than the 64 Kb limit of BLOAD and BSAVE.


The CALL INTERRUPT statement, REG statement, and REG functions are not supported.  You cannot call real-mode DOS/BIOS interrupts from within a protected-mode Windows application.  Most DOS and BIOS style interrupts calls have been replaced with API functions in Windows that 32-bit PowerBASIC applications should use instead.


Because there are no longer any limitations to the size of applications you can create with PB/CC, the CHAIN and COMMON statements are not supported.  If you require modular programs, you should use the SHELL statement, or create DLLs using the PowerBASIC GUI Compiler for Windows (PB/Win).  If necessary, COMMON variables can be emulated with conventional disk files or Memory Mapped files (available through Windows API functions) to exchange data between programs.


In PB/DOS, the CLEAR statement was used to reset all variables, close all open files, and turn off event trapping.  This is not supported in PB/CC.  To close all open files you can use the CLOSE statement.


The CODESEG and CODEPTR32 functions are not supported.  The CODEPTR function returns a complete 32-bit address to any Sub, Function or Label in your code, (Labels are local to each Sub/Function in your program, so you cannot obtain a pointer  to a Label outside the scope of the current Sub or Function).  32-bit Windows uses a flat memory model, so segments are not used.

The VARSEG and VARPTR32 functions are not supported.  The VARPTR function returns a complete 32-bit address to any variable or array element in your code.


The COLOR statement does not provide the option to of change the CGA Border Color, which was a holdover from the days before EGA and VGA monitors.  Console Windows do not support colored borders.  However, the PB/CC COLOR statement offers new functionality to enable for setting the color attributes of multiple characters starting at the current caret position.


The CSRLIN and POS functions have been replaced with the CON.CELL function.


The CVMS, CVMD, MKMS$ and MKMD$ functions are not supported.  If you need to access data stored in the obsolete Microsoft floating-point formats, source code is available on the PowerBASIC web site to mimic these functions.  See Additional Source Code and Examples.


DATA statements in PB/CC must be located inside a Sub or Function, and only string data can be used.  The READ statement is no longer used to read data, and the RESTORE statement is no longer valid.  See the DATA, DATACOUNT, and READ$ statements for more information.


The DEF SEG statement is no longer supported because of the flat-memory mode that protected mode Windows applications use.  DOS applications often use the DEF SEG statement to access memory, such as the DOS DTA memory area to obtain file information.  Such functionality can be obtained with Windows API functions instead.  For example, the GetFileTime API can be used to obtain file date/time information.


It is not necessary to use the HUGE or VIRTUAL keywords to create arrays larger than 64 Kb in size.  PB/CC applications can access all available memory up to a maximum of two Gigabytes for arrays.  No special support or keywords are needed.


The END statement is supported in a limited fashion for compatibility with DOS programming styles.  However, it is much better to use the EXIT FUNCTION statement inside your PBMAIN or WINMAIN function to stop execution of your program prematurely.

To return an error level to the calling application, your program must have a PBMAIN or a WINMAIN function.  The value assigned to PBMAIN or WINMAIN is then returned as the error level:

PBMAIN = 5   ' return an error level of 5 to PBMAIN()


WINMAIN = 5  ' return an error level of 5 to WINMAIN()


FUNCTION = 5 ' return the error level to either function


In PB/DOS, using ERASE on a STATIC array simply clears the array back to its initialized state.  In PB/CC, the RESET statement performs the same functionality.  The PB/CC ERASE statement deallocates the memory regardless of whether the array is LOCAL, GLOBAL, or STATIC.  This is similar to the way the PB/DOS ERASE statement works when used on dynamic arrays.


Windows does not allow different modules to share variables.  Therefore the EXTERNAL, PUBLIC and SHARED keywords are no longer supported for setting variable scope.  See the GLOBAL keyword for sharing variables between Subs and Functions.


MSBASIC demands a colon after the $INCLUDE, and requires apostrophes around the file name.  PB/CC uses no colon, and uses quotation marks around the file name.


The INKEY$ function and the PB/CC WAITKEY$ function are used to return keystroke codes; however, certain combinations such as CTRL+LeftArrow, etc, provide no indication in the keystroke code that the CTRL key modifier was used.  To detect such keystrokes, use the INSHIFT function to determine whether the CTRL, ALT or SHIFT keys were pressed at the time the last INKEY$/WAITKEY$ key code was retrieved.


INP, OUT and WAIT are not supported.  Windows NT security does not allow user-level applications to access hardware ports directly.  In order to access a hardware port in Windows NT, you will need to use a kernel-mode device driver.  Please visit for more information.

Because Windows 95/98 and ME are hybrid operating systems, (unlike Windows NT/2000/XP which are pure 32-bit), they do not support the NT security model.  This means you can directly access hardware ports, but it is not recommended.  To do so, use the "!in" and "!out" assembler mnemonics.


The INPUT statement is now supported for reading keyboard text.  You may still use the LINE INPUT statement for reading keyboard text into a string.  If you need numeric input, you can use the VAL function to convert the string into a number.

The INPUT$ function is no longer supported for getting keyboard or file input.  Use the INKEY$ function instead for reading keyboard input, or GET$ for reading from a file.


The IOCTL statement and IOCTL$ function are no longer supported.  They have been replaced by calls to the Windows API.


The LOCATE statement is no longer used to set the size and visibility of the caret.  See the CON.CURSOR statement.


The LPOS function is no longer supported.


The MTIMER statement and function are no longer supported.  See the API functions QueryPerformanceFrequency and QueryPerformanceCounter for information on high-resolution counters.


The syntax for the OPEN statement no longer supports the following:

OPEN "modestring", filenum, filespec [, recordsize]


In PB/DOS, the OPEN statement was used to access serial communications ports by directly accessing the hardware.  PB/CC uses the COMM OPEN statement to begin access to serial ports in Windows.


In PB/DOS, you can use OPTION BASE or OPTION ARRAY BASE statements to specify the first (LBOUND) dimension of an array.  For example, by default:

DIM A(10)

…creates an array with 11 elements numbered 0 to 10.  Using the OPTION BASE statement, you can change the default to 1:


DIM A(10)

…creates an array with 10 elements numbered from 1 to 10.  In PB/CC, you cannot universally set the base subscript number for arrays.  To dimension an array from 1 to 10, you must do so explicitly.  For example:

DIM A(1 TO 10)

Note, however, that any array that does not begin with a subscript of zero will be less efficient when accessed.  This is because the compiler must generate code to first subtract the base subscript number, before computing its location in memory.


In PB/DOS, the OPTION BINARY BASE statement is used to specify whether the lowest numbered byte position in a binary file is zero or one (the default is zero for PB/DOS, and one for MSBASIC).

PB/CC uses the default base of one, in keeping with Windows programming conventions.  Furthermore, PB/CC does not support the OPTION statement, but instead provides a BASE clause in the OPEN statement, allowing the base byte position to be set for each individual disk file.  Use BASE = 0 in the OPEN statement to mimic the default PB/DOS behavior.


The PEEKI and PEEKL functions are now supported by PEEK(INTEGER,x) and PEEK(LONG,x).  Likewise, POKEI and POKEL statements are now supported by POKE INTEGER, addr, nexp  and  POKE LONG, addr, nexp.


The PLAY and SOUND statements are now supported by the PLAY statement.


RESET in PB/DOS closes all open files.  In PowerBASIC, RESET clears the contents of variables (including UDTs and Unions) and arrays.  Use CLOSE with no parameters to close all open files, including COMM, TCP, and UDP files.


Both PB/DOS and MSBASIC use the SHARED keyword to indicate variables that are shared among different Subs and Functions in your code.  PowerBASIC uses the GLOBAL keyword to share variables between ALL Subs and Functions.


The SYSTEM statement is no longer supported.  To prematurely end your application, you must call the EXIT FUNCTION statement from within your PBMAIN or WINMAIN function, or jump to a label which is located before the END FUNCTION in PBMAIN or WINMAIN.


PRINT USING and LPRINT USING have been superceded by the FORMAT$ and USING$ functions.  FORMAT$ takes its parameters are in the reverse order to USING, and accepts only one numeric argument, but offers a more flexible set of digit placeholders and format mask options.  USING$ offers the same functionality as PRINT USING, but takes the form of a function rather than an output statement, permitting greater flexibility.


View is not supported by PowerBASIC or Windows, although similar effects can often be achieved with judicious print positioning and the SCROLL statement.


See Also

Upgrading To PBCC