DOCS: TURBO BASIC Command List

From: Len Stys (aa399)
Date: 12/23/89-09:48:24 PM Z


From: aa399 (Len Stys)
Subject: DOCS: TURBO BASIC Command List
Date: Sat Dec 23 21:48:24 1989



       TURBO BASIC COMMAND LIST

--------an on-line reading text--------

Compiled and Translated by
Dave and Laura Yearke

This documentation is provided by the
Western New York Atari Users Group and
may be reprinted freely provided this
credit is included.

     In case you've just landed from
Mars, or just plain haven't heard yet,
TURBO BASIC is the exciting new Public
Domain Basic Interpreter that we
recieved from the Atari Users Group in
Holland. It works on the XL or XE
series of Atari computers. It's almost
too good to be true and should be a
definate must for all XE or XL Atari
owners.
     Turbo BASIC, in addition to
offering 42 more commands and 22 more
functions than Atari BASIC, gives the
user 1603 more bytes of program space
by "hiding" part of itself under the
XL/XE's operating system.  It also runs
3 times faster than Atari BASIC,
includes most DOS commands, has
advanced graphics and programming
functions, and is insensitive to lower
case or inverse characters for most
commands.

TURBO BASIC COMMANDS:

Name      Syntax        Description

                        disk i/o

BLOAD  BLOAD "D:name"  Binary loads
                       file name (DOS
                       option L with
                       /N).
BRUN   BRUN  "D:name"  Binary load and
                       run file name
                       (DOS option L).
DELETE DELETE "D:name" Deletes the file
                       name (DOS option
                       D).
DIR       DIR          Disk directory
                       (DOS option A).
       DIR "Dn:*.*"    Directory of
                       drive n, note
                       that wildcard
                       extenders may be
                       used.
LOCK   LOCK "D:name"   Locks the file
                       name (DOS option
                       F).
RENAME    RENAME
        "D:old,new"    Renames the file
                       name (DOS option
                       E).
UNLOCK UNLOCK "D:name" Unlocks the file
                       name (DOS option
                       G).

                        graphics

CIRCLE CIRCLE x,y,r    Plots a circle
                       with center at
                       x,y and radius
                       r.
       CIRCLE x,y,r,r2 R2 is an
                       optional
                       "vertical
                       radius" for true
                       circles or
                       ellipses.
CLS       CLS          Clears the
                       screen.
         CLS #6        Clear screen
                       opened in
                       channel 6.
FCOLOR   FCOLOR n      Determines fill
                       color.
FILLTO  FILLTO x,y     A fill command
                       analagous to the
                       BASIC commands
                       "POSITION x,y:
                       XIO
                       18,#6,0,0,"S:"
PAINT   PAINT x,y      Another type of
                       fill command,
                       this one is a
                       recursive
                       routine that
                       will fill any
                       closed object as
                       long as x,y are
                       inside it.
TEXT   TEXT x,y,a$     bit-blocks text
                       in a$ at x,y.

                        memory

DPOKE   DPOKE m,v      Pokes location
                       m,m+1 with
                       2-byte integer
                       v (0 <= v <=
                       65535).
MOVE   MOVE m,m1,m2    Block transfer;
                       moves m2 (number
                       of bytes) from
                       starting
                       position m to
                       new starting
                       position m1.
MOVE   -MOVE m,m1,m2   Same as MOVE but
                       copies starting
                       with the last
                       byte of the
                       block.
BPUT   BPUT #n,adr,len Block Put; same
                       as FOR I=0 TO
                       len-1:PUT
                       #n,PEEK
                       (adr+I):NEXT I
BGET   BGET #n,adr,len Block Get; same
                       as FOR I=0 TO
                       len-1:GET #N,A:
                       POKE adr+I):NEXT
                       I
%PUT     %PUT #n,a     Until now, there
                       was no
                       convenient way
                       to put numeric
                       values onto disk
                       or cassette
                       files other than
                       by using PRINT,
                       which converted
                       them to strings
                       first, a slow
                       and cumbersome
                       process.  %PUT
                       puts the number
                       to the device
                       "as is," in
                       6-byte FP
                       format.
%GET     %GET #n,A     Get a number
                       stored with %PUT
                       from the device
                       and store it in
                       variable A.
                       Again, this is
                       much faster than
                       using "INPUT #n,
                       A".

                        structured
                        programming

REPEAT    REPEAT       Start a
                       REPEAT-UNTIL
                       loop.
UNTIL     UNTIL <c>    Terminate when
                       condition <c>
                       met.
WHILE     WHILE <c>    Start a
                       WHILE-WEND loop
                       to end when
                       condition <c>
                       met.
WEND      WEND         Terminate a
                       WHILE-END loop.
ELSE      ELSE         Optional
                       extension for
                       IF.  The IF
                       condition must
                       not be followed
                       by a "THEN", but
                       terminated by
                       end-of-line or
                       colon.
