Author Topic: Getting started in Casio-Basic? You can ask here.  (Read 77475 times)

0 Members and 3 Guests are viewing this topic.

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Getting started in Casio-Basic? You can ask here.
« on: January 18, 2011, 02:58:58 pm »
This is a thread where you can put your Casio-Basic related questions.
Me and the other Casio guys will try to answer these.
« Last Edit: January 18, 2011, 03:01:44 pm by cfxm »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #1 on: January 18, 2011, 03:12:49 pm »
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.

-Also are there any assembly tools that allow us to run programs directly from the Storage memory or even just a program that works in a parser hook way and allows you to move/copy back and forth programs from the RAM to storage? That isn't really BASIC-related, although some 83+ BASIC games uses such programs to get around the 24 kilobytes of RAM limit.

-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???

On an unrelated note, somebody started writing a guide to help people porting TI-BASIC programs to Casio BASIC or vice-versa a while ago. I can't find the topic right now but I'll try to find it later.

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #2 on: January 18, 2011, 03:39:11 pm »
Quote
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.
"Locate" and "Text" seem to allow this, but it's bad practice and does not seem to work with the ":" command either. Actually, I have never used this. The few bytes you save get lost by using special characters.

Quote
-Also are there any assembly tools that allow us to run programs directly from the Storage memory
Maybe this is what you are looking for?
http://casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&cid=16&lid=542&ttitle=FX9860G_LOADER_2.00#dldetails

