Results 1 to 40 of 69

Thread: Feeling nostalgic I fired up QuickBASIC and wrote a Brain***** interpreter!

Threaded View

  1. #15

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,945

    Re: Feeling nostalgic I fired up QuickBASIC and wrote a Brain***** interpreter!

    Here is the content of a text file that came with PowerBASIC 3.5 about PB vs QB:

    Code:
                    100 ways PowerBASIC 3.2 beats QuickBasic
                    ========================================
    
       1- PB 3.2 supports true pointer variables.  Traditionally, a Basic
          programmer had to use a combination of DEF SEG and PEEK and POKE to
          access memory.  Pointers are not only more flexible, they also make
          data access much faster.
    
       2- Code pointers allow a programmer to call a routine or jump to a label
          without having to know their name.  The CALL DWORD extension allows
          programmers to call subs by address and pass up to 16 arguments.
    
       3- Calling procedures that accept a variable number of arguments.
    
       4- Underscores "_" in variable names, allowing for more flexibility in
          naming variables and procedures.
    
       5- Enhanced communications support.  Support for COM1 through COM4 at up
          to 115200 bps.  Even support for non-standard addresses and IRQs as
          well as 16550 FIFO support.
    
       6- 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.
    
       7- 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.) 
    
       8- 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.
    
       9- 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. 
    
      10- 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.
    
      11- Optionally, PB3 can require that all variables be declared before use;
          this option greatly enhances the probability of catching "typos"
          automatically during compilation.
    
      12- 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.
    
      13- PowerBASIC is DesqView aware.
    
      14- As an enhancement to user-defined TYPES, PowerBASIC is the first Basic
          compiler to offer user-defined UNIONS as well.
    
      15- PB3 offers 64-bit signed integer variables types.  Quad-word integers
          are not available in other Basic compilers.
    
      16- 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.
    
      17- 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.
    
      18- PB3 offers extended precision (80-bit) floating point variable types.
    
      19- 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.
    
      20- PB3 offers conditional compilation directives ($IF/$ELSE/$ENDIF) to
          allow easy version control, as well as large comment blocks in your
          source code.
    
      21- 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.
    
      22- 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.
    
      23- PB3 supports floating point BCD variable type.
    
      24- PB3 offers built-in array manipulation functions:  ARRAY SORT,
          ARRAY SCAN, ARRAY INSERT, and ARRAY DELETE.
    
      25- 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.
    
      26- PB3 won't run out of memory compiling the largest programs.  It
          automatically uses EMS, XMS, and VMS virtual disk memory.
    
      27- User-defined TYPE arrays need not be a power of two in element
          size in order to exceed 128k of data space.
    
      28- The PB3 program editor offers the capability to read and write
          blocks of text to external disk files.
    
      29- PB3 supports source-level metastatements for all compilation
          switches.
    
      30- VIEW TEXT supports scrollable rectangular text view ports.
    
      31- PEEK and POKE extensions support byte, integer, and long integer.
    
      32- PEEK$ and POKE$ extensions support memory block moves or assignment.
    
      33- FLUSH will force all buffered data to be written to a disk file,
          while minimizing the overhead of a file close and re-open.
    
      34- PowerBASIC offers MIN and MAX functions which allow a variable
          number of arguments:  PRINT MIN(a%,b%,c%,d%)
    
      35- BIT operations include shift, rotate, set, reset, toggle, test.
    
      36- BIT arrays up to 512k bits are implicitly supported.
    
      37- CHR$ allows a variable number of arguments.  CRLF$ = chr$(13,10)
    
      38- 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.
    
      39- Flex string variable type offers fixed-length strings which may
          be sized dynamically at run-time.
    
      40- 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.
    
      41- Many string and numeric functions offer the ANY option, such
          as INSTR("abcde", ANY "cq") returns 3.
    
      42- EXTRACT$ captures that portion of a string up to a sub-string.
    
      43- REPEAT$ creates a string from a repetition of another string.
    
      44- REPLACE substitutes one sub-string for all occurrences of another.
          REMOVE$ removes all occurrences of a sub-string.
    
      45- VERIFY ascertains that all characters in one string also occur
          in a second string.
    
      46- TALLY counts the occurrences of a sub-string.
    
      47- LTRIM$/RTRIM$ strip leading/trailing spaces or other characters.
    
      48- STR$(x,y) function specifies y significant decimal digits.
    
      49- ROUND(x,y) rounds off x to y digits past the decimal point.
    
      50- STRPTR/STRSEG return the address of any string variable data.
          Dynamic, Flex, and Fixed-length strings are supported as both
          scalars and arrays.
    
      51- END statement may return an optional error level.
    
      52- ASCII functions avoids error conditions of ASC function, by
          returning -1 if the argument is a zero-length string.
    
      53- 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).
    
      54- PB3 optionally generates 80286/80386 specific code.
    
      55- Library stripping for ambiguous library functions is controlled
          directly by meta-statements or menu choices, rather than the 
          necessity of complex linker commands.
    
      56- Separate compilation via unit modules is simpler, faster, and offers
          standard PUBLIC/EXTERNAL statements. Assembler object modules may be
          linked via $LINK meta-statements.
    
      57- Executable files are generated directly rather than complex
          shells to a compiler and linker, resulting in faster compilation.
    
      58- A full complement of error checks can easily enabled or
          disabled, including STACK, NUMERIC, OVERFLOW, and BOUNDS.
    
      59- The PowerBasic editor doesn't alter capitalization or spacing,
          and doesn't insert or remove code from the source program.
    
      60- Line continuation characters are supported inside and outside of
          the IDE.
    
      61- 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.
    
      62- 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.
    
      63- PowerBasic performs short-circuit expression evaluation in
          boolean expressions.
    
      64- Interpreted print: the user chooses graphic character or
          interpreted actions for special ascii characters.
    
      65- MTIMER function provides microtimer accuracy.
    
      66- INSTAT function tests for a keypress without removing it from
          the keyboard buffer.
    
      67- INCR and DECR statements are offered for all numeric data types.
    
      68- Forward references to DEF FN, SUB, and FUNCTION are allowed.
    
      69- $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.
    
      70- EXP2, EXP10, LOG2 and LOG10 are supported.
    
      71- CEIL function returns the smallest integer greater or equal to n.
    
      72- CALL INTERRUPT is built right into the PowerBASIC language.  There's
          no need to load a special library in order to access this capability.
    
      73- FRAC function returns the fractional part of n.
    
      74- FIX function returns the whole number part of n.
    
      75- ISTRUE and ISFALSE Boolean operators force true and false values
          to -1 and 0 respectively.
    
      76- ITERATE forces a new iteration of a loop.
    
      77- PB3 offers absolute arrays at any specific memory location.
    
      78- 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.
    
      79- 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.
    
      80- A standalone debugger (PBD.EXE) is included with PowerBASIC 3.0.
    
      81- 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.
    
      82- Internal assembler code can access all PowerBASIC variables (even
          local and static variables), as well as subs, functions, and labels.
    
      83- $ALIAS metastatement allows the name of the main data segment to be
          redefined for external object modules.
    
      84- BITS function allows fast, one-step conversion between signed and
          unsigned representations of a numeric value.
    
      85- Internal procedures ARRAYCALC and ARRAYINFO are provided so that
          assembler code can manipulate all aspects of PowerBASIC arrays.
    
      86- 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.
    
      87- PowerBASIC functions can be called just as if they were a SUB, and
          the returned result is discarded.
    
      88- CLS statement offers options to clear the text viewport, the graphics
          viewport, the key line, or the entire screen.
    
      89- 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.
    
      90- FILEATTR function can optionally return the open/closed status of a
          particular file number, as well as the record length of a random file.
    
      91- 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.
    
      92- NAME statement allows renaming of directories as well as files.
    
      93- DIR$ function allows you to read directory items with any attribute,
          not just normal files:  sub-directories, volumes, hidden/system files.
    
      94- OPEN COM supports the DT option which causes DTR to be asserted after
          the communications file is closed.  PowerBASIC supports direct access
          to COM3 and COM4.
    
      95- OPTION BINARY BASE allows the programmer to choose binary file access
          based at zero or one, depending upon the program logic.
    
      96- 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.
    
      97- BIN$ function returns the binary representation of a number.
    
      98- GET$ statement reads a binary file, assigning a specified number of
          bytes to a string variable.  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.
    That's all very impressive, however here's what QB can do and PB can't:
    1. Low-resolution 320x200 256 color VGA.
    2. 60 rows of text in default VGA (640x480 16 color)
    3. Constants of a datatype other than integer.
    4. QB's IDE and help are more user friendly imho.
    Last edited by Peter Swinkels; Jan 30th, 2024 at 11:18 AM. Reason: additional info

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width