Welcome! You are about to discover the Sorcerer's Standard BASIC. BASIC is a programming language, the one most commonly used on microcomputers. BASIC (Beginner's All-purpose Symbolic Instruction Code) was originally designed to teach the fundamental principles of computer programming. BASIC is fast becoming the most popular high-level programming language. Its commands are simple English words and it uses standard mathmatical symbols. When you finish this book you will be able to write complex programs; yet you will find BASIC easy to learn, even if you have no mathematical or scientific; background.
Before starting, you must go through some preliminaries. First, read A GUIDED TOUR OF PERSONAL COMPUTING (the Sorcerer operations manual). There is some technical information there which you won't need at first, and some which will be covered in more detail in this manual.
Second, turn off the power to the Sorcerer, insert your Standard BASIC ROM PAC(TM) and turn the power back on. When the video cable is attached to thte Sorcerer and power is applied to both the display and the Sorcerer, the following message will appear on the screen:
Third, there are some conventions this book will follow:
1. Items enclosed in angle brackets (< >) must be supplied as
explained in the text. For example, the format for a GOTO statement is:
GOTO
<line number>
This means that you must supply a line
number, as explained in the text.
2. Items enclosed in square brackets ([ ])are optional. For example, the
RUN command has the forinat:
RUN [<line number>]
This means
that you may supply a line number if you wish, but you don't have to.
(When you the <line number> option, execution begins at the
specified line.)
3. We recommend printing instructions to the computer in capital letters and typing them into the keyboard exactly as shown; this includes all punctuation and proper placement of spaces. These niceties make your programs easier to read. The Sorcerer changes all lower-case instructions to capitals, but does not touch literals (characters within quotes).
Fourth, there are some special terms you should know. Here are their definitions:
CHARACTERS: The letters, numbers, punctuation, mathematical symbols and graphic symbols, taken together, are called characters. The letters and numbers, taken as a group, are called alphnnumeric characters.
COMMAND LEVEL: After the Sorcerer prints READY, it is at the command level. This means it is ready to accept commands.
COMMANDS AND STATEMENTS: Instructions in Standard BASIC are loosely divided into two classes, Commands and Statements, Commands are instructions normally used only in direct mode (see Chapter 1). One command, CONT, may be used only in direct mode, since it has no meaning as a program statement. Some commands, such as NEW and LIST, are not normally used as program statements because they cause a return to command level. But most commands will find occasional use as program statements. Statements are instructions that are normally used in indirect mode. Some statements, such as DEF, may only be used in indirect mode.
CURSOR: The Sorcerer places a small underline (_) on the monitor screen when it is ready to accept information. This mark is called the cursor and it shows where the next character you type will appear.
FORMAT OF AN INSTRUCTION: The correct way to write the instruction, so that the Sorcerer understands it.
INTEGER: A whole number (that is, without fractional parts) - positive, negative, or 0.
FLOATING POINT NOTATION: Also called scientific, exponential or E notation. All numbers are considered to be decimals, with six significant figures. Zeros are added as necessary to fill up the unfilled digits, and extra digits are dropped. Each number is written as an integer followed, if necessary, by a decimal point and up to five decimal places, an E and then a two-digit number with a plus sign or a minus sign. See Chapter 5.
NUMERIC VARIABLE: An alphanumeric expression that takes the place of one or more numeric values. A variable is analagous to an unknown in an algebraic equation. The naming of a variable follows several rules which are covered in Chapter 5.
PROMPT: When the Sorcerer expects Information from you, it places a special symbol or message in front of the cursor. The symbol or message is called the prompt, and it tells you what kind of information Sorcerer wants (or which persona of the Sorcerer you are dealing with: each software system has its own special set of prompts). These are the prompts you should know about:
READY -- means the Sorcerer is in Standard BASIC at command level and wants a BASIC command or a program statement.
> -- means the Sorcerer is in the Power-On Monitor and wants a Monitor command.
? -- means the Sorcerer has just read an INPUT statement (from BASIC) and wants data (see Chapter 3).
?? -- means the Sorcerer has not received a response (in BASIC) to all the requested elements of the INPUT statement and wants farther data (see Chapter 3)
RESERVED WORDS: Some words or combinations of letters are reserved for use as statements, cornmands or intrinsic functions. You may not use these as part of the name of any variable, array or function name. (These are the terms of Standard BASIC. For a complete list of the reserved words see Appendix A.)
STRING VARIABLE: An alphanurneric expression that takes the place of one or more literals (characters that are not treated mathematically and are usually found between quote marks). The rules for naming string variables are found in Chapter 9.
CLEAR -- This erases the screen and puts the cursor in the upper left corner without resetting the Sorcerer's memory (but it does reset, in early versions of Standard BASIC, any user-redefined standard graphics characters to their original states; see Chapter 12)
CTRL C -- Press these two keys simultaneously to stop a program. You can restart the program with the comrnand CONT, but only if you have not changed the program in any way. (If you use CTRL C and then change the program, you may restart the program from the beginning with the RUN command, or continue from the point you left off with RUN <line number> or GOTO <line number>. These commands "kill" your variables: only CONT preserves variable values.)
ESC -- Press this key first, then the two RESET keys to restart Standard BASIC without wiping the current program out of memory. Do this only in extreme situations, when CTRL C will not work. Warning: May cause system to crash! ESC by itself works the same as RUN STOP but really has limited function in BASIC.
SHIFT HOME -- CTRL HOME -- These put the cursor in the upper left corner of the screen without wiping the screen display or clearing the memory.
RETURN -- One of the most irnportant keys on the board. The Sorcerer will not execute any command, or put any instruction or data into its memory, until you press this key. This key corresponds to the carriage return on a typewriter.
RESET -- Press both RESET keys simultaneously to restart Standard BASIC and wipe the current program out of memory. (This does an automatic NEW command.)
RUN STOP -- Temporarily stops program execution or screen display, as long as you depress the key. Release the key and the program or display continues.
Some commands require two or three keys: SHIFT, CTRL or GRAPHIC (or SHIFT and GRAPHIC together) plus one of the other keys of the keyboard (for example CTRL C and SHIFT HOME, above). It is difficult to push two keys precisely simultaneously, and you don't want to give the Sorcerer the wrong instruction. To make sure you tell the Sorcerer exactly what you want, first hold down the command key ( SHIFT, CTRL or GRAPHIC ). While holding this key down, press the companion key (such as C, ?, etc.). Release the second key, and then, only after releasing the second key, release the command key.
There are many versions of BASIC. Standard BASIC (Exidy's version is a variation of Microsoft 8K BASIC) is one of the most common, and is becoming the standard first programming language for home computer owners.
There are many books and magazines for home computer enthusiasts; in these publications you find BASIC programs that you can run on your Sorcerer. However, if they are not written in Standard BASIC, you have to "translate" them. Generally this is not difficult. Find out which version the program is written in, and study an instruction manual for that version. After mastering this manual, you should have no trouble learning another version.
The differences between versions are often minor. Some versions use a backslash (\) instead of a colon (:)to separate two or more statements on the same line; some versions do not allow multiple statements on one line; some versions have different limitations on the lengths of names of variables; sorne versions have different requirements for dimensioning variables and arrays; in some the random number functions behave differently from Standard BASIC's function RND.
After some experience with Standard BASIC, you may wish to use a version of BASIC with more powerful capabilities, more commands and functions, increased precision (up to 16 digits) and the ability to store programs on disk. To fill these needs, Exidy offers Extended BASIC, available both on cassette and disk. For the cassette version you require a Sorcerer with at least 16K of memory and for the disk version 32K.
Standard Graphics -- In addition to upper and lower case letters and most standard typewriter symbols (a total of 128 characters), the Sorcerer has assigned 64 graphics values (pictured on the keys). You print these on the screen by pressing the GRAPHIC key and the key of the desired character.
User-Defined Graphics -- The Sorcerer let's you create your own alphabets and symbols. You can c:hoose which key on the keyboard you want to store your symbol under, and can call up that character whenever you wish, by pressing the GRAPHIC key, the SHIFT and your character's key, as descibed above. The Sorcerer has given you 64 keys to work with, plus you may redefine any of the 64 standard graphics characters (these are accessed with just the GRAPHIC key), for a total of 128 user-definable graphics. Chapter 12 tells you how to do it.
One-Stroke Instructions -- Most of the keys on the Sorcerer's keyboard have a Standard BASIC instruction or function as an additional meaning. For example, you can enter the command CLOAD by pressing the GRAPHIC and S keys simultaneously, or the statement PRINT by hitting GRAPHIC P (or just the ?), or the function LOG by pressing the GRAPHIC key and the X on the 16-key numeric pad. This is explained in Appendix F.