I'm working on an unofficial open-source CG50 emulator that aims to be better for testing custom add-ins and reverse engineering than the official fx-CG Manager. So far it runs most programs created using fxsdk/gint, which was announced on this forum here (if you haven't tried it, please do, it's really nice and feels much more comfortable to use than PrizmSDK in my opinion). It's not very popular here but most games created by the Planet Casio community use it. These are easier to emulate because gint is a custom kernel that doesn't use syscalls except for a few specific tasks, so I only have to emulate hardware that is already well-documented and that I can see the driver code for rather than running the whole OS. It has a Qt UI and is so far only tested on Linux (there's a web port too but it's a bit slow). Here are some screenshots:





Some gint programs that rely on syscalls or USB won't work, though.

I'm also working on loading an OS dump into memory so that PrizmSDK add-ins and the OS itself can run too. This is more difficult, because the OS uses a lot of undocumented hardware, but I have made some progress:




They don't get much further than that, though, because GetKey doesn't work (probably because I'm not emulating keyboard interrupts yet, gint uses a timer to poll it periodically). The support for this is on a separate branch called "os" on my repo and needs you to dump some files, I can explain how if anyone wants to try it.

The source code is here: https://github.com/Heath123/casio-emu/

There are no precompiled binaries yet but the people who would want to use it at this point in development can probably follow the compile instructions anyway
Wow, this is really cool!
I'll certainly be using this once it gets PrizmSDK support, looks way more friendly than the official emulator.
I made a lot of progress, here's Utilities running now:
https://youtu.be/3DVTTN1oWs8
Almost everything works now, except the time doesn't update until you press a key (I'm pretty sure it's an issue with the non-blocking keyboard routines, probably to do with timers/interrupts) and it crashes at the end in "System information"

The rest of the OS doesn't work yet, going to the menu causes a crash
And here are two official add-ins, Physium and Prob Sim:


It's really all starting to come together now, though with some major bugs at the moment:




This is amazing. It could potentially let me make a video tribute to Casio fx-CG gaming.
This is very exciting: the lack of a Prizm emulator had a significant impact on the speed of my Prizm add-in development, and probably impacted my willingness to continue to write software for the calculator over time. I look forward to trying it!
Hi Heath,
this is absolutely amazing.
From my perspective it is absolutely wonderful to get a full package to code/compile and test addins remotely including such an emulation solution.
I guess in the future we wille be able to "pipe" compiled addin directly to the emulator and save a lot of time (no need anymore to connect actual hardware, even if the Addin Push you made is wonderfull).
I don't know if you plan to support USB on the emulator, so what we can use fxlink even from the emulator and possibly in the futur integrate Redoste work on creating a GDB interface.
That would create the ultimate tool for programming fxCGs.

Cheers

Sly
slyVTT wrote:
Hi Heath,
this is absolutely amazing.
From my perspective it is absolutely wonderful to get a full package to code/compile and test addins remotely including such an emulation solution.
I guess in the future we wille be able to "pipe" compiled addin directly to the emulator and save a lot of time (no need anymore to connect actual hardware, even if the Addin Push you made is wonderfull).
I don't know if you plan to support USB on the emulator, so what we can use fxlink even from the emulator and possibly in the futur integrate Redoste work on creating a GDB interface.
That would create the ultimate tool for programming fxCGs.

Cheers

Sly


Thanks!

The emulator does already load g3as directly from a command line argument, so that part should already work. USB would be nice, but it's still possible to add features like debug logs and breakpoints without emulating all of USB by just creating a fake hardware register that e.g. prints anything you write to it to the console, which is probably an easier way to do it in the short term (I did something like this for early debugging when the display hardware wasn't emulated).

When you say "full package to code/compile and test addins remotely", what do you mean? I was thinking of making a website with a code editor and an emulator built in so you don't have to install the SDK locally to get started, do you mean something like that?
Heath wrote:

Thanks!


You are very welcome.

Heath wrote:

The emulator does already load g3as directly from a command line argument, so that part should already work. USB would be nice, but it's still possible to add features like debug logs and breakpoints without emulating all of USB by just creating a fake hardware register that e.g. prints anything you write to it to the console, which is probably an easier way to do it in the short term (I did something like this for early debugging when the display hardware wasn't emulated).


I guess so. If the USB registers are supported, it should be able to work properly. Lephe is currently working in supporting "advanced USB" in gint and Redoste's work is focused on adding a GDB interface into gint. As it is WIP, I don't hava clear view on what's going on.

Heath wrote:

When you say "full package to code/compile and test addins remotely", what do you mean? I was thinking of making a website with a code editor and an emulator built in so you don't have to install the SDK locally to get started, do you mean something like that?


That's definitely an option, as currently done on TI-CE calculator. I was rather thinking in offering a full solution aside gint/fxsdk to be able to test programs even for people that do not have an actual fxCG calculator.

