Commit graph

136 commits

Author SHA1 Message Date
Christophe de Dinechin
709436d095 dm32: Add DB48-specific keymap
Add a DM48 keymap that restores correct keybindings in the file
selector dialog.

Fixes: #1002

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-08-30 15:51:19 +02:00
Christophe de Dinechin
75ac41bbd6 Makefile: Remove unwanted attributes from geneated tar file
The tar file we build should not include macos crap such as

```
help/img/._SimpleShear.bmp
tar: Ignoring unknown extended header keyword
     'LIBARCHIVE.xattr.com.apple.provenance'
```

Fixes: #1125

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-08-23 14:00:27 +02:00
Christophe de Dinechin
8a4559e3ac Makefile: Only include help[ file for target
When distributing a release, only include the relevant help file,
i.e. DB48X.md for DB48X and DB50X.md for DB50x.

Fixes: #1124

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-08-23 13:46:20 +02:00
Christophe de Dinechin
b3af5db1e1 makefile: Add mv echo for image comparisons
This is simply for convenience while updating tests.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-08-23 11:55:22 +02:00
Christophe de Dinechin
59c9d183e5 build: Add BMP files to the distribution
From now on, we should probably only ship the tar files.

Fixes: #1083

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-31 01:47:02 +02:00
Christophe de Dinechin
384684cb83 build: Shorten the size of the version abbrev
We exceed the 16-byte limit with the existing format for
`0.7.11-12-42421Z`, which leads to a crash checking the QSPI.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-27 10:11:45 +02:00
Christophe de Dinechin
6d5af00a8c help: Add ability to display BMP images in help files
Add code to load BMP images from disk and show them in help files.

Fixes: #1033

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-22 01:57:32 +02:00
Christophe de Dinechin
28dac54c64 images: Convert help images to BMP
Convert the image files to BMP so that we can display them on the
target calculators.

This will be needed for #1033 (displaying BMP files in help file).

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-22 01:19:41 +02:00
Christophe de Dinechin
35e189dcd8 build: Fix the clean build
Fix clean build of simulator with `make sim`:

- Pass `TARGET=opt` instead of `TARGET=` when building tools
  to ensure the tool gets properly built irrespective of environment

- Remove reference to obsolete Intel decimal library, which was still
  hanging around in my build directories.

Fixes: #999

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-06-28 01:33:03 +02:00
Christophe de Dinechin
329800f219 wasm: Run the RPL thread in a separate thread
Reserve the main thread for display updates and keyboard interaction,
like for the Qt version. This allows the web simulator to work
correctly when you run a program or when you access the firwmare
interface.

The downside is that you need to run that on a web server that is able
to set the following [HTTP headers][coop]:

```
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Opener-Policy: same-origin
```

Unfortunately, it is not entirely clear if this can be made to work
easily with [GitHub pages][ghp].

Fixes: #994

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>

[coop]: https://web.dev/articles/coop-coep
[ghp]: https://github.com/orgs/community/discussions/13309
2024-06-24 21:14:06 +02:00
Christophe de Dinechin
f858087209 wasm: Implement WASM support
This is an in-tree port of [Franco Trimboli's excellent work][wasm].

The goal is to be able to run the simulator in a browser.
This builds with emscripten, as installed by the `emsdk`.
The `emsdk` is added as a submodule, and initialized on first build.

To build the browser WASM version of the simulator, run `make wasm`.

Fixes: #993

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Suggested-by: Franco Trimboli <sunpazed@gmail.com>
Co-developed-by: Franco Trimboli <sunpazed@gmail.com>

[wasm]: https://github.com/sunpazed/db48x-wasm
2024-06-24 21:12:16 +02:00
Christophe de Dinechin
2ca01b758d build: Remove any leftover references to Intel decimal library
That library has not been used since 0.6.0, it's time to wipe it out.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-05-13 19:17:34 +02:00
Christophe de Dinechin
b05453ad25 polynomials: Add support for polynomials as a separate type
Enough algorithms need a separate notion of polynomials.
Devise a space-efficient representation for them.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-29 20:42:38 +02:00
Christophe de Dinechin
18b22ce7f4 simulator: Separator color and dm32 support
Make it possible to run the DM42 configuration with color and the DM32
configuration in black-and-white.

Fixes: #907

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-17 00:23:47 +02:00
Christophe de Dinechin
d2d5db6ce1 makefile: Add configuration files to the release .tgz file
The `.tgz` file should contain the `csv` files in the `config`
directory.

Fixes: #892

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-14 16:38:15 +02:00
Christophe de Dinechin
0c1abf2689 simulator: Separate db50x and db48x builds
Put the object files in different locations, since they use different
configuration parameters that widely impact the generated code.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-11 13:05:30 +02:00
Christophe de Dinechin
927cb623d2 simulator: Convert simulator code to support color
Use the blitter code to manage the LCD buffer instead of ad-hoc
bit-manipulation.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-08 21:28:16 +02:00
Christophe de Dinechin
00a4a25869 files: Convert all file names to lowercase
For case-sensitive filesystems like on Linux, avoid file errors
when the case does not match.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-08 21:28:16 +02:00
Christophe de Dinechin
d1e6f008cb readme: Remove reference to DM42 from top-level readme
The project now supports the DM32 just as well as the DM42, so it's better to
not have the DM42 so prominently in the title.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-08 14:53:00 +02:00
Christophe de Dinechin
63eb8efabd catalog: Fix a subtle bug on DM32 with the catalog content
With the original code, the loop searching for commands to add to the
catalog skips many commands. I suspect this is another case of QSPI
hammering similar to what was observed for fonts. In any case, the
workaround appears to be to slightly deoptimize the code by selecting
a lower optimization level and adding an `else` clause in the inner
`if` statement.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-12 01:14:14 +01:00
Christophe de Dinechin
9e95425850 library: Add equations library and object library
These are two catalogs that behave much like the constants catalog,
and inherit most of the code.

The equations library is intended to store standard equations.

The library is for standard objects and various useful objects or
programs.

Both can be organized by topics.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
7c49adaf2c makefile: Add dependency of 'all' to the decimal constants
The dependency is not quite correct anyway, it's not the end result
that is dependent on the decimal headers, but the intermediate build
steps.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:10 +01:00
Christophe de Dinechin
c62b792b19 characterss: Add dynamic characters menu
Same principle as constants and units, but simpler.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:09 +01:00
Christophe de Dinechin
3db955b2ab doc: Add videos and pictures to quickstart guide
Add some quick videos and screen snapshots to the quickstart guide.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 14:02:14 +01:00
Christophe de Dinechin
bbec0939c8 date/time: Refactor the code and add Julian day number
Refactor the code to put all date and time related functions into the
`datetime.h` and `datetime.cc` files.

Also added Julian day number calculations, which enable the
computation of the day of the week in the date format rendering, and
will make it easier to implement future commands such as `DDAYS`.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 01:11:00 +01:00
Christophe de Dinechin
f29346e830 makefile: Add helper to compare images
Add `compare-foo` to compare reference images for `foo`.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 01:11:00 +01:00
Christophe de Dinechin
2782e32e42 expressions: Graphics rendering
Graphics rendering of expressions

Fixes: #47

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 01:11:00 +01:00
Christophe de Dinechin
beaaee23e4 constants: Evaluate constants from config/constants.csv
Dynamic constants menu, similar to units menu, which is populated
either from an internal table, or from `config/constants.csv`

Fixes: #497

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 00:55:00 +01:00
Christophe de Dinechin
c12d27ac8b hwfp: Add support for hardware-accelerated floating-point
The hardware-accelerated floating-point support in the ARM chip is
about 2000 faster than the variable-precision decimal floating point
implementation. It makes sense to use it.

See numbers recorded in `doc/6-Performance.md` for details.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-02-05 00:24:27 +01:00
Christophe de Dinechin
fc2c7bae10 decimal: Add Euler's constant
Add Euuler's constant to the list of built-in large constants

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:33:09 +01:00
Christophe de Dinechin
14b48eb21c decimal: Add code to generate constants
A single 10000-digit constant takes about 4K in QSPI space.
Constants are generated in a cache and rebuilt when precision changes.

For now, store pi, which we will need to implement sin/cos/tan

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:33:09 +01:00
Christophe de Dinechin
0aa6a813aa decimal: Add decimize tool to generate mantissa files
This makes it possible to store constants in packed decimal format.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:33:09 +01:00
Christophe de Dinechin
27aa945013 decimal: Switch DM42 back to -O2
We now have sufficient room to do that.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:33:09 +01:00
Christophe de Dinechin
6f2158107e decimal: Remove all the BID128 stubs and related decimal types
Remove all the bid128 interfaces to make room for the decimal stuff.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:33:06 +01:00
Christophe de Dinechin
6286deafcf decimal: First baby steps of variable-precision decimal code
The `decimal` class represents a variable-size decimal, similar to
what can be found in newRPL.

This commit implements the base class.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 19:32:23 +01:00
Christophe de Dinechin
77c5f57f8a dm42: Restore Intel decimal library by default
It's interesting to prove that we can build without it, but we can't
do a release without it.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-25 11:51:13 +01:00
Christophe de Dinechin
f7484708ad decimal128: Add ability to disable decimal code
At some point, we will need to shift to variable-precision decimal.
Being able to disable all `decimal128` code will help evaluate
how much room we have for that.

With decimal128 active, sizes are:

   text	   data	    bss	    dec	    hex	filename
2254248	   3840	   2524	2260612	 227e84	build/dm42/release/db48x.elf
wc -c db48x.pgm
  710180 db48x.pgm

Without decimal128, sizes are:
   text	   data	    bss	    dec	    hex	filename
 455864	   2872	   2412	 461148	  7095c	build/dm42/release/db48x.elf
wc -c db48x.pgm
  282236 db48x.pgm

In other words, decimal128 at the moment uses 427944 bytes out of our
716800 budget (i.e. 59.7%) and 1798384 in the total size (79.7%).
Chances that a variable decimal implementation can be made smaller
than that.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-05 18:15:30 +01:00
Christophe de Dinechin
af64992f47 Makefile: Add check-ids target
The `check-ids` target checks if commands are in the menus
or in the help.

The `src/ignored_menus.csv` and `src/ignored_help.csv` indicate what
does not need to be reported by the tools. It was initialized with the
current state of missing things, and can serve as a reference for what
commands need to either be documented or added to menus.

Fixes: #615

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
20489b6b8a statistics: Initial implementation
Just the infrastructure to be able to build the statistics commands.

This originally exceeded the RAM section on DM42, which is surprising
(RAM, not Flash). It turns out that this was the size of the sorted
commands for the catalog, which was fixed.

Fixes: #495

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-15 01:59:04 +01:00
Christophe de Dinechin
76150c6289 files: Allow STO and RCL to write to filesystem
When the argument describing the variable is a text, interpret that as
a file path on the disk. By default, data is stored in in a directory
named `data`, which will be created if necessary. For example, you can
use `3 "foo.48s" STO` to store the value `3` in a file named
`data/foo.48s` on disk.

How the file is stored depends on the extension given to the file:

* For `.txt` files, the object is stored as text
* For `.48s` files, the object is stored as DB48X source code
* For `.48b` files, the object is stored in binary format
* For `.csv` files, the object is stored in comma-separated format.

The binary format used for `.48b` includes a 4-byte magic number
identifying a DB48X format, and a 4-byte checksum used to ensure
binary compatibility between the firmware and the disk format.

At least during early days of development (prior to 1.0), it is quite
unlikely that the binary format for one version of the firmware would
be readable or writable by another version. If you need to recover
data from another version, you need to install that version and save
the object again in `.48s` (text) format.

Fixes: #375

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-15 01:59:04 +01:00
Christophe de Dinechin
328c2e484f Makefile: install demo state and configuration
Better to update the demo and unit configuration files when updating

Fixes: #547

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-06 00:19:11 +01:00
Christophe de Dinechin
c548d19413 Implement debug_printf
Implement a `debug_printf` that shows something on the screen, and a
`debug_wait` to wait for a given delay or a key.

Fixes: #541

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-05 14:19:59 +01:00
Christophe de Dinechin
d49a9bb478 Rename equation as expression
The `equation` type does not really represent equations (it may)
but arithmetic expressions.

Fixes: #518

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-01 19:54:49 +01:00
Christophe de Dinechin
c8d9f4fb9d Makefile: Add a sync before ejecting
This avoids havinf `hdiutil eject` complaining that the resource is busy

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-23 00:18:47 +02:00
Christophe de Dinechin
a5ae7bcbe9 dm32: Generate config-independent font file
The generated font files contained an ID that could depend on the
configuration settings for the build. That caused the font file on
DM32 to be incorrect, which caused a crash when editing text.

Fixes: #458

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-23 00:18:47 +02:00
Christophe de Dinechin
b4eeaa6bb8 unit: Implementation of unit objects
This is a very basic implementation of unit objects.
Unit objects are treated as equations where the outermost object
is an ID_mkunit operator.

Fixes: #16

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-23 00:10:03 +02:00
Christophe de Dinechin
76927fcd20 documentation: Distinct sections for DM32 and DM42
Add the ability to have machine-specific text in the on-line help.

Fixes: #450

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-23 00:10:03 +02:00
Christophe de Dinechin
572cd55ed2 documentation: Update DM42 to DM32 for DB50X
For the moment, simply perform textual replacements

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-22 23:46:37 +02:00
Christophe de Dinechin
9f5ca3dcd2 help: Skip images in the source file
Allow images in the source markdown files, but skip them on calculator

Note that we need to skip them at runtime if we want to be able to
have them in the GitHub file correctly.

Fixes: #438

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-20 20:25:16 +02:00
Christophe de Dinechin
ba206a6e33 build: Build DB50X with CONFIG_FIXED_BASED_OBJECTS
This is mostly to validate the sanity of that build option
(a compilation bug was actually fixed).

Fixes: #432

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-10-20 20:25:16 +02:00