Friday, January 27, 2012
Create and Save the Program
The GW-BASI C program is a file that contains instructions for computer. In GW-BASIC program lines have this format” Line# statement (s)”
Line# is an unsigned integer in the range from 0 to 65529 .A line cannot have more than 255 characters.
Statement (s) is any valid GW-BASIC statement .There can be more than one statement in a line. Each statement must be separated by colon sign ( : ).
To save program :
We can save program by using this procedure.
i- Press the F4 key or type SAVE command.
ii- Type a valid name (in quotes) for the program and press ENTER key and program will be save.
Rules for Naming a Variable
1- A Variable name cannot be more than 40 characters.
2- The name of Variable may contain alphabets (both lower case and upper case) numbers and decimal points.
3- The first character in name of Variable must be an Alphabet.
4- Key /Reserved words of BASIC cannot be used as Variables.
5- Blank space is not allowed in names of Variables.
6- Last character of variable name should indicate the type of variable.
VARIABLES
In GW-BASIV Variables are the names of Memory Cells which are used to store program’s input data and its computational results during the execution of program.
Every Variable used in BASIC must have a name. There are some rules for naming a Variable.
Character Set of BASIC
The following are the characters valid for GW-BASIC
Character | Meaning |
= | Equal sign or assignment symbol |
+ | Plus sign or string concatenation |
- | minus sign |
* | Asterisk or multiplication symbol |
/ | Slash or division symbol |
^ | Carter, exponentiation symbol, or CTRL key |
( | Left parenthesis |
) | Right parenthesis |
% | Percentage or integer declaration |
# | Number sign or double precision declaration |
Exclamation point or single precision declaration | |
[ | Left bracket |
] | Right bracket |
, | Comma |
“” | Double quotation marks or string delimiter |
. | Period ,dot or decimal point |
‘ | Single quotation mark, apostrophe, or remark indicator |
; | Semi colon or carriage return suppressor |
: | |
& | Ampersand or descriptor for hexadecimal and octal number |
? | Question mark |
< | Less than symbol |
> | Greater than symbol |
\ | Backslash or integer division symbol |
@ | “At” sign |
__ | Underscore |
BACK SPACE | Deletes last character typed |
ESC | Erases the current line from the screen |
TAB | Moves print position to next tab stop. Tab stops are every eight columns. |
ENTER | Terminates input to a line and moves cursor to beginning of the next line ,or executes statement in direct mode. |
Reserved /KEY Words in BASIC
In BASIC there are some reserved or Key words which have predefined uses and cannot be used for any other purpose. These words cannot be used as variable names. some Key words are IF, ELSE, THEN, WHILE.
Wednesday, January 25, 2012
Writing Programs in GW-BASIC
GW-BASIC provides a IDE (Integrated Development Environment ) where we can write ,edit, save ,load and execute BASIC programs.
As you could see in above picture that there are some options at bottom of the picture that are F1 List, F2 Run, F3 Load, F4 Save, F5 Cont, F6 LPT1, F7 TRON, F8 TROFF, F9 KEY AND F10 SCREEN.
Key | Command | Description |
F1 | LIST | Displays the program listing from RAM |
F2 | Execute the program if available | |
F3 | LOAD | Read a program in to RAM from Disk |
F4 | SAVE | Write a program from RAM to disk |
F5 | CONT | Continues program after STOP command |
F6 | LPTI | Send the out put to the Printer |
F7 | TRON | Displays each line number when program is running |
F8 | TROFF | Shuts off the TRON function |
F9 | KEY | Used with different Key functions. |
F10 | SCREEN 0,0,0 | Changes the screen with default settings. |
Subscribe to:
Posts (Atom)


