BASIC Programming

by Roosi80 in Circuits > Software

66229 Views, 41 Favorites, 0 Comments

BASIC Programming

basic-256-1.jpg
Hi! I will show you today how to program in BASIC.
(BASIC=Beginner's All-Purpose Symbolic Instruction Code)

How to Get BASIC-256

addremove.jpg
You can download it here:
Windows
http://downloads.sourceforge.net/kidbasic/basic256-0_9_2.zip
Sourcecode
http://downloads.sourceforge.net/kidbasic/basic256-0.9.2.tar.gz
Ubuntu Linux
Go to Applications / Add/Remove
Now make sure all applications are displayed
Search for basic-256
And install it.
(see picture)

Text 1 - Hello, World!

basic-256-2.jpg
Start BASIC-256 (for Ubuntu users: It's in Applications / Education.
Now enter into the programming window:

clg
cls
print "Hello, world!"

and run the program.
Output:

Hello, world!

Text 2 - Math

The new program:

clg
cls
print "1 + 3"
print 1 + 3
print "7 - 5"
print 7 - 5
print "9 * 7"
print 9 * 7
print "5 / 4"
print 1 / 1

And the output:

1 + 3
4
7 - 5
2
9 * 7
63
5 / 4
1

Rule:
The "print" command prints a message exactly when it is enclosed in "quotation marks".
If not, you can do math with numbers and variables.

Graphics 1 - a Circle!

basic-256-3.jpg
Now add to the beginning of the code:

fastgraphics

and to the end:

color black
circle 145, 145, 145
refresh

so that it looks like this:

fastgraphics
clg
cls
print "Hello, world!"
color black
circle 145, 145, 145
refresh

Run it, and you see a big circle in the graphics window.

Graphics 2 - a Rectangle!

Replace "circle 145, 145, 145" with "rect 0, 0, 290, 290"
And what do you see? A square instead of a circle!

Graphics 3 - All Colors...

white
black
red
darkred
green
darkgreen
blue
darkblue
cyan
darkcyan
purple
darkpurple
yellow
darkyellow
orange
darkorange
gray
darkgray
clear

"clear" isn't really a color. You can erase other colors with it.
Try it out! Replace "color black" in the program with "color blue", for example.

Finish!

That's it for now. I'll make a second instructable as soon as possible.