Post Reply 
[WP 34S] Enhanced Y register display: fractions, bugfixes etc.
02-04-2014, 03:14 AM (This post was last modified: 02-07-2014 03:07 AM by Bit.)
Post: #1
[WP 34S] Enhanced Y register display: fractions, bugfixes etc.

I've created a patch to improve the Y register display in the WP 34S. Really good Y register display is impossible on the measly screen of the HP 30b but even a less than perfect implementation can improve usability. Not only is it a reminder of what's been entered or which numbers the next operation will work on (if it requires two arguments) but it provides feedback on whether or not a stack lift occurred. Because of the latter it could be especially useful in simplified versions of the WP 34S targeting users who are new to RPN.

Bugs fixed:
* Both YREG_CODE and RP_PREFIX cut off the last digit in certain cases. This could lead to incorrect rounding at best, or totally wrong exponent shown at worst. The numbers 1.123456178 and 1.234567e311 will reproduce the problem.
* YREG_CODE often interferes with viewing complex numbers.
[CPX] [h] [VIEW] [Z] will reproduce the problem.
* If the X register was erased (thus stack lift disabled) and a new number is being entered, the original YREG_CODE will display a zero (the erased X register) instead of the Y register.
[1] [ENTER] [<-] [1] will reproduce the problem.

The original code directly manipulated the horizontal position (the 'x' variable) in set_status_sized() in order to align the number displayed. This seemed like an ad-hoc solution that wouldn't scale to support new features with different alignment requirements so I came up with something else. The '\007' character (the gradian symbol) starts an escape sequence that specifies the width of the next character explicitly and whether the big or the small font should be used.

By default the Y register is displayed even if a shift key and/or the CPX key have been pressed, and both indicators are squeezed into the 7 pixel wide area on the left. This makes the Y register display much nicer because it isn't flashing on and off while one performs basic operations. There's no longer any visual indication of the date mode, but it's unlikely anyone would change the date mode often after they configured it to their liking so I don't think it's a big loss. The old behavior (disabling Y register display whenever a shift key or the CPX key is pressed) is available via a compile time option.

Whether the Y register display can be turned on or off at run time using the J flag has been made into a compile time option. Disabling both this and the old behavior mentioned above eliminates some code paths and makes the firmware slightly smaller. I see little value in being able to turn off the Y register display at run time (once it works well) but I kept the option in case someone needs it.

The new code supports fraction mode. The 'Gt' and 'Lt' indicators are changed into '>' and '<' in small font and they're removed if the fraction wouldn't fit in the display otherwise. If the fraction still doesn't fit, the number is displayed as decimals.

HMS mode is also supported. The overflow indicator and the fractional part of the second are cut off if necessary to make everything fit in the display. There's no need to fall back to displaying decimals.

Being able to control the width of individual characters and the font used made another feature possible: stack size indication without repurposing the BEG annunciator. If it's enabled at compile time, a small '.' on the left side of the display will indicate a 4-level stack and a small ':' an 8-level one. The idea is that single vs. double dots indicate normal vs. double stack size. If someone can think of a neater way to do it, let me know.

Besides changing set_status_sized() and some other minor changes, I had to revamp the structure of annunciators() in order to avoid lots of code duplication within #ifdef's. I was trying to be careful and not increase the firmware size unnecessarily. With all Y register related features disabled, i.e. configured for equivalent functionality as the official firmware, the ARM machine code generated from the new version is actually a few bytes shorter. The default configuration that comes with the patch (most new features enabled) makes the firmware roughly half a kilobyte bigger.

This is still a work in progress but at this point it may be of interest to others. The image below shows what the new Y register display looks like. Any feedback is welcome.

Edit: Uploaded a fixed version of the patch.

[Image: attachment.php?aid=232]


Attached File(s) Thumbnail(s)
   

.zip  wp34s-code_revision-3470_20140127_enhanced_yreg_2_patch.zip (Size: 6.38 KB / Downloads: 14)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[WP 34S] Enhanced Y register display: fractions, bugfixes etc. - Bit - 02-04-2014 03:14 AM



User(s) browsing this thread: 1 Guest(s)