Author Topic: Prizm: C Addin & CASIO Basic programs works together  (Read 16467 times)

0 Members and 1 Guest are viewing this topic.

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Prizm: C Addin & CASIO Basic programs works together
« on: June 03, 2011, 08:22:23 pm »
This is a port of MPoupe's TSR program for the fx-9860 to the Prizm. http://ourl.ca/10095
I had this idea earlier, but wasn't sure where to start:  http://ourl.ca/9185/173872
I added new syscalls to this program, not found in the mini-SDK, but proven to work here.
The program was developed using Simon's mini-SDK, on the cg10-20 Manager emulator and
finally tested on Prizm hardware. [easier to recover from emulator crashes]
The code is almost the same as MPoupe's , but I took out the scrolling screen and
put in the appearing rotating character sequence "/","-","\", ...
You get this on the lower right corner after the program appears to finish, and press and hold one of the navigation keys: UP,DOWN,LEFT,RIGHT
You exit the progran pressing EXIT.
To run again delete TSRDEMO, and activate another addin like Conversion , then back to BASICEXT


This is only a proof of concept, this works the same way n the Prizm as on the fx-9860
The wish list of what to add to this is long.  Adding custom Basic commmands is possible.


Ashbad

  • Guest
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #1 on: June 03, 2011, 08:27:19 pm »
Looks interesting :) how exactly does this work?  Is it like an all new BASIC editor/interpreter, or does it just improve upon the current form of BASIC?  Does this have a documentation of commands and the like?

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #2 on: June 03, 2011, 08:33:02 pm »
Looks interesting :) how exactly does this work?  Is it like an all new BASIC editor/interpreter, or does it just improve upon the current form of BASIC?  Does this have a documentation of commands and the like?
Nothing yet , but it shows promise - its very early at this point to use this - its just a demo

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: Prizm: C Addin & CASIO Basic programs works together
« Reply #3 on: June 03, 2011, 08:33:14 pm »
Wow this looks nice. I unfortunately do not know how that stuff works so I would need program examples with visible code to see how it operates, or documentation of some commands, but this sounds promising. :D

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #4 on: June 03, 2011, 08:40:39 pm »
The zip is on the posting just above the first picture. Sorry - It is hard to see and easy to miss.

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: Prizm: C Addin & CASIO Basic programs works together
« Reply #5 on: June 03, 2011, 08:55:47 pm »
Oh ok, thanks. :D

That might be useful because a lot of people like BASIC style languages and might not want to learn an entire new language, so they can stick to BASIC while being able to do some extra stuff.
« Last Edit: June 03, 2011, 08:56:36 pm by DJ_O »

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #6 on: June 04, 2011, 03:52:50 am »
Looks interesting :) how exactly does this work?  Is it like an all new BASIC editor/interpreter, or does it just improve upon the current form of BASIC?  Does this have a documentation of commands and the like?
It adds functionality to the existing BASIC. The one that's currently posted is just a demo, but the code of it can probably be used to make much more complex stuff.

Offline SimonLothar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 129
  • Rating: +35/-1
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #7 on: June 04, 2011, 09:02:30 am »
I just downloaded BasicExtension_001.zip and had a look a the source.

It installs a timer-handler and starts the built-in Basic-Interpreter (APP_PRGM). While the BASIC interpreter waits for input, the timer-handler injects keycodes (via PutKey) based on a fixed text, hardcoded in the G3A. The built-in BASIC interpreter receives the keycodes and acts accordingly. But alas, I cannot see, how it should be possible to change the behaviour of the BASIC interpreter this way.
Some years ago, I wrote LOADER for the fx-9860, which followed this scheme to load BASIC-programs from storage memory:
http://www.casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&lid=542&title=FX9860G%20LOADER%202.00
If I am not totally mistaken, the upload contains some source and knowhow. But I do not know, if casiokingdom's download area is still operable at all.

If you want to change/extend the BASIC-interpreter, you either have to write a completely new interpreter as G3A (sagarvaze did this some years ago at casiokingdoms) or you have to mod the OS.

@bsl: are you one of the SDK-chums, which have been around at casiokingdoms some years ago? The old syscall-wrapper: long time no see!
I'll be back.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #8 on: June 04, 2011, 09:04:53 am »
I just downloaded BasicExtension_001.zip and had a look a the source.

It installs a timer-handler and starts the built-in Basic-Interpreter (APP_PRGM). While the BASIC interpreter waits for input, the timer-handler injects keycodes (via PutKey) based on a fixed text, hardcoded in the G3A. The built-in BASIC interpreter receives the keycodes and acts accordingly. But alas, I cannot see, how it should be possible to change the behaviour of the BASIC interpreter this way.
Ah, so that's what it does? It gives key input to the BASIC program? Then it might not be as exciting as I thought at first... But still, nice job.