ENDIF     ENDIF        Ends an
                       IF-ELSE-ENDIF or
                       IF-ELSE
                       condition.  Note
                       that this allows
                       an IF condition
                       to span more
                       than one BASIC
                       line, provided
                       the "IF"
                       statement is
                       structured as
                       shown in Note 4.
DO        DO           Starts an
                       "infinite" DO
                       loop.
LOOP      LOOP         Cycle back to
                       the start of a
                       DO loop.
EXIT      EXIT         Exit a DO-LOOP
                       loop.
PROC      PROC name    Start definition
                       of procedure.
ENDPROC   ENDPROC      End definition
                       of procedure.
EXEC      EXEC name    Execute
                       procedure name.

                        general
                        programming


PAUSE     PAUSE n      Pause processing
                       for n/50
                       seconds.
RENUM     RENUM n,i,j  Renumber the
                       program starting
                       at line n, first
                       number is i,
                       increment is j.
                       This function
                       will handle
                       GOTOs, TRAPs,
                       and all other
                       line references
                       except those
                       which involve
                       variables or
                       computed values.
DEL       DEL n,i      Delete lines
                       n-i.
DUMP      DUMP         Display all
                       variables and
                       values.  For
                       numeric arrays,
                       the numbers are
                       the DIMed values
                       plus one.  For
                       strings, the
                       first number is
                       the current
                       LENgth of it and
                       the second
                       number is the
                       DIMed size of
                       it.  DUMP also
                       lists procedure
                       names and labels
                       with their line
                       values.
          DUMP name    DUMP to device
                       name, such as
                       "P:" or
                       "D:DUMP.DAT".
TRACE     TRACE        Trace program
                       during
                       execution.
          TRACE -      Turns trace mode
                       off (Default).
DSOUND  DSOUND n,f,d,v Form of SOUND
                       which activates
                       channel-pairing
                       for increased
                       frequency range.
           DSOUND      Turns off all
                       sounds.
GO TO     GO TO n      Alternate form
                       of GOTO.
*L        *L           Turn line-indent
                       on (Default).
          *L -         Turns
                       line-indent off.
*F        *F (or *F +) Special mode for
                       FOR..NEXT loops
                       which corrects a
                       bug in Atari
                       BASIC.  Seems
                       that in Atari
                       BASIC, an
                       "illegal"
                       reverse loop
                       like "FOR X=2 TO
                       1:PRINT X:NEXT
                       X" will execute
                       once even though
                       the condition is
                       met initially (X
                       is already
                       greater than 1).
                       Turbo BASIC
                       fixes this bug,
                       but leaves it
                       available for
                       Atari BASIC
                       programs which
                       may take
                       advantage of it.
          *F -         Turns off the
                       special
                       FOR..NEXT mode
                       to make Turbo
                       BASIC act like
                       Atari BASIC.
*B     *B (or *B +)    Command which
                       allows the break
                       key to be
                       trapped via the
                       "TRAP" command
                       within a
                       program.
          *B -         Turns off the
                       special BREAK
                       key mode.
--        --           Special form of
                       REM which puts
                       30 dashes in a
                       program listing.

                        line labels

#         # name       Assigns the
                       current line
                       number to the
                       label name.
                       This is a
                       convenient way
                       to get around
                       the problem of
                       renumbering when
                       using variables
                       as line numbers.
                       Labels can be
                       thought of as a
                       special form of
                       variable, as
                       they occupy the
                       variable name
                       table along with
                       the "regular"
                       variables.  We
                       also believe
                       that the number
                       of variables
                       allowed has been
                       increased from
                       128 to 256 to
                       allow for the
                       addition of
                       these labels.
GO#       GO# name     Analagous to the
                       GOTO command.

                        modifications

CLOSE     CLOSE        Close channels
                       1-7.
DIM       DIM a(n)     Will
                       automatically
                       assign a value
                       of zero to all
                       elements of the
                       numeric array
                       being
                       dimensioned, and
                       null characters
                       to all elements
                       of a string (The
                       LEN is still
                       variable,
                       however, and
                       initially zero).
GET       GET name     Wait for a key
                       press, assign
                       the value to
                       name.  Same as
                       "OPEN
                       #7,4,0,"K:":GET
                       #7,name:CLOSE
                       #7".
INPUT     INPUT        "text";a,b...
                       Prints text as a
                       prompt before
                       asking for
                       variable(s),
                       same as
                       Microsoft-BASIC.
LIST      LIST n,      List program
                       from line n to
                       end.
ON       ON a EXEC
         n1,n2,...     Variation of
                       ON...GOSUB for
                       procedures.  N1,
                       n2 and so on are
                       names of
                       procedures to be
                       run.
         ON a GO#
         n1,n2,...     Similar to
                       ON...GOTO except
                       that line labels
                       are used instead
                       of line numbers.
POP       POP          This command now
                       pops the runtime
                       stack for all
                       four types of
                       loops.
PUT       PUT n        Same as "PRINT
                       CHR$(n)";
RESTORE  RESTORE #name Restores the
                       data line
                       indicated by the
                       label name.
