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
Casio BASIC Tutorial
#1
Posted 22 April 2003 - 09:13 PM
#2
Posted 22 April 2003 - 09:20 PM


#3
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
Posted 23 April 2003 - 10:24 AM
#5
Guest_Bytefish Productions_*
Posted 23 April 2003 - 10:46 AM

#6
Posted 23 April 2003 - 12:40 PM
Can I have permission to publish it on CasioCorner?
#7
Posted 23 April 2003 - 05:31 PM
#8
Posted 23 April 2003 - 06:39 PM

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)?

#9
Posted 23 April 2003 - 06:53 PM
#10
Posted 24 April 2003 - 12:46 AM

#11
Posted 24 April 2003 - 02:14 AM

but sure, your free to use it (just give me credit plz).

#12
Posted 24 April 2003 - 02:50 AM

#13
Posted 24 April 2003 - 02:52 AM

#14
Posted 24 April 2003 - 02:52 AM

#15
Posted 24 April 2003 - 08:55 AM
(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
Posted 24 April 2003 - 09:51 AM
#17
Posted 02 May 2003 - 07:37 PM

#18
Posted 02 May 2003 - 08:20 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users