Offline fxdev

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 177
  • Rating: +34/-6
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #9 on: June 04, 2011, 09:32:43 am »
That's why MPoupe said somewhere this is for demo purposes only.

Offline bsl

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 157
  • Rating: +14/-0
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #10 on: June 10, 2011, 05:21:55 pm »
But alas, I cannot see, how it should be possible to change the behaviour of the BASIC interpreter this way.
If you want to change/extend the BASIC-interpreter, you either have to write a completely new interpreter as G3A (sagarvaze did this some years ago at casiokingdoms) or you have to mod the OS.
MPoupe  outlines on the other link given above how to do this - there is interaction between the interpreter and the C program.
You establish an I/O protocol through Alpha variables to accomplish the custom call.
So you have to write the basic program differently. I think for the time being I will develop it this way .
The first two custom calls will be Asm and Syscall .

I would really like to make this transparent to the Basic coder as you are wondering about and find a syscall to the interpreter,
such as SetBasicErrorHandler to handle and process new calls if it exists ?

@bsl: are you one of the SDK-chums, which have been around at casiokingdoms some years ago? The old syscall-wrapper: long time no see!
It's in MPoupes code, I only started on Casio calcs January 2011. 
« Last Edit: June 10, 2011, 07:54:49 pm by bsl »

Offline MPoupe

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +30/-1
  • The coder of yesterday
    • View Profile
    • My web site about Casio calculator
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #11 on: June 13, 2011, 12:31:09 pm »
I just downloaded BasicExtension_001.zip and had a look a the source.

It installs a timer-handler and starts the built-in Basic-Interpreter (APP_PRGM). While the BASIC interpreter waits for input, the timer-handler injects keycodes (via PutKey) based on a fixed text, hardcoded in the G3A. The built-in BASIC interpreter receives the keycodes and acts accordingly. But alas, I cannot see, how it should be possible to change the behaviour of the BASIC interpreter this way.
Some years ago, I wrote LOADER for the fx-9860, which followed this scheme to load BASIC-programs from storage memory:
http://www.casiokingdom.org/modules.php?name=Downloads&d_op=viewdownloaddetails&lid=542&title=FX9860G%20LOADER%202.00
If I am not totally mistaken, the upload contains some source and knowhow. But I do not know, if casiokingdom's download area is still operable at all.

If you want to change/extend the BASIC-interpreter, you either have to write a completely new interpreter as G3A (sagarvaze did this some years ago at casiokingdoms) or you have to mod the OS.

@bsl: are you one of the SDK-chums, which have been around at casiokingdoms some years ago? The old syscall-wrapper: long time no see!
Hello SimonLothar,
I wrote the original TSR demo.
Yes, the source si very simple, I tried to show the concept as simple as possible. This is also the reason why I used the "old syscall-wrapper", this allowed me to use 1 simple source code file:-)
The OS extension is very far from to be ideal. The idea is to communicate from Basic to TSR by agreed variables (e.g. A,B).
The Basic must not use A for any other purposes and must keep it's value to 0 in idle. If basic wants some extra functionality (e.g. load new basic program from the flash), it setups the parameters (set up additional variables (e.g. filename to load to Str 1, filename to save to Str2) and as a last thing set variable A to the appropriate code (value).
TSR periodically check A's value and if it is nonzero, it will execute the requested operation and after then it resets A to 0.
Basic may wait for execution (for synchronous - like operations) - loop until A is zero again.
I write simple example, how it may work at http://ourl.ca/10095/197514

Offline SimonLothar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 129
  • Rating: +35/-1
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #12 on: June 13, 2011, 01:19:30 pm »
The idea is to communicate from Basic to TSR by agreed variables (e.g. A,B).
Very smart idea!
Do you use one of the free system timers to implement the TSR (if I remember right, the user timers are destroyed if another addin is invoked)?
I'll be back.

Offline MPoupe

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 168
  • Rating: +30/-1
  • The coder of yesterday
    • View Profile
    • My web site about Casio calculator
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #13 on: June 14, 2011, 05:48:16 am »
Do you use one of the free system timers to implement the TSR (if I remember right, the user timers are destroyed if another addin is invoked)?
No, I used standard SDK timer. Another addin would not only kill my timer, but also unmap my memory area (do the timer handler would be invalid). So I called App_PRGM() (0x09F5 on 9860G, 0x1945 on cg20), which runs as standard procedure (it keep my TSR addin as the current one). I inspired by your loader :-)

Offline SimonLothar

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 129
  • Rating: +35/-1
    • View Profile
Re: Prizm: C Addin & CASIO Basic programs works together
« Reply #14 on: June 14, 2011, 06:32:30 am »
Do you use 0x04DF and 0x04E0 to get and set the BASIC-variable, which you use to communicate (on 9860G)?
Do you know the corresponding syscall numbers on the fxCG?
I'll be back.