home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
robot-pd
/
19132.ZIP
/
19132A.DSK
/
basic
< prev
next >
Wrap
Text File
|
1998-03-02
|
6KB
|
128 lines
Part 1 BASICly GOOD
If you want to program,then learn BASIC.What do you mean you don't
know how to program??!! Well,you've come to the right place.
TURNING ON
When ever you turn on your CPC,you all ways see the word
"BASIC".So,what is it?
A BIT OF HISTORY
BASIC (Beginner's All-purpose Symbolic Instruction Code) was invented
in the late 60's.In the 80's there was a boom in home computers,and
all most all of these computers had BASIC built in.
EASY PEASY BIG-MAC AND CHIPS
BASIC is very easy to learn.And you can program some high quailty
programs.(just take a look at Rambase3 and PDPlanner)
TIME FOR WORK
Today,we will have a look at printing on the screen.Don't worry,this
is very easy.
Below is the listing.Those letters at the start of each line are
the typechecker codes.All you do is load up Typechecker,and type-in
the program below.When you have finished type in LIST.This will list
the program below.If the codes at the start of the lines on the screen
match the ones below,then the line has been typed in correctly.If the
codes don't match,then the line is wrong! Oh,don't type-in the codes!
______________________________________________________________________
| |
| DABN 10 ' Program1 |
| GAII 20 ' By Richard Avery |
| HAOG 30 ' (c)1994 Richard Avery |
| AALK 40 ' |
| BAHG 50 CLS |
| JAKP 60 INPUT"What is your name";a$ |
| BAJG 70 CLS |
| EANE 80 PRINT"Hello" |
| FACG 90 LOCATE 8,1:PRINT a$ |
| LAHG 100 LOCATE 1,2:PRINT"My name is arnold" |
| BAJI 110 END |
|____________________________________________________________________|
Now let's take a look at each line.
EVERY REM HURTS
10 ' Program1
Look,I just can't help it! Every time I see a REM statement I just
have to make a joke about the pop group REM! Sorry!
The ' symbol is called a REMark.This is just here to help the
programmer to remember where each part of a program starts.This makes
the program easy to debugg.(get rid of errors)
You can type-in REM instead of '.A REM can have anything inside
it.I've just put in "Program1",but you could put in "Fish,Chips and
Mushy peas",or "the local shop gets ram-raided".A REM dose'nt do
anything.They are there for the benefit of the programer.
CLEAR THE TABLE
50 CLS
CLS means CLear Screen.When your CPC comes across one,it will clear
the screen,so you have an empty screen ( apart from the word "Ready"
at the top)
INPUT ONLY
60 INPUT"What is your name";a$
Now we're getting somewhere! The command "INPUT" tells the computer to
expect the user to type-in something.The above "What is your name"
will be printed at the top left corner of the screen.
The ";a$" means that the name you typed-in will be stored.(More on
that in just a second)
SCREEN PRINTING
80 PRINT"Hello"
PRINT tells the computer to print something. (in our case,the word
"Hello") The " marks are important,as these tell the computer that the
following is not a command but something to be printed on screen.
LOCATION PLEASE
80 LOCATE 8,1:PRINT a$
On your screen,you can type-in 40 letters from left to right,and 25
from top to bottom.(without the screen scrolling down) When you use
the PRINT command,the sentance you want printed will be printed at the
top left hand corner of the screen.In order to print,say,a word at the
start of the second line,you will use the LOCATE command.
The LOCATE command is used to print a sentance anyway on the
screen.The LOCATE command uses two numbers,The first one is what
column the sentance will start and the second is what line the
sentance will be printed on.
The : tells the computer that the next bit is different to the
last bit.In other words,it separates two commands.
The PRINT a$ bit tells the computer to print the name you typed-in
earlier.
THE END IS NEAR
110 END
END ENDS a program.You can access the program again by typeing-in RUN.
A BASIC WORD
If you typed in the above program wrong,then a error messege will be
displayed.The messege will tell you which line the error is in.If you
get an error type in EDIT followed by the line where the error is in.
To keep any programs you have written see the "Using Discs"tutor-
ial.
THAT'S ALL FOLKS!!
Well,that's it for now.In part two,we deal about drawing in
BASIC and the different modes