A Python add-in with extra features, for fx-CG and fx-9860G-like.
Go to file
Lephenixnoir 8c5f68f16e
fxcg50/modion: rename file ion.c -> modion.c
2024-03-18 22:41:16 +01:00
.github github/workflows: Bump actions/upload-artifact from 3 to 4. 2023-12-15 16:14:43 +11:00
docs Merge remote-tracking branch 'slyvtt/numworks' into dev 2024-03-03 13:17:10 +00:00
drivers rp2: Switch rp2 and drivers to use new event functions. 2023-12-08 12:49:43 +11:00
examples py/obj: Fix mp_obj_is_type compilation with C++. 2023-11-17 14:31:42 +11:00
extmod extmod/nimble: Do not set GAP device name after sync. 2023-12-22 16:07:02 +11:00
lib lib/micropython-lib: Update submodule to latest. 2023-12-22 14:18:09 +11:00
logo windows: Use the MicroPython logo as application icon. 2023-11-07 17:22:52 +11:00
mpy-cross py/builtinevex: Handle invalid filenames for execfile. 2023-10-12 15:17:59 +11:00
ports fxcg50/modion: rename file ion.c -> modion.c 2024-03-18 22:41:16 +01:00
py meta: merge from upstream 1.12.0 into dev 2024-01-04 19:25:14 +01:00
shared meta: merge from upstream 1.12.0 into dev 2024-01-04 19:25:14 +01:00
tests tools/ci.sh: Set `ulimit -n` for unix CI. 2023-12-21 11:05:31 +11:00
tools tools/manifestfile.py: Add support for external libraries. 2023-12-21 15:28:32 +11:00
.git-blame-ignore-revs top: Update .git-blame-ignore-revs for latest formatting commit. 2023-11-03 13:32:19 +11:00
.gitattributes extmod/asyncio: Add ssl support with SSLContext. 2023-12-14 12:20:19 +11:00
.gitignore updated .gitignore 2024-01-30 22:55:23 +01:00
.gitmodules lib/protobuf-c: Add protobuf-c library. 2023-09-14 23:51:30 +10:00
.pre-commit-config.yaml all: Replace "black" with "ruff format". 2023-11-03 13:30:38 +11:00
ACKNOWLEDGEMENTS ACKNOWLEDGEMENTS: Remove entry as requested by backer. 2019-07-12 12:57:37 +10:00
CODECONVENTIONS.md CODECONVENTIONS: Update for change from black to ruff format. 2023-11-09 13:36:21 +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 rp2/mutex_extra: Implement additional mutex functions. 2024-01-03 15:59:02 +11:00
README-MicroPython.md meta: merge from upstream 1.12.0 into dev 2024-01-04 19:25:14 +01:00
README.md teensy: Remove the teensy port. 2023-10-31 13:04:41 +11:00
pyproject.toml all: Replace "black" with "ruff format". 2023-11-03 13:30:38 +11:00

README.md

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

UI:

  • 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)