RND       RND          Parentheses are
                       no longer needed
                       at the end of
                       this command,
                       but it will
                       still work if
                       they are there.
SOUND     SOUND        Turn off all
                       sounds.
TRAP      TRAP #name   TRAPs to the
                       line referenced
                       by the label
                       name.


          TURBO BASIC FUNCTIONS:


                       arithmetic/logic

HEX$      HEX$(n)      Convert n to hex
                       string.
DEC       DEC(a$)      Convert hex
                       string A$ to
                       decimal.
DIV       n DIV i      Integer quotient
                       of n/i.
MOD       n MOD i      Integer
                       remainder of
                       n/i.
FRAC      FRAC(a)      Fractional part
                       of a.
TRUNC     TRUNC(a)     Truncates
                       fractional part
                       of a.
RAND      RAND(n)      Generates random
                       number 0-n.
$         $nnnn        Allows input of
                       hexidecimal
                       numbers, but
                       they are
                       converted to
                       decimal.  Ex:
                       "FOR I=$0600 to
                       $067F" => "FOR
                       I=1536 to 1663".
&         n & i        8-bit boolean
                       AND.
!         n ! i        8-bit boolean
                       OR.
EXOR      n EXOR i     8-bit
                       Exclusive-OR.

                        memory

DPEEK     DPEEK(m)     Double-PEEK of
                       m,m+1.
TIME      TIME         Time of
                       day(numeric).
TIME$     TIME$        Time of day
                       string, HHMMSS.
                       Unfortunately,
                       the time
                       commands don't
                       work properly
                       because they
                       were written for
                       European Ataris
                       which operate at
                       50 Hz, instead
                       of 60 Hz like
                       American ones,
                       the net result
                       being that they
                       gain 12 minutes
                       each hour.
INKEY$    INKEY$       Returns last
                       character typed.
INSTR     INSTR(x$,a$) Returns relative
                       location of
                       start of string
                       A$ within X$
                       (returns 0 if
                       not found).  The
                       match must be
                       exact; strings
                       with the same
                       letters but
                       differences in
                       case or type
                       (normal or
                       inverse) will
                       not be found.
        INSTR(x$,a$,i) i specifies the
                       starting point
                       of the search.
UINSTR   UINSTR(x$,a$) Same as INSTR,
                       does not
                       distinguish
                       between case or
                       inverse
                       characters. Ex:
                       UINSTR("HeLlO",
                       "hello") returns
                       1.
            UINSTR
           (x$,a$,i)   Specifies
                       optional
                       starting point.
ERR       ERR          Value of last
                       error number.
ERL       ERL          Line last error
                       occurred at.

           constants

              %0
              %1
              %2
              %3

These four constants simply stand for
the numbers 0-3, respectively.  The
difference with using these in a
program is that "X=1" requires 10
bytes, whereas "X=%1" only needs 4
(numbers require 7 bytes, 6 for the
number plus an identifier preceeding
it.  It is always a good practice to
make variables for numbers that are
used more than three times in a
program).

NOTES:

1.  Variable, Procedure and Label names
may contain the underscore (_)
character.

2.  To print a double-quote (") in a
text string, use two of them together,
instead of the Atari BASIC method of
using CHR$(34).  Ex: 
"TEST";CHR$(34);"TEXT" becomes
"TEST""TEXT" in Turbo-BASIC, both of
which produce the output => TEST"TEXT.

3.  Upon initial boot-up, TURBO-BASIC
looks for a BASIC file named
AUTORUN.BAS. If it finds an AUTORUN.BAS
file, it will automatically load and
run this file.

4.  Turbo-BASIC also prints out English
descriptions of all errors, including
several new ones for errors involving
the new commands:

Error - 22 ?NEST =   Loops not properly
                     nested.
Error - 23 ?WHILE =  WEND with no
                     corresponding
                     WHILE.
Error - 24 ?REPEAT = UNTIL with no
                     corresponding
                     REPEAT.
Error - 25 ?DO =     LOOP with no
                     corresponding DO.
Error - 26 ?EXIT =   EXIT is outside a
                     loop.
Error - 27 ?XPROC =  Error executing
                     PROC.
Error - 28 ?EXEC =   ENDPROC with no
                     corresponding
                     EXEC.
Error - 29 ?PROC =   Procedure does not
                     exist.
Error - 30 ?# =      Label does not
                     exist.

Also, Error 15 has been expanded to
include an UNTIL which relates to a
REPEAT which has been deleted.

4.  A multiline IF is constructed like this:

10 IF X > 10
20    PRINT X-10
30    GO# TOO_BIG
40 ELSE
50    PRINT X
60    GO# X_IS_OK
70 ENDIF

Note also the use of line labels in the
GOTO statements.

-- 


PLEASE NOTE:  The information contained on this system is not
intended to supplant individual professional consultation,
but is offered as a community education service.  Advice on
individual problems should be obtained directly from a professional.


-- 


-- 


-----------------------------------------
Return to message index