From: strong-john@yale.edu (John Strong)
Newsgroups: alt.lang.basic
Subject: Re: Power BASIC
Date: 23 Dec 1992 05:39:32 -0500
Organization: Yale University Science & Engineering UNIX(tm), New Haven, CT 06520-2158
Distribution: world
NNTP-Posting-Host: minerva.cis.yale.edu

>
> > Actually there are a number of other enhancemants. One of the simplest,
> > yet most important (to me!) is that there's a command line compiler! So
> > I can call PBC from a make file.
>
>Based on the PB review posted here, it appears that there are a great
>number of things that fall into the "enhancement" category!
>
Okay, here's some more PB tidbits straight from the Zalemeister himself,
Bob Zale.  Zale is going to be a guest in the American On-Line BASIC forum
on the 14th of January (I'm the host).  I don't suppose that many here
have AOL, but if there is any interest I can provide an ASCII text file of
the evening's discussions.
 
                100 ways PowerBASIC 3.0 beats QuickBasic
                ========================================

   1- PB3 directly creates TSR (terminate/stay-resident) programs which can
      "pop-down" to a memory image of 4K!  Memory resident programs can be
      activated by practically any stimulus:  a hot key, timer, inactivity,
      a hardware or software interrupt, even a message from a foreground
      program.  In fact, it's possible for multiple TSRs to activate each
      other repeatedly, with two-way communication throughout.  No other 
      language offers this capability as an integral part of the compiler.
   2- PB3 uses all real mode memory for dynamic strings.  It's the first 
      and only Basic with a no-limit, handle-based string memory manager;
      QB is limited to substantially less than 64k, and PDS has "inside" 
      segmentation limits (<64k per module, per sub-program, etc.) 
   3- The PB3 String Memory Manager is a resource available to any user
      code.  Both Basic and Assembler code can allocate, release, and alter
      memory blocks as required by the programmer.  While other compilers
      may allow you to calcluate string location or assignment, none allow
      the full memory management functionality of PowerBASIC.
   4- PB3 compiles to true machine code in the integrated environment; the 
      identical code as an .EXE file.  You never need to deal with a slow,
      p-code interpreter as in QB and PDS.  That means faster development, 
      and the elimination of subtle differences between interpreted and 
      compiled results. 
   5- PB3 offers unsigned integer variable types: BYTE, WORD, DOUBLE WORD.
      (byte: 0-255   word: 0-65,535   dword: 0-4,294,967,295).  Unsigned
      integers are not available in other Basic compilers.
   6- Optionally, PB3 can require that all variables be declared before use; 
      this option greatly enhances the probability of catching "typos"
      automatically during compilation.
   7- Dual Monitor Support is offered in both the PowerBASIC Integrated
      Environment and the PBD Standalone debugger.  This allows the
      programmer to simultaneously view a full screen of source code and
      debug information alongside a second full screen generated by the
      target program.  Annoying screen flashes and pauses are eliminated.
   8- PowerBASIC is DesqView aware.
   9- As an enhancement to user-defined TYPES, PowerBASIC is the first Basic
      compiler to offer user-defined UNIONS as well.
  10- PB3 offers 64-bit signed integer variables types.  Quad-word integers
      are not available in other Basic compilers.
  11= With PowerBASIC, there is no need to maintain numerous sets of
      libraries.  Other compilers require one set of run time libraries for 
      near strings, another for far strings, and still another for each of 
      the floating point options.  Then you need Quick Libraries for work
      in the IDE, but Link Libraries to create an .EXE.  With PowerBASIC,
      there's no more confusion:  All run time libraries are built into
      the compiler, and PB3 selects them automatically!  Furthermore, the 
      built-in PowerBASIC linker recognizes the same object modules, units, 
      and libraries, whether you're running in the IDE or creating an .EXE.
  12- PB3 offers a USING$ function, which may be referenced in any string
      expression.  It duplicates the numeric and text formatting capability
      of PRINT USING, but allows the result to be saved or modified, rather
      than require immediate printing.
  13- PB3 offers extended precision (80-bit) floating point variable types.
  14- The PRINT USING and USING$ functions in PB3 may be dynamically altered
      to format numeric values with leading zeros, or other special
      characters.  Further, currency characters ("$,.") may be easily
      adapted to non-USA standards when needed.
  15- PB3 offers conditional compilation directives ($IF/$ELSE/$ENDIF) to
      allow easy version control, as well as large comment blocks in your
      source code.
  16- PB3 supports HUGE arrays (total data size > 64k) on a selective basis.
      Unlike other Basic compilers, the extra overhead of huge array
      calculation is only applied to those arrays which require it.
  17- PB3 supports fixed-point BCD variable type with variable precision
      from 0-18 digits, not a forced 4 digits which introduces additional
      round-off errors.
  18- PB3 supports floating point BCD variable type.
  19- PB3 offers built-in array manipulation functions:  ARRAY SORT,
      ARRAY SCAN, ARRAY INSERT, and ARRAY DELETE.
  20- PB3 offers a full-functioned, built-in assembler.  Critical sections
      of a program can easily be hand-optimized to provide the utmost
      performance, as Assembler and Basic can be intermixed line-by-line.
  21- PB3 won't run out of memory compiling the largest programs.  It
      automatically uses EMS, XMS, and VMS virtual disk memory.
  22- User-defined TYPE arrays need not be a power of two in element
      size in order to exceed 128k of data space.
  23- The PB3 program editor offers the capability to read and write
      blocks of text to external disk files.
  24- PB3 supports source-level metastatements for all compilation
      switches.
  25- VIEW TEXT supports scrollable rectangular text view ports.
  26- PEEK and POKE extensions support byte, integer, and long integer.
  27- PEEK$ and POKE$ extensions support memory block moves or assignment.
  28- FLUSH will force all buffered data to be written to a disk file,
      while minimizing the overhead of a file close and re-open.
  29- PowerBASIC offers MIN and MAX functions which allow a variable
      number of arguments:  PRINT MIN(a%,b%,c%,d%)
  30- BIT operations include shift, rotate, set, reset, toggle, test.
  31- BIT arrays up to 512k bits are implicitly supported.
  32- CHR$ allows a variable number of arguments.  CRLF$ = chr$(13,10)
  33- Optional procedural math package offers faster calculation
      (improvement of 40% to 500%) when no numeric co-processor is
      installed.  Procedural math package uses the 8087 if it is
      available, and can toggle between the emulator/procedural option
      on a statement-by-statement basis for the highest optimization.
      Procedural package adheres to IEEE floating-point standard.
  34- Flex string variable type offers fixed-length strings which may
      be sized dynamically at run-time.
  35- MAP statement allows flex scalar and array variables to be 
      linked together into dynamic data structures, with nesting
      capabilities limited only by available memory.  These data
      structures are created and sized dynamically at the time of
      program execution to offer dynamic data base capabilities.
  36- Many string and numeric functions offer the ANY option, such 
      as INSTR("abcde", ANY "cq") returns 3.
  37- EXTRACT$ captures that portion of a string up to a sub-string.
  38- REPEAT$ creates a string from a repetition of another string.
  39- REPLACE substitutes one sub-string for all occurrences of another.
  40- REMOVE$ removes all occurrences of a sub-string.
  41- VERIFY ascertains that all characters in one string also occur 
      in a second string.
  42- TALLY counts the occurrences of a sub-string.
  43- LTRIM$/RTRIM$ strip leading/trailing spaces or other characters.
  44- STR$(x,y) function specifies y significant decimal digits.
  45- ROUND(x,y) rounds off x to y digits past the decimal point.
  46- STRPTR/STRSEG return the address of any string variable data.
      Dynamic, Flex, and Fixed-length strings are supported as both
      scalars and arrays.
  47- END statement may return an optional error level.
  48- ASCII functions avoids error conditions of ASC function, by
      returning -1 if the argument is a zero-length string.
  49- Integer divide, MOD, AND, OR, XOR, EQV, and IMP are valid
      on all numeric values in the range of a quad-word (64-bit)
      integer (+/- 2^63-1).
  50- PB3 optionally generates 80286/80386 specific code.
  51- Library stripping for ambiguous library functions is controlled
      directly by meta-statements or menu choices, rather than the 
      necessity of complex linker commands.
  52- Separate compilation via unit modules is simpler, faster, and
      offers standard PUBLIC/EXTERNAL statements.
  53- Assembler object modules may be linked via $LINK meta-statements.
  54- Executable files are generated directly rather than complex
      shells to a compiler and linker, resulting in faster compilation.
  55- A full complement of error checks can easily enabled or
      disabled, including STACK, NUMERIC, OVERFLOW, and BOUNDS.
  56- The PowerBasic editor doesn't alter capitalization or spacing,
      and doesn't insert or remove code from the source program.
  57- Line continuation characters are supported inside and ouside of
      the IDE.
  58- Identical code, just as efficient, is generated when error
      trapping is enabled.  Other compilers generate larger, slower
      code whenever a program includes an ON ERROR GOTO clause.  This
      is a serious factor often overlooked in published benchmarks.
  59- PowerBasic supports a single-line if/then/else statement which
      is 100% compatible with BASICA/GW-BASIC.  Other Basics force this
      code to be re-written.
  60- PowerBasic performs short-circuit expression evaluation in
      boolean expressions.
  61- Interpreted print: the user chooses graphic character or
      interpreted actions for special ascii characters.
  62- MTIMER function provides microtimer accuracy.
  63- INSTAT function tests for a keypress without removing it from
      the keyboard buffer.
  64- INCR and DECR statements are offered for all numeric data types.
  65- Forward references to DEF FN, SUB, and FUNCTION are allowed.
  66- $SEGMENT allows multiple segments of module level code within
      the same source file.  There is no requirement to split your
      program into multiple modules as your program size increases.
  67- EXP2, EXP10, LOG2 and LOG10 are supported.
  68- CEIL function returns the smallest integer greater or equal to n.
  69- CALL INTERRUPT is built right into the PowerBASIC language.  There's
      no need to load a special library in order to access this capability.
  70- FRAC function returns the fractional part of n.
  71- FIX function returns the whole number part of n.
  72- ISTRUE and ISFALSE Boolean operators force true and false values
      to -1 and 0 respectively.
  73- ITERATE forces a new iteration of a loop.
  74- PB3 offers absolute arrays at any specific memory location.
  75- EXIT FAR provides a controlled, multi-level SUB/FUNCTION
      exit - a safe, yet powerful enhancement to the SETJMP and
      LONGJMP functions found in C compilers.  This allows you to
      exit a SUB/FUNCTION, and immediately branch to the label most
      recently specified as an EXIT FAR destination in any "parent"
      procedure with any number of intervening procedure calls.  All
      temporaries and local variables are released as necessary, so
      this is readily usable for special exception-processing.  EXIT
      FAR constructs may be nested to any level.
  76- CODEPTR and CODESEG functions allow you to obtain the offset
      and Segment of any SUB, FUNCTION, or LABEL in the program.
      This capability, unavailable in other Basics, is essential
      for interrupt handlers and certain other assembler code.
  77- A standalone debugger (PBD.EXE) is included with PowerBASIC 3.0.
  78- The PB3 Librarian (PBLIB.EXE) constructs libraries which may
      include both industry-standard object modules (.obj), as well as
      highly efficient binary unit modules (.pbu) constructed by the
      PowerBASIC compiler.
  79- Internal assembler code can access all PowerBASIC variables (even
      local and static variables), as well as subs, functions, and labels.
  80- $ALIAS metastatement allows the name of the main data segment to be

  81- BITS function allows fast, one-step conversion between signed and
      unsigned representations of a numeric value.
  82- Internal procedures ARRAYCALC and ARRAYINFO are provided so that
      assembler code can manipulate all aspects of PowerBASIC arrays.
  83- PowerBASIC offers the option to preserve or discard the GOSUB stack
      at the current SUB/FUNCTION level in case of a trapped error.  If
      the choice is to discard it, substantially more efficient code can
      be generated.
  84- PowerBASIC functions can be called just as if they were a SUB, and
      the returned result is discarded.
  85- CLS statement offers options to clear the text viewport, the graphics
      viewport, the key line, or the entire screen.
  86- ERRTEST function returns the current error number, while resetting it
      to zero for future calls.  This provides an efficient means of error 
      polling when using ON ERROR RESUME NEXT to mask system errors.
  87- FILEATTR function can optionally return the open/closed status of a
      particular file number, as well as the record length of a random file.
  88- KEY statement now offers an optional third parameter which allows the
      programmer to define any shift keys which should be ignored in
      determining if ON KEY GOSUB should be called.  With other Basics,
      it's necessary to declare numerous key statements to cover every
      possible combination of shift keys., or else an errant "caps lock"
      or "num lock" key can cause a defined hot-key to be ignored.
  89- NAME statement allows renaming of directories as well as files.
  90- Serial communication is supported at baud rates up to 115200.  Other
      Basics are limited to 9600.
  91- DIR$ function allows you to read directory items with any attribute,
      not just normal files:  sub-directories, volumes, hidden/system files.
  92- OPEN COM supports the DT option which causes DTR to be asserted after
      the communications file is closed.
  93- PowerBASIC supports direct access to COM3 and COM4.
  94- OPTION BINARY BASE allows the programmer to choose binary file access
      based at zero or one, depending upon the program logic.
  95- PowerBASIC provides documented Basic and Assembler access to numerous
      internal system variables.  This provides easy access to the cpu type,
      co-processor type, cursor shape and visibility, PB revision, screen
      page and attributes, video card, print using format characters, 
      screen/viewport size, and much more.
  96- BIN$ function returns the binary representation of a number.
  97- GET$ statement reads a binary file, assigning a specified number of
      bytes to a string variable.
  98- PUT$ statement writes a string expression to a binary file.
  99- DELAY statement pauses program execution for n seconds without the
      possibility of interrupt by a keystroke.
 100- While PowerBASIC offers a large superset of the functionality found
      in other compilers, moving up to PowerBASIC 3.0 couldn't be easier!
      PB3 is 99+% compatible with QuickBasic syntax, and our Programmer's
      Guide devotes a chapter to the minor differences which remain.

                PowerBASIC . . . it's not your basic BASIC!

                        Check List
                        ==========

Feature                                        PB 3.0  QB 4.5  PDS 7.1  VBDOS
=======                                        ======  ======  =======  =====

TSR programming support built-in                  X
Internal Assembler in the language                X
Option to require variable declaration            X                      X
Unsigned byte, word, dword integer variables      X
User-Defined TYPES                                X       X       X      X
User-Defined UNIONS                               X
User-Defined Dynamic Data Structures (MAPS)       X
Array sort, scan, insert, delete statement        X
Pointers to a sub, function, or label             X
EXIT FAR multi-level sub/function exit            X
Unlimited dynamic string space <1>                X
ON LOCAL ERROR                                    X               X      X
Standalone debugger included                      X               X      X
Editor never changes your source programs         X
Conditional compilation ($IF/$ELSE/$ENDIF)        X
Viewport for screen text display                  X                      X
Alternate procedural math package                 X               X      X
Procedural math package utilizes 8087             X
Extended 80-bit floats & 64-bit integers          X
Floating point BCD variables                      X
Fixed point BCD variables  <2>                    X               X      X
Block memory moves with PEEK$/POKE$               X


<1> PowerBASIC can allocate all real mode memory for any and all dynamic
    strings.  There are no "inside limits" (such as 64k limit per module
    or sub-program) as are found in far string implementations.

<2> PowerBASIC Fixed-Point BCD variables are implemented as 64-bit scaled
    integers for computational efficiency.  The decimal digits (to the right
    of the decimal point) may be user-defined from 0 to 18.  Some Microsoft 
    products offer a currency data type, which is fixed at 4 decimal places.  
    Even though the internal format is identical to that of PowerBASIC, 
    additional round-off code is typically required in financial calculations
    to correct the precision to standard dollars/cents levels.  Since this 
    binary-coded-decimal format differs from traditional "natural bcd", 
    Microsoft contends that their products do not support BCD variables.

-- 
John Strong                 |"My mother never breast fed me.  She told me that
strong@minerva.cis.yale.edu | she only liked me as a friend."                 
Yale University             |                             - Rodney Dangerfield
Newsgroups: alt.lang.basic