Category : BASIC Source Code
Archive   : QBNEWS1.ZIP
Filename : QBNW0101.NWS

 
Output of file : QBNW0101.NWS contained in archive : QBNEWS1.ZIP
Volume 1, Number 1 November 1, 1989











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


The QBNews is an electronic newsletter published by QBNews. It can
be freely distributed providing NO CHARGE is charged for distribution.
All articles in QBNews are copyright by QBNews. 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. Copyright (c) 1989 by QBNews.



























The QBNews Page i
Volume 1, Number 1 November 1, 1989
----------------------------------------------------------------------

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


1. From the Editors Desk
The Mission of the QBNews by David Cleary .................... 1

2. Feature Presentation
What I Would Like To See by David Cleary ..................... 3

3. Who ya gonna call? CALL INTERRUPT
QuickBASIC Directories by Hector Plasmic ..................... 4

4. Under The Hood
Memory Moves with QB by David Cleary ......................... 6

5. The Tool Shed
MicroHelp's QB Optimizer by Larry Stone ...................... 7

6. Product Announcements
P.D.Q. ....................................................... 9

7. The BUG Report
QB Quirks .................................................... 11

8. CTL-Z
Closing Comments by David Cleary ............................. 13

9. Address
Address ...................................................... 14



























The QBNews Page ii
Volume 1, Number 1 November 1, 1989



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

The Mission of the QBNews
by David Cleary

Welcome to the first issue of the QBNEWS. With the growing
popularity of QuickBASIC, a newsletter was needed to help users get the
most out of the language. The QBNEWS has 3 goals. The first is to
inform people about what is out there as far as tools are concerned.
The second is to teach users how to get the most out of the QuickBASIC
product. And last but not least is to share code.

To accomplish the first goal, the QBNews will contain a review of a
commercial or shareware product in every issue. Many times I have come
across a problem and I wasn't aware that the solution was available. We
hope to provide a fair review o f what is out there to let you make an
informed decision on whether the product will fit your needs. The
reviewers are actual users of the product just like you and me. They
will let you know if the product does what it says and report any
problems t o you. The QBNews will also contain new product
announcements from anybody who has a QuickBASIC related product to
announce. This will keep you informed as to what is happening on the
QuickBASIC scene.

We will have a variety of features to help you get the most out of
QuickBASIC. Hector Plasmic will have a regular column on CALL
INTERRUPT. CALL INTERRUPT is one of the most powerful yet least
understood features in QuickBASIC. With Hector's help, you will learn
how to use it and you will get code that you can plug directly into
your programs to access DOS and BIOS system calls. Another feature that
will appear from time to time is UNDER THE HOOD. This will feature ways
to access interna l QuickBASIC routines to get power you thought you
had to go to third party assembly libraries to get.

Now comes the good part. The CODE. We want to include as much code
as possible. You can either choose to use this code as is, or even
better, learn what it is doing and come up with improvements. I would
like to see the development of real ap plications from start to finish
that span issues. I also want to see lots of contributions from all you
out there with useful subroutines that you feel everyone would benefit
from. All code published in the QBNEWS is put into the public domain.
That means you can do whatever you want with it except copyright it. If
we all work together to learn and share, we can make QB the language of
the 90's. Every QB user will benefit by expanding the popularity of
QuickBASIC and the best way to do that will be to knock down the "YOU
CAN'T DO THAT WITH BASIC" walls.

In order for this newsletter to succeed, we need your help. Believe
it or not, writing is one of my least favorite activities. This
newsletter is going to die without contributions from YOU. This is both
code AND feature articles. Also we nee d suggestions on what you want
to see in future issues. QBNEWS is going to start out being published
once every two months. If I see some support, we can make it a monthly.

The QBNews Page 1
Volume 1, Number 1 November 1, 1989

You don't have to be an expert at QuickBASIC to contribute either. The
only t hing I ask is NO LINE NUMBERS PLEASE . As Bartles and
James say, "Thank you for you support."




















































The QBNews Page 2
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
F e a t u r e P r e s e n t a t i o n
----------------------------------------------------------------------

What I Would Like To See
by David Cleary

