Fix the vertical bearing of the `v` glyph so that it does not appear
to be one pixel above the others.
Also add glyphs for
* dot-product (`⋅`, U8901)
* cross-product (`⨯`, 10799)
These can be used to refer to the `CROSS` and `DOT` commands.
Fixes: #1117
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `DispXY` command on the HP50G takes a font ID that takes 2 values,
1 for small font and 2 for regular font.
In order to implement this in a more easy way, reorder the font IDs so
that they "match", except that 0 gives the even smaller help font and
3 gives the larger editor font.
Fixes: #1146
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Switch to using the built-in data files by default, and extending them
with teh configuration file.
The `ShowBuiltinConstants`, `ShowBuiltinCharacters` and
`ShowBuiltinUnits` are not on by default. The size of the
corresponding `config/*.csv` files are reduced to a really simple
example.
Fixes: #1052
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `shown` variable should be set even without a `\n`, so that
history records position correctly.
Fixes: #1044
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The right margin only needs to be rounded to the nearest byte.
Using the scanline is wrong for the hardware screens, where the value
is artificially inflated (416 for 400 actual pixels) because DMCP uses
the extra two bytes for its own internal processing. Swapping
coordinates with 416 instead of 400 ends up messing up that data.
Fixes: #1053
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we draw a BMP that has a width that is not a multiple of 8, some
black pixels show up on the right, and the left part is truncated.
The root cause is that the horizontal adjustment uses the width and
not the scanline, so we don't get the correct range of pixels.
Code inspection also showed that there was an error in the size of the
datalen being returned from `grob::pixels`, because it returnes the
size of the object, not the size of the data bitmap.
Fixes: #1043
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the `Edit` feature to the interactive stack.
When editing an object and replacing it with multiple objects, the
objects are inserted at the interactive stack location.
Add the `Info` button to show information about the stack level.
Separate the `Sort` feature into `MemSort` (sort by memory
representation) and `ValSort` (sort by value).
Add the `EchoNSp` to echo without spaces the way the HP48 does.
Fixes: #1031
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add commands to the `EditMenu` to go both up and down in the history,
and to enter the interactive stack.
Switch to the `EditMenu` automatically when we use the history command.
Fixes: #1028
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The menus are now 3 pixels higher than before.
Adjust the help display area to match.
Fixes: #1026
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement an additive congruential random number generator (ACORN),
which is a very simple implementation that can be configured to have
an arbitrary number of random bits.
https://en.wikipedia.org/wiki/ACORN_(random_number_generator)Fixes: #1019
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The tests for the interactive stack involved a change in the code to
show an object, in order to process test commands correctly and to not
overwrite the screen content with the stack.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add link to [pre-built WASM simulator](https://c3d.github.io/db48x)
to make it easy for someone to actually try the simulator.
Fixes: #994
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When parsing `'xroot(a;-b)'` we were incorrectly returning
'-xroot(a;b)'` because we were treating `-` specially and before
treating parentheses or arguments.
Fixes: #959 (first comment)
Reported-by: mahi2003@users.github.com
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `xroot` command is a special case on HP50, in that `A B XROOT`
returns `XROOT(B;A)` and not `XROOT(A;B)` like for other commands.
Special-case the parsing and rendering of that command.
(This is super-ugly, all the more so that the HP50G advanced user
manual actually indicates the order depends on algebraic vs. RPN mode)
Fixes: #959
Reported-by: mahi2003@users.github.com
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Automatically apply some common simplification rules, like `-(-X)`
being converted to `X`.
Fixes: #952
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Descenders in softkey menus were not really visible. This meant that a
unit like `kg` would be visually equivalent to `kq`.
This adjusts the size of menus by one pixel to make it visible, and
extends the clipping area by another pixel, which gives two extra
pixels when drawing in white on a black background.
This is not visually perfect, because as a result, menu entries
without a descender, e.g. 'mol' now appear to be a bit shifted up.
Fixes: #939
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Depending on the context, we either want another menu, e.g. `SymbolicMenu`, or
the editor menu when using the `ToolsMenu` with an empty command line.
Fixes: #902
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we don't add parentheses around a function's argument, insert a
space to make it look better.
Fixes: #900
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add configuration parameters that lets you choose the color for the
various elements in the user interface.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Store files and objects as BMP files.
Recall BMP files as graphical objects.
Also adjust `Show` to not add a border to input graphical objects.
Fixes: #867
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
We need to ignore a few additional rows of pixels at the top,
otherwise the test images depend on the month name, e.g. "April",
which has a descender for "p", modifies pixesl at the top.
Fixes: #873
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Render `comb` and `perm` using the traditional mathematical notation.
Note that this is different from the way the HP48 and HP50G do it:
- The HP48 gives an `Undefined name` error for `N M COMB`
- The HP50 expands this to a factorial-based expression.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use a smaller font for the argument of these functions.
Also add tests for `sqrt`, `cbrt` and `xroot`
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Boxes` menu is a replication of the `Blocks` menu.
Replace it with a `Music` menu.
Add four missing music glyphs to the font.
Also add the reference file for `chars-menu.png`, which was missing.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Lib` menu was added, which changes the default screen. This
explains the observed change in `help-exit.png`.
There was a minor change in clipping for the help that causes a
mismatch on `help-keyboard.png`.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
There was a prefix in the editor in the first iteration of the
implementation for constants. This was actually a good idea, since it
lets us distinguish if you really want a constant or a normal symbol.
One of the main benefits is that there is no namespace clash. For
example, you can again use the `g` name, since the g constant will
actually be (cst) g. This was breaking the part in the Demo that used
`g` as a value for the level of green.
Visually, added three characters that show as (cst), (eq) and (lib) in
the text editor, in order to know what kind of name we are dealing
with.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Make sure that `Undo` and `LastArg` work correctly for plotting
functions, integration and solver.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Make sure that we capture consistent pixmaps, which we can do on the
RPL thread, and only defer the transfer of the pixmap to the main
thread, which is fast.
Additionally, optimize updates by doing a byte-by-byte xor comparison
in order to see which bytes actually changed. This minimizes the cost
on the RPL thread to update the pixmap.
This makes it possible to have a much better screen behaviour for the
`CBench` benchmark, where it updates it regularly on the screen while
not slowing things down too much.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When typing a program, insert commands for unit conversion, constants
and variable menu entries.
For variables, it used to work, but the way this was happening was
fragile, and had been broken by changes in what commands were seen as
"immediate".
Add tests for all these cases to make sure we catch future breakage.
Also emit an error if trying to insert `ConvertToUnitPrefix in a
program.
Fixes: #848
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have a hierarchical menu, do not clip the text.
Use case: `Length` unit menu now shows its `h`.
Fixes: #846
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When scrolling down through the text, an optimization was avoiding
drawing glyphs until we had reached a displayable point. However, the
computation of the width of each text row was done incorrectly in that
case, leading to undesirable large skips in the text being displayed.
Fixes: #836
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add support for the `InfinityValue` (-22) flag, described in the
HP50G as the "Infinite result exception" flag.
When the flag is set, infinite results are returned either as symbolic
constant infinity `∞` or as its value, currently defined as
`9.99999E999999`.
Whether the infinity value is returned symbolically or numerially
depends on the `NumericalConstants` (-2) and `NumericalResults` (-3)
flags.
Fixes: #835
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The last regression tests was failing because `XSHIFT` was incorrectly
clearing the `alpha` settting.
Add special keys to reach any of the shift states, e.g. `ALPHA_LS` for
`ALPHA` with left shift.
Fixes: #796
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Check the `CurveFilling` and `NoPlotAxes` setting, as well as numeric
flags -31 and -29.
Fixes: #778
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>