Commit graph

26 commits

Author SHA1 Message Date
Christophe de Dinechin
4d7cbf0b3a equations: Add graphical rendering for integrate
Render integrals graphically, in line with sums and products.

Fixes: #1174

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-09-12 00:50:35 +02:00
Christophe de Dinechin
13a74414ec Minor pre-release adjustments (missing files, .gitignore)
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-09-11 10:18:19 +02:00
Christophe de Dinechin
60236d8fc5 font: Fix v glyph vertical placement, add dot and cross glyphs
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>
2024-08-31 17:19:56 +02:00
Christophe de Dinechin
f511df292e graphics: Implement DispXY command
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>
2024-08-31 01:41:18 +02:00
Christophe de Dinechin
1ee54c9662 constants: Fix numerical value for G constant
The G constant had a bad definition with `2•kg` instead of `2*kg`.

Fixes; #1128

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-08-23 11:55:32 +02:00
Christophe de Dinechin
84cc30a81d solver: Add tests for testing with units
Add test to check that we correctly take the units from

Tests: #1049

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-30 11:44:24 +02:00
Christophe de Dinechin
d64fdb3452 config: Use config files only for user configuration
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>
2024-07-27 17:34:02 +02:00
Christophe de Dinechin
b00a1c3154 help: Record position for history even without a \n
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>
2024-07-27 10:11:44 +02:00
Christophe de Dinechin
4fe509691c blitter: Base horizontal adjust on scanline, not width
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>
2024-07-24 14:33:54 +02:00
Christophe de Dinechin
c9c770b981 ui: Add Edit feature to interactive stack
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>
2024-07-20 23:57:42 +02:00
Christophe de Dinechin
4febac76d7 ui: Add history menu entries to EditMenu
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>
2024-07-20 04:28:29 +02:00
Christophe de Dinechin
3c1dd5afd2 ui: Replace interactive stack "Edit" with "Echo"
This is more consistent with the HP user interfaces.

Fixes: #1027

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-20 02:36:35 +02:00
Christophe de Dinechin
7234b918c5 help: Adjust help area to new height for menus
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>
2024-07-20 00:55:27 +02:00
Christophe de Dinechin
196f2ee754 random: ACORN random number generator
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>
2024-07-19 22:08:35 +02:00
Christophe de Dinechin
e32f001ea2 tests: Add tests for interactive stack
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>
2024-07-13 00:28:19 +02:00
Christophe de Dinechin
378aa9111a wasm: Add link to deployed WASM simulator in the README
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>
2024-06-28 01:33:03 +02:00
Christophe de Dinechin
5c6d3ed13d expressions: Parse negation after parentheses
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>
2024-06-14 19:23:59 +02:00
Christophe de Dinechin
761c4216c3 xroot: Reverse xroot arguments in algebraic parsing
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>
2024-06-14 19:23:50 +02:00
Christophe de Dinechin
e6a7d2c1e8 functions: Automatic simplification of expressions
Automatically apply some common simplification rules, like `-(-X)`
being converted to `X`.

Fixes: #952

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-05-30 10:33:13 +02:00
Christophe de Dinechin
e57c310ccd menus: Adjust size of menus to make descenders visible
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>
2024-05-15 18:57:28 +02:00
Christophe de Dinechin
ffa6948022 tests: Some adjustments on color images
The color of the bar on the left was changed. Adjust test files.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-23 20:40:40 +02:00
Christophe de Dinechin
b404eddd1b arithmetic: Add space around mod and rem in rendering
Add spaces around `mod` and `rem` during rendering.

Fixes: #906

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-16 21:04:00 +02:00
Christophe de Dinechin
d1bd1a813c menus: Replace EquationsMenu with the correct one
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>
2024-04-15 22:20:31 +02:00
Christophe de Dinechin
0ffafba65f graph: Add space when rendering simple function
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>
2024-04-15 21:09:57 +02:00
Christophe de Dinechin
ead9ae6bf6 tests: Add colorized images to testing
Add a color-images directory to record color reference images

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-11 13:05:31 +02:00
Christophe de Dinechin
80e94a38d4 tests: Add colorized images to testing
Add a color-images directory to record color reference images

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-04-11 13:05:30 +02:00