This is our FEATURE section. It is a little bare in this issue
though. What I want to see in this section is a group of articles all
pertaining to a chosen topic. To achieve this, I need people who want
to write these articles. Since I started this newsletter, I am choosing
the next Feature Presentation. I want articles on how to use the
various tools that Microsoft supplies with their languages. These
should be tutorials on how to use them and any tips you might have
stumbled across while using them. I still don't know how to use every
feature of the QB debugger and I know there are quite a few out there
who don't know how to compile and link from the command line. Not all
of these tools are provided with QuickBASIC but they do come in handy
sometimes. The tools I want to cover are

BC.EXE
LIB.EXE
LINK.EXE
QB Debugger
Codeview
HelpMake
NMake
Exemod and the like

This list could be expanded if I have left out anything. If you are
interested, read the final notes on how to reach me. Thank you.
























The QBNews Page 3
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
W h o y a g o n n a c a l l ? C A L L I N T E R R U P T
----------------------------------------------------------------------

QuickBASIC Directories
by Hector Plasmic

While QuickBASIC has a lot of features, there are a few it lacks.
Ever wanted to do a directory search? Chances are you had to Shell to
DOS, create a temporary file by redirecting the DIR command, then
return to QB and read the file line-by-line, parsing out the filenames.
Either that or you resorted to a third-party library function. It's
not necessary. QB can be cajoled into doing directory searches by
utilizing the DOS directly via Interrupt.

Interrupt 21h functions 4Eh and 4Fh do find-first-match and
find-next-match respectively. If the call to these functions is
successful, information on the matched file is placed by DOS into the
current DTA (disk transfer area) as follows:

Bytes 0-20 = (reserved, used during findnext calls by DOS)
Byte 21 = attribute of matched file
Bytes 22-23 = file time
Bytes 24-25 = file date
Bytes 26-27 = least significant word of file size
Bytes 28-29 = most significant word of file size
Bytes 30-42 = filename and extension in form of ASCIIZ string

All this brings up another question: where is the current DTA? The
answer is given by a call to interrupt 21h function 2Fh, which returns
the DTA's offset in BX and the segment in ES.

So, we make a call to interrupt 21h with register .ah set to 2Fh like
this:

InRegs.AX = &H2F * 256 'Remember, .ah is the high-byte of .ax
INTERRUPTX &H21, InRegs, OutRegs

And retrieve the returned information:

DTASeg = OutRegs.ES 'Segment of current DTA
DTAOff = OutRegs.BX 'Offs of current DTA

If we now say DEF SEG = DTASeg we can directly PEEK into the DTA,
wherever it may be.

Okay, we know where the data will be, now how do we get it there? Like
this:

FLName$ = "*.*" + CHR$(0) 'ASCIIZ filespec (null terminated)
InRegs.AX = &H4E * 256 'Which function (4Eh)
InRegs.CX = 0 'Attribute (normal)

InRegs.DS = VARSEG(FLName$) 'Segment of ASCIIZ filename
InRegs.DX = SADD(FLName$) 'Offset of ASCIIZ filename
InterruptX &H21, InRegs, OutRegs

The QBNews Page 4
Volume 1, Number 1 November 1, 1989


This calls interrupt 21h function 4Eh and places the information on
the first matched file into the DTA. There's a catch, though. There
may not be a matching file. If there isn't, this function returns an
error by setting the carry flag and returning a code in AX. We can
check for this with:

IF OutRegs.Flags AND 1 THEN WhichError = OutRegs.AX

The two possible errors are "invalid path" (2h) and "no (more) matching
file(s)" (12h).

Now all that remains is to PEEK the information out of the DTA and do
something useful with it.

FINDEM.BAS is a sample program together with a Function FindFirst that
will do directory searches for you. Modify the main module code to
load the filenames into an array or whatever you need it to do.





































The QBNews Page 5
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
U n d e r T h e H o o d
----------------------------------------------------------------------

Memory Moves with QB
by David Cleary

This is a section that will appear from time to time if the
information presents itself. Although not support certain functions
directly, QuickBASIC does have internal routines that can be very
helpfull. When using internal QuickBASIC routine s, you must use the
DECLARE statement and give the routine an ALIAS. This is because the
routines internal to QB have names that are not allowed in QuickBASIC.
This is mostly because they contain either the $ or _ characters within
them. The only pro blem when using internal QB routines is that I
haven't found a way to use them in the environment.

