home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Liren Large Software Subsidy 9
/
09.iso
/
l
/
l075
/
1.ddi
/
TBHELP.TBH
(
.txt
)
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
Turbo BASIC Help
|
1988-11-05
|
40.1 KB
|
1,113 lines
TURBO BASIC HELP FILE.
$*$* &&&&$*$
Index
Help on Help
Directory option
Bounds option
Editing commands
Chain files
Edit window
Change dir option
8087 option
Changing colors
Environment variables
Character set
Environment windows
Close option
Error messages
Colors option
Executable option
Communications opt
EXE file setting
Compile command
File command
Debugging
File names
Directories option
Goto option
'Go on...
Index
Hotkeys
Miscellaneous option
Include directories
Moving windows
Include files
Music buffer setting
Keyboard break option New option
Load option
Next option
Load setup options
Open option
Main file option
Options command
Main menu
OS shell option
Memory setting
Overflow option
Message window
Palette box
Metastatements
Parameter line option
Metastatements option Quitting Turbo
'Go on...
Index
Rounding numbers
Syntax
Running a program
Tile option
Run-time error option Trace option
Save option
Trace window
Saving setup options Turbo directory opt
Setup command
Window command
Stacking windows
Windows
Stack size setting
Write to option
Stack test option
Zoom option
Welcome to Turbo Basic's Help. Use the arrow
keys to move the selection bar to any of the
highlighted items. The Home key takes you to
the first item on the screen; End takes you to
the last. The 25th line gives you help on how
to move around. Note that if you press F1
while you're in the Help system, it will bring
up the Help index.
Here's some general topics to get you started
using Turbo Basic.
Character set
Editing
Hotkeys
Main Menu
Windows
The Turbo Basic menu system is both logical
and intuitive. You'll find that several of
the main menu commands have both pull-down and
pop-up menus, offering you many programming
options. Here's what the main menu has to
offer:
File
Compile
Options
Setup
Window
Debug
You can either press an arrow key to move to
the desired option and then press Enter or
simply press the highlighted capital letter
of the option you want.
Go on...
Use the arrow keys to select which part of a
menu item, window, or system box you want to
change, then press Enter. The palette box
of colors will be displayed on your screen.
You can restore the original colors by
selecting "Restore defaults."
Keep in mind that any colors you change will
be lost once you exit Turbo Basic unless you
save them using the Save Options/Window/Setup
in the Setup menu.
Turbo Basic has a number of hotkeys you can
use no matter where you are in the main menu.
Two of the most important are probably Esc,
which takes you back to the main menu, and
Alt-X, which exits you to DOS.
Function
--------------------------------------------
Takes you to context-sensitive
Saves your file
Creates a new file
Zooms the active window (only Run
and Edit are zoomable)
'Go on...
Function
------------------------------------------
Switches to the next active
window
Goes to the active window
(in the editor, F7 functions
differently)
Scroll Lock
With the arrow keys, sizes
and moves the active window
Returns you to the main menu
Alt-F5
Zooms the active window at
runtime
Alt-F6
Switches to the next active
window at runtime
'Go on...
Function
-----------------------------------------
Alt-F9
Toggles between tracing and
executing your program
Alt-F10
When tracing, single-steps to
next line number, label, etc.
Alt-C
Compiles the currently loaded
program
Alt-D
Takes you to the Debug menu
Alt-E
Takes you to the Edit window
'Go on...
After selecting the Colors option, use the
arrow keys to move to and select which part
of the screen you'd like to redefine the
colors for.
Any colors you change will be lost once you
exit Turbo Basic unless you save them using
the Save Options/Window/Setup in the Setup
menu.
For example, use the Right arrow key to move
to the Edit command from the File command, or
else just press E from anywhere in the main
menu. Pressing the Alt key and the letter of
any of the main menu options will get you to
the option (or action) desired.
Function
--------------------------------------------
Alt-F
Takes you to the File menu
Alt-O
Takes you to the Options menu
Alt-R
Runs currently loaded program
Alt-S
Takes you to the Setup menu
Alt-X
Exits the Turbo Basic system
The File command provides a number of options.
This is where you'll spend a lot of time--
naming files, doing saves, writing to disk,
and more. Select an option that you want to
know more about:
Load
Save
Write to
Main file
Directory
Change dir OS shell
Use Load to select a work file to
Compile
At the prompt, you can enter any legal file
name. Choose unique file names and avoid the
extension names .EXE, .BAK, .COM, and .BAT.
Pressing Enter after the prompt for a file
name or entering wildcards (* and ?) followed
by Enter will bring up the directory facility.
Use the arrow keys to move around and then
press Enter when you reach the file you want.
The New option erases any text that is
currently in the editor and gives the
default name NONAME.BAS to the file.
Use Save to save your current work file to
disk. An old version will be given a .BAK
extension unless you toggle off the option
Backup source files (in the Miscellaneous
pop-up window of the Setup command).
If you attempt to save a NONAME.BAS work file,
you are prompted to rename it first. Pressing
Enter will save your file as NONAME.BAS.
Use Save to save your current work file to
disk. An old version will be given a .BAK
extension unless you toggle off the option
Backup source files (in the Miscellaneous
pop-up window of the Setup command).
If you attempt to save a NONAME.BAS work file,
you are prompted to rename it first. Pressing
Enter will save your file as NONAME.BAS.
After editing, use the Write to option to
write the current edit file to disk under a
new name. You are prompted for a file name
to write to.
Miscellaneous Commands con't
-------------------------------------
Find
Ctrl-QF
Find & replace
Ctrl-QA
Repeat last find
Ctrl-L
Control character prefix
Ctrl-P
Abort operation
Ctrl-U
Restore error message
Ctrl-QW
'Go on...
Search Options
------------------------------------------
Searches backwards
Searches globally
n = any number; searches n times
Replaces without asking
Ignores uppercase/lowercase
Searches for whole words only
The Directory option is handy when you
want to get a directory listing, to search
subdirectories, and to change the mask on
the fly. You can specify a mask using the
wildcard characters * and ?, following the
usual DOS rules.
You can use the arrow keys to move around
the directory listing and subdirectories.
Select another directory with the Change dir
option. At the prompt, type in the directory
path that will become your current directory.
You can use any legal path name.
As a note, the Executable directory contains
.EXE and .TBC files generated by the Turbo
Basic system. The Include directories
hold files that contain the Include compiler
directive. The Turbo directory file is
where Turbo Basic expects to find system
files: TB.EXE, the config files (.TB), and
the help files (.TBH).
Choose the OS option when you want to call the
DOS operating system--Turbo Basic will remain
resident in memory. Once DOS has been loaded,
you can execute any DOS commands. Type EXIT
to return to Turbo Basic.
Use the Quit option to exit from the Turbo
Basic system to DOS. If you've modified a
work file without saving it, you are prompted
to do so now. (Alternatively, you can exit
Turbo Basic by pressing Alt-X from anywhere
in the menu system.)
If you're at all familiar with SideKick's
Notepad, this editor should be a breeze.
Press E to get into the Edit window and enter
text just as if you were typing at a
typewriter. When you want to end a line,
simply press the Enter key. To exit from the
editor, press Esc.
The editor's status line indicates the drive,
name, and extension of the file being edited,
which line and column number contain the
cursor, whether you're in Insert or Overwrite
mode, and whether the auto-indent and tab
features are on.
'Go on...
After you finish writing or editing your file,
press Esc to get back to the main menu. Your
file will still be displayed onscreen, but
you won't be able to do anything to it until
you press E to return to the editor.
The next screen gives you a summary of some
of the most commonly used commands (take a
look at Chapter 3 in the manual for the more
complex ones).
'Go on...
Cursor Movement Commands
------------------------------------------
Character left
Ctrl-S or Left arrow
Character right
Ctrl-D or Right arrow
Word left
Ctrl-A
Word right
Ctrl-F
Line up
Ctrl-E or Up arrow
Line down
Ctrl-X or Down arrow
Scroll up
Ctrl-W
Scroll down
Ctrl-Z
Page up
Ctrl-R or PgUp
Page down
Ctrl-C or PgDn
'Go on...
Insert & Delete Commands
------------------------------------------
Insert mode on/off
Ctrl-V or Ins
Insert line
Ctrl-N
Delete line
Ctrl-Y
Delete to end of line Ctrl-QY
Delete character left Ctrl-H or Backspace
Delete character
Ctrl-G or Del
Delete word right
Ctrl-T
'Go on...
Block Commands
-----------------------------------
Mark block begin
Ctrl-KB or F7
Mark block end
Ctrl-KK or F8
Mark single word
Ctrl-KT
Copy block
Ctrl-KC
Move block
Ctrl-KV
Delete block
Ctrl-KY
Read block from disk Ctrl-KR
Write block from disk Ctrl-KW
Hide/display block
Ctrl-KH
Print block
Ctrl-KP
'Go on...
Miscellaneous Commands
------------------------------------------
Quit edit, no save
Ctrl-KD, Ctrl-KQ, or
Save and edit
Ctrl-KS or F2
New file
Tab
Ctrl-I or Tab
Tab mode
Ctrl-OT
Auto indent on/off
Ctrl-OI
Restore line
Ctrl-QL
Set place marker
Ctrl-KN
Find place marker
Ctrl-QN
'Go on...
Once you open the window of your choice, it
becomes the active window. From that point
on, all other window commands will only affect
the active window.
The Close option hides, or makes "invisible,"
the currently selected window. Note, however,
that you can still write to the "closed"
window.
Use the Next option to select another window
as the active window without returning to the
Open option. If you press Next repeatedly,
you'll cycle through the windows. When you're
in a window or main menu, pressing the F6 key
will accomplish the same thing.
After you've Opened a window, use Goto to
enter that window without returning to the
main menu.
Tiling makes all of the active windows occupy
an equal portion of the screen. The F6 key
switches the active window.
Stack layers all active windows to the largest
possible size. Pressing F6 will bring the
last screen in the stack to the top of the
screen.
The Zoom option zooms to full size the Run
and Edit windows. Toggle Zoom again to
restore your original screen setup.
The Turbo directory is where Turbo Basic
expects to find the system files: TB.EXE,
the configuration files (.TB), and the help
file (TBHELP.TBH).
After selecting this directory, you are
prompted for a drive and a path. Type it
in and then press Enter.
If you change your mind about the directory
you've selected and want to reselect, you
can press Esc any time prior to leaving the
system box and before pressing Enter. This
will return you to the directory selections.
The Colors option lets you define the colors
of any window, menu, or system box and their
respective items by using the arrow keys and
pressing Enter.
Any colors you change will be lost once you
exit Turbo Basic unless you save them using
the Save Options/Window/Setup in the Setup
menu.
The Directories option lets you define a drive
and path to the three directories used by the
system:
Include
for files containing Include
compiler directive
Executable for .EXE and .TBC (chain) files
Turbo
for Turbo Basic system files
The default directory is whatever directory
you happen to be in when you start up Turbo
Basic.
The Load Options/Window/Setup lets you load
a .TB file from the Turbo directory and
reset the system with the parameters in that
file. After entering the file name, press
Enter to have Turbo Basic accept it.
The Save Options/Window/Setup lets you save
the current configuration file in a .TB file
in the Turbo directory. No matter what
extension is used, it will be stripped off
and .TB appended. The default file name
TBCONFIG.TB is automatically used at startup.
The Window option lets you resize and move any
active environment window using the following
commands:
Open
Close
Tile
Stack
By default, all environment windows are active
until closed.
To move a window, use the Scroll Lock and
arrow keys; resize using Scroll Lock and the
Shift and arrow keys.
To enter a directory name, type the drive name
and then the directory path: C:\TURBO
The backslash indicates the path starts from
the root.
To enter a subdirectory name for the drive
you're currently in, type a backslash and
then the subdirectory name. To reach the
subdirectory of another drive, enter the
complete path name: C:\BASIC\GRAPHICS
'Go on...
When you're in the palette, you can use the
arrow keys to move around in the palette box.
Notice that as you move through each color,
the item you've selected to change takes on
the color you're currently positioned on.
Once you've found a color you like, press
Enter to accept it and Esc to exit from the
palette box.
Any colors you change will be lost once you
exit Turbo Basic unless you save them using
the Save Options/Window/Setup in the Setup
menu.
You can use a combination of keystrokes to
resize and move an active environment window
(the one with the double bars around it).
To resize a window, first toggle on the Scroll
Lock key. Then hold down the Shift key and
use any of the arrow keys to make the active
window as large or as small as desired.
To move a window, again toggle on the Scroll
Lock key and use any of the arrow keys to
move the window to a new position onscreen.
Every subdirectory listing has the . and ..
special files. The single period (.) file
name identifies the directory being listed
as a subdirectory. The double period (..)
file name refers to the parent of the
subdirectory.
There are four environment windows:
Edit
Message
Trace
An active window is the one that has a double
border around it. You can only have one
active window at a time.
You can resize and move these windows or make
them invisible. Go to the Window command in
the main menu to perform these actions or use
some of the hotkeys available.
The Trace window lists any program line
numbers, labels, and procedure and function
names as your program runs. To trace your
program, you can do one of two things:
1. You can toggle on Trace in the Debug
command.
2. You can place the TRON/TROFF commands
within your program. Using these commands
in your program overrides the system Trace
switch.
In the Edit window, you can create and edit
any of your programs using Turbo Basic's
built-in screen editor. Press F5 to Zoom
the Edit window.
The Turbo Basic Editor works much like editors
in the world-at-large (go to the editing help
screen for the commonly used commands). If
you don't name your work file (using the Load
command in the Files pull-down menu), the
default file name NONAME.BAS will be assigned.
The Message window acts as a program status
window.
After compiling a program, the window will
display the total number of lines and
statements in the program, and the amount of
free space left.
After running a program, the Message window
shows in hexadecimal the size of the code
segments, the stack, and the data area of the
generated program.
The Run window simply displays your program
output. You can Zoom the Run window prior
to running your program by pressing F5. To
Zoom the window while running your program,
press Alt-F5.
After you've run your program, you can also
pan the contents of the Run window. Notice
that the Run window is the active window
(it has a double border). Press F7 to go to
it and then use the arrow keys to move left,
right, up, or down to review the window's
contents.
Toggle on Backup source files to automatically
back up (append the extension .BAK to) your
files. Toggle it off when you don't want to
create a backup file each time you do a save.
When working with large programs, you may need
or choose to break the source into manageable
sections. Used in conjunction with $INCLUDE
metastatements, the Main file selection lets
you compile multiple source file programs.
The source module defined as the Main file
should be the one with the $INCLUDE directive.
To edit any module of the program, always make
it the currently loaded file.
After you select the Compile option from the
main menu, Turbo Basic determines whether the
current work file is different from the Main
file.
!Go on...
If the files are not different (or if Main
file has not been selected), then the file
is compiled. If the files are different,
you are prompted to save the work file (if
it has changed), and then the Main file is
loaded into memory.
If any errors are found during compilation,
the file containing the error is loaded so
that you can correct it. Once the error has
been corrected and compilation restarted, you
are prompted to save the work file and the
Main file is then reloaded.
Turbo Basic's character set includes A to Z,
a to z, and 0 to 9. The numbers 0 to 9; the
symbols ., +, and -; and the letters E, e, D,
and d can all be used to form numeric
constants.
These symbols have specific meaning in Turbo
Basic:
Symbol
Function
----------------------------------------------
assignment operator
addition and string concatenation
operator
'Go on...
Symbol
Function
------------------------------------------
subtraction and negation operator
multiplication operator
division operator
integer division operator
exponentiation operator
integer-type declaration operator
long-integer-type declaration
character and nondecimal base
descriptor
single-precision-type declaration
character
'Go on...
Symbol
Function
------------------------------------------
double-precision-type declaration
character
string type declaration character
and metastatement prefix
function/procedure arguments,
arrays, expression prioritizing
valid only for arrays
(space) separator
all-purpose delimiter
decimal point and file name
extension separator
'Go on...
Symbol
Function
------------------------------------
remark delimiter
all-purpose delimiter
statement delimiter
PRINT substitute
relational operator
relational operator
string delimiter
line continuation character
%Topic menu
When your compiler begins executing or when a
generated .EXE file starts executing, it will
actually search the environment variable space
for these variables.
Though you don't need to set these variables,
they're available if you need them. If you
choose not to set them, the current directory
searches for files, creating temporary ones
in which to store to default variables.
Once you've written and compiled your
program, use Run to execute it.
Ctrl-Break interrupts your program and
returns to the main menu. Note, however,
that this only works if you've toggled on
the Keyboard break option in the Options
menu.
'Go on...
When an error occurs, you're placed in the
editor at the point of error. An error
description appears on the status line;
correct the error and then recompile.
If you've made changes to the source, when
recompiling your program, the Message
window will show in increments of 20 the
number of lines and statements processed.
The Run window shows your program's output;
while running it, use Alt-F5 to Zoom this
window.
The Compile command compiles the currently
loaded program. Set the Compile to switch
in the Options menu to compile to an .EXE
file, to a .TBC file, or to memory (the
default).
If a Main file is not specified, then the
loaded file is compiled. If you select Main
file, you are prompted to save the current
work file.
'Go on...
When compiling, the number of lines and
statements processed are recorded in the
Message window.
When an error occurs, you are placed in the
editor at the point of error. The status
line displays the error's description;
correct your file and recompile.
Enter the size of the receive buffer for your
communications port (1 or 2). The minimum is
0; the maximum is 32767; the default is 256.
Use the $COMn metastatement in programs to
allocate space for either of the two serial
receive buffers.
Use the Stack size option to enter a new
stack size within the interval 1024 to 32K
(400 Hex to 7FFE Hex). The default size is
1024 bytes (one paragraph equals 16 bytes).
Enter the size of the background music buffer.
When you're not using the SOUND or PLAY
statements, set this to zero so your resulting
code will be smaller.
The minimum is 0; the maximum is 4096 notes;
the default is 32 notes (or 256 bytes; 1 note
equals 8 bytes).The $SOUND metastatement
can also be used to declare the buffer's
capacity.
You can use the Communications option to
specify the size of the receive buffer for
your communications port (1 or 2). The
minimum is 0; the maximum is 32767; the
default is 256. Use the $COMn metastatement
in some programs to allocate space for either
serial receive buffer.
Compiling to memory produces the fastest
results when you're in a development
environment. So use this setting when
you're debugging and testing your program.
The EXE setting is usually used after you've
already debugged your program. It creates
files that are runnable from the operating
system. The file extension .EXE is appended
to these files.
Use this setting when you want to produce
files that can be chained or run from a Turbo
Basic-created .EXE file. These files do not
include library routines and thus cannot be
run independently. The files produced with
this option have the extension .TBC appended
to their names.
When compiling a program, you can choose from
three different file settings:
Memory
EXE file
Chain
Use the arrow keys to move to the desired
option or press the key that corresponds to
that option.
Turn on the 8087 required option when you're
using an 8087 coprocessor chip for program
execution. When you have this option on,
Turbo Basic generates the best possible code
for floating-point operations, both fast and
compact, using inline 8087 statements. The
disadvantage is that a program generated with
this option on won't run on a machine without
an 8087.
With the 8087 option off (the default),
programs can go both ways; that is, if an
8087 is available, the program will use it.
If not, the program will use software routines
to accomplish the same thing (only slower).
Turn on the keyboard break option in order to
stop a program with a Ctrl-Break sequence.
(This only applies to Ctrl-Break, not Ctrl-C).
Keep in mind that Ctrl-Break doesn't take
effect until your program outputs text (not
graphics) to the screen or printer or performs
keyboard input. What this means is that you
cannot interrupt sequences that don't perform
I/O.
Toggle on the Auto save edit option in the
Setup menu so that your program is saved
automatically in case you crash or hang.
Toggle on Bounds to get the compiler to
generate array subscript-checking code.
Subscript-checking code ensures that a
subscript is appropriate (given the size of
the array it is to be used on) before reading
or writing the indicated element. With Bounds
checking on, a subscript range error (error 9)
is reported whenever your program attempts to
use a subscript too large or too small for a
given array.
Note that the compiler always reports constant
out-of-range subscripts.
Compile your program with the Overflow option
on in order to detect the generation of any
overflow errors. Overflow occurs when an
arithmetic operation produces a value beyond
the storage capacity of integers (-32,768 to
+32,767).
Turning off this option can cause the
assignment of an erroneous value(s).
Overflow checking occurs for integers, long
integers, or either of the floating-point
types (single precision and double precision);
however, integers have some exceptions (for
example, register calculations).
When compiling, toggle on Stack test if you
suspect your programs are running out of stack
space. This switch causes Turbo Basic to
generate code that checks for stack collisions
upon entry to each subroutine, function, or
procedure.
If you want to allocate more stack space, use
the $STACK metastatement.
Select Parameter line to get Turbo Basic to
prompt for the string that the COMMAND$
function returns the next time a program is
run. Type in your string and press Enter to
accept it.
This option lets you simulate command line
information to help you in debugging programs
from within Turbo Basic.
Metastatements control the compiler at compile
time (different from standard statements,
which control the program at runtime). Called
compiler directives, they always begin with a
dollar sign ($). Note, however, that your
source program can override these settings.
You can control three metastatements through
this option:
Stack size
redefines the stack
Music buffer
determines the size of
the background music buffer
Communications
changes the allocation of
each serial receive buffer
Use the Trace option to globally set program
tracing. You can override this switch with
embedded TRON and TROFF statements.
The Trace window will display statement
labels, line numbers, and procedure and
function names.
Use the key combo of Alt-F9 to toggle between
tracing and executing your program. Alt-F10
single-steps to the next line number, label,
and so on.
Find errors in your .EXE and .TBC files by
using this option; no messages are given in
these cases. Note, however, that when you're
running a program within the Turbo Basic
system, the following is automatic:
1. Enter the program counter value in the box
provided. Turbo Basic finds the correspond-
ing point in your source code and places
the cursor on the statement of error.
2. When a run-time error occurs, Turbo Basic
tells you the error number and its value
in the processor's program counter at the
time of error.
Go on ...
The window you've selected is now the "active"
window (note the double border around it).
From now on, all other window commands will
affect this window.
If the selected window had been closed, it
will be created and will be brought to the
screen, or made "visible" again.
Environment variables are variables that
actually override compiler and/or program
options, and are determined by using the SET
command in DOS. You may want to use these
variables if you have some special hardware
needs or if you're a developer who needs a
dynamic environment.
Environment variables affect the entire
environment in which a program is executed.
So once you set a variable, it's in effect
until you reset it to another value or turn
off your machine.
'Go on...
If you find yourself consistently setting
these values one way, you may want to enter
the SET command into a batch file or into your
AUTOEXEC.BAT file.
Turbo Basic's environment variables allow you
to override compiler and run-time options for
8087 support and Color/Graphics Adapter "snow"
checking.
'Go on...
The following example sets up an environment
for 8087 use by typing at the DOS prompt
SET 87=yes
where yes means you have an 8087; no means
even if you have an 8087, don't use it. The
default setting is yes.
For CGA snow-checking, you could type
SET CGASNOWCHK=no
where no doesn't do snow-checking and yes does
snow-checking.
Go on...
After selecting the Include directories,
you are prompted for a drive and a path.
Type it in and then press Enter. You can
enter multiple directories in this option
by separating them with semicolons:
C:\TB; C:\DOS
If you change your mind about the directory
you've selected and want to reselect, you can
press Esc any time prior to leaving the system
box and before pressing Enter. This will
return you to the directory selections.
After selecting the Executable directory, you
are prompted for a drive and a path. Type it
in and then press Enter.
If you change your mind about the directory
you've selected and want to reselect, you can
press Esc any time prior to leaving the system
box and before pressing Enter. This will
return you to the directory selections.
Toggle on Auto save edit when you want to
automatically save your current work file
before Running a program.
Toggle on Backup source files to automatically
back up (append the extension .BAK to) your
files. Toggle it off when you don't want to
create a backup file each time you do a
Save.
The Miscellaneous option offers you access to
two handy options:
Auto save edit
Backup source files
The Options command provides a number of
compile options that when chosen will have a
global effect. These options control the
entire compilation unless overridden by
internal source program metastatements.
Compile to
8087 required
Keyboard break
Bounds
Overflow
Stack test
Parameter line
Metastatements
The Setup command offers several options that
allow you to either inspect any of the setup
parameters, alter them, or permanently record
the current configuration in a .TB file.
Colors
Directories
Miscellaneous
Load Options/Window/Setup
Save Options/Window/Setup
Use Debug when you're trying to debug
your programs. It offers these valuable
options:
Trace
Run-time error
By recompiling, Turbo Basic calculates the
point in a source program that corresponds to
a run-time address in an executable program.
Metastatements are compiler directives that
operate at a different level than regular
language statements, controlling the behavior
of the compiler at compile time. All
metastatements always begin with a dollar sign
($). Turbo Basic's metastatements include:
$COM
$INLINE
$DYNAMIC
$SEGMENT
$EVENT
$SOUND
$IF/$ELSE/$ENDIF
$STACK
$INCLUDE
$STATIC
$COM
Syntax: $COMn size
Allocates space for the serial port receive
buffer. The default is 256. n indicates the
communications adapter and size is an integer
constant defining the capacity of the buffer
for that adapter.
$DYNAMIC
Syntax: $DYNAMIC
Declares default array allocation to be
dynamic. $DYNAMIC takes no argument.
$EVENT
Syntax: $EVENT {ON|OFF}
Controls generation of event-trapping code.
$IF/$ELSE/$ENDIF
Syntax: $IF const
... statements
[$ELSE
... statements]
$ENDIF
Define portions of a source program to skip
or compile. const is a named constant or
constant value. If const is nonzero (True),
then the statements between $IF and $ENDIF
are compiled and the statements between
$ELSE and $ENDIF are not. The $ELSE clause
is optional, but $ENDIF is required.
Conditional compilation statements can be
nested 256 deep.
$INCLUDE
Syntax: $INCLUDE filespec literal
Includes a text file. Use it to compile the
text of another file along with the current
file. The $INCLUDE mechanism causes the
compiler to treat the included file as though
it were physically present in the original
text.
$INLINE
Syntax: $INLINE [byte list]|[filespec literal]
Declares inline machine code in an inline
subprocedure.
$SEGMENT
Syntax: $SEGMENT
Declares a new code segment. Use this
to break up your source program when
the compiler reports that the 64K segment
limitation has been exceeded.
$SOUND
Syntax: $SOUND buffer size
Declares the capacity of the background
buffer. buffer size is a numeric constant,
indicating the capacity of the PLAY
statement's background buffer (1 to 4096
notes).
$STACK
Syntax: $STACK count
Declares the size of the run-time stack.
count is a numeric constant from 1024 to 32K.
The default is 1024 bytes (400H).
$STATIC
Syntax: $STATIC
Declares the default array allocation to be
static. $STATIC takes no arguments. Space
for static arrays is allocated at compile
time.
There are two types of errors in Turbo Basic:
compile-time and run-time. Compile-time
errors are errors in syntax (missing symbols,
misspelled commands, etc.) discovered by the
compiler. Run-time errors are anomalies
caught by error-detection mechanisms the
compiler places in your executable programs.
If a compile-time error occurs, you are placed
in the editor, with the cursor positioned at
the point of error. You only need correct the
error and recompile. Turbo Basic lists the
error number and a brief description of the
error. Compiler errors have error codes of
256 and above.
Go on...
Run-time errors occur when a compiled program
is executed. They can include file-system
errors, improper function calls, memory
errors, and a myriad of other problems.
If a run-time error occurs in a program you're
executing from within Turbo Basic, you'll also
be placed at the point of error. A run-time
error occurring in a program run from DOS will
simply be displayed in numeric form (not
text).
Refer to the ON ERROR and ERROR statements
and the ERR, ERL, and ERADR functions for
information about run-time error trapping.
The program structure of a line of Turbo Basic
source text consists of the following:
[linenumber] statement[:statement]...['comment]
label:
$metastatement
'Go on...
linenumber is an integer in the range 0 to
65535.
statements are the building blocks that make
up programs. A line can contain none, one, or
several statements, each separated by a colon.
comment can be any text added to the end of a
line and separated from the program itself by
a single quote ('). REM can also be used as
a comment delimiter.
'Go on...
label must appear on a line by itself, and
serves to identify the statement immediately
following it. Labels must begin with a
letter and be followed by a colon. It can
contain any number of letters and digits.
$metastatements are statements that operate
at a different level than standard statements,
controlling the compiler at compile time.
They are called compiler directives, and must
always begin with a dollar sign ($).
Unlike Interpretive BASIC, Turbo Basic doesn't
always round the fractional part of a number
up. Turbo Basic treats in a special manner
any number containing a 5 in its fractional
part. The number is always rounded toward the
closest even number. For example, 0.5 would
be rounded down to 0; 9.005 would be rounded
down to 9.00.
When you save data, you are creating a file
that can be used for input or output. A file
name consists of two parts, separated by a
period:
filename.ext
where filename can be from one to eight
characters, and ext is an optional type
extension of up to three characters. If a
file name is longer than eight characters,
Turbo Basic truncates the name and adds a
period at its end. An extension name longer
than three characters is also truncated.
'Go on...
File names and extensions can contain the
following characters:
A-Z 0-9 ( ) { } @ # % ^ & ! - _ ' / ~
The space character cannot be used and
lowercase letters are automatically converted
into uppercase.
File names in Turbo Basic statements must be
in string form; for example:
KILL "MYFILE.BAK"