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>
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>
The `\t` character inside a label menu or `SelfInsert` command marks
the position for the cursor.
Fixes: #881
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Draw the battery voltage with a different color based on level.
Draw a red line around error messages.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When editing on the command line, it's not helpful to have `exp` or
other command names show up as you enter them.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Split the color conversion step away from the blitop function.
This makes the `Walkman` demo work in color mode.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When `printf` was involved in any kind of target buffer rendering, it
could overflow the buffer.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When the line width is set to 0, we were incorrectly taking
`(width-1)/2` for the negative offset, resulting in a huge box being
drawn instead of a thin line.
Arguably, a line width of 0 should maybe not be drawn at all?
But this makes it more likely that someone will run the test, see a
blank screen and think this is buggy.
Fixes: #880
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
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>
Compiled local variables is a rather obscure feature with a weird
syntax. It is documented on page 1-10 of the HP50G advanced reference
manual as follows:
Global variables use up memory, and local variables can’t be used
outside of the program they were created in. Compiled local
variables bridge the gap between these two variable types. To
programs, compiled local variables look like global variables, but
to the calculator they act like local variables. This means you can
create a compiled local variable in a local variable structure, use
it in any other program that is called within that structure, and
when the program finishes, the variable is gone.
Compiled local variables have a special naming convention: they must
begin with a `←`. For example,
« → ←y 'IFTE(←y<0,BELOW,ABOVE)' »
The variable `←y` is a compiled local variable that can be used in
the two programs `BELOW` and `ABOVE`.
There does not seem to be any mention of the feature in the HP48 user
manual.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
We can now take advantage of:
* The `Gray` command to set patterns
* Redrawing text with a different foreground color
Also change the lines demo to have a progressive fade-out
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use `TEval` to benchmark the code, remove the benchmark helper.
Also rename the two sum benchmarks to add clarity in the name
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `ImaginaryUnit` and `Pi` commands no longer exist.
Replace them with the constants from the constant library.
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>
The `Clone` command creates a clone of the object on top of stack.
This is useful for example to be able to garbage-collect an object
that the subobject was extracted from.
The hardest part was to actually come up with a test that reliably
shows the memory being saved.
Fixes: #871
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
`Increment` increments a variable and returns its value.
`Decrement` decrements a variable and returns its value.
Fixes: #872
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>
Implement `Sto+`, `Sto-`, `Sto*` and `Sto/` like on the HP48.
Implmeent `Rcl+`, `Rcl-`, `Rcl*` and `Rcl/` like on the HP42
(even if for RPL, there is not much to gain compared to separate
operation)
Fixes: #866
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For equations, it's often the case that they render horizontally.
Have `Show` automatically switch between horizontal and vertical mode.
The `MaxW` value has been increased to 1280 to match this new
behaviour, and the `MaxH` value has been decreased to 1280 because a
1280x1280 bitmap is already about 204K, so it is unlikely to work well
in the DM32 memory constraints.
Fixes: #869
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a word wrapping in the editor at a position defined by
`EditorWrapColumn`. This makes editing of moderately large programs
more practical.
Fixes: #870
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The vertical rendering mode renders one RPL instruction per line while
editing. This makes the program look a bit more like RPN programs.
Fixes: #868
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `SetBit` command sets a bit in the value,
e.g. `2 4 SETBIT` is `18`
The `ClearBit` command clears a bit in the value,
e.g. `16#2A 3 CLEARBIT` is `16#22`.
the `FlipBit` command flips a bit in the value,
e.g. `3 18 FLIPBIT` is `262147`.
Fixes: #850
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For all commands, put the arity check in the top-level evaluator.
This factors out all that code in a single (source-code) location.
This also makes it possible to use arity reliably during parsing of
expressions, and fixes a number of cases where it wqas set wrong, like
for the `det` command and many others.
Finally, it fixes missing calls to `rt.args` for a number of commands,
while explicitly removing it (`nargs < 0`) for a few cases where it
was harful, like `LastArgs` or `Undo`.
Fixes: #865
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
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>
In an expression, parse `Foo(1;2;3;4)` as a function call invoking
`Foo` with arguments `1 2 3 4`.
Fixes: #863
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Move `nand`, `nor`, `implies`, `equiv` and `excludes` to the two-bytes
section of identifiers.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add calls to `program::interrupted()` to make sure we can interrupt a
running sum or product function.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Instead of only emitting the `Unterminated` error message for the
outermost expression, emit it for the innermost unterminated
expression, which gives a much better sub-range for the editor.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add "real" n-ary functions for `sum` and `product`.
Note that the HP50G does symbolic pre-computation for sums, with the
interesting side effect that it may give "strange" results for empty
sums. For example, `I 10 1 'I^3' Σ` gives `-2024`, which is a bit
suprising.
The rationale, I believe, is that `I A B 'I^3' Σ` is first simplified
as `'(B^2+2*B^3+B^4-A^2+2*A^3-A^4)/4'`, which gives the negative
result when `A>B`.
This behaviour is not replicated in DB48X, which follows the HP48
model, where a sum between 10 and 1 returns 0, not a negative value.
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>
Remove the `DataMenu`.
Replace `PrintMenu` with `ListMenu` as keyboard-accessible menu
(we can tuck the rarely used `PrintMenu` under `I/O`)
Add list product, sum, etc to `ListMenu`
Modify `ProgramMenu` to add special program entry characters.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
For some reason, I used the `Sum` (`Σ`) and `Product` (`∏`) commands
for list sums and products. This is not the way the HP48/HP50 do it,
so it's better to have dedicated `ΣList` and `∏List` commands.
Also implemented the missing `∆List` command and added the missing
related tests for all these commands.
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>