A Python add-in with extra features, for fx-CG and fx-9860G-like.
Go to file
Lephenixnoir 3df7eae26c
examples: examples: add Synchro-Donjon
Only AI mode has been tested. Graphical mode suffers from single VRAM
combined with naive updates. A custom version would solve that.
2022-12-21 19:37:39 +01:00
.github unix: Refactor mpconfigport.h and mpconfigvariant.h. 2022-09-13 17:39:03 +10:00
docs py/py.mk: Make user-C-module handling self-contained in py.mk. 2022-10-11 23:23:18 +11:00
drivers py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00
examples all: Use += rather than = everywhere for CFLAGS/LDFLAGS/LIBS. 2022-10-11 23:17:41 +11:00
extmod extmod/mbedtls: Remove brainpool curves from config. 2022-10-22 19:12:46 +11:00
lib lib/btstack: Update to v1.5.3. 2022-10-22 13:21:28 +11:00
logo all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpy-cross extmod: Make extmod.mk self-contained. 2022-10-11 23:31:49 +11:00
ports examples: examples: add Synchro-Donjon 2022-12-21 19:37:39 +01:00
py pe: debugging tools 2022-11-10 22:37:04 +01:00
shared pe: basic GUI setup 2022-11-05 18:25:54 +01:00
tests tests/extmod: Add test for sleep_ms value that overflows ticks. 2022-10-14 16:10:38 +11:00
tools extmod/extmod.mk: Make extmod.mk handle GIT_SUBMODULES. 2022-10-11 23:29:09 +11:00
.git-blame-ignore-revs top: Update .git-blame-ignore-revs for latest formatting commit. 2022-05-05 13:31:04 +10:00
.gitattributes gitattributes: Mark *.a files as binary. 2019-06-03 14:57:50 +10:00
.gitignore gitignore: Ignore macOS desktop metadata files. 2021-05-04 16:56:16 +10:00
.gitmodules lib/stm32lib: Update library to get L1 v1.10.3, and some other fixes. 2022-09-25 23:56:20 +10:00
.pre-commit-config.yaml tools: Add pre-commit support. 2022-10-04 14:52:48 +11:00
ACKNOWLEDGEMENTS ACKNOWLEDGEMENTS: Remove entry as requested by backer. 2019-07-12 12:57:37 +10:00
CODECONVENTIONS.md CODECONVENTIONS.md: Update pre-commit instructions. 2022-10-11 17:47:05 +11:00
CODEOFCONDUCT.md top: Add CODEOFCONDUCT.md document based on the PSF code of conduct. 2019-10-15 16:18:46 +11:00
CONTRIBUTING.md top: Update contribution and commit guide to include optional sign-off. 2020-06-12 13:32:22 +10:00
LICENSE drivers/cc3000: Remove CC3000 WiFi driver files. 2022-08-26 12:51:37 +10:00
README-MicroPython.md meta: move original README.md 2022-10-27 17:20:32 +02:00
README.md examples: examples: add Synchro-Donjon 2022-12-21 19:37:39 +01:00


PythonExtra - A community MicroPython for CASIO calculators

Original MicroPython README: README-MicroPython.md.

This is a MicroPython port for fx-CG 50, fx-9860G III and related CASIO calculators.

Build instructions

Requires the fxSDK. Go to ports/fxcg50 or ports/fx9860g3 and run make. If it doesn't build, first try to use the dev branches for fxSDK, gint, fxlibc and JustUI. Rebuilds don't always work especially when checking out other commits (maybe my fault), so try to delete build if you think that's related.

Most of the code is in ports/sh and is shared between the platforms.

Test suite

Located in ports/sh/examples.

  • fx-CG: Whether the program successfully runs on PythonExtra on models of the fx-CG family. This is typically tested on a Graph 90+E but should include the fx-CG 10/20/50.
  • G-III: Whether the program successfully runs on G-III models. This does not include older models like the fx-9860G II.
  • Raw speedup: Speedup from using PythonExtra instead of the official Python app, without changing the code (as a ratio of execution times).
  • Full speedup: Seedup from using PythonExtra-provided modules for rendering and input (usually gint), after changing the program's code.
Program fx-CG G-III Raw speedup Full speedup
Chute tridimensionnelle Yes Yes x1.36 x2.26 ⁽¹⁾
Bad Apple Meh⁽²⁾ - TODO TODO
Island of the Dead Kings TODO TODO TODO TODO
Synchro-Donjon (AI mode) Yes TODO x1.82 -
Flappy Bird Yes Yes x1.04 x2.35

⁽¹⁾ After upgrading to full-screen 396x224 instead of the original 120x80. (!)

⁽²⁾ Bad Apple requires unloading modules to not run out of memory, and I haven't been able to consistently do that. See the unload-modules branch.

Basic benchmarks

PythonExtra is slightly faster than the official Python app, probably due to optimization during compilation of the VM. The tests below show the effect on basic Python operations.

Test Program Official Python (fx-CG 50) PythonExtra (fx-CG 50)
VM speed pe_loop.py (1 million pass) ~12 seconds 8.9 seconds
Shell output pe_print.py (print 100000 integers) ~22 seconds 11.3 seconds
Large integers pe_fact.py (compute 250!, 500 times) ~15 seconds 8.6 seconds

TODO list

Bugs to fix:

  • Fix not world switching during filesystem accesses (very unstable)
  • Fix current working directory not changing during a module import (for relative imports)
  • Fix casioplot not stopping on the last show_screen()

Python features:

  • Compare features with existing implementations and other brands
  • Get filesystem access (open etc) with the POSIX interface
  • Get a decent amount of RAM not just the fixed 32 kiB that's hardcoded so far


  • Add an option for fixed-width font which also sets $COLUMNS properly so that MicroPython paginates (requires better getenv/setenv support in fxlibc)
  • Use unicode-fonts to provide Unicode support
    • Extend it with a fixed-width uf8x9 which maybe changes some glyphs (like i and l; the usual fixed-width unambiguous styles)
    • Try and provide a font smaller than 5x7 for more compact shell on mono
  • A decent keymap that can input all relevant characters into the shell
  • Features that would match MicroPython's readline:
    • Multi-line input (figure out how to store it); also, auto-indent
    • History (use MP_STATE_PORT(readline_hist) with readline_push_history() for a start); also, zsh-style search
    • Autocompletion (use mp_repl_autocomplete() which should hook just fine)

Future wishes:

  • Build for fx-9860G II (requires manual filesystem support)
  • Lephe's secret ideas (complete previous list to unlock)