Quote
-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???
You could try clearing the screen first using "cls" and you should disable any background image with "BG-None". Unfortunately, there is no way to test if a picture exists - causing a memory error sometimes.
« Last Edit: January 18, 2011, 03:39:38 pm by cfxm »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #3 on: January 18, 2011, 04:07:46 pm »
Quote
-One question I have is can we omit quotes at the end of Locate? In TI-BASIC you can do things such as Output(1,1,"HELLO WORLD instead of Output(1,1,"HELLO WORLD") as long as the next code is on a different line, but I was wondering if it was the same on Casio? That usually saved us some bytes of RAM.
"Locate" and "Text" seem to allow this, but it's bad practice and does not seem to work with the ":" command either. Actually, I have never used this. The few bytes you save get lost by using special characters.
Ah ok, I guess it is different between both brand of calcs. On TI, we try to save every possible byte by using such optimization. It is even considered a good practice among us. The only time it should be avoided is with For() when it only contains an IF instruction that is often False, due to a TI-OS glitch. Does special characters actually take more space than the regular ones? I remember something similar on TI with lowercase letters.

Quote
-Also are there any assembly tools that allow us to run programs directly from the Storage memory
Maybe this is what you are looking for?
http://casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&cid=16&lid=542&ttitle=FX9860G_LOADER_2.00#dldetails
Does this allow copying individual programs to the RAM? Being forced to copy entire packages might not be something I want, especially when each program is 15 KB large.

Quote
-Also how would we recall a picture from a program on the Prizm? I tried RecallPict 1 (after storing a pic with StorePict 1) and it does nothing... ???
You could try clearing the screen first using "cls" and you should disable any background image with "BG-None". Unfortunately, there is no way to test if a picture exists - causing a memory error sometimes.
Nope, no luck. Here's my code (Casio Prizm OS 01.01.0200):

Code: [Select]
Cls
Vertical -3
StoPict 1
Cls
BG-None
RclPict 1
Basically I wanted to clear the screen, display a line at -3, Store the screen content in picture 1, clear the screen again, then re-display the picture 1 content again. Not an useful program, but it was for testing purpose since I'm experimenting with the language.
« Last Edit: January 18, 2011, 04:17:03 pm by DJ Omnimaga »

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #4 on: January 18, 2011, 04:35:18 pm »
Quote
Does special characters actually take more space than the regular ones?
As long as they're non-ASCII.

Quote
Does this allow copying individual programs to the RAM? Being forced to copy entire packages might not be something I want, especially when each program is 15 KB large.
As far as I know, this copies any program within a *.g1m/*.g2m file into the user RAM.
You may ask Simon to obtain the source code.

Quote
Nope, no luck. Here's my code (Casio Prizm OS 01.01.0200):

Code: [Select]
Cls
Vertical -3
StoPict 1
Cls
BG-None
RclPict 1
And if you go to RUN|MAT and enter "Cls:RclPict 1"? This will display the coordinate system with an additional vertical line on my fx-9750GII.
Inside RUN|MAT you can press [Shift]+[F3] and reset the view window with [F1] - just in case the vertical line is not within the display area...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #5 on: January 18, 2011, 04:45:52 pm »
Yeah in RUN|MAT it works fine, just not in PRGM.

However I noticed it seems to work if I set the pic as a background. I guess a background could do the job maybe, although that doesn't allow dual-layer ASCII graphics it seems D: (see animated screen capture for what I mean about dual-layer ASCII graphics).

Thanks a lot by the way!
« Last Edit: January 18, 2011, 04:46:14 pm by DJ Omnimaga »

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #6 on: January 18, 2011, 04:53:02 pm »
Maybe this is because the program execution stops after RclPict 1?
Try putting it into a loop or append the small triangle command after RclPict to pause the interpreter (until you press [EXE]).
« Last Edit: January 18, 2011, 04:54:48 pm by cfxm »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #7 on: January 18, 2011, 04:59:51 pm »
Actually I noticed something even worse: Cls doesn't do anything O.O

(Btw I tried with the triangle thing and also For 1->Z to 999:Next)

Could this just be my OS? I think you or someone else who has access to OS 1.02 should try on it to see. I hope Casio won't wait a year or two before releasing 1.02. X.x
« Last Edit: January 18, 2011, 05:00:33 pm by DJ Omnimaga »

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #8 on: January 18, 2011, 05:30:41 pm »
Have a look at this:

Code: [Select]
// Program: INIT
Cls
BG-None
AxesOff
Horizontal -1
Horizontal 1
StoPict 1
Cls
Vertical -1
Vertical 1
StoPict 2

// Program: TEST
Prog "INIT"
While 1
Cls:RclPict 1_ // '_' is the small triangle
Cls:RclPict 2_
WhileEnd

Quote
Actually I noticed something even worse: Cls doesn't do anything
Indeed, when "Cls" is followed by a loop, the screen won't be cleared immediately.

PS: I don't own a Prizm yet.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #9 on: January 18, 2011, 05:38:44 pm »
I see. Well, I tried replacing _ with For 1->A To 999:Next and the pics wouldn't show up. I guess RecallPict only works as soon as the program is paused. Thanks for the help!

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #10 on: January 18, 2011, 05:44:07 pm »
You could use the famous PxlOff 1,1 trick to force a screen refresh. ;-)
Actually, lots of those refresh issues were fixed with the fx-9860G series; however, a few are still there...

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #11 on: January 18, 2011, 05:46:35 pm »
O yeah I forgot to say earlier. Unlike TI-BASIC pixel coordinates don't start at 0, but instead 1. Also the client area is 187x379.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #12 on: January 18, 2011, 05:55:21 pm »
Ah, right, although on the Prizm PxlOff is so friggin slow (3 pixels per second rate) so that would slow down the game quite a lot. X.x

EDIT: Why does PxlOn 1,1 works, but not PxlOn X,Y? We can't even use variables as arguments? I get a message saying the arguments must be an integer, even though they're integers

For 1->X To 96
For 1->Y To 64
Pxl-On X,Y
Next
Next
« Last Edit: January 18, 2011, 06:05:52 pm by DJ Omnimaga »

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Getting started in Casio-Basic? You can ask here.
« Reply #13 on: January 18, 2011, 06:15:06 pm »
X and Y are used internally when drawing things - so you should not use them.
The same is true for r and theta when doing polar stuff.
« Last Edit: January 18, 2011, 06:23:49 pm by cfxm »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Getting started in Casio-Basic? You can ask here.
« Reply #14 on: January 18, 2011, 06:17:56 pm »
oh, right. I'll try with other variables, then. Thanks.

EDIT: Ok that works. Is there any way to speed up drawing or something? I find it hard to believe a 6 MHz calc with a 8 bits CPU can fill 5985 pixels by the time a 29 MHz 32 bits CPU one can't even fill 300 O.O
« Last Edit: January 18, 2011, 06:31:28 pm by DJ Omnimaga »