Jump to content



Photo
- - - - -

Casio Basic Tutorial


  • Please log in to reply
35 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 31 July 2003 - 01:34 AM

I hope this is where I left off, I dont have my copy in front of me so I'm going to write it right here.

Chapter 12- Advanced Loops
ok, if you have been reading this tutorial all the way from the begining you will know understand the concept of loops, this chapter deals mostly with with nesting loops.

A simple loop:
While A<>B
WhileEnd

A nested loop:
While A<>B
Do
LpWhile A=B
WhileEnd

get it? a nested loop is just a loop inside of a loop, just like a nested if. what most people have trouble with is the execution of nested loops, if you have programming experiance then you will all ready know this but if your new to field take a look at the sample below:

Lbl 1<!--QuoteEBegin-->1->A<!--QuoteEBegin-->1->B<!--QuoteEBegin-->1->C //counter var<!--QuoteEBegin-->1->D //counter var<!--QuoteEBegin-->Do<!--QuoteEBegin-->A+B->A<!--QuoteEBegin-->While D<=5 //loops 5 times<!--QuoteEBegin-->B+A->B<!--QuoteEBegin-->Isz D<!--QuoteEBegin-->WhileEnd<!--QuoteEBegin-->1->D<!--QuoteEBegin-->Isz C<!--QuoteEBegin-->LpWhile C<3 //loops 3 times<!--QuoteEBegin-->A+B_<!--QuoteEBegin-->

Go through this program and see if you can figgure out what the output will be, then look below for the answer.

if you 610 got as the output then you did this right, if not then you fell pray to a mistake that many begining programmers make (I took a C++ programming class and some people had all sorts of programs with this).  If you did get this wrong its because you do not understand one of the basics of nested loops:

PRIMARY RULE: an inner loop executes fully for each interation (loop) of an outer loop

for those of you who are looking at me like I'm stupid: trust me, some people will make this mistake, I have seen highly intelegent people make this mistake so I thought I'd save others the trouble (and frustration).

You can nest as many loops as you want, I dont know if there is an upper limit on the amount you can nest but I cant see you ever needing to worry about it.

Now you should know what the break statement is, but if you dont I'll review: Break terminates execution of a loop and resumes normal program flow at the end of that loop.
Sample:

While A=A //endless loop
Isz A
Break
"THIS ISN'T SHOWN, IT ISN'T EVEN LOOKED AT BY THE PROGRAM"
"NEITHER IS THIS"
WhileEnd
"ESCAPE FROM THE LOOP" //Break goes to here

now we will look at how Break works in nested loops

Sample:

While A<>B
Do
Break
LpWhile A=A
//Break goes to here
WhileEnd //loops like normal

As you can see, Break only exits the current loop, and when that loop comes around again and if Break isn't executed (if its in an if statement) then the loop does not terminate and continues like normal. Get it?



#2 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 31 July 2003 - 04:29 PM

by the way, the ch13 is comming soon.

#3 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 01 August 2003 - 01:03 AM

thanks crimson, the tutorials have really helped :)

#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 01 August 2003 - 01:49 AM

the matrix and list chapter is next, that will be very useful to you for the contest.

#5 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 01 August 2003 - 02:17 PM

the matrix and list chapter is next, that will be very useful to you for the contest.


thanks

#6 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 05 August 2003 - 06:32 AM

Bob:
It's good that you are learning form the master Crimson, yet reading the manual already gives you a solid grounding on BASIC programming.
just read it and you'll be fine.

That's how i learned to program. :rock:

#7 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 05 August 2003 - 01:22 PM

i know about the manual it helped, but i already knew most of the commands (Jave has some similar commands), but i was always to lazy to apply it on the calc. :) and crimsons tutorials are more detailed.

#8 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 05 August 2003 - 03:02 PM

here it is, ch13.

Part 13: Advanced Variables

Those of you who know other programming languages have probably seen a big problem in what you have read so far, what if you need more than 28 variables in your game? A long time ago (in a calc far, far away), when I was first learning to program I was making little games like Example 1 of this tutorial.  But then I started trying to make some more complex games and I ran into a problem, I needed more variables and there were none to be found!  Eventually I found the answer: Lists and Matrices.  

Lists ? A list is exactly that, a list of variables, they can be up to 255 cells long.
Here is a visual of a list with 5 cells:
[ ]
[ ]
[ ]
[ ]
[ ]
to access a cell in a list you just use List #[#] (List 1[1]), the first # represents the number of the list and the second represents the index of the cell.  You can use Lists just like you use normal variables, anything you can do with a letter variable you can do to a list, you just have to specify what list and what cell.

