›<><><><><><><><><>><><>><><><><><><><>›› MORE BITS OF BASIC› By M. Olin (WAUGI,MACE)›Reprinted from the Michigan Atari›Magazine›››'PROTECTING' YOUR SOFTWARE››You say you've written a program, and›you spent a lot of hours making it›"just right?" You've written some›pretty nice routines that you're quite›proud of, but you don't want just›anybody to have access to it? Here's›a couple of hints that might help you›keep some prying eyes from viewing›your work.››DISABLE THE BREAK KEY››The very first line of your program›should look like this:›› 10 POKE 16,64:POKE 53774,64››Effectively, we have told the computer›to ignore the fact that the user is›pressing the BREAK key. Therefore,›the user cannot "break out" of the›program and look at your code. But,›that's only the beginning. Any›Atarian who has had his/her computer›for more than 2 weeks should know that›all you'd have to do is press RESET,›and we'd be back to Square 1.››COLD STARTING››Add the following command to line 10,›making sure to separate it from the›previous commands with a colon(:).›› POKE 580,1 ››Now, whenever the user presses the›RESET key alone, the computer will act›almost as if you had turned the power›off and back on again. In other›words, it will "reboot", and the›program that was running will be›erased from memory.››So far so good! Now you need a›routine that permits the approved›users to have access to your program,›but those persons you want to keep out›will have to be "filtered" somehow. A›"password" seems in order here.›› 19 DIM PASS$(20)› 20 INPUT PASS$:IF PASS$<>"Your›Password" THEN NEW:END››All persons who are using the program›must know the password, which can be›up to 20 characters long. Notice that›it is upper/lower "case sensitive."›If they enter it wrong, the program is›erased from memory. Zip. Kaput.›Gone. And, just to make sure that›"the enemy" can't discover your›password by staring over your›shoulder, we're going to make sure›that the characters you type never›appear on the screen.›› 15 X=PEEK(559):POKE 559,0››This command will turn off the chip,›called ANTIC, that drives your›monitor. The screen will turn black›with no visible text, and will remain›in this state until you turn it back›on again, which you will not do unless›the proper password is entered in line›20. if the correct password is given,›then this line will complete the job:›› 25 PRINT "":POKE›559,X› 30 REM Your program starts here.››Let's check our progress: The program›won't run if they don't know the›password. They can't RESET, and they›can't press BREAK and LIST the program›to look at your password. What's›left?››We have to find a way to prevent the›uninvited user from LOADing the›program and LISTing the lines that›contain your password, since none of›the above commands will take effect›until after the program starts›running. This part gets a little›tricky, so you will want to type it in›EXACTLY as it is written here. After›your program is completed and›"debugged" to your satisfaction, you›need to add these lines. Note that›your program must not ever GOTO or›GOSUB to these lines.›› 32761›BOTTOM=PEEK(131)*256+PEEK(130› ):TOP=PEEK(133)*256+PEEK(132)› 32762 FOR X=BOTTOM TO TOP:POKE›X,15› 5:NEXT X› 32763›FINISH=PEEK(139)*256+PEEK(138› ):POKE FINISH+2,0:SAVE›"D:filename.› ext":NEW››A WORD OF CAUTION: Make sure you SAVE›a copy of your program before you›continue with the following›instructions. Store this copy in a›safe place as it is the only copy that›can EVER be LISTed again. Not even›the approved password user can LIST›your program once these routines have›been performed, so take good care of›this "source" disk!››Ready? Make sure the disk on which›you want the "protected" version of›your program is in Drive 1, then›type:›› GOTO 32761››and press . Here's what›happens: The FOR/NEXT loop in line›32762 will cause all the variable›names which are used in your›program(and stored in the Variable›Name Table) to be replaced with›CHR$(155), the ATASCII value in the›POKE statement in line 32762). When›this happens, the program can no›longer be LISTed, nor can it be›LOADed! In fact, the only way to LOAD›and RUN this program ever again is by›issuing the RUN "D:filename.ext"›command from BASIC.››And, there you have it! A reasonably›good, but not absolutely perfect, way›to "protect" your software.››() )( )( )( )( )( )( )( )( )( )( )(››