Copy Link
Add to Bookmark
Report

QBNews Volume 2 Number 1

eZine's profile picture
Published in 
QBNews
 · 28 Dec 2019

  

Volume 2, Number 1 February 28, 1991













**************************************************
* *
* QBNews *
* *
* International QuickBASIC Electronic *
* Newsleter *
* *
* Dedicated to promoting QuickBASIC around *
* the world *
* *
**************************************************
















The QBNews is an electronic newsletter published by Clearware
Computing. It can be freely distributed providing NO CHARGE is charged
for distribution. The QBNews is copyrighted in full by Clearware
Computing. The authors hold the copyright to their individual
articles. All program code appearing in QBNews is released into the
public domain. You may do what you wish with the code except
copyright it. QBNews must be distributed whole and unmodified.

You can write The QBNews at:

The QBNews
P.O. Box 507
Sandy Hook, CT 06482

Copyright (c) 1991 by Clearware Computing.

The QBNews Page i
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------

T A B L E O F C O N T E N T S


1. From the Editor's Desk
Happy Birthday To Us ......................................... 1

2. Beginners Corner
How I Came To Know And Love ANSI.SYS by Charles Graham ....... 2
Intellectual Property Protection by David Postler ............ 9

3. Swap Shop
Getting and Setting Bits by Richard Randles .................. 17
Reversing Color Attributes by Rick Cooper .................... 18
Detecting DesqView from QB by Monte Ferguson ................. 19
Getting and Setting File Attributes by Rick Cooper ........... 20
Everything You Want To Know About A Program by Keith Rolland . 22
Playing Around With Random Numbers by James Young ............ 24

4. Grapically Speaking
Reading Print Shop Graphics in QuickBASIC by Michael Welch ... 25

5. Power Programming
Creating Smaller QB Executables by T. G. Muench ............. 28

6. New and Noteworthy
PDQComm 2.5 from Crescent Software ........................... 33

7. Some Assembly Required
Setting Error Levels with QuickBASIC by Dave Cleary .......... 34

8. Psst ... Looking For A Library?
An Introduction to QuickSHARE by Michael Welch ............... 37

9. EOF
Receiving The QBNews ......................................... 40
Submitting Articles to The QBNews ............................ 41
Volume One Cumulative Index .................................. 42















The QBNews Page ii
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
F r o m t h e E d i t o r ' s D e s k
----------------------------------------------------------------------

The QBNews Turns Two ! ! !

Welcome to the first installment of Volume 2 of The QBNews. As the
QBNews goes into its second year, I would like to thank everybody who has
contributed to make Volume 1 as good as it was.

Now comes the bad news. As good as the QBNews has been, I've been
working to make it better. I have wanted to be able to offer authors some
cash for their work. This would result in much better articles. I
wanted to do this by selling advertising to companies who sell
QuickBASIC related products. Unfortunately, because the QBNews is a
different kind of magazine in as far as distribution goes, I have no
way to gauge readership. I know and you know that the QBNews has many
readers all over the world. The companies I approached about
advertising don't know and don't consider The QBNews seriously when it
comes to spending advertising dollars.

I urge all of you out there to help out. If you see a product or company
mentioned in the QBNews and you purchase it, let them know where you heard
about it. The only alternative if I can't raise money from advertisers is
to raise money from readers. Come the November issue, I will have to decide
on the fate of Volume 3.

One final note. There is a bug in QBFormat from the last QBNews. In
the SUB InitFormatParms under the SELECT CASE media, it should read:

CASE DX9
Info.Ts = 1440

It previously read 720. Also, QBFormat contains an unimplemented feature
that will allow booting from hard drive C: with a QBFormated floppy in
drive A:. Line 103, column 19 is &H50. Changing &H50 to &H80 will turn that
feature on.

Enjoy your QBNews!
Dave Cleary - Editor














The QBNews Page 1
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
B e g i n n e r s C o r n e r
----------------------------------------------------------------------

How I Came To Know And Love ANSI.SYS by Charles Graham

One morning close to a year ago, I woke up and was troubled about
the future of QuickBASIC. It's a language I know and love and teach,
but I kept coming back to a central question. If QB is so great,
where are the application programs written in QB? At the time, I
didn't know of any. (I have since learned that there *are* a few such
critters. But I didn't know that then.) So I decided I would try to
write such a program. I considered many possibilities. What I really
wanted was something that could be distributed nationally, would be of
general interest, and would be noticed by devotees of C, Pascal and
Assembly. The idea wasn't intended to show the superiority of QB, it
was just to stand on an equal footing.

Being the fan of Bulletin Boards that I am, I finally decided that
writing a full-featured communications (or terminal) program would be
just the ticket. There was only one small remaining problem: I
didn't know anything about communications. I was at the bottom of a
very steep learning curve. But that morning I set out to write -- and
eventually *did* write -- Quick Dial.

Talk about Trial And Error! One of the first things I discovered
is that there are few -- if any -- useful written resources for
writing *modern* communications software. What do you do about the
animation and color that's the staple of modern BBSs? Nobody says
much about that. Oh sure. There's the example in the back of the
GWBASIC manual you get with DOS. There's TERMINAL.BAS that comes with
QB. There's the fine print in the Appendices at the back of your
modem manual. And I *did* locate a text file on file transfer
protocols. But put it all together and it's still not worth six bits.
It's pretty skimpy and pretty lame.

For the purpose of writing Quick Dial, I decided that I would have
to write my own ANSI emulation subprograms. And after a lot of pain
and heartache, I eventually did. But that's not where I started a
year ago. I started by utilizing plain, old, vanilla-flavored,
everybody's-friend, comes-for-free- with-DOS, ANSI.SYS. Using ANSI.SYS
is what Z.BAS is all about.

WHY USE ANSI.SYS?

There are three very good reasons.

* ANSI.SYS is a relatively efficient way to handle screen writes.

* Using ANSI.SYS is a *lot* easier than writing ANSI emulation
routines.

* Even if you're tempted to write your own ANSI emulation
routines,using ANSI.SYS is a good way to get familiar with what

The QBNews Page 2
Volume 2, Number 1 February 28, 1991

ANSI does and how it does it, before you start writing your own
routines.



ARE THERE ANY DISADVANTAGES TO USING ANSI.SYS?

There are only two that I know of.

* The statements required to use ANSI.SYS are slightly longer and
more complex than the equivalent statements would be without
using ANSI.SYS.

* You will, effectively, not be able to keep a "command line"
visible on the screen at all times. This is a popular, but
unnecessary, convention in many commercial communications
packages.



WHAT IS ANSI.SYS?

ANSI.SYS is many things. But for purposes of communications
software, you can think of ANSI.SYS as a standardized set of
instructions that does four things

* clears all or part of the screen
* locates the cursor
* changes the foreground and background colors
* performs all screen writes

ANSI.SYS performs its wonders by interpreting special sequences of
characters that it receives through the modem from a Bulletin Board.
These sequences are referred to as ANSI sequences or ESCape sequences.

Each ANSI sequence begins with an ESCape character which I will
refer to as <ESC>. <ESC> is ASCII character 27 which QD knows as
CHR$(27). <ESC> is always followed by a left bracket. Then none, one
or multiple sequences of digits may be received. If multiple
sequences of digits are received, they are separated by semi-colons.
Finally, each ANSI sequence terminates with an UPPER or lower case
letter that indicates which ANSI command you need to perform.


WHAT ARE THE ANSI.SYS COMMANDS?

For communications purposes, there are 13 ANSI commands indicated
by the terminal letters

H A B C D R n f s u J K m
[Note. CaSe Is ImPoRtAnT. "A" does not equal "a".]

Here's the syntax and what each of these commands means.


The QBNews Page 3
Volume 2, Number 1 February 28, 1991

