[comp.os.msdos.programmer] Protection mode in BASIC

darcy@druid.uucp (D'Arcy J.M. Cain) (07/31/90)

In article <4020@sonata> brianle@sonata ( ICCAD CO-OP) writes:
First of all you should use comp.os.msdos.programmer.  It supercedes the alt
group which should probably be removed by now.

>    In the GWBASIC or BASICA on IBM-PC. After finishing your program. Usually
> the user type save "FN.FT" then <CR>. You can protect your program by typing
> SAVE "FN.FT",P for protection mode. This option will protect the source code
> to be listed by other user but other user can still execute it.
>
I can help you but first let me mount my soapbox.  If you are writing programs
for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
be using BASIC for anything but quick and dirty stuff.  If you feel you must
use BASIC then you shouldn't be protecting them but rather let others see the
actual code.  There are two benefits to this.  Others learn from you and some
of them may be able to suggest improvements in the code for you.  In any case
the "protection" is pretty flimsy.  See below.

>   My question is : how do you unprotect the source code after you saved it
> as protect mode? Is there any way to do this?
>
In theory you can't unprotect BASIC files so you save two versions of the
program.  You modify the regular file then "protect" it under a different
name.  This is the version that you send out so that no one can look at your
code but you still have the code in case it needs to be modified.  I think
of this scenario whenever I need a laugh.  In reality there is no problem
unprotecting a BASIC program.  Use debug to create a small BASIC program
as follows:

C>debug
-e100
xxxx:0100  xx:FF xx:1a
-rcx
CX 0000
:2
-nunprot.bas
-w
Writing 0002 bytes
-q
C>

Note that the computer responds with some of the text.  The x's mean that
something is printed here but it doesn't matter what.  This will create
a 2 byte file called UNPROT.BAS in the current directory.  To unprotect
a BASIC program simply load the protected program into BASIC and then load
the UNPROT program on top of it.  Voila!  Listable code.  This may not work
under BASICA but it works under all versions of GWBASIC that I have tried.

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   MS-DOS:  The Andrew Dice Clay
West Hill, Ontario, Canada         |   of operating systems.
+ 416 281 6094                     |

ph@cs.uow.edu.au (Rev Phil Skinque, DD (Ret.)) (08/01/90)

In article <1990Jul31.124048.19015@druid.uucp> darcy@druid.uucp (D'Arcy 
 J.M. Cain) writes:
>
>[...] first let me mount my soapbox.  If you are writing programs
>for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
>be using BASIC for anything but quick and dirty stuff.  If you feel you must
>use BASIC then you shouldn't be protecting them but rather let others see the
>actual code.  There are two benefits to this.  Others learn from you and some
>of them may be able to suggest improvements in the code for you.

Hmmm... please explain the logic underlying these comments. Why shouldn't
people use BASIC? And why should they sell unprotected software? Methinks
you've not thought this through. There are reasons why someone might want
to use BASIC, and reasons why they might want the slender bit of protection
that can be had with the standard BASIC interpreters. Your comments sound
like religion to me.



-- Phil.

darcy@druid.uucp (D'Arcy J.M. Cain) (08/03/90)

In article <1037@wyvern.cs.uow.edu.au> ph@wyvern.cs.uow.edu.au (Rev Phil Skinque, DD (Ret.)) writes:
>In article <1990Jul31.124048.19015@druid.uucp> darcy@druid.uucp (D'Arcy 
> J.M. Cain) writes:
>>
>>[...] first let me mount my soapbox.  If you are writing programs
>>for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
>>be using BASIC for anything but quick and dirty stuff.  If you feel you must
>>use BASIC then you shouldn't be protecting them but rather let others see the
>>actual code.  There are two benefits to this.  Others learn from you and some
>>of them may be able to suggest improvements in the code for you.
>
>Hmmm... please explain the logic underlying these comments. Why shouldn't
>people use BASIC?
Read my posting.  I never said people shouldn't use BASIC.  I said that it
was unsuitable for commercial programs.  I realize of course that even that
will be considered elitist by many but I have had to bail out too many people
who figured that BASIC was suitable for high level applications.  I have seen
code that was shown to me proudly as an example of clever programming by the
writer and had to bite my tongue.

>                   And why should they sell unprotected software?
See what I wrote.  You quoted it in your message.

>                                                                  Methinks
>you've not thought this through.
I have.

>                                  There are reasons why someone might want
>to use BASIC,
Possibly good reasons.  I have been known to use it myself.

>             and reasons why they might want the slender bit of protection
>that can be had with the standard BASIC interpreters. Your comments sound
>like religion to me.
Then you don't know what religion is.  It certainly is my opinion and as such
you are free to take it or leave it but I have the right to hold them.  After
all, the above quote was just one paragraph from a larger article in which I
answer the original poster's question about how to unprotect a BASIC program.
I do try to help fellow programmer's any way I can.  I just feel that that
gives me the right to proselytize a little while I am at it.

Imagine that.  A programmer with opinions!  :-)

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   MS-DOS:  The Andrew Dice Clay
West Hill, Ontario, Canada         |   of operating systems.
+ 416 281 6094                     |

fredf@microsoft.UUCP (Fred FREELAND) (08/04/90)

In article <1990Jul31.124048.19015@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
>In article <4020@sonata> brianle@sonata ( ICCAD CO-OP) writes:
>First of all you should use comp.os.msdos.programmer.  It supercedes the alt
>group which should probably be removed by now.
>
>I can help you but first let me mount my soapbox.  If you are writing programs
>for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
>be using BASIC for anything but quick and dirty stuff. 

What unmitigated crap! I hope someone kicks the slats out of your soapbox.
Who are you to tell this person they shouldn't be programming in BASIC? Do 
you also prescribe what religion people should be? It's the same kind of thing.
I am grievously offended by your comments.

Maybe GW-BASIC isn't the best program development environment in the world, but
if it gets the job done, who cares. If people buy his product, they must not
care. I get absolutely sick to death of these "programmer's" who believe that
C is the "one true faith." It simply ain't so!  BASIC has come a long ways
since the days of a 4K interpreter. It has evolved into a highly sophisticated,
modern, structured programming language. It's stupid comments like yours that
prevent many people from improving their productivity and improving their
products by doing things with BASIC that BASIC does well.  I wouldn't begin
to write screen drivers in BASIC, but I wouldn't do it in C either.  

In case you didn't know, there are literally thousands of professional 
developers out there in the world that are (perish the thought) writing 
commercially viable programs and applications using the Microsoft BASIC 
Professional Development System. If you haven't seen it, or haven't tried it,
don't knock it. It is a very powerful system. It is the absolute state
of the art for the BASIC language. It allows mixed language programming, use
of EMS, and a whole host of other very nice features.

Benchmarks are comparable to C and other "high-level" languages.

Yes, I know the "B" stands for Beginner's, but I assure you that this language
has evolved into a whole new beast. It is absolutely the easiest way to
develop really powerful, commercial-quality applications. If you don't believe
that, then I suggest you sneak (because you wouldn't want anyone to see you)
down to your neighborhood software store and get a copy of QuickBASIC. 
QuickBASIC 4.5 is the little brother of the BASIC PDS. It is almost as full-
featured by it's a fraction of the price.  If you don't want to spend your
money on such a primitive language as BASIC, give me a call. I'll send you
a working model for your evaluation.

By the way, in the not too distant past, there was a contest that matched
Bill Gates against some other heavyweights in the programming world. The
contest was to see who could write a mutually agreed upon application
in the shortest time. Guess what? Bill blew 'em away. The participants 
could use any tools, libraries and what not. Bill could only use BASIC.
That tell's me quite a bit.

So come out of the dark ages and recognize that the new class of BASIC is
not your father's BASIC.  This is hot stuff!

As you might expect, I work in the Microsoft Division that develops BASIC
products. I'm proud of that association and I'm excited about the potential
of our modern BASIC language. It really ticks me off when language snobs
eschew BASIC as being some lower form of life. In short, you simply don't
know what you're talking about.


-- 
Frederick F. Freeland Jr.                        "Of all the things I've lost,  Microsoft Corporation                               I miss my mind the most!"   One Microsoft Way  
Redmond, WA 98052 (206) 882-8080                                                                                                                                internet: fredf@,microsoft.beaver.washington.EDU                                arpanet:  fredf%microsoft@uw-beaver.ARPA
uucp:     uunet!microsoft!fredf                                                                                                                                 Opinions expressed over this signature are my OWN and not those of my employer! 

bcw@rti.rti.org (Bruce Wright) (08/05/90)

In article <1037@wyvern.cs.uow.edu.au>, ph@cs.uow.edu.au (Rev Phil Skinque, DD (Ret.)) writes:
> In article <1990Jul31.124048.19015@druid.uucp> darcy@druid.uucp (D'Arcy 
>  J.M. Cain) writes:
> >
> >[...] first let me mount my soapbox.  If you are writing programs
> >for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
> >be using BASIC for anything but quick and dirty stuff.  If you feel you must
> >use BASIC then you shouldn't be protecting them but rather let others see the
> >actual code.  There are two benefits to this.  Others learn from you and some
> >of them may be able to suggest improvements in the code for you.
> 
> Hmmm... please explain the logic underlying these comments. Why shouldn't
> people use BASIC? And why should they sell unprotected software? Methinks
> you've not thought this through. There are reasons why someone might want
> to use BASIC, and reasons why they might want the slender bit of protection
> that can be had with the standard BASIC interpreters. Your comments sound
> like religion to me.

When I first saw D'Arcy's article I thought he was referring to the
GW-BASIC interpreter (and its BASICA cousin distributed on the IBM-PC)
rather than to the language itself.  Reviewing the article that seems
to have been a reasonable interpretation, but his later article makes
it clear that he also objects to the language.

I think it's reasonable to argue that nobody should write commercial
programs in GW-BASIC or BASICA.  Not only is the language accepted by
those products fairly restricted, but their interpretive nature
places a great deal of unnecessary overhead on the program's execution.
Not only that, distributing a program in this form requires the user to
obtain GW-BASIC (which is not, alas, universal on PC's, though it's
pretty common).  The only reason you'd want to distribute a program 
written in GW-BASIC or BASICA would be that you want people to be able 
to see (and possibly modify) the code.

But this is not the same thing as saying that nobody should write
commercial programs in BASIC!!  If you like the BASIC language, you
owe it to yourself to look into things like the QuickBASIC compiler
or Microsoft's full BASIC development system.  The QuickBASIC product,
especially, combines a pretty nice development environment with fast
execution and lots of language features beyond GW-BASIC and BASICA, 
at a _very_ reasonable price, and has almost complete source level
compatibility with GW-BASIC and BASICA.  I don't understand why anyone
would _want_ to use GW-BASIC for commercial products (even small ones)
after having tried QuickBASIC.

Now I'm not a great fan of BASIC;  most commercial programs I've
written are in other languages that are less awkward for the sorts
of things I'm trying to do.  As a language it's not as bad as its
detractors try to make out (I think a lot of them don't realize that
the language has changed a lot since the days of CP/M BASIC and
before), but it still shows some of its heritage and this makes some 
complex operations difficult.  But for an awful lot of practical use, 
these operations are irrelevant.  In fact I have to admit that a 
few commercial programs I've written _have_ been in BASIC, either on 
QuickBASIC or VAX BASIC, though I am not now a heavy user of either.

Let's not get into wars about "My language is better than your
language" - these things are tools, not religions.

						Bruce C. Wright

jdudeck@polyslo.CalPoly.EDU (John R. Dudeck) (08/07/90)

In an article fredf@microsoft.UUCP (Fred FREELAND) wrote:
>>I can help you but first let me mount my soapbox.  If you are writing programs
>>for commercial sale you shouldn't be using BASIC.  If not you still shouldn't
>>be using BASIC for anything but quick and dirty stuff. 
>
>What unmitigated crap! I hope someone kicks the slats out of your soapbox.
>Who are you to tell this person they shouldn't be programming in BASIC? Do 
>you also prescribe what religion people should be? It's the same kind of thing.
>I am grievously offended by your comments.
>
>Maybe GW-BASIC isn't the best program development environment in the world, but
>if it gets the job done, who cares. If people buy his product, they must not
>care. I get absolutely sick to death of these "programmer's" who believe that
>C is the "one true faith." It simply ain't so!  BASIC has come a long ways
>since the days of a 4K interpreter. It has evolved into a highly sophisticated,
>modern, structured programming language. It's stupid comments like yours that
>prevent many people from improving their productivity and improving their
>products by doing things with BASIC that BASIC does well.  I wouldn't begin
>to write screen drivers in BASIC, but I wouldn't do it in C either.  

[Defense of modern BASICs deleted].

Now let's not get too carried away here.  What the original poster was
apparently saying we should stop using is the old-style interpreted BASIC
with line numbers, such as BASICA and GW-BASIC.

What Mr. Freedman did in his the above paragraph is to shift the discussion
to modern BASICs, which are, as he points out, not the same animal.  But
GW-BASIC is in no stretch of the imagination a "highly sophisiticatd,
modern, structured programming language".

I bet that in Bill Gates' programming contest where he challenged all these
other programmers, he wasn't using GW-BASIC!


-- 
John Dudeck                                 "I always ask them, How well do
jdudeck@Polyslo.CalPoly.Edu                            you want it tested?"
ESL: 62013975 Tel: 805-545-9549                               -- D. Stearns