Author Topic: User timers on the CG-50  (Read 156 times)

0 Members and 1 Guest are viewing this topic.

Offline thunker123

  • LV0 Newcomer (Next: 5)
  • Posts: 1
  • Rating: +0/-0
    • View Profile
User timers on the CG-50
« on: April 11, 2025, 07:56:40 pm »
Hello everyone,
Sorry but this needs a bit of context, hang with me please:
I am working on a sort of mod for my calculator (Casio FX CG-50). I have already managed to develop my own little add-in that is a sort of animation on the screen with user input affecting it, using the PrizmSDK.

Now, the final thing I want to add is to be able to mod my calculator to add a rainbow changing frame using the DrawFrame function. This works flawlessly within my add in using a user timer. The thing with these (user timers) is that they're limited to the child process you're in. Since by entering another app I terminate the old child process (my app) it then automatically deletes it and the RAM my app was using is cleared. Also, exiting to the main menu instantly pauses it.

A way around this is using system timers (I've read the documentation on Wiki Prizm and I know it's dangerous, but I'm ok with it - it's only supposed to be a cool trick to show to my friends). By doing that, if I exit into the main menu the rainbow function continues which I presume to be because the RAM isn't cleared yet and it's a global timer so the handler I have set for the timer is still accessible even though I'm outside the app, which is exactly what I want, and it is quite cool to see (so at least I confirmed it can work until there). If I enter another app, though, it is cleared so I get a system error since that pointer to the function now points nowhere: System Error Address(R), and the memory address provided keeps changing in line with how quick I set the timer to update. All system timers do this except 4 which is non-changeable as it's reserved by the OS.

I have tried a lot of things to try and remedy this. One of them was trying to place the pointer in a non volatile spot. While searching through other projects I came across some instances where people did things like:

Code: [Select]
void backupOCRAM2(void* buffer) {
  memcpy(buffer, (char*)0xE5017000, 8192);
} //This is from an image processing application

(https://github.com/gbl08ma/imageviewer/blob/master/src/imageGUI.cpp#L53)
to write to a non volatile spot for Prizm apps. I suspect that these addresses have changed because trying to change the linker script to include another spot in memory and then adding that to my C code proved to be unsuccessful. On the WikiPrizm (https://prizm.cemetech.net/OS_Information/Processes/) there's information about the addresses for the stack and the heap, but not anything permanent. This is probably too hard and out of my current capabilities but I would greatly appreciate it if anyone who knew anything about system timers and/or non volatile memory locations that would persist even when leaving the app could provide a bit of input. It seems hard, but seeing some other projects doing some stuff such as the code excerpt I provided gives me a bit of hope that such a thing is possible.

Thanks a lot!