<ESC>[row;colH -- The Cursor Position command moves the cursor to the
position specified by the parameters row and col. The default for
each parameter is 1. No parameters homes the cursor.

<ESC>[#A -- The Cursor Up command moves the cursor up the number of
lines specified by the parameter #. The default value is 1. Cursor
Up is ignored if the cursor is already on the top row.

<ESC>[#B -- The Cursor Down command moves the cursor down the number
of lines specified by the parameter #. The default value is 1.
Cursor Down is ignored if the cursor is already on the bottom row.

<ESC>[#C -- The Cursor Right command moves the cursor right the number
of columns specified by the parameter #. The default value is 1.
Cursor Right is ignored if the cursor is already in the far right
column.

<ESC>[#D -- The Cursor Left command moves the cursor left the number
of columns specified by the parameter #. The default value is 1.
Cursor Left is ignored if the cursor is already if the far left
column.

<ESC>[row;colR -- A Cursor Position Report is generated by the Device
Status Report command, below. The parameter row contains the cursor's
current line number; col contains the cursor's current column.

<ESC>[6n -- The Device Status Report command triggers a Cursor
Position Report, above, being generated.

<ESC>[row;colf -- The Horizontal and Vertical Position command works
exactly like the Cursor Position command, above.

<ESC>[s -- The Save Cursor Position command stores the cursor's
current row and column. This is used in conjunction with the Restore
Cursor Position command, below.

<ESC>[u -- The Restore Cursor Position command restores the cursor's
position to the location stored by the Save Cursor Position command,
above.

<ESC>[2J -- The Erase Display command clears the screen and homes the
cursor.

<ESC>[K -- The Erase Line command clears from the current cursor
position to the end of the line.


<ESC>[#;...;#m -- The Set Graphics Rendition command changes screen
colors according to any valid # parameters. The following schedule
lists allowable values for the # parameters and the meaning of each.

0 all attributes off
1 bold (or bright) on
4 underscore on (monochrome screens only)

The QBNews Page 4
Volume 2, Number 1 February 28, 1991

5 blink on
7 reverse video on
8 concealed on

30 black foreground
31 red foreground
32 green foreground
33 yellow foreground
34 blue foreground
35 magenta foreground
36 cyan foreground
37 white foreground

40 black background
41 red background
42 green background
43 yellow background
44 blue background
45 magenta background
46 cyan background
47 white background



INSTALLING ANSI.SYS

You need to make sure that the ANSI.SYS driver appears in your
CONFIG.SYS file and that your system knows where to find the file,
ANSI.SYS. There should be a statement in your CONFIG.SYS file that
says something like

DEVICE=[d:][path]ANSI.SYS

where "d:" is an optional drive name and "path" is an optional
directory name (and subdirectory name, if applicable) where the file,
ANSI.SYS is located. For example, if ANSI.SYS was on the C: drive in
a directory called DOS, the line in your CONFIG.SYS file should read

DEVICE=C:\DOS\ANSI.SYS

[Note. Some systems only require a space instead of an equals ("=")
sign. Consult your DOS manual.]

That's all there is to it. By the way, if you are just entering
this line in CONFIG.SYS for the first time, you will have to reboot
your system before ANSI.SYS is actually installed. Thereafter,
ANSI.SYS will be installed automatically each time you boot up.


ACCESSING ANSI.SYS IN A COMMUNICATIONS (TERMINAL) PROGRAM

You need to open the "console" as a file. Opening the "console"
gives you access to the ANSI.SYS device driver that you've installed
in your CONFIG.SYS file. Opening the "console" is easy to do in

The QBNews Page 5
Volume 2, Number 1 February 28, 1991

QuickBASIC. Just enter a statement like

OPEN "CON" FOR OUTPUT AS filenum

where filenum is the file number you want to write to. For example,
if you want to open the "console" as file number 2, you'd enter

OPEN "CON" FOR OUTPUT AS 2

Thereafter, everything you write to file number 2 will be handled
by ANSI.SYS and *not* QuickBASIC.



USING ANSI.SYS IN A COMMUNICATIONS (TERMINAL) PROGRAM

An important hint about using ANSI.SYS is to use it exclusively, or
don't use it at all. I.E., ANSI.SYS and QuickBASIC don't talk to each
other very much -- one doesn't know what the other's doing. If you
want to use ANSI.SYS to take care of your screen functions then you
should *not* use statements like:

LOCATE
PRINT
CLS
COLOR

Instead, use the equivalent ANSI commands and send them through
ANSI.SYS by entering

PRINT #filenum, ANSIcommand;

where "filenum" is the file number that you opened the "console" under
and "ANSIcommand" is the specific ANSI command you want to perform
including any necessary parameters.

Another hint is to store some of the common ANSI characters and
commands in SHARED string variables. This makes programming a little
easier and execution speed a little faster. In Z.BAS, I did this in
four cases.

DIM SHARED ao$, cs$, es$, hc$
es$ = CHR$(27) 'this is the <ESC> character
ao$ = es$ + "[0m" 'this turns all screen attributes off
cs$ = es$ + "[2J" 'this clears the screen and homes the
cursor hc$ = es$ + "[f" 'this homes the cursor

"SHARED" means you can use these shortcuts in all subprograms without
having to define them in each one.


SOME PROGRAMMING EXAMPLES

For these examples, let's assume you have opened the "console" as

The QBNews Page 6
Volume 2, Number 1 February 28, 1991

file number 2.

Suppose you want to change the screen colors to bright cyan on a
black background before printing some text. You *could* use the
QuickBASIC statement

COLOR 11, 0

But don't! Do it the ANSI.SYS way. The statement you need is

PRINT #2, es$ + "[0;1;36;40m";

where
0 turns all attributes off
1 turns the "bold" or "bright" attribute on
36 specifies a cyan foreground
40 specifies a black background
m specifies the Set Graphics Rendition command

Suppose you want to clear the screen and home the cursor. You
*could* use the QuickBASIC statement

CLS

But don't! The statement you need is

PRINT #2, cs$;

Or suppose you're editing a field and want to emulate the action of
a destructive backspace. You *could* use the QuickBASIC code

LOCATE , POS(0) - 1
PRINT " ";
LOCATE , POS(0) - 1

But don't! The code you need is

PRINT #2, es$ + "[1D";
PRINT #2, " ";
PRINT #2, es$ + "[1D";


WHAT IF I NEED MORE INFORMATION?

I hope you'll be able to see how to use ANSI.SYS when you review
the source code for Z.BAS. Many of the ANSI commands are used. By
running, or compiling and running, Z.BAS you'll be able to compare the
code to the action. But if questions do arise, I'll be happy to *try*
to answer them.

The best place to leave questions for me is in the National
QuickBASIC Conference. If you do not belong to a BBS that carries
same, I would strongly suggest that you ask around to find a local
Board that *does*. It's loaded with folks who know *lots* of stuff

The QBNews Page 7
Volume 2, Number 1 February 28, 1991

about QuickBASIC and who are willing to talk to you!

**********************************************************************
Charles Graham is a division head for a local government agency in St.
Louis County, Missouri. He also teaches QuickBASIC part time at a
local community college. He is the author of several shareware
products including MOVIES . ON . LINE and Quick Dial. He can be
contacted at Post Office Box 58634, St. Louis, MO 63158, and on the
National QuickBASIC Conference.
**********************************************************************












































The QBNews Page 8
Volume 2, Number 1 February 28, 1991

Staking a Claim. Intellectual Property Protection for Software.
By David Postler

Well, you have finally done it. Your program works flawlessly,
the code is a wonder to behold and is the kind of program that no
computer owner can be without. But... How do you protect yourself
from being ripped off?? This article will give a very basic
introduction to intellectual property protection.

*****DISCLAIMERS*****
First let's get a few things out of the way. I AM NOT A LAWYER!
Any specific questions should be referred to an attorney skilled in
copyright/Patent and other intellectual property laws.Second,
intellectual property law varies from area to area. This article will
cover general U.S. law on the subject. This will vary from country to
country and even from state to state. Third, my experience comes from
many years in engineering jobs and also from my free lance writing
experience. I've found that knowing the law makes it harder to rip
you off.

Intellectual property law has a history that dates from a law
called the Statue of Anne in 1710 by the English Parliament. It was
the first copyright law granting authors the right to control
publication of their work. In addition, kings used to grant Letters
of Patent to allow inventors or others to profit from their work.
Intellectual property law was also important to the founding fathers.
Remember, Jefferson and Franklin among others both had scientific and
literary reputations in addition to their political skills. In the
constitution of the United States Article 1 section 8 states:

"To promote the Progress of Science and useful Arts, by
securing for limited time to Authors and Inventors the exclusive
Right to their respective Writings and Discovery."

Trademark protection came along in the late 1800's. Trade
secret protection relies on contract law and also came along in the
late 1800's or early 1900's. For those in the international arena,
many treaties have been negotiated regarding intellectual property
laws. The laws have been updated as the times change. The last major
revision of the copyright act was in 1978 with minor changes in 1980.
Patent law has also been updated to reflect the changing times. It
should be clear from all this that intellectual property is regarded
as property and can be protected. It should also be clear that such
protection is for a limited time only. Any person thinking otherwise
should read some of the books and magazine articles listed at the end
of this article.

Another major consideration for all intellectual property law is,
who owns the work. There are several things to watch out for. First
is public domain work. This is work that either the Copyright/Patent
has expired or has not been protected. Older work such as Shakespeare
is Public domain. Other works that are not protected include most
government works and other works that the authors simply do not care
to protect them. One thing to remember is that Shareware or Freeware

The QBNews Page 9
Volume 2, Number 1 February 28, 1991

is NOT THE SAME AS PUBLIC DOMAIN!!! If you remember anything from
this article remember that.

The next thing is the problem of work for hire. This varies
greatly from state to state, but in general, if you do work for your
employer within the scope of your employment, then the work belongs to
your employer. An example is if you are a database programmer and
program a database at work, it belongs to your employer. If you do
it at home, it may belong to your employer and it may not. This varies
from state to state. On the other hand if your job title is
"Assistant Night Custodial Engineer III", (Janitor), any programming
that you do outside of work does not belong to your employer. What if
you are an outside contractor? There was a very involved case
recently (Reid vs Community for Creative Non Violence) that settled
some of the law as it regards to that area. To save trouble, you
should make sure that those matters are settled in the contract. If
you are a regular employee, it helps to have a policy on this stated
up front rather than fighting it out in the courts. For the sake of
argument, we will assume that your work does not fit in any of these
categories meaning it is yours and you can legally protect it.

The first protection you will run across is Copyright. This
is quite literally the right to make copies. It can protect your
computer program and possibly the screens or other visual or
audio aspects of your program. In most cases, this is the only
protection you will have available for a computer program should be
all you need. Copyright protection is automatic. As soon as your work
is fixed in a tangible form of expression, a copyright exists. In
other words, when your program is saved to disk you have a copyright.

So why do you have to register? First, it proves your authorship
from the date the software is received by the copyright office.
Second, you can obtain statutory damages from any person who steals
your code. More about that later. A very common myth is that you
should seal your work in an envelope and send it to yourself.
According to the copyright office, this has never held up in court.
One reason it might not is, how can you prove that the envelope has
not been altered over the years? If any other person could prove that
it is possible that you could have altered the contents of the
envelope then it could be considered "tainted" and not be allowed as
evidence in a court. Registered mail might be better but, best of
all, register your work. A copyright certificate is Prima Face
evidence of your work. To register, call the Copyright office to get
the appropriate forms and information. The numbers are listed at the
end of this article.

Basically, you must send in a copy of your program source code. If
you wish to copyright the screens then you must send descriptions,
pictures or videotapes to the copyright office in addition to your
source code. There are special exemptions to disclosure requirements
if you wish to keep your program secret. You may block out or not
send in certain portions of the program. Contact the copyright office
and ask for circular R61 for details.


The QBNews Page 10
Volume 2, Number 1 February 28, 1991

What protection does a copyright give you? The right to make
copies, with some exceptions. First, any owner of a computer program
may make an archival copies, but may not distribute them. Second, the
owner may alter the program if necessary for use on a particular
computer. Bear in mind that these two items may be constrained by
the license agreement. Third is the fair use doctrine. This is a bit
nebulous but if the use of a program is for instructional purposes and
DOES NOT HARM the rights of a copyright holder, it is allowable. For
example, say that an English teacher may see your instructions for
installing your game and consider them a model of clarity (or disaster
of the first rate) and desire to show portions of the manuals to their
class as an example. That probably would be allowable. On the other
hand, if a Computer Science department decided to make multiple copies
of your program instead of buying them, this probably would be
considered infringement. There are some other instances where copying
is permitted, but in mast cases, they are for non commercial use only.
If they are commercial (for example jukeboxes) they usually include
mandatory royalties. The second right given is the right to prepare
derivative works. This means that the copyright owner must be
consulted to prepare new versions of a program. This may even include
translation to other computer languages. This means that you may not
rewrite someone's program, EVEN IF YOU IMPROVE IT, and then claim it
as your own. The protection lasts for the life of the author PLUS 50
years. If there are joint authors, the term is until 50 years after
the death of the last surviving author. For works for hire, the term
is 100 years after creation or 75 years after publication, whichever
comes first.

At first glance, copyright protection would be all you need.
So why do we have other types of protection in addition to
copyright? Well, Copyright protection does have some
limitations. First, it protects only the expression of the idea
not the idea itself. If someone else comes up with another way
to do the same idea, then you have no right to compensation from
them. With some precautions, you can legally reverse engineer a
copyright. However, talk to an attorney first. Also, copyright
must be an original and non obvious way of doing something. For
example, you can't copyright the Print Screen key on an IBM
keyboard as part of your program.

Another question concerns "look and feel" and the Lotus decision.
My research (I read the entire opinion) indicates that there really is
not much to fear. What the judge said, in essence, is that you cannot
deliberately copy another programmer's work down to the last keystroke
and hide behind copyright law. He specifically rejected look and feel
on its own as a legitimate test for infringement. The judge went to
great pains to point out that there was more than one way that a
spreadsheet could be programmed and cited Excel as an example.
Furthermore, it was admitted by VP software that they changed VP
Planner to duplicate 1-2-3 down to the last keystroke. According to
the judge that was one step too far.

How do you enforce your copyright? Send Sgt. Joe "We take
copyright law seriously in this town mister!" Friday over to bust

The QBNews Page 11
Volume 2, Number 1 February 28, 1991

them. Sorry folks it doesn't work that way. In almost all cases
copyright infringement is considered a civil matter. This means that
you must prove that the person actually copied your work. There are
two general parts to this. First, there must be at least one valid
copyright notice in the work in plain view. Another idea from the
book "The Legal Guide to Computer Software Protection" is to include
some nonsense code in your work. For example:

AHCTOG$ = "RELTSOP DIVAD YB 1991 THGIRYPOC"

Does not seem like much but by reversing the strings you get:

GOTCHA$ = "COPYRIGHT 1991 BY DAVID POSTLER"

If something like this were found in an offender's code, your next
step would be to prove how much money the "creep" should pay you.
Bear in mind that if you registered your code within the first three
months of publication, you would be entitled to $100/copy Statutory
damages plus Attorneys fees and court costs. Whether or not you
registered your work, you can always get an injunction stopping the
infringer from using your work and if you can prove that losses
resulted from infringement, you can recover damages. Be creative in
the nonsense code department. Do nothing loops or GOTO statements for
the next line can also be used. Another idea used by several people
on the Fidonet Quick Basic conference is to check your copyright
notice for alteration using a checksum or CRC. This is also a good
idea.

Patent protection is another form of protection for your program.
Patent protection offers protection for your IDEA for 17 years.
However, a patent is much more expensive and harder to obtain than a
copyright. A patent is for a useful original and non obvious process,
machine, manufacture, or composition of matter. Relating to programs,
patents will apply to algorithms or other parts of your program. You
cannot patent a program itself. If you can get it, the patent
provides some of the most airtight protection available. You have
exclusive rights to your idea for 17 years. You cannot reverse
engineer a patent as you can a copyright. However, you can invent
something similar that does not infringe on the patent. This
protection comes at a price. You must provide FULL disclosure so that
anyone skilled in the art may recreate your invention. To apply for a
patent on software, you should seek the advice of a Patent Attorney or
Agent. A Patent Attorney is a lawyer who has additional technical
skills and passed a special examination to be admitted to practice
before the Patent Office. A Patent agent is a skilled professional
such as an engineer who has also passed an examination and is also
permitted to practice before the Patent Office. Software patents are
a very new field and the Patent office will be inclined to deny your
patent. You will need a skilled person to explain what to patent and
how to draw up your patent for maximum protection. Also be prepared
to spend some serious money, usually several thousand dollars. It is
impossible to give an exact dollar amount but it is worthwhile to
mention that the inventor who recently obtained the patent on
microprocessor chip design took 20 YEARS AND 2 LAWSUITS to get his

The QBNews Page 12
Volume 2, Number 1 February 28, 1991

patent application approved. Another concern is that after 17 years,
you have no protection. Anyone can use an expired patent without
paying you compensation. Like a copyright, patent law is generally
enforced as a civil matter. You must show that the person used your
idea and infringed on a claim in your patent. Another popular defense
is to claim that your patent is not valid. It can and has worked so
be careful. This is where a patent attorney or agent is invaluable.

If you have a business, you may develop a trademark. This is
a distinctive word or mark used to identify your business. The
most common example in the computer business is the word IBM(tm). The
Apple symbol is also a trademark. The trademark is used to identify
your business and cannot be used by others in a deceptive manner. For
example, I would not suggest naming your company MicroSoftware, unless
you would like to meet Bill Gates in court. The main point to
remember is that Trademarks are created by use. A trademark is
registered by the Patent office, properly called the Patent and
Trademark office. Some states also permit trademark registration.
Registration is valid for 20 years and is renewable as long as you
continue to use it. To get a federal trademark, you must create a
mark and use it in interstate commerce for one year. Then you can
register it with the Federal government. To register, you should
contact the Patent and Trademark office for information and fees.
Surprisingly, this can protect your software. If someone makes pirate
copies, you can sue them for misuse of your trademark. In addition,
it can protect you from having another company try to mislead
customers by making a similar product with a similar name.

The last type of protection is much more difficult to quantify.
Trade Secrets are specialized knowledge or information used in a
business. The secret can be either the knowledge or the use of common
knowledge in a specialized manner. An example would be almost any of
the BIOS tricks used by people to make their programs better. This
would be protected by common law rather than Federal Statute. This
means that you may have to sue in state rather than Federal courts.
This can be one of the best methods of protection possible as there is
NO time limit on the protection. To qualify for protection, the
information first must be a secret. (Bet that surprised you, didn't
it.) This means that if you are asked to write a magazine article on
your methods you must refuse or else risk your trade secret
protection. Likewise, you must clearly state to any employees or
outside contractors used what is and is not secret, preferably by
written agreement. You should also keep the information locked up or
otherwise secured. In simple terms, the information must not be
common knowledge and you must treat it as a secret for trade secret
protection to apply. However, this will not protect you if someone
discovers your secret independently and then decides to publish it.

Let's talk a little about license agreements. Remember that there
are two very different cases for license agreements. In the first
case, you open the software and find a license agreement inside that
says by opening the software you have agreed to the license agreement.
This agreement gives you have almost no rights and the company
reserves all rights. In this case lawyers have said and the courts

The QBNews Page 13
Volume 2, Number 1 February 28, 1991

tend to agree that these agreements MAY not be enforceable. This is
still open to question however, meaning you will have to go to court
in order to get such an opinion. This would likely cost you much more
than the software itself. The second case is a more specialized job,
say a CAD/CAM or database system involving customization of software
and continuing support. As part of your contract you have a license
agreement spelling out trade secrets and other provisions and the
client reviews it and requests some changes, which you negotiate and
agree to. In that case, the license agreement is very likely to be
totally enforceable. The difference between the two agreements is
fairness and informed consent. In simple language, you simply cannot
hand someone a one sided document and say take it or leave it. When
creating a license agreement you should definitely have an attorney,
as failure to draft it properly can invalidate the entire agreement.
As a user you should check your state laws as several states have
passed laws regarding license agreements for mass marketed software.

Up till now I have tried to be factual and objective. This last
paragraph will still be factual but it will rest on some of my
personal experience and contain some of my opinions. You may
agree or disagree, but at least think about some the points I
raise. First, should you protect your work? If you are working
as a business then definitely yes! Your skills and programming
are your major assets and failure to protect them is foolish.
You should also have an attorney skilled in intellectual property
work with you. This will cost some money. Good attorneys get around
$100.00/hr and UP in my area. But it should be considered part of the
cost of doing business. If you are doing things as a hobby, then it
gets more doubtful. Most of the work involved in an idea is the
implementation. Ideas are not worth very much by themselves. If
another company wishes to create an idea similar to yours, they very
likely will succeed. You can "break" patents and any other form of
intellectual property protection. The second reason is that a lawsuit
is a very difficult undertaking. I have been slightly involved with a
some lawsuits in my professional life, and consequently, I get nervous
even walking past a courthouse. The fact is that a lawsuit is
expensive, although may be able to get a lawyer to take your case on
contingency fee. It is also expensive in terms of time. You will also
have to wait several years for your case to come to trial. When it
comes to trial, you may have to spend days or weeks in court. You
also may be completely surprised by the outcome of your case. I'm
pretty sure that had Ashton Tate and SEA realized the outcome of their
court cases, they would have been more careful before going to court.

In conclusion, intellectual property protection can protect your
knowledge and expressions of knowledge. Unless you have some good
business sense and skill to go with your knowledge, a copyright or
patent by itself will not make your rich.



Contact Information

Here is information for you to contact the appropriate government

The QBNews Page 14
Volume 2, Number 1 February 28, 1991

offices for copyright and patent information.

Copyright Office

There are two phone numbers for the copyright office. One to
order copyright information and another to speak with a copyright
information specialist who will help you with information. Bear in
mind that they are not an enforcement agency and they are not
attorneys so they will not give any legal opinions. Also remember
that the fee is $20.00 up from $10.00.

Order Line: 202 707-9100
Information Line: 202 479-0700
Start with circulars 1, 31, 61, and form TX.
Address: Register of Copyrights
Copyright Office
Library of Congress
Washington, D.C. 20559

Patent and Trademark Office

I tried to contact the Patent office for this article but could
not make contact with them. If you want to talk to them, good luck.
They have their major offices in Arlington Va.
Phone Number: 703 557-3341
Address: Commissioner of Patents and Trademarks
Washington, D.C. 20231



Bibliography

Here is a list of books and other sources I have used to prepare
this article. This is not a complete list but is a good stating
point.

Books

The Incredible Secret Money Machine
By: Don Lancaster, Published by: Howard Sams & Company.

What everybody should know about patents trademarks and
copyrights
By: Donald M Dible,editor Published by: Entrepreneur

The legal guide to computer software protection; a practical
handbook on copyrights, trademarks, publishing, and trade secrets
By: Thorne D. Harris

Spectacular Computer Crimes
By: Buck Bloombecker Published by: Dow Jones-Irwin

Magazine Articles


The QBNews Page 15
Volume 2, Number 1 February 28, 1991

Little Quarterdeck Throws Its Weight Around
Business Week June 19, 1989, By: Patrick Cole and Deidre Depke

Protecting Intellectual Property Rights Abroad: Pointers for
U.S. Exporters
Business America Nov 21, 1988, By: Guy C. Smith

Clamp a Lid on Company Secrets
Nation's Business July 1988, By: Jane Easter Bahls

Who Owns the Copyrights?
Byte April 1990, By: William T. McGrath

The Case Against Patents
Radio Electronics January 1991, By: Don Lancaster

BBS Information

Several Files were downloaded from EXEC-PC (414) 789-4210, Bix
(617) 861-9767 and Genie for research on this article. Search
for Copyright, patent and Trademark and you will find the current
files dealing with these subjects.

*********************************************************************
David Postler is a Field Service Engineer working on NC and CNC
machine tools. He can be reached in the Quik_Bas echo in Fidonet or in
care of this newsletter.
*********************************************************************


























The QBNews Page 16


----------------------------------------------------------------------
S w a p S h o p
----------------------------------------------------------------------


All of the following code came from the QUIK_BAS National
Conference available from FidoNet. If you are interested in receiving
this conference, ask the sysop of your local Fido BBS about picking
it up. Inquiries about echo feeds should be sent to Fabian Gordon
at 1:107/323.

---------------------------------------------------------------------

From: Richard Randles
To: Mike Welch
Subj: Re: Bit of this, bit of that

MW> First, I want to again thank you for the bit check routine. I
MW> finally got around to checking out all the responses I received.
MW> Sometimes it's nice, and sometimes it's not so nice, but it is
MW> always interesting to see how many DIFFERENT ways one thing can be
MW> handled in a program!

That's what I like about it. It doesn't matter how experienced you
are, sooner or later you'll see someone do something that works better
than what you thought was the best.

MW> I received about 8 different ideas, of those that actually worked
MW> (grin) I liked yours the best. Seemed the easiest way to get the
MW> answer.

It's a middle of the road routine. Simple but not as speedy as it
could be. I threw it in there for variety.

MW> My question for you, Richard, is sort of two fold:
MW>
MW> 1. What are you doing with GetBit% = Work& AND 1?
MW> Why is the Work& AND 1 necessary? Duh?

It removes any higher order bits that may remain. ie: if you pass 9
(1001) and check bit 2, Work& would contain 2 (10). Anding with 1
then turns off all other bits except the first one.

MW> 2. Now, fine. I can read bits in a word. Goodie. Okay,
MW> how about a similar routine that SETs bits in a word!
MW>
MW> Am I pushy, or what? (tapping foot)... <grin>

Oh, and I suppose you're going to be difficult and want it in BASIC
instead of assembler? ;) I'll give you both. The assembler version
of SetBit took a lot less time to write than the BASIC one because of
the problems of handling negative (sign bit set) values in BASIC.

See the next message for the assember versions of both routines.

The QBNews Page 17
Volume 2, Number 1 February 28, 1991


'------------------- Tear Here ---------------------

DECLARE FUNCTION GetBit% (Word%, BPos%)
DECLARE SUB SetBit (Word%, BPos%, OnOff%)

FUNCTION GetBit% (Word%, BPos%)
Bit& = 1
FOR i% = 1 TO BPos%
Bit& = Bit& + Bit&
NEXT i%
GetBit% = -((Word% AND Bit&) > 0)
END FUNCTION

SUB SetBit (Word%, BPos%, OnOff%)
Bit& = 1
FOR i% = 1 TO BPos% 'Make mask
Bit& = Bit& + Bit&
NEXT i%
IF Bit& > 32767 THEN Bit% = Bit& - 65536 ELSE Bit% = Bit&
IF OnOff% THEN
Word% = Word% OR Bit% 'Turn bit on
ELSE
Word% = Word% AND NOT Bit% 'Turn bit off
END IF
END SUB
----------------------------------------------------------------------


From: Rick Cooper
To: Mike Welch
Subj: Reversing Color Attributes

FUNCTION MakeReverse% (attrb)
'=====================================================================
' Syntax : Attribute = MakeReverse%(Attrbute)
' Will Reverse Attribute and Maintain Blink and High Intensity Bits.
' When You Reverse An Attribute With High Intensity Bit Set,The Former
' Background Color Will Become A High Intensity Forground Color.
'=====================================================================

forground = (attrb AND &HF) 'Get Forground Color
background = ((attrb AND &HF0) / &H10) 'Get Background Color

oattrb = attrb 'Save Original Attribute

attrb = ((16 * forground) + (background)) 'Make New Attribute

'=====================================================================
' Check The New Attribute Against The Old To See If Intensity And
' Blink Bits Agree And Take Needed Action
'=====================================================================

IF (oattrb AND 128) <> 128 AND (attrb AND 128) = 128 THEN
attrb = (attrb XOR 128) + 8
ELSEIF (oattrb AND 128) = 128 AND (attrb AND 128) <> 128 THEN

The QBNews Page 18
Volume 2, Number 1 February 28, 1991

attrb = (attrb XOR 128) - 8
END IF

MakeReverse% = attrb

END FUNCTION
----------------------------------------------------------------------


From: Monte Ferguson
To: Tony Mace
Subj: Detecting a Multi-Tasker

> Question: Does anyone know how using QuickBasic to detect if a
> multitasker is running.

I wrote something to detect Desqview (and return a version number):

------------------------------> clip here <---------------------------
DECLARE FUNCTION DVVers! ()

DEFINT A-Z

TYPE RegType
AX AS INTEGER
Bx AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE

DIM SHARED InRegs AS RegType, OutRegs AS RegType

CLS
DV! = DVVers!
IF DV! = 0 THEN
PRINT "DESQview is currently NOT running."
ELSE
PRINT USING "You are running under DESQview version #.##"; DV!
END IF

END

FUNCTION DVVers!

InRegs.CX = &H4445 ' An invalid date... (= "DESQ")
InRegs.DX = &H5351
InRegs.AX = &H2B01 ' DOS Set Date function
CALL interrupt(&H21, InRegs, OutRegs)
IF (OutRegs.AX AND 255) = 255 THEN
DV.Vers = 0

The QBNews Page 19
Volume 2, Number 1 February 28, 1991

ELSE
DV.Vers! = ((OutRegs.Bx AND &HFF00) / 256) + _
(OutRegs.Bx AND 255) / 100
END IF
DVVers! = DV.Vers!

END FUNCTION
----------------------------------------------------------------------


From: Rick Cooper
To: Tim Kilgor
Subj: File Exist

I Have Included The Routine For Setting The File's Attribute But To
Check For A File's Existance You Only Need Use The "Get Attribute"
routine. Its Only About 12 or 13 Lines Of Code.

'*********************************************************************
' This Code Is QB 4.5 For PSD7 Change VARSEG To SSEG
'
' I have Included Functions For Getting And Setting File Attributes
' You Should Always Get The Attribute First So That You Only Toggle
' The Attribute You Want And Leave Any Other Attributes Alone.
' Both Functions Return the Same Error Codes, GetFileAttribute%
' Returns The Error In ReturnCode% And The Attribute In It's Name
' While Function SetFileAttribute% Returns The Error Code In It's
' Name.
' Error Codes Are As Follows:
' 1 = Invalid Function (Networks Only)
' 2 = File Not Found
' 3 = Path Not Found
' 5 = Access Denied (NetWorks Only)
' Have You Guessed That GetFileAttribute Would Be Ideal For Checking
' For A Path Or File's Existance??? Only 13 Lines Of Code.
' Usage:
' Attribute% = GetFileAttribute% (FileName$,ReturnCode%)
' FileName$ Can Include Full Path Names
' ReturnCode% Will Be One Of The Above Or 0
' The File Attribute Is Returned In The Function Name
'
' ErrorCode% = SetFileAttribute%(FileName$,FileAttribute%,Attrb$)
' FileName$ Can Include Full Path Names
' FileAttribute% Is The Attribute You Wish To Change
' Attrb$ Is One Or All Of The Following Characters
' A = Archive
' S = System
' H = Hidden
' R = Read Only
' Will Accept Characters Of Any Case
'
' I Have Included A SIMPLE Demo With No Error Checking Routine....
' And It Will' Continue To Toggle The Attribute As Desired Until You
' Press Enter Or Escape.
'*********************************************************************
DECLARE FUNCTION GetFileAttribute% (FileName$, ReturnCode%)

The QBNews Page 20
Volume 2, Number 1 February 28, 1991

DECLARE FUNCTION SetFileAttribute% (FileName$,FileAttribute%, Attrib$)
'$INCLUDE: 'qb.bi'

FileName$ = COMMAND$ 'Get The Name Easy

IF FileName$ = "" THEN
INPUT "Enter file name "; FileName$ 'Or get it direct
END IF

CLS 'Clear the screen

start: 'OH GOD A LABEL!!!!

Attrb$ = STRING$(4, 95) 'Set up the blanks
FAttrb% = GetFileAttribute%(FileName$, RC%) 'Get the attribute
'And set string properly

IF (FAttrb% AND 1) = 1 THEN MID$(Attrb$, 1, 1) = "R"
IF (FAttrb% AND 2) = 2 THEN MID$(Attrb$, 2, 1) = "H"
IF (FAttrb% AND 4) = 4 THEN MID$(Attrb$, 3, 1) = "S"
IF (FAttrb% AND &H20) = &H20 THEN MID$(Attrb$, 4, 1) = "A"

mess$ = FileName$ + " " + Attrb$ ' Show the name and current
' file attribute
LOCATE 1, 1
PRINT mess$ 'And print it

IF RC% = 0 THEN 'Check for error and if
'none go on and toggle

Ans$ = INPUT$(1) 'Get attribute to toggle
'or request to exit

IF Ans$ = CHR$(27) OR Ans$ = CHR$(13) THEN SYSTEM
RC% = SetFileAttribute%(FileName$, FAttrb%, Ans$) 'TOGGLE
Ans$ = "" 'Clear
GOTO start 'OH GOD A GOTO!!!!!
ELSE
PRINT "Error #" + LTRIM$(STR$(RC%)) 'Yep, and error so print
'code and exit
SYSTEM
END IF

FUNCTION GetFileAttribute% (FileName$, ReturnCode%)
'*********************************************************************
'Now To The Meat Of Things... This Will Quickly Tell If A File Exists
'Or Not.
'*********************************************************************

DIM InRegs AS RegTypeX, OutRegs AS RegTypeX 'Dimension Register
'Types
FileToSet$ = FileName$ + CHR$(0) 'Make ASCIIZ String
'From File Name
ReturnCode% = 0 'Zero Return Code

The QBNews Page 21
Volume 2, Number 1 February 28, 1991


InRegs.ax = (256 * &H43) + &H0 'Set Function Number
InRegs.ds = VARSEG(FileToSet$) 'Pass Segment Of Name
InRegs.dx = SADD(FileToSet$) 'Pass Offset Of Name
CALL INTERRUPTX(&H21, InRegs, OutRegs) 'Call Interrupt 21

IF (OutRegs.flags AND 1) = 0 THEN 'Is There Any Errors?

GetFileAttribute% = OutRegs.cx 'Nope..Return Attribute
ELSE
ReturnCode% = OutRegs.ax 'Yep! Pass Error Code
END IF
END FUNCTION


FUNCTION SetFileAttribute% (FileName$, FileAttribute%, Attrib$)

DIM InRegs AS RegTypeX, OutRegs AS RegTypeX 'Dimension Register
'Types
Attrib$ = UCASE$(Attrib$) 'Make Sure It's
'Upper Case
FileToSet$ = FileName$ + CHR$(&H0) 'Convert Name to
'ASCIIZ
FOR i = 1 TO LEN(Attrib$) 'Toggle All The
'Any Selected
SELECT CASE MID$(Attrib$, i, 1) 'Attributes

CASE IS = "R"
FileAttribute% = FileAttribute% XOR &H1 'Toggle Read Only
CASE IS = "H"
FileAttribute% = FileAttribute% XOR &H2 'Toggle Hidden
CASE IS = "S"
FileAttribute% = FileAttribute% XOR &H4 'Toggle System
CASE IS = "A"
FileAttribute% = FileAttribute% XOR &H20'Toggle Archive
END SELECT
NEXT i

InRegs.ax = (256 * &H43) + &H1 'Load Set Function
InRegs.cx = FileAttribute% 'Attribute To Set
InRegs.ds = VARSEG(FileToSet$) 'Pass Segment
InRegs.dx = SADD(FileToSet$) 'Pass Offset
CALL INTERRUPTX(&H21, InRegs, OutRegs) 'Call Interrupt 21

IF (OutRegs.flags AND 1) <> 0 THEN 'Is There An Error?
SetFileAttribute% = OutRegs.ax 'Yep! Pass Error
ELSE 'Nope..Pass Zero
SetFileAttribute% = 0
END IF

END FUNCTION
----------------------------------------------------------------------


From: Keith Rolland
To: All

The QBNews Page 22
Volume 2, Number 1 February 28, 1991

Subj: Ok Mike... :)

'PROGRAMINFO.BAS, QuickBasic SUBroutine, 82 lines
'For the use of all QB users everywhere.
'Keith Rolland 1:321/109.2@FidoNet

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' declare sub ProgramInfo (ProgramName$, CommandTail$, DosVerHi%,_
' DosVerLo%, CurrentDir$, Path$, Environment$)
'
' ProgramName$ = the full name of the currently running program
' CommandTail$ = anything else that was on the command line, case
' preserved
' Environment$ = the full text of the environment, each separated by
' chr$(255)
' CurrentDir$ = the current directory, which may be different than
' Path$
' Path$ = the full path where the program is, as in "C:\BASIC\PROGS"
' DosVerHi% = the major number of DOS, as in "3"
' DosVerLo% = the minor number of DOS, as in "21" (for DOS 3.21)
' This routine should be used before any disk activity is performed,
' because the default 128-byte DTA (disk

  
transfer area) is the
' CommandTail$ area.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

'$include: '\qb\lib\qb.bi'

sub ProgramInfo (ProgramName$, CommandTail$, DosVerHi%,_
DosVerLo%, CurrentDir$, Path$, Environment$)

Environment$ = "" : ProgramName$ = "" : Path$ = "" : CommandTail$ = ""
dim reg as RegTypeX

reg.ax = &H3000
interruptx &H21, reg, reg
DosVerLo% = (reg.ax \ 256)
DosVerHi% = (reg.ax mod 256)

reg.ax = &H1900
interruptx &H21, reg, reg
Drive$ = chr$((reg.ax and &Hff) + 65) + ":\"
reg.dx = 0
reg.ax = &H4700
tmp$ = space$(64)
reg.ds = varseg(tmp$)
reg.si = sadd(tmp$)
interruptx &H21, reg, reg
CurrentDir$ = Drive$ + left$(tmp$, instr(tmp$, chr$(0)) - 1)


reg.ax = 25088
interruptx &H21, reg, reg
def seg = reg.bx
EnvLo% = peek(&H2c)

The QBNews Page 23
Volume 2, Number 1 February 28, 1991

EnvHi% = peek(&H2d)
CmdTailLen% = peek(&H80)

for tmp% = &H81 to ((&H81 + CmdTailLen%) - 1)
CommandTail$ = CommandTail$ + chr$(peek(tmp%))
next tmp%

def seg = EnvLo% + (EnvHi% * 256)
Pointer% = 0
do until peek(Pointer%) = 0
do until peek(Pointer%) = 0
Environment$ = Environment$ + chr$(peek(Pointer%))
Pointer% = Pointer% + 1
loop
Environment$ = Environment$ + chr$(255)
Pointer% = Pointer% + 1
loop

Pointer% = Pointer% + 3
do until peek(Pointer%) = 0
ProgramName$ = ProgramName$ + chr$(peek(Pointer%))
Pointer% = Pointer% + 1
loop

PathLen% = len(ProgramName$)
for Pointer% = PathLen% to 1 step -1
tmp$ = mid$(ProgramName$, Pointer%, 1)
if tmp$ = "\" then
Path$ = left$(ProgramName$, (PathLen% - Pointer% - 2))
ProgramName$ = mid$(ProgramName$, Pointer% + 1)
exit for
end if
next Pointer%
def seg
end sub
----------------------------------------------------------------------


From: James Young
To: All
Subj: Playing Around With Random Numbers

If anyone is interested in experimenting with random number
generators, you might try the following. The linear congruential
method of generating pseudo-random sequences has been widely studied
and analyzed for years. This method can be written like this:

FOR j = 2 to N
a(j) = (a(j-1) * B + 1) MOD M
NEXT

If a(1) contains some arbitrary number (the "seed"), this code
fragment will fill up an array with N random numbers. To get a new
random number, take the previous one, multiply by a constant B, add 1,
and take the remainder when divided by a second constant M. The
result will be an integer between 0 and M-1.

The QBNews Page 24
Volume 2, Number 1 February 28, 1991


The analyses of this formula have provided some guidelines for
selecting B and M. First, M should be large. It is normally
convenient to make M a power of 2 or 10. Second, B shouldn't be too
large or too small; a safe choice is to use a number with one digit
less than M. Third, B should be an arbitrary constant with no
particular pattern in its digits EXCEPT that it should end with the
three digits x21 with x being an even digit. (This last requirement
is peculiar, but it prevents some bad sequences which have been found
by analysis.) Any seed will work.

Some combinations of B, M, and a(1) will cause very short cycle
sequences to be generated. For example, B=19, M=381, and a(1)=0 will
generate the sequence 0,1,20,0,1,20,....

Implementing this in BASIC requires a little fiddling because the
multiplication a*b usually causes an overflow. This can be overcome
by breaking the multiplication up into pieces and tossing out the
pieces which cause the overflow since we are only interested in some
of the right-hand digits.

This example uses a seed of 1234, an M of 10000, and a B of 7821. The
seed is broken into p1 and p0, and B is broken into q1 and q0. M1 is
selected such that M1*M1=M.

One other problem with this method is that the right-most digits are
usually not particularly random. This example gets rid of the two
right hand digits.

DEFINT A-Z
a = 1234 ' this is the "seed'
FOR j = 1 to 100 ' generate 100 random numbers
M = 10000 ' see text
M1 = 100 ' M1 * M1 = M
b = 7821 ' see text (note last 3 digits)
p1 = a \ M1 ' this line and the next 5 lines
p0 = a MOD M1 ' get around the problem of
q1 = B \ M1 ' overflow
q0 = B MOD M1
c = (((p0 * q1 + p1 * q0) MOD M1) * M1 + p0 * q0) MOD M
a = (c + 1) MOD M ' replace the old random number with the new one
g = a \ M1 ' throw away the last 2 digits
PRINT g ' this is our "random" number
NEXT
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
G r a p i c a l l y S p e a k i n g
----------------------------------------------------------------------

Reading Print Shop Graphics in QuickBASIC by Michael Welch

Graphics have always impressed me, even back in the days when
SCREEN 2 was considered "high resolution." Recently, Earl Montgomery
revitalized my interest in a QuickBASIC script that Ryan Snodgrass
submitted to the Fido QUIK_BAS echo. I thought this program would
display Print Master graphics in SCREEN mode 1. Try as I did, I could
not get the program to work! In this, my second attempt at
understanding the file format, I realized that Ryan's routine was
designed to work only with Print SHOP icons, and I learned some other
very interesting things in the process.

The following discussion assumes the reader understands the
concept of data types, has a full grasp of file I/O, and has some
understanding of graphics programming. The aim of this article is to
discuss a popular graphic file format. For theory and syntax to the
QuickBASIC language, please refer to the beginner's column.

Print Master and Print Shop icons are 88 rows by 52 columns in
dimension. In this discussion I will use the term "row" and "column"
to refer to the X and Y coordinates, respectively, of what is actually
a pixel [pixel, as the reader may know, stands for "picture element"].
Considering the 88x52 structure, therefore, one might expect a single
Print Shop icon record to require 88 * 52 bytes, or 4576 bytes each.
After looking over his code, however, I noticed that Ryan processed
572 bytes for each icon read from the file. How could this be?

PM and PS graphics are BIT CODED, and quite elegantly so.
Remember that PS and PM icons are monochrome; the only colors used are
black and white, or if you will, OFF and ON. This BINARY structure
makes it quite possible to code 8 pixels into 1 byte. In summary, the
files break down as: 88 pixels * 52 pixels = 4576 pixels, and 4576
divided by 8 [the number of bits in a byte] = 572 bytes. This reduces
the potential size of a PS/PM file by a factor of 800%! Quite a
compression, I would say! Too, it offers the QB programmer a
beginning for developing his/her own screen compression algorithm!

Thanks to a discovery by your QBNews Editor, PSHOP.BAS also shows
how to read The New Print Shop graphic files. Actually, the format of
both the old and the new PS is exactly the same. The difference lies
in a 10 byte header in the beginning of each graphic file (not
record). To read The New Print Shop graphics, simply use SEEK, or as
I have done in PSHOP, INPUT$(10, #Buff), to skip the first 10 bytes of
the file.

I originally wrote PSHOP.BAS to be compiled with Crescent's PDQ
and to run only on VGA systems. Because PDQ does not support any
graphics itself, and since graphics are quite easy to accomplish in
VGA systems by simply writing directly to video memory [see Larry
Stone's article in the QBNews about reading video memory directly with

The QBNews Page 25
Volume 2, Number 1 February 28, 1991

PEEK: Vol 1, Num 5], I decided to use POKE to display the icons. As
requested by your Editor, however, I have redesigned PSHOP to use PSET
and SCREEN 2 ("high resolution" CGA mode). Also, you may test run
PSHOP.BAS in the QuickBASIC/PDS environment. To use a different
screen mode, simply change the SCREEN statement to match your hardware
configuration. As you change screen modes, you will likely also be
changing the screen dimensions. The coordinates used in PSHOP as it
stands will work only for screens having the 640x200 dimension.

Finally, I have included two different PSET statements and two
different POKE statements in the source file, the latter being
commented out for VGA/PDQ users. In both cases, the first statement
will print the icon on the upper left corner of the screen, and the
second will print the picture in the center of the screen. Consider
the following code segment from PSHOP:

PSET (x% + 7 - k%, y%), p% ' left of any screen
PSET (x% + 7 - k% + 276, y% + 74), p% ' Center on SCREEN 2

The second statement centers the image on the screen. Obviously,
this could be simplified to PSET(x% - k% + 283, y% + 74), p%. I coded
this portion specifically to demonstrate what I have done to center
the image. The reader's challenge is to determine how I formulated
the values of 276 and 74 in the forgoing example.

I commented PSHOP.BAS heavily, realizing that in-line comments
are much more useful than mentioning significant information in an
article, away from the actual code. Therefore, to understand how
PSHOP.BAS works, the reader should examine the code.

I am including the source code in PSHOP.BAS and two Print Shop
example graphic files. BOB.DAT contains a few public domain Print
Shop graphic icons in the "old format." NEWPS.DAT contains a few
pieces of art from The New Print Shop. When loading NEWPS.DAT, be sure
to include the /n parameter following the filename such that PSHOP
will know to skip the 10 byte header explained earlier. Look for
these files in PSHOP.ZIP.

Another point worthy of discussion involves a difference between
Print Shop's and Print Master's file structure. Print Shop files are
structured exactly as suggested. They are bit coded to 572 bytes in a
RANDOM type fashion (i.e., the icon data are contiguous). While I
cannot explain the structural difference between PS and PM files, I
did make a significant observation. Primarily, the difference lies in
the fact that PM files have some sort of delimiter (delimiters are
used, for example, in Turbo Pascal files to signify the end of a
record). This delimiter can be defined as: Delimiter$ = CHR$(11) +
CHR$(52) + CHR$(88). I discovered this Delimiter$ pattern to occur
the same number of times as there were icons. For example, if the PM
library has 100 icons, it also has 100 Delimiter$'s. However, more
information is needed to properly convert Print Master graphics to a
Print Shop format. Delimiter$ does not occur in a fixed order, and
reading PM graphic libraries with the PSHOP program will have sporadic
results.

The QBNews Page 26
Volume 2, Number 1 February 28, 1991


Now that we all understand the general format of a Print Shop
graphic image file, this author would be very interested to see a
utility which will convert Print Master files to the more simplified
Print Shop format. Hopefully, in the next issue...?

**********************************************************************
Mike Welch is a Rehabilitation Science major at the University of
Texas Southwestern Medical Center. He is also the "librarian" for
QuickSHARE, a free QuickBASIC file distribution service. For more
information on QuickSHARE and to contact Mike, please see the article
on QuickSHARE in this issue.
**********************************************************************

[EDITORS NOTE]
All files for this article can be found in PSHOP.ZIP.






































The QBNews Page 27
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
P o w e r P r o g r a m m i n g
----------------------------------------------------------------------

Creating Smaller QB Executables by T. G. Muench

QuickBASIC (QB) is a great product for the price, but it is not
exactly known for generating small programs. This article explains
how to create smaller stand alone QuickBASIC executables using nothing
other than what comes with QB. Hopefully it will help others avoid
some of the frustration I encountered learning HOW to accomplish this!

As the author of pEDIT, a shareware text editor written in QB 4.5,
I needed some way to reduce the size of the executable as pEDIT grew
larger and larger. The smallest EXE under QB4.5 is something like 12-
15k bytes. This is due mainly to the HUGE amounts of object code
linked in after compiling. It turns out that Microsoft's libraries
lack (here's a 25-cent word) granularity. This means that whenever you
link in a procedure you are probably getting the code for several
other procedures. Sometimes this added code is insignificant; some-
times it is HUGE.

An example is the HEX$() function. Whenever you use HEX$() you are
linking in a library module named 'hexoct' which contains three entry
points: B$FBIN (there is no BIN$() function), B$FHEX (what you want)
and B$FOCT (for the OCT$() function). This 'hexoct' module is only 50H
bytes but you get the idea. Why clutter up your program with code for
octal when you're doing hex?

Reducing the EXE size turned out to be non-trivial. It took 3 tries
before I was able to make any appreciable cut. I should also mention
that I considered 4 options in addition to vanilla QB:

1. Go to BASIC7 which is said to generate smaller/faster code
2. Go to something like Crescent's PDQ which uses an alternate
link library to generate smaller EXEs
3. Wait for QB 5.0 or QBX or ??? from Microsoft
4. Rewrite pEDIT in 'C'

Briefly, Options 1 and 2 required major changes to the source code
and/or a significant cash outlay. I had a major pEDIT upgrade planned
for January 1991 and couldn't wait for Option 3. Lastly, I hate 'C' -
so much for Option 4.

After much experimentation I found one thing that can result in a
sizeable reduction in program size plus a collection of other tricks
that, when taken together, can reduce the size even more. The methods
outlined here should apply to QuickBASIC 4.0(b) and 4.5.


Floating Point Emulation

It turns out that floating point emulation code can increase the
size of a program dramatically. QuickBASIC has to emulate floating

The QBNews Page 28
Volume 2, Number 1 February 28, 1991

point operations in software for systems that can't do it in hardware,
i.e. don't have a math coprocessor.

There isn't much we can do about the granularity problem as we have
no control over what Microsoft puts in their link libraries or how
many different procedures there are in each module. We can, however,
do something about eliminating unnecessary floating point code. This
turned out to be easier said than done.

To see if your program contains this floating point code, generate
a link map and look for EMULATOR_TEXT and EMULATOR_CODE. Under QB 4.5,
these modules have lengths of 2430H and 0170H bytes, respectively. If
this floating point support is present and you don't need it, you're
adding an incredible 9632 bytes of code to your program.

Following is a list of BASIC functions/keywords with information on
each's use of floating point. There are some general rules to follow
also: (1) you can't have any real variables declared - VAR! or VAR#;
(2) don't use the real division operator / (forward slash); replace it
by \ (back slash) which signifies integer division; (3) lastly, you
can't use any function which is explicitly for real numbers - for
example INT(), FIX().

TIMER Returns seconds elapsed since midnight (~18.2
ticks per second); replace by a FUNCTION that
reads the system clock and returns ticks; see
the sample function ReadTimer&()

INPUT Can input reals so must replace by a BASIC
SUB or FUNCTION that uses INKEY$ or INPUT$();
see the sample subprogram GetInput()

INPUT # Same as above; also see LINE INPUT #

VAL() One of the biggest offenders, ALWAYS uses fp
emulation, is also quite large and slow; use
a replacement such as the sample FUNCTION
StrToInt&()

ABS() Uses emulation only if the argument is a real

STR$() Uses fp emulation only if the argument is a
real; CAREFUL: there may be cases when the
compiler can't tell what the argument may be?

PRINT USING Uses emulation only if the print mask is for
a real number, e.g. "###.##"

READ Expected because you can READ into a real
variable; however you might think QB would be
smart enough to scan the DATA and see if any
is float? Replace by a DATA$ string and a
FUNCTION to parse it; see the sample function
ReadData$()

The QBNews Page 29
Volume 2, Number 1 February 28, 1991


LINE INPUT # Makes no sense at all as can *ONLY* input a
string! Must replace by some other method of
INPUTing a single line at a time; note also
that INPUT # and LINE INPUT # are VERY slow
in reading sequential ASCII text; see the
sample SUB InputLine()

The archive contains two sample programs: SMALLEXE and LARGEEXE.
SMALLEXE.BAS uses the mentioned InputLine(), ReadData$(), ReadTimer&
and StrToInt&() replacements for LINE INPUT #, DATA/READ, TIMER and
VAL(), respectively. SMALLEXE also uses the function FileExist() to
check for the existence of a file, while LARGEEXE has to use BASIC
error trapping. When compiled under QB 4.5 (LARGEEXE requires the /X
option) and linked, the EXE sizes are 24102 and 36784 bytes.

SMALLEXE provides another distinct advantage over LARGEEXE: file
I/O speed. When the two programs are timed to read the same file
without displaying the lines, SMALLEXE is 3-5 times faster! This is
with a 4k buffer; a larger buffer should speed it up even more.

The archive file SMALLFUN.TXT contains an overview of each of the
referenced Functions and Subprograms and includes a description, an
example of its usage, what BASIC code it replaces and a discussion of
the input/output parameters. These routines are, with the exception of
InputLine(), quite straightforward. InputLine() works by inputting a
bufferfull of text from the disk and splitting it into lines based on
the location of a carriage return/line feed pair. It is left to the
reader to dissect InputLine() further; pay particular attention to
what happens when a line crosses a buffer boundary.


Other Tips and Tricks

One easy way to reduce the EXE size - which I just rediscovered -
is to link with NOCOM.OBJ. This object file is provided by Microsoft
but was apparently not shipped with QB 4.5. You can use the one
included with previous versions of QB plus I am including it in the
SMALLEXE archive. Microsoft claims a reduction in EXE size of 4k
bytes; I saw about 3k. Note: NOCOM can be used only if your program
does no serial communications.

Link with SMALLERR.OBJ, also from Microsoft. This saves a few bytes
by eliminating the text of error messages; only the error number is
displayed. You might want to do this after your program is debugged.

Minimize string usage. All assigned strings (as in VAR$ = "Hello")
have to be stored somewhere. QB limits conventional string space to a
total of 64k so it is easy to run out... the infamous "Out of string
space" error encountered mainly in the QB environment. If possible,
'deassign' string variables to "" when you're done with them. Also,
compile /S to reduce the string storage space in the object file.

Eliminate the INTOLD86(X) routines declared in Microsoft's QB.BI

The QBNews Page 30
Volume 2, Number 1 February 28, 1991

include file. These are for the old interrupt calls INT86() and
INT86X(). The object code is in both QB.QLB and QB.LIB. It turns out
EVERYTHING in QB.LIB is included at link time; you can again see this
in the link map. If you don't need these old routines, build new
QB.QLB and QB.LIB files with support only for CALL ABSOLUTE and CALL
INTERRUPT(X). Following is a sample BAT file to do this with QB 4.5:

rem
rem Extract existing modules from QB LIBrary
rem
lib qb.lib *absolute *intrpt ;
rem
rem Build the new QuickLibrary w/o int86old
rem
link /quick absolute+intrpt,qb.qlb,,bqlb45 ;
rem
rem Build new LIBrary
rem
lib qb.lib absolute+intrpt ;
rem
del absolute.obj
del intrpt.obj

Finally, here are 3 link options that can be used to further reduce
the EXE size:

/EXEPACK This is, as far as I know, safe to use. Microsoft
uses it when you compile to disk from within the
environment. Some kind of compression is performed
to save some bytes.

/PACKCODE This is another kind of packing that is not very well
explained in the documentation.

/FAR I have been able to use this successfully even in
large programs. A discussion of what it does is
beyond the scope of this article; truthfully, I'm not
sure I could explain what it does!

The archive contains QBCOMP.BAT, a batch file which uses all of the
compile and link options discussed above. Try compiling/linking a
program as you normally would and note the size of the EXE in bytes.
Then, use QBCOMP and see how much smaller the executable gets. I did
this for one of the programs I wrote in the course of writing this
article. The executable went from 28342 to 22646 bytes - a reduction
of almost 5700 bytes without much effort!


Conclusions

It is possible to reduce the size of a QuickBASIC Version 4 stand-
alone executable by some 10-12k bytes by eliminating unnecessary
floating point emulation code and using a few compiler and linker
options. This is not to imply that you can create executables as

The QBNews Page 31
Volume 2, Number 1 February 28, 1991

small as possible with other languages. In the author's opinion, the
ease of programming in a modern BASIC such as QuickBASIC far out-
weighs the program size when compared to a user-hostile language like
'C'. Please, no hate mail from C lovers!

By eliminating floating point emulation code and applying the other
tricks detailed above I was able to reduce the size of my editor
(PEDIT.EXE) by 11,200 bytes. While this is not a huge reduction every
bit helps. It would be difficult to trim this much by tweaking!

Program size is not always a consideration. Sometimes you won't
care if a program takes up 38k or 22k (or 4k). Sometimes, however, it
is important. One example I can think of is an installation program on
a software distribution disk. There may not be room for a 'standard'
QuickBASIC program of 45k or so!

The reader is encouraged to start with the sample functions and
subprograms included here and build a library of routines that can,
when size and speed are important, be used in place of their QB
counter-parts. Feel free to modify the code to fit your needs.


*********************************************************************
T. G. (Terry) Muench has been in computers for 14 years and has been
a programmer (COBOL and BASIC), systems analyst and VAX Systems
Manager. He has been involved with micros since CP/M days and is now
trying his hand at shareware. He is the author of pEDIT, the personal
EDITor, and can be reached on CompuServe at [71171,2424].
*********************************************************************

[EDITORS NOTE]
All files for this article are contained in the file SMALLEXE.ZIP.






















The QBNews Page 32
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
N e w a n d N o t e w o r t h y
----------------------------------------------------------------------


PDQComm 2.5 from Crescent Software

Crescent Software announces a major update to PDQComm, the
communications library for QuickBASIC 4.x, BASIC 7.x PDS, and P.D.Q.
This upgrade adds many new features while maintaining compatibility
with previous versions. They are:

* Support for two com ports open at the same time
* Support for the NS16550 high speed UART in FIFO mode
* XModem and ASCII file transfer protocols
* Various windowed terminal emulations including:
TTY
ANSI
VT52
VT100
D215
* Support for ports with non-standard addresses or interrupts

The price for PDQComm has been increased to $99 and includes a new
manual with much more information on programming communications. Call
Crescent at 1-800-35-BASIC or 203-438-5300 to order or inquire about
upgrading from a previous version. You can also download a demo from
The Crescent Software Support BBS at 203-426-5958.


























The QBNews Page 33
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
S o m e A s s e m b l y R e q u i r e d
----------------------------------------------------------------------

Setting Error Levels with QuickBASIC by Dave Cleary

One of the big misconceptions people have is that it is all right
to terminate a QuickBASIC program by using CALL INTERRUPT. This is
done by calling interrupt 21h function 4Ch. By doing this, you yank
the machine away from QuickBASIC. This causes the numerous interrupt
vectors QB hooks to point into nothingness. This means that somewhere,
sometime, somehow when you least expect it, your machine will crash.

Now it is very possible that you can throw together a little test
program using INT 21h Function 4Ch and not lock up your machine. Does
this mean I don't know what I'm talking about? No. You just hadn't
happen to come across the right combination to cause problems. You may
find a program you have been using for years uses this procedure
without any problems at all. Consider yourself lucky. But as Murphy's
Law states, as soon as you give the program to someone, their machine
will lock up.

Does this mean you cannot set error levels with QuickBASIC? No it
doesn't. It does require you to do a little work though. When you run
a QuickBASIC program, the QB runtime takes control over most of your
machine. This is how BASIC offers many more built in features than
other languages and why it is a pretty stable platform for the
beginner. In the next few paragraphs, we will discuss how to exit QB
with an error level by looking at a small assembler routine I put
together.

The following is the routine:

;ELEAVE.ASM - Routine to return an error level from a QuickBASIC
;program ; ;By David Cleary

.Model Medium, Basic

.Code

Extrn B$CEND:Proc ;QB termination proceedure

Level DW 0
OldIntOfs DW 0
OldIntSeg DW 0

ELeave Proc , ELevel:Ptr Word

Mov BX, ELevel ;Get the level passed in
Mov AX, [BX]
Mov CS:Level, AX ;Save it in Level

Mov AX, 3521h ;Call DOS to get its int vector
Int 21h

The QBNews Page 34
Volume 2, Number 1 February 28, 1991

Mov CS:OldIntOfs, BX ;ES:BX points to old vector
Mov CS:OldIntSeg, ES

Mov AX, 2521h ;Now set our new int vector
Mov DX, Offset IntTrap
Push DS
Push CS
Pop DS ;Save DS and move CS into it
Int 21h
Pop DS ;Restore DS
Call B$CEND ;Call BASIC to end

IntTrap:
Cmp AH, 4Ch ;Wait for function 4C
Jne ChainOld ;If not, chain to original vector

Sti ;It is 4C, so turn interrupts on
Mov AX, 2521h ;Restore original vector
Mov DX, CS:OldIntOfs
Mov DS, CS:OldIntSeg
Call CS:DWord Ptr OldIntOfs ;We need to call it instead of chain


Mov AX, CS:Level
Mov AH, 4Ch ;Call INT 21h function 4Ch with
;our level
Int 21h

ChainOld:
Jmp CS:DWord Ptr OldIntOfs ;This is our chain to the original

Leave Endp

End

What you need to do to set an error level from QB is to create an
Interrupt Service Routine (ISR). This routine will trap all calls to
interrupt 21h. When a function 4Ch comes along, you know it is time to
set the level.

You will notice in the beginning of the program, I allocate some
data space in the code segment. Normally, this would be allocated in
the data segment. I can't do this here, because when our ISR is
executed, DS will not always point to our data segment. Therefore, I
allocate our data in the code segment and use CS overrides.

I also declare an external routine called B$CEND. This is the
internal routine QuickBASIC calls when your program terminates. After
setting up our ISR, I call this routine to end the program.

The first thing I do when ELeave is called is save the error level
requested. By default, QuickBASIC passes everything by reference. This
means that QuickBASIC passes an address of our variable instead of the
value. I take the address and find the value of the variable and save

The QBNews Page 35
Volume 2, Number 1 February 28, 1991

it for later.

The next step is setting up our ISR. I do this by first getting the
address of the old ISR. This is very important because I need it to
chain to later on and I also need to restore it when the program
terminates. Interrupt 21h Function 35h is the DOS routine to get
interrupt vectors. I load AH with 35h and AL with 21h since I want the
address of the DOS interrupt vector. The vector gets returned in ES:BX
and is stored for later use.

I now need to insert my ISR into the interrupt chain. This is done
by using DOS Interrupt 21h Function 25h. I put my ISR address into
DS:DX and do the interrupt. Now, all INT 21h will come to me first. I
now am ready to terminate the program so I call B$CEND.

B$CEND will start "cleaning up" your machine by restoring it to the
state it was in before you ran your QB program. It will issue numerous
INT 21h and when it does, IntTrap gets control first. I look into AH
first to see what DOS function is requested. I am only interested in
function 4Ch so if it is anything else, I chain to the old ISR. This
is done by a simple jump. When the old ISR gets executed, it will
never know I had control of the machine before it.

Eventually B$CEND will call function 4Ch to terminate the program.
When it does, I am ready. The first thing I have to do is uninstall
myself from the interrupt chain. I do this by setting up an INT 21h
Function 25h call. Instead of executing it by an INT instruction, I
need to call it instead. This is because I am still in the interrupt
chain and I would actually call myself. Upon return, the INT 21h
vector is restored back to normal. All that leaves is a normal INT 21h
Function 4Ch to set our level and terminate the program.

One caveat you should be aware of. You shouldn't use this program
in the environment. When you are in the environment, your program is
not actually running so it never terminates. If you tried using CALL
INTERRUPT 21h Function 4Ch in the environment, you'd find yourself at
a DOS prompt with a pretty messed up machine.

**********************************************************************
Dave Cleary is an electronics engineer for Vectron Laboratories
in Norwalk, CT. Besides putting together the QBNews, he is also the
author of Crescent Software's PDQComm. He can be reached in care of
this newsletter.
**********************************************************************

[EDITORS NOTE]
All code for this article is found in ELEAVE.ZIP







The QBNews Page 36
Volume 2, Number 1 February 28, 1991



----------------------------------------------------------------------
P s s t . . . L o o k i n g F o r A L i b r a r y ?
----------------------------------------------------------------------

An Introduction to QuickSHARE by Michael Welch

Here's the scenario: For weeks you have been diligently
coding a major database application. Your client wants the
software yesterday, but all of that coding takes time! In
desperation, you turn to your local BBS in search of a few text
files and a library which would speed the development process.
After browsing through the dreaded "GENERAL BASIC STUFF" section,
you download only a handful of files that might offer assistance.
Then, as they unpack, you discover that two of the files are
exactly the same.

Not all systems get THIS cluttered, but if you have ever
experienced such a situation, perhaps I can help. I am the
librarian for QuickSHARE: A QuickBASIC source code,
informational text, and library distribution service. The
QuickSHARE library is divided into eleven different sections
relating to communications, databases, general libraries,
graphics, source code, utilities, demonstrations, magazine
articles, Professional Development System (BASIC v.7) specific
libraries, and Crescent's P.D.Q. specific libraries. The service
is available through The Shipyard BBS in Garland, Texas (a suburb
of Dallas), through support BBSs referred to as "QuickSHARE
Points," and through United States and Canadian Mail. What's
more, the service is completely non-profit!

Each file in the QuickSHARE library relates specifically to
QuickBASIC, with very little emphasis on GWBASIC/BASICA. Most of
the general programming libraries are written in assembler, which
can offer you the speed and power of any other professional
language. Finally, each file in the library is described in the
QuickSHARE Catalog, which lists the author of the file, the size
and date the item was created, and a thorough description of the
features. To complete our scenario, below is a segment from the
database area of the QS Catalog:

DATABASE: A small QuickBASIC-only database
Date: 5/89 Author: Jose Garcia Cost: FW Size: 13K
Description: This is a small name/address database source code
file that shows how QuickBASIC can be used to
create structured databases. A nice job.

DB: Read dBASE files with this QuickBASIC source file
Date: 1/88 Author: David Perry Cost: FW Size: 4K
Description: By the definition of the author, this native QB
file will allow you to "open and read dBASE III
.DBF and .DBT files, display their structure,
read data to include up to the first 4000 bytes
of a memo field." Uses the structured TYPE block
for file i/o. Completely modular and structured.

The QBNews Page 37
Volume 2, Number 1 February 28, 1991


QBTREE42: B-Tree access method for QuickBASIC Programmers
Date: 9/90 Author: Cornel Huth Cost: $45 Size: 61K
Description: Written in a mix of QuickBASIC and Microsoft ASM,
the author describes this package as a "keyed-file
system based on the b-tree sorting method." It
maintains up to 10 key fields and also 10 data
files (at once). This package contains 32
routines to make your database programming easier
in QuickBASIC. Running a demo on my PC/XT with a
rather slow hard card resulted in 3.849 seconds to
produce and delete 100 records with the PutKey()
routine. The $45 registration includes source
code (sent to you when you register). Cornel may
also be reached via the Fido QUIK_BAS echo for
assistance. This looks like a fine indexing
library.

While this is only a very small sample, the reader should
see that QuickSHARE actually resembles that of a "Shareware
Distributor," with a few exceptions: the service is free, the
catalog is electronic, and in addition to the mail service, users
can obtain QS files from several Bulletin Board Systems. Also
unlike shareware distributors, we copy files on an individual
basis. You do not have to order an entire disk to obtain the one
library that you actually want. The only cost involved is that
of media and postage (for example, $1.35 gets you one 360k disk,
$1.85 gets two 360k disks, and $1.65 gets you a 1.2mb disk full
of whatever you wish). If you prefer, too, you can even mail
your own disks to me or to QuickSHARE Canada with enough postage
to cover return mail, and we will fill your order. Therefore, if
you are not comfortable with using a BBS, you have the option of
direct mail. For a current copy of the QuickSHARE catalog, which
lists well over 300 *quality* QuickBASIC-related files, send
$1.35-$2.00 ($2.00 would cover ANY media type) to the address
listed at the end of this article. Note that QuickSHARE Canada
at this time only supports 360k diskettes.

If you are familiar with Bulletin Boards, you can obtain
your QS file(s) from any of eight QuickSHARE Points (including
The Shipyard). To logon immediately without having to register,
use Quick Basic (two words) for YOUR NAME, and use QuickSHARE
(one word) for YOUR PASSWORD. Some systems will allow a maximum
of 15 minutes access under this special method while others will
allow an hour. QuickSHARE Points are listed below:

The Wizards of Orchid BBS Gulf Coast BBS
Sysop is Jeff and Lynda Howard Sysop is Jim Brewer
Ferndale, MI New Port Richey, FL
(313)-547-2985 (813)-856-7926

Oregon Trail Crossroads BBS The Nest Egg BBS
Sysop is Thomas Lange Sysop is Tom Frye
Casper, WY Lenexa, KS

The QBNews Page 38
Volume 2, Number 1 February 28, 1991

(307)-472-3615 (913)-492-2739

The COM Port BBS dix MOJO BBS
Sysop is Craig McCracken Sysop is Dick Dennison
Montgomery, AL New Hampton, NY
(205)-260-9904 (914)-374-3903


For Mail Orders and Additional BBS Services:

QuickSHARE Canada QuickSHARE Headquarters
Duram Systems (ONLINE) BBS The Shipyard BBS
Sysop is Paul Chantler Jim Woolly/Mike Welch
(416)-430-3812 (214)-686-1962
28 Lumsden Cres P.O. Box 801011
Whitby Ontario, L1R 167 CANADA Dallas, TX 75240

Using libraries written by other programmers can be a real
life saver. If you have a project that needs extra flair, or if
you are writing an application that needs to minimize the time in
which it takes to complete a task, a library written in assembly
language is the only answer. However, libraries are not always
the best route to take. When portability is a factor, or when
one starts to learn to program, I suggest "reinventing the
wheel." Whatever your particular situation, QuickSHARE offers an
inexpensive alternative to obtaining quality shareware and
freeware programming tools.



























The QBNews Page 39


----------------------------------------------------------------------
E O F
----------------------------------------------------------------------

Receiving The QBNews

The QBNews is distributed mainly through BBS systems around the
world. Some of the networks it gets distributed through are SDS
(Software Distribution System), PDN (Programmers Distribution
Network), and SDN (Shareware Distribution Network). Ask the sysop of
your local board about these networks to see if there is a node in
your area.

The QBNews can also be found on CompuServe in the MSLang
(Microsoft Language) forum. It can be found in file area 1 or 2 of
that forum. Just search for the keyword QBNEWS. The QBNews will also
be available on PC-Link. I send them to Steve Craver, who is the BASIC
Programming Forum Host on PC-LINK and he will make them available. I
would appreciate anybody who could upload The QBNews to other services
such as GENIE since I don't have access to these.

I have also set up a high speed distribution network for people
who would like to download The QBNews at 9600 baud. The following
boards allow first time callers download privileges also. They are:

Name Sysop Location Number Node #
---------------------------------------------------------------------

Treasure Island Don Dawson Danbury, CT 203-791-8532 1:141/730

Gulf Coast BBS Jim Brewer New PortRichey,FL 813-856-7926 1:3619/20

221B Baker St. James Young Panama City,FL 904-871-6536 1:3608/1

EMC/80 Jim Harre St. Louis, MO 314-843-0001 1:100/555


Finally, you can download The QBNews from these vendors BBS's:

The Crescent Software Support BBS 203-426-5958

The Microhelp BUG BBS 404-552-0567
404-594-9625


You do not have to be a customer of these vendors in order to download
The QBNews, but the Microhelp BBS only allows non-members 15 minutes
of time per call.

If you would like to receive The QBNews on disk, I am now
offering a subscription for volume 2 next year. If you subscribe, you
will receive a disk with all the issue from volume 1, plus you will
receive 4 disks next year as each of the 4 issues of volume 2 come
out. I have decided against offering individual disks as I don't have

The QBNews Page 40
Volume 2, Number 1 February 28, 1991

the time to administer that. The cost of a subscription is as follows:

Base Price for Volume 2: $15.00
Additional charge for 3.5" disks: $5.00
Additional charge for international: $5.00

The base price includes 5.25" 360k disks. Send a check or money
order in U.S. funds to:

The QBNews
P.O. Box 507
Sandy Hook, CT 06482

Please be sure to specify what archive format you want. The
QBNews normally uses PKZip as it's archiver.
----------------------------------------------------------------------

Submitting Articles to The QBNews

The QBNews relies on it's readers to submit articles. If you are
interested in submitting an article, please send a disk of Ascii text
of no more than 70 characters per line to:

The QBNews
P.O. Box 507
Sandy Hook, CT 06482

Articles can also be submitted via E-Mail. Send them via Compuserve to
76510,1725 or via FidoNet to 1:141/777. I can be reached at the above
addresses as well as on Prodigy as HSRW18A.
----------------------------------------------------------------------



























The QBNews Page 41
The QBNews Master Index for Volume 1 February 28, 1990
Article Name Vol Issue
======================================================================


Algorithms
Fast String Searching in QuickBASIC.................... 1 2
Improving Your IQUEUE.................................. 1 4
Reversing INSTR........................................ 1 2

Ask Mr. Wizard
Mr. Wizard Tells What "Bytes Free" Means............... 1 2

BASIC 7.X PDS
Microsoft Professional BASIC 7.0 Product Announcement.. 1 2

Beginners Corner
Basic Menuing and Graphics............................. 1 3
Common Questions about QuickBASIC...................... 1 5
How to Use Libraries in QuickBASIC..................... 1 5
The BASICS of QB's Serial Communications............... 1 4

CALL INTERRUPT
Directory Swapping..................................... 1 3
Format Floppy Disks with QB............................ 1 5
Getting the Day of the Week with CALL INTERRUPT........ 1 3
QuickBASIC Directories................................. 1 1
Screen Scrolling with CALL INTERRUPT................... 1 3
Self-Cloning Exe's Revisited........................... 1 5
Using a FOSSIL - Take 1................................ 1 4
Using a FOSSIL - Take 2................................ 1 4
Using the PSP.......................................... 1 2

Chris Wagner
Using a FOSSIL - Take 2................................ 1 4

Communications
A Pop-Up Communications Program with P.D.Q............. 1 4
The BASICS of QB's Serial Communications............... 1 4
Using a FOSSIL - Take 1................................ 1 4
Using a FOSSIL - Take 2................................ 1 4

Cornel Huth
Format Floppy Disks with QB............................ 1 5

Crescent Software
A Pop-Up Communications Program with P.D.Q............. 1 4
Don Malin's Cross Reference Program Announcement....... 1 4
P.D.Q. Product Announcement............................ 1 1
Peeking at DOS with P.D.Q.............................. 1 4

DOS
Directory Swapping..................................... 1 3
Fast File I/O.......................................... 1 3
The QBNews Master Index for Volume 1 February 28, 1990
Article Name Vol Issue
======================================================================


DOS
Format Floppy Disks with QB............................ 1 5
Getting the Day of the Week with CALL INTERRUPT........ 1 3
Peeking at DOS with P.D.Q.............................. 1 4
QuickBASIC Directories................................. 1 1
Returning ErrorLevels to QB............................ 1 2
Using the PSP.......................................... 1 2

Database
DBase III File Viewer.................................. 1 5
Index Manager Product Announcement..................... 1 2
Index Manager Review................................... 1 3
Index Manager for PDS-7 and Networks Announcement...... 1 4

Dave Cleary
A Pop-Up Communications Program with P.D.Q............. 1 4
GPIB Instrument Control from IOTech.................... 1 5
Memory Moves with QB................................... 1 1

Directory
Directory Swapping..................................... 1 3
QuickBASIC Directories................................. 1 1

Engineers Corner
GPIB Instrument Control from IOTech.................... 1 5

Ethan Winer
Fast File I/O.......................................... 1 3
Fast String Searching in QuickBASIC.................... 1 2
Peeking at DOS with P.D.Q.............................. 1 4

File IO
Fast File I/O.......................................... 1 3
QuickBASIC Directories................................. 1 1

Frederick Volking
Getting and Putting Graphics........................... 1 2

Graphics
Basic Menuing and Graphics............................. 1 3
GEOGRAF Level One Announcement......................... 1 4
Getting and Putting Graphics........................... 1 2
Getting the .PCX Palette Info.......................... 1 5
Graphics and Text Screen Dumps......................... 1 5
Saving and Loading .PCX Files.......................... 1 5

Harold Thomsom
Returning ErrorLevels to QB............................ 1 2

Hector Plasmic
Directory Swapping..................................... 1 3
The QBNews Master Index for Volume 1 February 28, 1990
Article Name Vol Issue
======================================================================


Hector Plasmic
QuickBASIC Directories................................. 1 1
Using a FOSSIL - Take 1................................ 1 4
Using the PSP.......................................... 1 2

Jim Mack
Improving Your IQUEUE.................................. 1 4
Programming UEVENT..................................... 1 3

Keyboard
A Replacement for INPUT................................ 1 3
Basic Menuing and Graphics............................. 1 3
Extended Key Codes..................................... 1 2
Menus.................................................. 1 2
Yes/No Response DEF FN................................. 1 3

Larry Stone
A Pop-Up Calculator with Stay Res...................... 1 4
How to Make a Self-Cloning Exe in QuickBASIC........... 1 3
MicroHelp's QB Optimizer - How to Save Some Bytes...... 1 1
Reversing INSTR........................................ 1 2
Scenic Views by Way of the Video Map................... 1 5
Update on MicroHelp's QB Optimizer..................... 1 2

Libraries
A Pop-Up Calculator with Stay Res...................... 1 4
A Pop-Up Communications Program with P.D.Q............. 1 4
GEOGRAF Level One Announcement......................... 1 4
How to Use Libraries in QuickBASIC..................... 1 5
Index Manager Product Announcement..................... 1 2
Index Manager Review................................... 1 3
Index Manager for PDS-7 and Networks Announcement...... 1 4
MicroHelp's QB Optimizer - How to Save Some Bytes...... 1 1
P-Screen Announcement.................................. 1 3
P-Screen+ and P-Screen Professional Review............. 1 3
P.D.Q. Product Announcement............................ 1 1
Peeking at DOS with P.D.Q.............................. 1 4
Update on MicroHelp's QB Optimizer..................... 1 2

MicroHelp
A Pop-Up Calculator with Stay Res...................... 1 4
MicroHelp Library Manager Product Announcement......... 1 2
MicroHelp's QB Optimizer - How to Save Some Bytes...... 1 1
Update on MicroHelp's QB Optimizer..................... 1 2

Microsoft
Microsoft Professional BASIC 7.0 Product Announcement.. 1 2

Power Programming
How to Make a Self-Cloning Exe in QuickBASIC........... 1 3
The QBNews Master Index for Volume 1 February 28, 1990
Article Name Vol Issue
======================================================================


Power Programming
Programming UEVENT..................................... 1 3
Scenic Views by Way of the Video Map................... 1 5
Self-Cloning Exe's Revisited........................... 1 5

Product Announcements
Don Malin's Cross Reference Program Announcement....... 1 4
GEOGRAF Level One Announcement......................... 1 4
Index Manager Product Announcement..................... 1 2
Index Manager for PDS-7 and Networks Announcement...... 1 4
MicroHelp Library Manager Product Announcement......... 1 2
Microsoft Professional BASIC 7.0 Product Announcement.. 1 2
P-Screen Announcement.................................. 1 3
P.D.Q. Product Announcement............................ 1 1

Ranjit Aiyagari
The BASICS of QB's Serial Communications............... 1 4

Ronny Ong
Self-Cloning Exe's Revisited........................... 1 5

Ryan Snodgrass
Basic Menuing and Graphics............................. 1 3

Screen
Memory Moves with QB................................... 1 1
P-Screen Announcement.................................. 1 3
P-Screen+ and P-Screen Professional Review............. 1 3
Scenic Views by Way of the Video Map................... 1 5
Screen Scrolling with CALL INTERRUPT................... 1 3
Windowing Routines with Shading........................ 1 3

Some Assembly Required
Assembler Programming for QuickBASIC................... 1 3
Returning ErrorLevels to QB............................ 1 2

Strings
Fast String Searching in QuickBASIC.................... 1 2
How to Make a Self-Cloning Exe in QuickBASIC........... 1 3
Reversing INSTR........................................ 1 2

Swap Shop
A QuickBASIC Archive File Viewer....................... 1 5
A Replacement for INPUT................................ 1 3
DBase III File Viewer.................................. 1 5
Extended Key Codes..................................... 1 2
Getting the .PCX Palette Info.......................... 1 5
Getting the Day of the Week with CALL INTERRUPT........ 1 3
Graphics and Text Screen Dumps......................... 1 5
The QBNews Master Index for Volume 1 February 28, 1990
Article Name Vol Issue
======================================================================


Swap Shop
Menus.................................................. 1 2
Saving and Loading .PCX Files.......................... 1 5
Screen Scrolling with CALL INTERRUPT................... 1 3
Windowing Routines with Shading........................ 1 3
Yes/No Response DEF FN................................. 1 3

TSR
A Pop-Up Calculator with Stay Res...................... 1 4
A Pop-Up Communications Program with P.D.Q............. 1 4
Peeking at DOS with P.D.Q.............................. 1 4

The Tool Shed
Index Manager Review................................... 1 3
MicroHelp's QB Optimizer - How to Save Some Bytes...... 1 1
P-Screen+ and P-Screen Professional Review............. 1 3
Update on MicroHelp's QB Optimizer..................... 1 2

Tips
Mr. Wizard Tells What "Bytes Free" Means............... 1 2
QB Quirks.............................................. 1 1

Tom Hanlin

  
Assembler Programming for QuickBASIC................... 1 3
Common Questions about QuickBASIC...................... 1 5
How to Use Libraries in QuickBASIC..................... 1 5

Tools
Don Malin's Cross Reference Program Announcement....... 1 4
MicroHelp Library Manager Product Announcement......... 1 2
MicroHelp's QB Optimizer - How to Save Some Bytes...... 1 1
Microsoft Professional BASIC 7.0 Product Announcement.. 1 2
Update on MicroHelp's QB Optimizer..................... 1 2

Under The Hood
Fast File I/O.......................................... 1 3
Memory Moves with QB................................... 1 1

XRef
Don Malin's Cross Reference Program Announcement....... 1 4

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT