Jump to content



Photo
- - - - -

Casio BASIC Tutorial


  • Please log in to reply
17 replies to this topic

#1 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 22 April 2003 - 09:13 PM

hello, some of you know (and care) that I am making a casio tutorial, I decided to release it in segments on the forum so that it could be disscused... anyway, here is the beginer part, anyone with basic knoledge of BASIC can skip this part.

INTRODUCTION
This tutorial was made to provide an in-depth overview of the Casio BASIC programming language. Many Casio sites offer a basic tutorial for game programming (using Getkey & Locate) where as this tutorial is meant to cover not only those but every other aspect of Casio game programming.  This tutorial does not cover the mathematical uses of calculator programming except when it relates to a game.  When you have completed this tutorial you will be able to create basic games of your own, and with practice much more advanced ones.
                                                      
PART 1: Creating a Program

I really shouldn't have to explain this, but if I don't I know someone will ask.  To create a new program press [MENU] then locate the program icon and hit [EXE], press [F3] to create a new program.  You will then be asked to enter a name for your program, also you may create a password at this time (WARNING: if you put a password on your program you will not be able to use the debugger).
                                                      
PART 2: Variable Basics
A variable is something which holds a value.  The most commonly used are the letters A~Z and r,_. There are others, but they are not covered in this section. To store a value into a variable you must use the [->] key, like this:
1->A  // Assigns 1 to A
To assign values to more than one variable at a time (Algebra FX2) press [OPTN] [F5] [F5] [F4] then select ~, On the CFX calcs hit [ALPHA] then select ~ from the menu.
It should look like this:
1->A~D	// Assigns 1 to A B C & D
Variables are the most important aspect of game programming, without them it is almost impossibly to make a game (You could make a very simplistic guess the number game, but why bother).
                                                      
PART 3: Debugging Basics
Your calculator comes with a very simplistic debugger, or error finder (historical note: its called debugging because back in the dawn of computers roaches would crawl into computer vacuum tubes and cause problems, then someone would have to go get them out, hence the term debugging). To use the debugger run the program, then on an AFX2 Press [ESC] when an error message appears or on the CFX hit left or right when you get an error.   The debugger will take you to the place where the error occurred so that you can fix it. Warning, the debugger sometimes reports an error to be in one place, but what caused the error might be in a different place. If you can't find anything wrong at the place the debugger took you to go up a few lines and see if something up there is causing an error.
                                                      
PART 4: Basic Loops
Loops are used to repeat blocks of code. There are several types of loops in Casio BASIC: Goto/Lbl, Do/lpWhle, For/Next, and While/WhileEnd.   Here is an example of a Goto/Lbl loop:

1->A  //Assigns 1 to A
Lbl 1
A+1->A  //Adds 1 to the variable A and stores new value
Goto 1  //Returns to Lbl 1

This loop will execute infinitely, Adding 1 to a each time (Actually it will stop when the value of A is greater than 99*10^99 because you will get a mem error).

Here is an example of a For loop note that it doses not take as many lines.

For 1->A to 100 Step 1
	//this loop assigns 1 to A then adds 1 to A until it equals 100
Next	//Goes back to the start of the loop, adds the step to the variable.

Anything between the For and next statement will be executed until the expression evaluates true (A equals 100). By changing the value of Step you can change how much A is incremented by.

The While loop checks to see if the expression is true then executes the code.  After the code has been executed it returns to the top, checks the expression, and if it is false jumps out of the loop and continues with executing the program.  This is an example of a While loop.

1->A
While 1=1	//1 always equals 1 so the expression always evaluates to True
A+1->A
WhileEnd

Since the while loop evaluates the expression before executing the code it is possible that if the expression is false before loop begins (ex: 1=2) then the loop will never occure, it will just skip right over the code and continue with the program.

Unlike a while loop a Do/LpWhle loop will always execute at least once since it evaluates the expression after the code has been executed. A Do/LpWhle loop looks like this.

1->A
Do 	 //Start of the Do/LpWhle loop
A+1->A
LpWhle A<100	//Loops while A is less than 100


#2 Bob Vila

Bob Vila

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 768 posts
  • Gender:Male
  • Location:USA

  • Calculators:
    FX 1.0+ : CFX-9850 GB Plus : TI-81

Posted 22 April 2003 - 09:20 PM

looks good. :) now i can get started. B)

#3 Pixter

Pixter

    Casio Fan

  • Members
  • PipPip
  • 43 posts
  • Location:The Netherlands
  • Interests:casio, visual basic, lego mindstorms and formula 1.

  • Calculators:
    cfx9850gb plus