The routine we are going to learn about today is called B$ASSN.
QuickBASIC uses this routine for a number of things. Among them is
copy userdefined types to each other and copy fixed length strings to
variable length strings. What we will use it for is to copy a block of
memory to another location. The syntax for B$ASSN is:

B$ASSN(FromSeg, FromOfs, NumBytes, ToSeg, ToOfs, NumBytes1)

In order to use it in a QB program, we need to use the following
DECLARE statement:

DECLARE SUB MemMove ALIAS "B$ASSN" (BYVAL FSeg%, BYVAL FOfs%,_
BYVAL Bytes1%, BYVAL TSeg%, BYVAL TOfs%, BYVAL Bytes2%)

You can change the name MemMove to whatever you like. The
program SCRNSUBS.BAS show how to use this routine to save and restore
screens. This routine is very efficient in doing this paticular job but
because of other things it has to do, it w ill bring all the string
handling routines into your program. So, if you are planning on using
this routine in a program that already uses the string handling
routines, there will be no effect on file size. If you don't use the
same number of bytes, QB will truncate it. Be carefull not to destroy
memory by writing where you don't belong.















The QBNews Page 6
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
T h e T o o l S h e d
----------------------------------------------------------------------

MicroHelp's QB Optimizer - How to Save Some Bytes
by Larry Stone

It seems that MicroHelp, Inc. releases a new library for QB at the
rate of one every other week. Their latest release is "QB/Pro Volume
7" or, for short, "QB Optimizer".

The QB Optimizer is comprised of four exe files: PP.EXE - the pre-
processor, OPT.EXE - the optimizer, XREF.EXE - the cross-reference
utility, CHECKX.EXE - to inform you which XModules can be linked with
your programs.

The package also includes seven XModules used to link with your
programs to reduce exe size, three object modules to set various screen
displays, one object module used as a replacement for QB's INKEY$
function, one object module used to replace QB's LOCATE command, one
link library to use in lieu of the supplied object modules, one QLB
library for use with QB's environment, and some sample programs to get
you started.

Question: Does MicroHelp give you all you need to effectively use
the QB Optimizer? Answer: No! If, for example, you desire to use the
XFLOAT module to reduce your program by 9386 bytes and you have used
QB's VAL or STR$ functions, then you must buy MicroHelp's "QB/Pro
Volume 2". If your program uses QB's PRINT USING then you need to buy
MicroHelp's "Mach 2" package.

Because MicroHelp has produced some outstanding packages for
compiled BASIC programs, I already had these packages and, therefore,
incurred no additional expense. However, I was dissapointed when I
discovered in the manual that I could not use the XFLOAT module if my
programs use QB's SETMEM command.

If you are developing a TSR program in QB 4.x and link it with
MicroHelp's Stay-Res module (an excellent buy), you *MUST* use SETMEM
to re-allocate your dynamic arrays to the bottom of the heap. I write
TSR programs using Stay- Res and would love to reduce their size by
another 9386 bytes. But no can do because the XFLOAT object cannot
work with SETMEM. MicroHelp's "Volume 2" has one outstanding ditty
called, "MhCopy" which opens up all available DOS or EMS memory, reads
your file into this free memory, then copies it to your designated
location. It is a faster procedure than the DOS COPY command and
returns error codes that can be acted upon without error trapping. It
requires SETMEM. Need I say more? When I called MicroHelp and
complained, they informed me that no one else seems to be upset about
this and therefore, they don't intend to add a replacement for SETMEM.
If you use MicroHelp products, give them a call and ask for a
replacement for SETMEM.

Do the XModules work? Well, I tried it with their supplied example
called, FULLCUR.BAS and it bombed. XFLOAT gave me a duplicate

The QBNews Page 7
Volume 1, Number 1 November 1, 1989

definition error with a procedure already in existence in my
BCOM40.LIB. XINPUT.OBJ does not work without XINTS.OBJ and XINTS.OBJ
caused my program to lock up my system. When I linked without the
offending modules, my exe size was cut in half.

I contacted MicroHelp about this problem, and, as always, their
support was above and beyond what most other companies would offer. As
instructred, I returned my diskette and one week later my diskette was
returned with their latest routines and a nice letter. The letter
informed me that QB Optimizer would not work with the QB 4.00 libraries
and that I needed to have Microsoft send me version 4.00b. I
immediately ordered my free update from Microsoft.