Some special list functions:
X->Dim List # : creates a list with X cells in it, all cells are set to 0.
Fill(X,List #) : fills a list with X.
There are others, but you probably wont use them.

Matrices ? A matrix is a two dimensional list
Here is a visual of a 5x4 matrix.
[ ][ ][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]
[ ][ ][ ][ ]
Matrices are just like lists except that they are two dimensional, I like to use them for maps, especially tiled maps.  To use a matrix use Mat (letter A~Z)[Y,X] (Mat A[1,1]), the X and Y are reversed, make sure not to confuse them.

Special Matrix functions:
{Y,X}->Dim Mat (letter) : creates a YxX matrix
Fill(#,Mat (letter)) : fills a matrix with a #
Again, there are more, but you wont need them right now.

Tip: List and Matrices are very useful for loops, since they are indexed you can loop through them or use List 1[A] so you can change what list cell you are using dynamically.  Also note that you cannot do this with the number of the list.


#9 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 05 August 2003 - 07:08 PM

I agree with bob, the crimsons tutorials are more "practical", the manual give us the theory and crimson make it so easy as i think.

By the way i learn a little of basic with the manual, but i dont read the matrix and list function, because i think that i will never use the lists (i was bad thinking that) and i only use the matrix on the RUN/MAT mode.

Some people learn of best way the things reading (probably the casiokingdom's case) , others with practice (thats me).

#10 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 05 August 2003 - 07:26 PM

thanks, happy to help. :D by the way, the next part is another example program followed by some exercises. after that I will go over good programming techniques. :)

#11 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 05 August 2003 - 10:46 PM

goody :)

#12 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 06 August 2003 - 06:04 AM

thanks, happy to help.  :D by the way, the next part is another example program followed by some exercises.  after that I will go over good programming techniques. :)

that sounds great Crimson.

i think i could even learn some tips from your tutorials too. :rock:

#13 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 06 August 2003 - 06:56 PM

Every mind its a world, one program have a lot of ways to do it, it will be good see your tips.

#14 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 07 August 2003 - 06:43 AM

Betoe, you think you'll get some good tips for your game?

Good luck in the comp.

BTW; are most of you almost finished your game?
i am already almost done.

Can't wait till the end. :rock:

#15 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 07 August 2003 - 06:48 PM

Thanks for your good wishes Casiokingdom, I have serious problems because i made a program to capture strings on the AFX (I need it for the game) but its so slow. If one day i buy the classpad it will be better!

Besides, my pc interface or my AFX serial port its damaged, i need to check that, to upload the pictures and basic files that i made...

But now my game sucks :rolleyes: and if my main battery fail (it has 14 months of use), all will be erased.

#16 2072

2072

    Casio over god

  • Admin
  • PipPipPipPipPipPipPipPip
  • 1564 posts
  • Gender:Male
  • Location:Somewherebourg
  • Interests:Alternative states of consciousness, programming, making things work the best they possibly can.

  • Calculators:
    AFX2 ROM 1.02, CFX-9940GT+, FX-180P-Plus

Posted 07 August 2003 - 06:58 PM

You still have the backup batterie mine is still good after more than 2 years...

#17 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 07 August 2003 - 06:59 PM

I've never replaced the one on my cfx, thats 5 years.

#18 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 07 August 2003 - 07:30 PM

Good, i hope that will not occur an tragedy on my calc.

I change the main batteries in January , i bought 4 energizer AAA batteries. In April i dont use in 1 week my calc, and when i try to use it, i press the AC button and nothing appear. Then i check the batteries and one battery was damaged (the electrolyte was out of the battery), and the calc was nearly of have damages on the print circuit board :blink:

#19 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 07 August 2003 - 07:54 PM

@ kingdom

i am only though with the opening screen :)

#20 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 08 August 2003 - 06:18 AM

@ kingdom

i am only though with the opening screen :)

come on bob, hurry up.

BTW; my backup batteries are fine.
just replace your normal batteries straight away when you see the "low battery message" :rock:

#21 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 08 August 2003 - 01:08 PM

come on bob, hurry up.


oh dont worry your little buttons off, i have been finding time and will be done before you know it :)

#22 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 08 August 2003 - 06:18 PM

