9a47650ca9
Add the basic rules for `expand`, `collect` and `simplify`. And to be honest, I am quite proud of the fact that the core code looks _exactly_ like this (this is actual code): ```c++ return rewrite((x+y)*z, x*z+y*z, x*(y+z), x*y+x*z, (x-y)*z, x*z-y*z, x*(y-z), x*y-x*z); ``` A lot of template metaprogramming to turn that into transparent building of _compile-time constants_ representing the RPL objects for the equations, and passing that to the `rewrite` function that was implemented earlier. What is really neet about this is that the generated equations: * Are automatically _shared_ if used multiple times, because they are represented by the same template. So the equations used in `collect` and those used in `expand` (which are the same in reverse) share the same memory. * Automatically go into QSPI, not consuming precious flash space, because they are represented as initialized data arrays, and I requested that all C++ .rodata go in QSPI. I intentionally did not support the historical names (`expan` and `colct`). Our level of compatibility with the HP48 is never going to be that good anyway. The code as is works with `clang`, but runs into unsatisfied symbols with g++ 10.3 due to what I believe is a g++ bug (that's what living on the edge of template metaprogramming gives you): ``` /opt/homebrew/Cellar/arm-none-eabi-gcc/10.3-2021.07/gcc/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: build/release/equation.o: in function `equation::collect() const': equation.cc:(.text._ZNK8equation7collectEv+0xd0): undefined reference to `eq<(unsigned char)10, (unsigned char)1, (unsigned char)120, (unsigned char)10, (unsigned char)1, (unsigned char)122, (unsigned char)57, (unsigned char)10, (unsigned char)1, (unsigned char)121, (unsigned char)10, (unsigned char)1, (unsigned char)122, (unsigned char)57, (unsigned char)55>::object_data' ``` Fixes: #231 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org> |
||
---|---|---|
DB48X-Keys | ||
dmcp | ||
doc | ||
fonts | ||
inc | ||
lib | ||
recorder@9b1b214ab2 | ||
sim | ||
src | ||
STATE | ||
tools | ||
.clangd | ||
.gitignore | ||
.gitmodules | ||
BUILD.md | ||
FREEDOM_COVENANT.txt | ||
Keyboard-Cutout.png | ||
Keyboard-Layout.png | ||
LICENSE.txt | ||
Makefile | ||
README.md | ||
STATUS.md |
DB48X on DM42
The DB48X project intends to rebuild and improve the user experience of the HP48 family of calculators, notably their "Reverse Polish Lisp" (RPL) language with its rich set of data types and built-in functions, and Lisp-level programming power.
The project in this repository is presently targeting the SwissMicro DM42 calculator, and leveraging its built-in software platform, known as DMCP. There is also a simulator that is tested on macOS or Linux.
In the long-term, the vision is to be able to port DB48X on a number of different physical calculator platforms, like the ARM-based HP50 and related machines (HP49, HP48Gii, etc), and the HP Prime (at least the G1, since the G2 seems a bit more locked down), maybe others. The basis for that work can be found in the DB48X project.
This project was presented at FOSDEM 2023
Why name the project DB48X?
DB stands for "Dave and Bill", who are more commonly known as Hewlett and Packard. The order is reversed compared to HP, since they reportedly chose the order at random, and it's about time Dave Packard was given preeminence.
Part of Dave and Bill's great legacy (beyond giving birth to the Silicon Valley) is a legendary series of calculators. The HP48 remains one of my favorites, notably for its rich built-in programming language, known as Reverse Polish Lisp (RPL). This project aims at recreating a decent successor to the HP48, at least in spirit.
State of the project
This is currently UNSTABLE and INCOMPLETE software. Please only consider installing this if you are a developer and interested in contributing. Or else, have a paperclip at hand just in case you need to reset your calculator.
The detailed current status is described in the STATUS file.
How to build this project
There is a separate document explaining how to build this project.
The simulator includes a test suite, which you should run before submitting
patches. To run these tests, pass the -T
option to the simulator, or hit the
F12 key in the simulator.
Built-in documentation
The calculator features an extensive built-in documentation that uses
a restricted version of Markdown. You access
that built-in help by holding a key down, or using
the Help
command
Other documentation
There is DMCP interface doc in progress see DMCP IFC doc (or you can download html zip from doc directory).
The source code of the DM42PGM
program
is also quite informative about the capabilities of the DMCP.