Category : BASIC Source Code
Archive   : QBTINY12.ZIP
Filename : PDQINFO.TXT
This file contains the text from a pamphlet on P.D.Q. 3.0. A
new version of P.D.Q. with additional features will be released
shortly. P.D.Q. is currently $149. For technical information,
call (203) 438-5300. To order, call 1-800-35-BASIC.
Crescent Software
11 Bailey Avenue
Ridgefield, CT 06877
Introducing P.D.Q.: What C Was Supposed To Be
A Revolutionary Concept in High-Level Languages
(and Assembler too!)
No one would dispute the value of a program that's small and
fast. Indeed, compiler vendors such as Microsoft and Borland
are constantly refining their products, to improve the
performance and size of your programs. Unfortunately, no
high-level language comes even close to creating programs as
efficient as those written in assembly language. That is,
until now.
Introducing P.D.Q. Version 3.0
This remarkable library lets you write programs that are
extremely fast and compact, using a high-level language you
already know. Unlike C, Pascal, or QuickBASIC, P.D.Q. can
produce a "Hello world" program with a stand-alone .EXE file
size of only 750 bytes. Real programs that perform useful
tasks may be written in less than 2,000 bytes. For example,
P.D.Q. includes as an example a perpetual on-screen TSR clock
program with an .EXE file size of less than 1500 bytes.
Also included are numerous examples such as a 1480-byte
redirectable DOS "filter" program, and a utility similar to
Peter Norton's 9K FILESIZE.COM, but less than 5K in size.
Programs produced by P.D.Q. are often half the size of an
equivalent written in C. P.D.Q. truly is the closest you'll
come to a pure assembler program, but without having to code in
assembly language. And if you do use assembly language, P.D.Q.
will help you with floating point math, TSR programs, dynamic
strings, file and device input and output, sound, and multi-
dimensional arrays.
The primary purpose of P.D.Q. is to write small to medium-sized
applications, where program size and execution speed are
critical. Because P.D.Q. programs are inherently well-behaved,
they may also be run under operating systems such as
Quarterdeck's DESQview and Microsoft Windows without requiring
additional programming effort. A wealth of string, DOS, and
BIOS services are provided, along with full support for modern
programming constructs and user-defined variables.
Best of all, TSR programming support and interrupt handling are
built into the P.D.Q. library. You can create complete memory-
resident applications in just minutes, instead of days or even
weeks. TSR capabilities are added using four simple subroutine
calls, and the P.D.Q. routines then handle all the details of
memory allocation, the DOS "busy" flag, deinstallation, and so
forth. A P.D.Q. TSR program can even intercept multiple
interrupts, with separate program entry points for each.
The TSR capabilities are especially impressive, and very easy
to use. You simply specify which hot key to use, and where in
the program control is to go when that key is pressed. Real
interrupt handlers are just as easy to create-- you indicate
the interrupt to take over and where in the program the handler
is located. Once the interrupt handler is in place you can
process it entirely yourself and return to the underlying
program, call the original handler as a subroutine, or jump to
the original handler. Your program has full access to the CPU
registers at all times.
Without doubt, P.D.Q. is the most revolutionary and exciting
concept in high-level languages to come along in years. But
what is it?
As Easy As BASIC
P.D.Q. is a replacement linking library for use with
Microsoft's QuickBASIC and BASIC PDS compiler. By completely
rewriting the BASIC language library, we were able to improve
the efficiency of the resultant code enormously. All of the
"handholding" that BASIC normally adds to every program has
been removed, leaving only the essential elements. Thus, you
can be productive immediately, without having to struggle with
yet another new language.
We also overhauled BASIC's convoluted method of handling DOS
errors. Where conventional BASIC requires you to first define
an error handler and then set up an ON ERROR trap to jump
there, P.D.Q. lets you simply test the success or failure of
the most recent DOS operation. The short program fragment
below shows this in context.
OPEN "accounts.dat" FOR INPUT AS #1
IF ERR = 53 THEN PRINT "Sorry, file not found."
Why BASIC?
Some programmers, particularly those who don't ordinarily
program in BASIC, may wonder why we selected Microsoft BASIC as
the core language for P.D.Q. Simply put, BASIC is the easiest
of all high-level languages to use, and nearly every programmer
is already familiar with it. Microsoft compiled BASIC provides
all of the features needed for modern, structured programming.
By using BASIC, P.D.Q. is able to offer an impressive list of
string handling features, along with sound, direct memory and
port access, automatic variable type conversion, and structured
data. Of course, BASIC also supports dynamic memory
allocation, variable length strings, access to DOS and BIOS
services, and protection against inadvertently overwriting
memory. Further, P.D.Q. is fully compatible with subroutines
and functions written in assembly language such as those in our
QuickPak Professional.
Finally, the BC.EXE compiler supplied with Microsoft BASIC is
as powerful and capable as any language compiler. Programs may
be written and debugged in the convenient environment BASIC
offers, and then linked for maximum performance when creating
the final program.
The Spirit of Performance
Our goal in designing P.D.Q. was to place code size and
execution speed above all other considerations. Many
programmers incorrectly believe that compiled languages are
inherently large and slow, simply because they are compiled.
But nothing could be further from the truth. In many cases,
the Microsoft BASIC compiler generates object code as efficient
as a human hand-coding in assembly language. The real problem
with most compilers is the way their language libraries have
been implemented. By taking an entirely new and different
approach to language design, P.D.Q. is able to create programs
that are nearly as small and fast as those written in assembly
language.
Like most compilers, Microsoft BASIC translates simple program
statements directly to the equivalent machine-code
instructions. For example, X% = X% + 1 is compiled to INC WORD
PTR [X%]. However, more complex commands generate calls to the
BASIC language library. And that's where P.D.Q. comes in. All
of the routines in the P.D.Q. library are extremely efficient,
and have been optimized to the fewest number of bytes and
machine clock cycles.
But Isn't That What C Is For?
One of the promises of C was to provide smaller and faster
programs, in exchange for additional programming effort. If
you were willing to step down to a lower level language nearer
to assembler, the compiler would reciprocate by generating a
more efficient program. But this simply isn't true-- the
current generation of C compilers offers little if any
improvement over QuickBASIC 4.5. In fact, compared to P.D.Q.,
C is just another slow and bloated high-level language! By
contrast, P.D.Q. is nearly as easy to use as conventional
BASIC, while providing a level of performance that is clearly
superior to C. And everyone knows that performance is what
programming is all about.
How We Did It?
In order to achieve such impressive file sizes and high
performance, we did have to make some compromises. BASIC's
graphics, communications, and advanced (transcendental) math
operations are not supported; however, Crescent also sells
graphics and communications libraries for programs that need
those capabilities. Further, statements that access DOS and
BIOS services provide little or no error checking. For
example, if you attempt to position the cursor at an illegal
row or column, P.D.Q. simply passes your parameters on to the
BIOS which ignores them.
Seeing is Believing
Compare the sample programs created using P.D.Q. with
equivalent programs written in QuickC, Turbo C, Turbo Pascal,
and regular QuickBASIC 4.5. The benchmark timings shown below
were obtained using a Northgate Elegance 386-25 computer, but
slowed down to 8 MHz to obtain repeatable results. A RAM disk
was used for the read/write timings. All .EXE file sizes are
in bytes, and all times are given in seconds.
The Num-Off utility turns the NumLock key off and the Hello
program simply prints "hello"-- these show the effective
minimum program size for each language system. Note that the
P.D.Q. Hello program includes the entire dynamic string
management portion of the runtime library! The DOS filter
program accepts input from STDIN, capitalizes it and strips the
high bit from each character, and sends the result through
STDOUT.
The Epson set-up program is a small, menu-driven utility that
sends escape codes for various printer characteristics. The
TSR version can be popped up on top of any text-mode program,
and it saves and restores the underlying screen. Finally, the
File Size program is a clone of Peter Norton's 9K FS.COM
utility. It reads all files whose names match a given spec,
adds up their sizes, and also checks if they will fit onto a
selected target. Like Norton's, our version also takes the
target cluster size into account when determining if the files
will fit.
For the long integer multiply test, 150 multiplications were
performed in a loop 1,000 times. Please note that the Turbo C
programs were compiled using the Small memory model which
produces .COM files. Also note that we have optimized long
integer operations for size rather than speed. Finally, a bug
in the sort routine provided with QuickC is responsible for its
poor showing in that category.
File Size Comparisons
P.D.Q. QC 2.0 TC 2.0 TP 5.5 QB 4.5
+-------------------+-------+-------+-------+-------+-------+
| Num-Off Utility | 418 | 2371 | 990 | 2845 | 10325 |
| Print Hello | 754 | 5363 | 3958 | 3260 | 12798 |
| DOS filter | 1482 | 5345 | 4970 | 3443 | 19523 |
| Epson Set-up | 2228 | 7837 | 8030 | 8014 | 35877 |
| TSR Epson Set-up | 4800 | n/a | n/a | n/a | n/a |
| File-Size program | 4956 | 10537 | 7814 | 8809 | 19650 |
+-------------------+-------+-------+-------+-------+-------+
Timing Comparisons
P.D.Q. QC 2.0 TC 2.0 TP 5.5 QB 4.5
+---------------------+-------+-------+-------+-------+-------+
| Long Int Multiply | 2.64 | 2.31 | 2.25 | 7.52 | 3.02 |
| Long Int Mult (386) | 2.20 | 2.31 | 2.25 | 7.52 | 3.02 |
| Sort 3000 Strings | 0.60 |144.89 | 1.54 | 0.99 | 1.92 |
| Print 3000 Strings | 0.88 | 1.15 | 1.04 | 3.52 | 2.04 |
| Write 500 Records | 0.33 | 0.33 | 0.66 | 0.44 | 0.38 |
| Read 500 Records | 0.27 | 0.27 | 0.27 | 0.49 | 0.28 |
+---------------------+-------+-------+-------+-------+-------+
What's Included
P.D.Q. is supplied as two library files-- PDQ.LIB is intended
for use with any IBM PC/XT/AT or compatible computer, and
PDQ386.LIB is a 386-specific version for use with computers so
equipped. In all, more than 190 BASIC statements and keywords
are supported.
More than 90 useful language extensions are provided including
memory allocation, DOS critical error trapping, block memory
moves and comparisons, string array sorting, a complete set of
TSR extensions including swapping to disk or EMS, output
through STDERR, access to the parent's environment, and much
more. Many programming examples and utilities are also
included, as well as a comprehensive owner's manual.
Finally, P.D.Q. comes with complete, commented library source
code so you can see exactly how it works, or even modify and
extend the language if you like.
What's New in Version 3.0
Many new and important features have been added in version 3.0.
These include: Floating point math that automatically uses a
coprocessor if present; full network file support; TSR programs
that swap to disk or EMS to take as little memory as possible;
bit manipulation; and safe DOS and BIOS access within TSR
programs that handle interrupts manually. The manual has been
greatly expanded, and now totals more than 500 pages. Numerous
new example and utility programs have been added, including a
menu-driven environment for compiling and linking, TSR programs
that capture printer output and keystrokes to disk, color
printing with no source code changes, and much more.
Equally exciting is the new assembly language toolbox
capability. The entire P.D.Q. library internal operation is
now fully documented, and there are many examples showing how
to add BASIC-like capabilities to programs written in assembly
language. Every routine is described in detail, accompanied by
a description, calling convention, and brief example. Many
complete assembler programs are provided as examples showing
how to utilize dynamic strings, IEEE floating point math, and
all of the P.D.Q. TSR capabilities.
System Requirements
P.D.Q. requires QuickBASIC 4.0 or later or BASIC 7 PDS; DOS 2.1
or later; 256K RAM; and a PC/XT/AT or compatible computer.
5-1/4 inch disks are standard, although 3-1/2 inch disks are
available if specified when ordering.
About Crescent Software
Crescent Software publishes many other useful products for
BASIC programmers. We offer general purpose toolboxes, as well
as programs for graphics, screen design, communications, laser
printing, scientific applications, and more. All products
include complete source code, free technical support, and
royalties are never required.
The Best Reviews in the Business
P.D.Q. won Byte Magazine's User's Choice Award for Language of
the Year in 1989, and following is additional praise it has
received.
"The talk of the programming community...is P.D.Q. Hot stuff,
for sure."-- John Dvorak, PC Magazine, November 28, 1989
"Every QuickBASIC programmer ought to have P.D.Q.-- the speed
and code size reduction will amaze you. Recommended."-- Jerry
Pournelle, Byte Magazine, February 1990
"I feel sure the approach taken by Crescent Software is the
approach the whole industry will follow in the future."-- Bruce
Tonkin, Dr. Dobb's Journal, December 1989
"The combination of TSR ability and small code makes P.D.Q. a
contender for a development environment of choice."-- Jeff
Angus, Computer Language, December 1989
"I think P.D.Q. will very likely become one of the best-selling
add-ons of all time."-- Jim Pyle, PCM Magazine, February 1990
"You can write TSR code without having to worry about the
technicalities...I like P.D.Q."-- Hardin Brothers, PC Resource,
March 1990
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/