Do anybody have an string capture program for the AFX? i made one but its too sloooow :( , my little brain dont give me more ideas to make it fast.

I need that program, i will thank your help...

#23 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 08 August 2003 - 06:20 PM

I could make you one, what do you need it for?

#24 betoe

betoe

    UCF Spanish Translator

  • [Legends]
  • PipPipPipPipPipPipPip
  • 846 posts
  • Gender:Male
  • Location:Guadalajara/Mazatlan, Mexico.
  • Interests:Electronics, SW development, automotive. Swim->bike->run

  • Calculators:
    Algebra FX2.0 (R.I.P.), Classpad 300

Posted 08 August 2003 - 08:12 PM

I want that the program capture a string, save the getkey code of each letter on a list, and show the string on the screen. I will try to send you the program that i made, i will type it on the PC.

#25 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 09 August 2003 - 01:40 AM

come on bob, hurry up.


oh dont worry your little buttons off, i have been finding time and will be done before you know it :)

I don't have little buttons (ha!)

BTW: your avatar is cool.
Did you design it by yourself? :rock:

#26 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 09 August 2003 - 01:52 AM

it looks like the little cloud-thing from the depression commercials. :D

#27 casiokingdom

casiokingdom

    UCF BASIC Programming 2nd Place

  • Members
  • PipPipPipPipPipPipPip
  • 782 posts
  • Gender:Male
  • Location:Perth, WA, Australia

  • Calculators:
    CFX-9850GB PLUS WE, fx-9860G AU

Posted 09 August 2003 - 01:59 AM

it looks different, that's why i like it. :rock:

#28 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 09 August 2003 - 06:52 PM

i think that it is cool

#29 PJay

PJay

    Casio Freak

  • Members
  • PipPipPipPip
  • 260 posts
  • Gender:Male

  • Calculators:
    Casio fx-991ES Plus

Posted 29 August 2003 - 10:57 AM

No problem ! Very good :) :rock: Thanks :)

#30 renjer

renjer

    Casio Fan

  • Members
  • PipPip
  • 41 posts
  • Location:Perth, WA
  • Interests:BASIC programming (would like to try MLC but I have no AFX), computer games

  • Calculators:
    cfx-9850gb plus

Posted 11 May 2004 - 08:49 AM

Crimson, so when's it going to be chapter 14, 15 and so on?

#31 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 11 May 2004 - 02:58 PM

good question :(

i really dont know, I keep making plans to work on thins but always end up not having enough time... right now im working on a big game so it wont be untill after I finish for sure.

however, you can ask questions and i will answer them. ;)

#32 Andy.Davies

Andy.Davies

    Forum Ghost

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1547 posts
  • Gender:Male
  • Location:Dorset, England
  • Interests:Age: 18
    Studying: MEng in cybernetics at Reading uni
    Interests: Progaming (VB, VB.Net, C#, Casio Basic)
    Computers UBBD (Using, Building, Breaking &amp; Destroying)
    Gaming (FPS, RTS, RPG)
    Electronics
    Rock Music (Preferably Loud)
    Riley's (Pool &amp; Snooker Bar)
    Driving (Preferably fast)
    Aikedo (Martial Art)

  • Calculators:
    Algebra FX 2.0 ROM 1.01, FX9750G

Posted 11 May 2004 - 03:29 PM

however, you can ask questions and i will answer them. ;)


unless i get there first :P

#33 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 11 May 2004 - 04:06 PM

heh, if its math related I'll leave it to you ;)

#34 Andy.Davies

Andy.Davies

    Forum Ghost

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1547 posts
  • Gender:Male
  • Location:Dorset, England
  • Interests:Age: 18
    Studying: MEng in cybernetics at Reading uni
    Interests: Progaming (VB, VB.Net, C#, Casio Basic)
    Computers UBBD (Using, Building, Breaking &amp; Destroying)
    Gaming (FPS, RTS, RPG)
    Electronics
    Rock Music (Preferably Loud)
    Riley's (Pool &amp; Snooker Bar)
    Driving (Preferably fast)
    Aikedo (Martial Art)

  • Calculators:
    Algebra FX 2.0 ROM 1.01, FX9750G

Posted 11 May 2004 - 04:18 PM

im not too good maths :( engineering maths is another matter ;)

#35 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 11 May 2004 - 07:06 PM

better than me for sure :(

#36 Acdra

Acdra

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    The Casio fx-7400G PLUS Power Graphic

    Getting The 9400 Soon :)

Posted 17 December 2005 - 05:48 PM

I've Been Following This Tutorial As A Guest For A While, Your The Only Reason I signed Up... :greengrin: And Before You, I Just Got So Angry At Not Knowing How To Program The Calculator :banghead: I just Wanted To Say Thanx And Good Luck On All The Rest Of Em :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users