If all the modules worked for me, the final exe size of the FULLCUR
program should have been 3343 bytes using BC 4.00b (3311 using BC
4.50).

What I did like about this package was PP.EXE - very nice.
CHECKX.EXE is also a slick program - it worked as expected. OPT.EXE
was, in my opinion, useless - I already write readable, structured
code. The XREF.EXE utility seems a little cumbersome to use - I think
its most useful feature is as a utility to "weed out" variables that
are assigned and never used.

Who should use this package? As MicroHelp states in their manual,
"The XModules are not for use by the 'faint of heart'. This means that
if you are not proficient with programming in QB, you should not
consider buying this package.

Do I like the QB Optimizer? Even without the ability to work with
SETMEM, there are many applications that I could write that would
benefit with the Optimizer. If you are presently using MicroHelp asm
libraries for your QB programs, the Optimizer is a must.























The QBNews Page 8
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
P r o d u c t A n n o u n c e m e n t s
----------------------------------------------------------------------

P.D.Q QuickBASIC Replacement Library
$99.00
Cresent Software
11 Grandview Ave.
Stamford, CT 06905
203-846-2500

P.D.Q. is a replacement linking library for use with Microsoft
QuickBASIC version 4.0 or later. When a compiled BASIC program is
linked with PDQ.LIB instead of the usual BCOM library supplied with
QuickBASIC, the .EXE file size will be reduced dramat ically. Code size
reductions of six to one are typical for small source files, however
the actual improvement will of course depend on the individual program.
Program execution speed when using P.D.Q. will likewise be greatly
improved. Applications t hat have been linked with P.D.Q. will be
noticeably smaller than an equivalent written in C, and will in fact be
closer to pure assembly language.

P.D.Q. also features a number of important language extensions,
including TSR program support and interrupt handling. Writing TSR
programs and interrupt handlers usually requires an extensive knowledge
of assembly language, however P.D.Q. includes a full compliment of
routines that allow you to do this using only QuickBASIC commands and
simple extensions. Many other important features are provided with
P.D.Q., and we will get to those shortly.

The primary purpose of P.D.Q. is to create .EXE programs that are as
small and fast as possible. There is virtually no error checking beyond
simple syntax errors which are caught at compile time. However, because
P.D.Q. is based on Microsoft QuickBAS IC, programs may also be
developed and tested in the more secure enviroment BASIC offers, and
then linked for maximum efficiency using the P.D.Q. library once they
are working correctly.

P.D.Q. has been designed as a subset of the recognized industry
standard BASIC that has been established by Microsoft. Programs that
are created using P.D.Q. are inherently "well-behaved", and may thus be
run under operating systems such as Microsoft Windows and DesqView
without any additional effort.

Some programmers, paticularly those who don't ordinarily program in
BASIC, may wonder why we would select BASIC as the core language for
P.D.Q. Simply put, BASIC is the easiest of all the high-level languages
to use, and nearly every programmer is al ready familiar with it.
Microsoft QuickBASIC provides all of the features necessary for modern,
structured programming. Further, the BC.EXE compiler supplied with
QuickBASIC is as powerful and capable as any available language
compiler. P.D.Q. progra ms may be written and debugged in the
convenient enviroment QuickBASIC offers, and then linked for maxium
performance when creating the final program.


The QBNews Page 9
Volume 1, Number 1 November 1, 1989

Our goal in designing P.D.Q. was to place code size and execution
speed above all other considerations. Many of QuickBASIC's most
advanced features are not included, and some commands have been
implemented in a slightly different manner. Therefore, w e'll begin by
looking at what has been omitted. Please understand that in all cases
where a QuickBASIC feature is not supported, the improvement in speed
or code size was the deciding factor. The primary purpose of P.D.Q. is
to create extremely small programs that execute very quickly. If you
intend to write a mojor accounting program or relational database, you
will probably be better off using regular QuickBASIC.

P.D.Q. provides no support for floating point numbers -- only
integers and long integers may be used. However, fixed point numbers
may be accommodated by treating them as long integers, and then
formatting them when needed. A special routine (Dollar$ ) is provided
precisely for this purpose. There is no built-in support for graphics.
Though you can easily switch the PC's screen to any of the graphics
modes supported by the hardware, we have not provided library routines
for drawing lines, boxes, or circles. These may be added in a future
version of P.D.Q., but if those features are needed now, other third-
party packages are available. We are about to add a full set of
communications routines. These will provide enhanced features over
what is built into QuickBASIC.
