One more question: You are emulating SH4 and CG hardware. Do you plan to support fx9860G-ish hardware (B&W models) or just Prizms ?
Wonderful, congratulations! I can't wait to be able to test it with KhiCAS! And with gdb support so that I can efficiently fix bugs (the official emulator can be tweaked to have gdb support, but it is painfully slow to load addins...)
parisse wrote:
Wonderful, congratulations! I can't wait to be able to test it with KhiCAS! And with gdb support so that I can efficiently fix bugs (the official emulator can be tweaked to have gdb support, but it is painfully slow to load addins...)


Thanks! The slowness of the official emulator's file transfer is one of the main reasons I made this, I think it's emulating a serial transfer or something... I don't have GDB support yet but I'd like to add it. It does seem to run KhiCAS fine (at least the single-file CG10/20 version), though I don't know how to use/test the more advanced features:



I also fixed a CPU bug related to bitwise operations and it now runs the OS mostly correctly (though still with frequent crashes)




A problem that Lephe pointed out is that this could be seen by Casio as competing with their emulator, which they make money from, so while it's not illegal it might not be a good idea to annoy them because they could take away direct hardware access like Ti and Numworks did. I might have to limit running the OS which I don't want to have to do but I might need to
Heath wrote:
I don't have GDB support yet but I'd like to add it. It does seem to run KhiCAS fine (at least the single-file CG10/20 version), though I don't know how to use/test the more advanced features:

Wow! I thought I would have to wait more before I could test... I'll try tomorrow!

Quote:

A problem that Lephe pointed out is that this could be seen by Casio as competing with their emulator, which they make money from, so while it's not illegal it might not be a good idea to annoy them because they could take away direct hardware access like Ti and Numworks did. I might have to limit running the OS which I don't want to have to do but I might need to

I don't see how there could be a problem competing with Casio because there is simply no market for the Casio emulator, teachers get free licenses and I just can't see why anyone else would want to run the emulator (except developpers...). The only reason for Casio to keep the emulator non free is probably to keep mailing lists of math teachers in order to send them newsletters, news and offers about their calculators.
Don't limit yourself running the OS. Just take care not to distribute material copyrighted by Casio like ROM images and I'm confident everyone will be happy. Better devel environment will help us developpers implement more new addins that will help Casio get marketshare.
parisse wrote:
Heath wrote:
I don't have GDB support yet but I'd like to add it. It does seem to run KhiCAS fine (at least the single-file CG10/20 version), though I don't know how to use/test the more advanced features:

Wow! I thought I would have to wait more before I could test... I'll try tomorrow!

You will have to dump the OS to run anything that uses syscalls though so it won't work out-of-the-box, also this isn't on the master branch yet
Can anyone think of a good name for this emulator? My current "casio-emu" repo name is a bit boring...
Prizmulator.
What are the prerequisites to build? Is cmake 3.25 really required? My debian 11 box provides 3.18, I can of course re-compile cmake from source, but if cmake 3.25 is required, then I'm afraid other components will also require compilation from sources or re-install (e.g. qt or sdl) which means I should wait for an easier install path...
parisse wrote:
What are the prerequisites to build? Is cmake 3.25 really required? My debian 11 box provides 3.18, I can of course re-compile cmake from source, but if cmake 3.25 is required, then I'm afraid other components will also require compilation from sources or re-install (e.g. qt or sdl) which means I should wait for an easier install path...


I just copy/pasted that from somewhere, I expect there’s a good chance it will work if you just lower the version in the CMakeLists.txt because I’m not doing anything too advanced

If you want to use the os branch to run KhiCAS you’ll need to change some hardcoded paths in src/memory/memory.c to the OS dump files for the ROM, RAM and RS memory in the code which need to be dumped with the latest commit on the dev branch (because there was a fix recently) of gintctl
Using cmake 3.18 returns an error, but perhaps it's because I did something wrong getting the source: I typed
git clone -b os https://github.com/Heath123/casio-emu,
then edited CMakelist.txt and replaced 3.25 by 3.18 then I typed
cmake . -B build but it failed because of a missing file src/hardware/debug/debug.c, in fact the whole directory src/hardware/debug does not exist.
Details below:

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Error at CMakeLists.txt:57 (add_executable):
Cannot find source file:

src/hardware/debug/debug.c

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx


-- Generating done

Well, it's probably time for me to wait for all the requirements to stabilize...
parisse wrote:
Using cmake 3.18 returns an error, but perhaps it's because I did something wrong getting the source: I typed
git clone -b os https://github.com/Heath123/casio-emu,
then edited CMakelist.txt and replaced 3.25 by 3.18 then I typed
cmake . -B build but it failed because of a missing file src/hardware/debug/debug.c, in fact the whole directory src/hardware/debug does not exist.
Details below:

-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
CMake Error at CMakeLists.txt:57 (add_executable):
Cannot find source file:

src/hardware/debug/debug.c

Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
.hpp .hxx .in .txx


-- Generating done

Well, it's probably time for me to wait for all the requirements to stabilize...


Oops, sorry, I forgot to push that file. It should be fixed now.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement