Additional commands and programming tips

1)   The FIND command is not documented in GeoBASIC but is very useful.
     Its syntax is as follows:

     FIND <string>

     This must be entered from direct mode, and will result in a Syntax error
     if done within execution mode.  

2)   The ' can also be used in place of REM.  This will save you a few key
     strokes.  The ' will be replaced by REM after you hit return.

3)   The POP command is not documented within the GeoBASIC manual because
     it contained a bug which was later fixed with a patch made by William
     Coleman.  Pop now removed the last two current pointers for
     UNTIL, LOOP, & RETURN.  This can be useful if you plan it right.   


4)   To detect whether sprites have collided or not, it is best to use the
     Commodore Kernal Sprite collision detect.  But we need a way to swap
     the GEOS Kernal in and out to Peek the Commodore Kernal.  Use the following:
     POKE 1,53: REM This Swaps GEOS Kernal out and Commodore Kernal in.
     POKE 1,48: REM This Swaps GEOS Kernal back in.

5)   If you want to create temporary data files, but do not want to clutter up
     your disk and do not want to do Disk cleaning later, use a header that
     creates a TEMPORARY data file as follows:

     HEADER 13, "Temporary", 1

     When you re-enter the deskTop, it will automatically be erased from your
     disk, regardless.  This is good if your about to run out of variable
     space, or any other data which you do not need at the moment.  This will
     conserve some space.

6)   On some printers PRNTER will allow you to select between your printers
     DRAFT or NLQ modes.  The Manual is correct in stating that a 0 will
     route output to screen while 1 will route it to printer.  Any number
     greater than one will also route text to the printer, but in NLQ mode.


7)   If you are running a program which does not require MOUSE input, shut
     off the mouse pointer.  It will increase the speed of your program.  To
     shut it off type MOUSE0,0,0.  You can use MOUSEX and MOUSEY to store 
     that mouse pointer position for later.

8)   The UPDATE option isn't totally useless.  If you make a program you do
     not want anyone to alter or modify, use the update command after you
     have made your program source into an application.  Remember you can
     still view the source code of a program by double-clicking on geoBASIC,
     not the Application.  Then select the geoBASIC Application and PUNCH
     open.  Then select UPDATE a bunch of times.  Your program will still
     work normally, but lines added to the Program will disappear once you
     exit.

9)   geoBASIC Application Chaining:

     10 CLS
     20 HEADER 6,"",1 : REM look for applications
     30 DBFILE L$
     35 IF L$="" THEN END
     40 S=LEN(L$)
     50 FOR I = 1 TO S
     60 X + ASC(MID$(L$,I,1))
     70 POKE45055+I,X: REM Stores application name in screen memory.
     80 NEXT I
     90 SYSINFO 3,CD: REM CD is Current Drive
     100 CALL 49840,0,0,CD: REM This is SetDevice
     110 CALL 49825: REM This is OpenDisk
     120 DPOKE14,45056: REM Flag R6.  Name pointer.
     130 POKE 2,0: REM Flag R0L.
     140 CALL 49672: REM This is GetFile.

     There are side effects though! If you use this, you can only load
     another GB Self Running Applications!! Anything else will cause a 
     lock up!  Also you must Exit to Basic!  To do so your Exiting program
     must not end with END.  Use this instead:

     10 DPOKE 12,0: REM flag R5
     20 DPOKE 16,2051: REM flag R7
     30 POKE 2048,0
     40 DPOKE 2049,0
     50 CALL 49729,S
     60 REM Call ToBasic
 
     Now look at line 50.  The variable S must not have any set value!
     Leave it Undefined!  When you exit to basic all you have to do is
     hit RESTORE and you will be deposited back to DESKTOP. 
 
10)  Creating SEQ files in geoBASIC:

     Although CREATE does not work on SEQ files you can still create a 
     new SEQ file or overwrite an existing one using the SAVE command.
     You have to take a totally different approach than the simple way
     to do it with VLIR files.  Here's the technique for creating or 
     overwriting a Text Scrap:

     First POKE the new Scrap into part of the background screen, say 
     from 29000 to  29999.  Then execute these commands:

     HEADER 4, "Text  Scrap", 0
     SAVE "Text  Scrap", 29000, 1000
 
     Note the two spaces between Text and Scrap.

     You can read a SEQ file one byte at a time using the HEADER, OPEN, RDBYTE, and
     CLOSE commands.  You can also LOAD it into memory but there is no way to
     prevent a long file from overwriting more memory than you want so I prefer
     reading it one byte at a time.  Or you could read the first few bytes to see  
     how big it is and then CLOSE and LOAD it if it is not too big.