Immediate or Direct mode
Entering a command
There two basic modes for running GWBasic. There is the DIRECT mode, also called the IMMEDIATE
mode. The other mode is called the program mode. The DIRECT mode takes its inputs directly
from the keyboard. GWBasic is called an INTERPRETER because it takes what is typed on the
keyboard, interprets it and tells the processor how to respond to the line of code that has
been typed in. This session will provide a few simple exercises using the DIRECT mode.
You already know how to start and stop GWBasic. Now we will demonstrate how to use it.
GWBasic is called a COMMAND LINE INTERPRETER because the instructions to be executed are
all in a single line of code. This code will begin at the prompt as you type and the line
will end when the ENTER ( or carriage return ) key is typed. When the ENTER key is pressed,
the instructions on the current line will be interpreted and executed. A lot of instruction
can be typed into a single line of code. The line can be up to 156 characters long, but we
are going to use much simpler examples.
Here goes...!!! Our first instruction consisting of a command that needs no argument followed
by a Carriage Return (ENTER or RETURN key). By convention, examples of a command line will
show what is to be typed in upper case characters. The command line will be termintate with
a RETURN (ENTER).
A colon and semi-colon are important characters in command line instructions. A number of
commands may be placed on the same line if they are seperated with a colon. Anything typed
after a semi-colon will be treated as a remark statement and ignored by the interpreter.
CLS
will clear the screen... remember that the RETURN key must be pressed.
CLS ;sdflkjsdlfj
will do the same thing because the interpreter ignors all after the semi-colon
CLS: KEY OFF ; any bunch of characters here
will clear the screen, turn the keys off and ignore the final remark
KEY ON ; will turn the function key menu at the bottom of the screen back on
Here are a few more examples of commands for this exercise in command line programming.
DATE$
returns the date
TIME$
returns the time.
CLS: KEY OFF: DATE$
clears the screen, turns off the FNKY display and returns the current date.
Type away and see what you may find out for yourself. If you have any questions, or problems
then write them down because they will be answered later. If you don't take note of them
then you will probably forget them.
Here are a few more statements to play with. Why they do what they do will be explained in
subsequent lessons. For now, they should at least raise a question to be noted.
PRINT
PRINT "hello world"
PRINT 1+2
PRINT "1+2"
PRINT " At the beep, it will be the correct time ": PRINT TIME$: PRINT chr$(7)
cls: for n= 1 to 10: print n: next n
That last Statements will require a little explaination later, I'm sure.
Thats the end of the lesson. The remainder of this text is me taking the oppertunity to
add a few words for kicks and giggles. Editors license if you will.
Just a word about symantics. Once upon a time the keyboard replaced the old paper tapes
and keypads that were needed to enter data into the computer. The keyboard permitted an
operator to perform command line programming. The hacking noise of the old keyboards gave
computer operators the name of Hacker. When someone was busily and noisely using the
keyboard, they were hacking away at a program. The word has taken on a new meaning recently
and the word hacker has been given a bum rap.
As an interactive tool under Windows, the keyboard has largly been replaced with a mouse.
An understanding of command line programming using a keyboard is still valuable.
It can be laughingly said that; today, the computer operator is much like the pis-pis.
They both like windows and mouses.
**** Happy Hacking ****