The QBNews Page 10
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
T h e B U G R e p o r t
----------------------------------------------------------------------

QB Quirks
Reprinted from QUIRKS.ARC from MicroHelp, Inc.

This section contains exerts from Quirks.arc. This file probably is the
most comprehensive bug report on QB. We will include all new bugs in
this newsletter as they come up. We will also include interesting
quirks.

This file is maintained by Mark Novisoff of MicroHelp, Inc. Much of the
information was contributed by members of MicroHelp's BASIC Users
Group, users of the MSSYS forum on Compuserve and users of Mach 2,
Stay-Res, The MicroHelp Toolbox and the QB/Pro Professional series.

If you have additional information that should be added, please send it
to:
Mark Novisoff
MicroHelp, Inc.
4636 Huntridge Drive
Roswell GA 30075
Compuserve ID 73047,3706 in MSSYS (Microsoft Systems Forum)

If possible, please include a *small* sample program that will
demonstrate the problem and cause it to happen whenever the program is
run.
_____________________________________________________________

Using CALL with literals takes lots of stack space. (89/10/10)

' Demonstrate the effect on stack space when using literals
' in CALL statements.

' First, run the program as is and note the low point for
' stack space. Then REM the line with variables in the CALL
' and unREM the line with literals and run the program again.

' Note that the low stack point is ten bytes lower when
' literals are used. In a large program with a lot of CALL
' statements, this can really add up.

DEFINT A-Z
PRINT "Lowest amount of stack space before CALL:"; FRE(-2)
A% = 1
B% = 2
C% = 3
D% = 4
E% = 5
' REM next line for second pass
CALL TestStack(A%, B%, C%, D%, E%)
' UNREM next line for second pass
'CALL TestStack(1, 2, 3, 4, 5)
PRINT "Lowest amount of stack space after CALL:"; FRE(-2)

The QBNews Page 11
Volume 1, Number 1 November 1, 1989


SUB TestStack (A%, B%, C%, D%, E%)

END SUB
_____________________________________________________________

Sample program #35. Demonstrates a problem using SWAP and CONST in QB
4.50 (89/09/07)

** Warning - this program will crash your system **

Load the following program into QB4.50 and press F5:

const Nul$=""
z$="hello"
swap z$,Nul$

QB4.50 gives different results, depending on if Nul$ is "" or has a
length.

QB4.00b correctly traps the error of trying to SWAP a constant.


































The QBNews Page 12
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
C T L - Z
----------------------------------------------------------------------

Closing Coments
by David Cleary

Well, the first issue of the QBNews is done. To tell you the truth,
I am a little disappointed. I don't feel that this issue has fufilled
its mission but it is a start. I am hoping by getting this off the
ground, an overwhelming amout of support will start to flow. We need
code. We need articles. We need your help! Special thanks to Larry
Stone and Hector Plasmic who have given their time to write articles. I
know that Microsoft has sold over 500,000 copies of quickBASIC so if
only .005 % of these users contributed something to this newsletter, we
would be a big success. In the next issue, look for Reader Mail along
with the Swap Shop. The Swap Shop will comprise of small useful
subroutines that you readers have sent in. We need more code for this
newsletter and its got to come from you.




































The QBNews Page 13
Volume 1, Number 1 November 1, 1989



----------------------------------------------------------------------
A d d r e s s
----------------------------------------------------------------------


If you wish to submit something for publication in the QBNews, you can
reach me in a number of ways. By U.S. Mail

David Cleary
Lakeview Terrace Ext.
Sandy Hook, CT 06842

The QBNews will have a PO Box by the next issue. I can also be reached
on FIDONET at 1:141/730, Compuserve as 76510,1725, Prodigy as HSRW18A,
and on the QUIK_BAS Echo.

If you want to announce a new shareware or commercial product in the
QBNews, submit it as an ASCII file. Keep it under 70 lines and make it
an announcement and not a review. If you would like to review a
commercial or shareware product, contact me first so we don't have more
than one person writing the same review.


































The QBNews Page 14



  3 Responses to “Category : BASIC Source Code
Archive   : QBNEWS1.ZIP
Filename : QBNW0101.NWS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/