Posted 23 April 2003 - 06:40 AM

This loop will execute infinitely, Adding 1 to a each time (Actually it will stop when the value of A is greater than 99*10^99 because you will get a mem error).


it must be ma error I think. But it looks good :)

#4 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 23 April 2003 - 10:24 AM

yes, you are correct, I wasnt being specific with errors.

#5 Guest_Bytefish Productions_*

Guest_Bytefish Productions_*
  • Guests

Posted 23 April 2003 - 10:46 AM

But it could be a mem error too if your memory is too messed. :)

#6 Netforce

Netforce

    Casio Fan

  • Members
  • PipPip
  • 44 posts

  • Calculators:
    Casio CFX-9850GB Plus

Posted 23 April 2003 - 12:40 PM

Very good tutorial CrimsonCasio!
Can I have permission to publish it on CasioCorner?

#7 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 23 April 2003 - 05:31 PM

yes, you can publish it in segments or wait untill I release the whole thing.

#8 Volcano

Volcano

    Casio Slave

  • Members
  • PipPipPip
  • 66 posts

  • Calculators:
    CFX-9850 GB Plus WE

Posted 23 April 2003 - 06:39 PM

Wow this looks really good, and the complete tutorial will be really helpfull! :D

I just can't wait for the whole thing to be realeased. When do you think you will realease it (complete), and how do you think to present it (As a help file, a word document)? B)

#9 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 23 April 2003 - 06:53 PM

It will be a word document, and the full thing will be released once it has all been posted here... that way I can add in a Questions and Answers section for each chapter. next installment due later today or tomarrow.

#10 Bob Vila

Bob Vila

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 768 posts
  • Gender:Male
  • Location:USA

  • Calculators:
    FX 1.0+ : CFX-9850 GB Plus : TI-81

Posted 24 April 2003 - 12:46 AM

i just used it in my stupid computer tech class, had to do a how to power point presentation, hope that that is okay. :)

#11 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 24 April 2003 - 02:14 AM

uh, used it how? :huh:
but sure, your free to use it (just give me credit plz). B)

#12 Bob Vila

Bob Vila

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 768 posts
  • Gender:Male
  • Location:USA

  • Calculators:
    FX 1.0+ : CFX-9850 GB Plus : TI-81

Posted 24 April 2003 - 02:50 AM

we had to make a simple 4 slide presentation about how to do something, so i simply abriged your tuturial and put it into power point, and of course i will give you credit. :)

#13 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 24 April 2003 - 02:52 AM

ok, sure. :D

#14 Bob Vila

Bob Vila

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 768 posts
  • Gender:Male
  • Location:USA

  • Calculators:
    FX 1.0+ : CFX-9850 GB Plus : TI-81

Posted 24 April 2003 - 02:52 AM

boy you reply fast. anyway thanks. :D

#15 MathManiac

MathManiac

    Casio Addict

  • Members
  • PipPipPip
  • 85 posts
  • Gender:Male
  • Location:Portugal
  • Interests:Maths & Physics
    Girls
    Science fiction
    Cinema

  • Calculators:
    fx CG20
    fx 9860 GII SD
    Afx 2.0 plus
    CFX 9850 G
    Fx 115 D
    TI 83 Plus SE
    Ti 92 Plus
    Hp 49 G

Posted 24 April 2003 - 08:55 AM

Ok...with your permission, i may translate it to Portuguese (If Brazzucko hasnt already done it)...
(nstead of making my own tutorial - your is a bit better than my first sketches.


I guess a PDF file would be better than a word document. (You can make it in Word,convert it to ps and then to pdf with GhostScript )

#16 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 24 April 2003 - 09:51 AM

sure, just provied me with the finished copy so I can put it on my site. if any one else would like to translate it into another language feel free to do so.

#17 flyguy

flyguy

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 02 May 2003 - 07:37 PM

This tutorial is really informative. Thanxs alot :)

#18 CrimsonCasio

CrimsonCasio

    UCF Ambassador

  • [Legends]
  • PipPipPipPipPipPipPipPipPipPip
  • 3579 posts
  • Gender:Male
  • Location:USA
  • Interests:Claculators, Stephen King, Video Games, Calculators, Programming, Calculators, Reading, Calculators... hmm, what else... Ah! Calculators!

  • Calculators:
    Algebra FX2.0, CFX 9850Ga+, Classpad 300

Posted 02 May 2003 - 08:20 PM

your welcome, more will be up soon, I just havent had the time...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users