HP Forums
WP 34S: Quick access to bitwise operations as on the 16C - Printable Version

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: WP 34S: Quick access to bitwise operations as on the 16C (/thread-2932.html)

Pages: 1 2


WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-25-2015 10:34 PM

The WP 34S provides a comprehensive set of bitwise operations but most are only accessible via catalogs, which is quite slow, especially if you often use more than just one such operation and cannot rely on the catalog remembering the last position. Fortunately there are plenty of unassigned keyboard positions in integer mode that can be used to provide quick access to bitwise operations without removing existing functions. I've designed a layout for bitwise operations that I believe is logical and easy to learn:

[Image: attachment.php?aid=1500]

Rationale:
- Nand, nor and xnor are in obvious locations below their siblings.
- Shift and rotate are on the S and R keys as that's easy to remember.
- Rotate through carry operations are below rotate, and arithmetic shift right is below shift right.
- Bit tests are above the TEST catalog.
- Set bit is on + because it adds a bit, clear bit is on - because it removes a bit, and flip bit lines up with them nicely.
- Commands to select signed integer representations occupy the only place (on the A-D keys) where a group of four operations fit.
- Double word operations occupy the only remaining place where a group of three operations fit.
- Mask was placed next to other operations that require an argument.
- LJ and RJ were placed in the only remaining place for a pair of left and right oriented operations.
- Mirror was placed next to other bit shuffling operations.
- WSIZE is next to mode changing operations.
- LZ (LZON/LZOFF) was placed in the last remaining h-shifted position because it's similar to SEPON/SEPOFF and that's also h-shifted.
- The last remaining f-shifted position is used for nBITS.
- The two free hotkey positions are assigned to shift left and right by one bit because shifts are needed often. For shifting by only a few bits, it's faster to press A or B repeatedly than to type a number.
- The unshifted position on the EEX key remains unassigned because I couldn't think of an integer operation that should occupy such a prominent position.

If shift or rotate operations are invoked with the corresponding shift key (f or g) held down, they won't prompt for an argument but shift or rotate by a single bit instead. This greatly enhances usability in my experience and allows for quicker operation.

The only integer operations not available on the keyboard are *MOD and ^MOD. They could replace IP and FP, which would conflict with the key assignment on the unmodified 34S, but IP and FP are useless in integer mode so it probably wouldn't inconvenience anyone. If someone would like to see *MOD and ^MOD on the keyboard, please speak up.

All bitwise operations continue to be available in catalogs so you don't need to remember the position of rarely used functions. I've put some effort into optimizing the layout but someone else might have an even better idea, so suggestions are welcome.

I think this feature together with Y register display for integer modes, once they've been thoroughly tested, will make the WP 34S much more useful as a programmer's calculator and it'll be a superior replacement for the HP 16C in every way (except build quality and the keyboard). I've updated my custom builds, you'll find precompiled binaries as well as the patch there. Below I've attached PDF files with a cheat sheet that you can print out and stick to the back of the device, and an ASCII diagram of the layout that's easier to modify than a graphical file, in case someone would like to play with various designs.

Enjoy!


RE: WP 34S: Quick access to bitwise operations as on the 16C - PANAMATIK - 01-25-2015 11:09 PM

(01-25-2015 10:34 PM)Bit Wrote:  The WP 34S provides a comprehensive set of bitwise operations but most are only accessible via catalogs, which is quite slow, especially if you often use more than just one such operation and cannot rely on the catalog remembering the last position. Fortunately there are plenty of unassigned keyboard positions in integer mode that can be used to provide quick access to bitwise operations without removing existing functions. I've designed a layout for bitwise operations that I believe is logical and easy to learn:

I cannot comment all your ideas in detail, but generally it is a very good approach to add programmers features and binary arithmetic to the WP34S in integer mode. Already its early intention was to include the HP16C and why not going further. What I need primarily as a programmer is the fast and easy conversion from Hex to decimal in both directions with 16-bit and 32-bit word size in signed and unsigned mode. I never need 1s complement mode, always 2s complement. The binary arithmetic functions are very useful too. I would agree that shift by one on a hot key is much easier to use than shift n on a key combination. One could ask, why were these functions not already integrated in the WP34S? it is a logical step to use free buttons for them. I hope there will be enough ROM left for your implementation.

Please go on with your approach. I really like it.

Added: Hold On! It seems you already implemented that. I promise, that I will test it this week.

Bernhard


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-25-2015 11:19 PM

(01-25-2015 11:09 PM)PANAMATIK Wrote:  
(01-25-2015 10:34 PM)Bit Wrote:  The WP 34S provides a comprehensive set of bitwise operations but most are only accessible via catalogs, which is quite slow, especially if you often use more than just one such operation and cannot rely on the catalog remembering the last position. Fortunately there are plenty of unassigned keyboard positions in integer mode that can be used to provide quick access to bitwise operations without removing existing functions. I've designed a layout for bitwise operations that I believe is logical and easy to learn:

I cannot comment all your ideas in detail, but generally it is a very good approach to add programmers features and binary arithmetic to the WP34S in integer mode. Already its early intention was to include the HP16C and why not going further. What I need primarily as a programmer is the fast and easy conversion from Hex to decimal in both directions with 16-bit and 32-bit word size in signed and unsigned mode. I never need 1s complement mode, always 2s complement. The binary arithmetic functions are very useful too. I would agree that shift by one on a hot key is much easier to use than shift n on a key combination. One could ask, why were these functions not already integrated in the WP34S? it is a logical step to use free buttons for them. I hope there will be enough ROM left for your implementation.

Please go on with your approach. I really like it.

Added: Hold On! It seems you already implemented that. I promise, that I will test it this week.

Bernhard

Yes, everything is ready and working already, the only thing that remains is possibly tweaking the layout further if someone can suggest an improvement. The size of the firmware only increased by approximately 120 bytes so that's unlikely to be a problem.

I'll be very interested in your feedback once you've tried it out.


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-26-2015 02:54 AM

(01-25-2015 11:19 PM)Bit Wrote:  I'll be very interested in your feedback once you've tried it out.
I tried out the integer mode key definitions, and I really like your logical choices. I noticed that in base 16 mode the primary function of the SL1 and SR1 hotkeys is replaced by the A-F hex numeric entry keys, and that the "f A" and "f B" also implement SL1 and SR1 operations, but the overlay does not show the SL1 or SR1 in yellow below the A and B keys. Perhaps you could update the overlay to show these useful definitions. I think that many digital Engineers prefer base 16 mode when dealing with binary just because it packs more bits into each digit. When I first tested the feature, I thought that the convenient SL1 and SR1 functions were not possible in base 16 mode looking at the overlay. When I tried what I thought would be a logical place to put the alternate SL1 and SR1 keys, I found to my surprise that you had already implemented my wish list. (Even though it was not obvious by looking at the overlay alone) Thanks again Bit for the excellent well thought out contributions to the WP-34s project. If it is a too crowded under the A and B keys you could shorten the "1CO" and "2CO" down to "1C" and "2C". Perhaps that would help make enough room under the key to add the "SL1" and "SR1" in yellow beneath the A and B keys.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-26-2015 03:30 AM

(01-26-2015 02:54 AM)BarryMead Wrote:  
(01-25-2015 11:19 PM)Bit Wrote:  I'll be very interested in your feedback once you've tried it out.
I tried out the integer mode key definitions, and I really like your logical choices. I noticed that in base 16 mode the primary function of the SL1 and SR1 hotkeys is replaced by the A-F hex numeric entry keys, and that the "f A" and "f B" also implement SL1 and SR1 operations, but the overlay does not show the SL1 or SR1 in yellow below the A and B keys. Perhaps you could update the overlay to show these useful definitions. I think that many digital Engineers prefer base 16 mode when dealing with binary just because it packs more bits into each digit. When I first tested the feature, I thought that the convenient SL1 and SR1 functions were not possible in base 16 mode looking at the overlay. When I tried what I thought would be a logical place to put the alternate SL1 and SR1 keys, I found to my surprise that you had already implemented my wish list. (Even though it was not obvious by looking at the overlay alone) Thanks again Bit for the excellent well thought out contributions to the WP-34s project. If it is a too crowded under the A and B keys you could shorten the "1CO" and "2CO" down to "1C" and "2C". Perhaps that would help make enough room under the key to add the "SL1" and "SR1" in yellow beneath the A and B keys.

Thank you for the feedback.

If there are programs defined with the names A, B, C or D, then [f] [A] etc. will start those programs instead of invoking the hotkey functions. That's not a feature I introduced, I've merely preserved the original behavior (it's described e.g. in point 1 at the top of page 14 in the PDF version of the 34S documentation). I doubt it'd make sense to change it but feel free to provide counterarguments. Because of this, marking the hotkeys as [f] functions could be misleading.

I'd like to point out that, as explained in the first post, if you hold down [f] or [g], you can quickly invoke not only SL/SR 1 but also ASR and the rotate functions.


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-26-2015 03:36 AM

Bit:

I especially LOVE the feature where you can hold down the f or g keys along with shift or rotate
to shift or rotate a single bit. Also if you keep holding down the f or g key you can press the desired
shift/rotate key as many times as you want, say twice, or three times to quickly shift/rotate two or three bits.

This is way faster and more intuitive for smaller shift numbers than supplying a numeric shift number.
One really has to try it to see how fast and cool it is!!!!


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-26-2015 05:22 AM

(01-26-2015 03:30 AM)Bit Wrote:  Thank you for the feedback.

If there are programs defined with the names A, B, C or D, then [f] [A] etc. will start those programs instead of invoking the hotkey functions. That's not a feature I introduced, I've merely preserved the original behavior (it's described e.g. in point 1 at the top of page 14 in the PDF version of the 34S documentation). I doubt it'd make sense to change it but feel free to provide counterarguments. Because of this, marking the hotkeys as [f] functions could be misleading.

I'd like to point out that, as explained in the first post, if you hold down [f] or [g], you can quickly invoke not only SL/SR 1 but also ASR and the rotate functions.
This works fine on the real calculator and the NON-QT emulator, but if this feature ever becomes part of the official source tree and gets compiled into the QT emulator then the "HOLD f" or "HOLD g" plus a button quits working, so the SL1 and SR1 functions become more important. For this reason I suggest that they be added to the legend in yellow beneath the A and B keys. Even the existing black colored "SL 1" and "SR 1" definitions get cancelled by a program using LBL A or LBL B when the base is anything other than base 16 so I don't see why a yellow "SL1" or "SR1" legend beneath the A and B keys should be omitted on this basis. If you omit the space between the "SL" and "1" like this "SL1" instead of "SL 1" and change "1CO" and "2CO" to "1C" and "2C" then there would be room for both the yellow and blue shifted legends beneath the A and B keys.


RE: WP 34S: Quick access to bitwise operations as on the 16C - John Galt - 01-26-2015 05:57 AM

This is very cool stuff Bit. Thank you!

A couple of thoughts: considering that a programmer is going to make almost exclusive use of programming functions, in other words no need for trig, etc. have you given any thought to creating a permanent, custom adhesive label? The idea would be that a programmer might want to have a dedicated WP34S just for that purpose.

I am at a disadvantage because I am not familiar with how Eric Rechlin came to take on that project, but it seems the hard part would be creating the dies, not the artwork. It might not be all that difficult for him to create a new one, perhaps from artwork you supply.

Along those lines, if that were an option, it would make sense to label the top row A - F all the way left to right.

It would be a better 16C than the 16C ever was (already is, IMO).


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-26-2015 06:31 AM

(01-26-2015 05:57 AM)John Galt Wrote:  It would make sense to label the top row A - F all the way left to right.
See the attached modified text version of the legend that incorporates John's suggestions along with mine.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Paul Dale - 01-26-2015 06:54 AM

Walter and I had a discussion very much like this a few years ago Smile

We ended up leaving off the extra integer functions -- lack of keyboard overlay space/clutter, minimal surprises in the interface and no duplicate functions between the catalogues and keyboard.

Of course, with a new overlay the 16C replacement/improvement makes perfect sense -- the 34S was always a scientific however so we couldn't justify these. Doing a brand new integer mode calculator to replace the 16C based on the 34S code base would be an interesting project.


- Pauli


RE: WP 34S: Quick access to bitwise operations as on the 16C - walter b - 01-26-2015 11:42 AM

A 34P would be an interesting gadget. We focussed on the WP 34S since we guessed the market for a scientific calc being at least one order of magnitude larger than for a dedicated programmer's calc. If we have less than 1000 WP 34S and WP 31S in the field that would mean less than 100 for a 34P. Though designing its layout would be a very nice task.

OTOH, a customizable calc like the 43S would catch them all.

CETERVM CENSEO: Priority one is getting 43S prototypes for firmware development.

d:-)


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-26-2015 05:25 PM

Bit:

When I downloaded the latest zip/7z file from the "my custom builds" link above and flashed my WP-34s real calculator, all of these extra integer functions as well as the "StopWatch" work. But when I run the compiled Emulator "wp34sgui_Bit.exe" included in the zip file's "Win34GUI" subdirectory, it does not contain the "StopWatch", why is that? Is it possible to include the StopWatch features in the wp34sgui_Bit.exe file? Both the QT emulator and the standard NONQT emulator without
the _Bit suffix DO INCLUDE the StopWatch feature, so I thought to be consistent with the other builds it would be reasonable to request that the StopWatch be part of the emulator. What do you think?

Thanks again for these great improvements I use your improved versions exclusively.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-27-2015 12:27 AM

(01-26-2015 05:25 PM)BarryMead Wrote:  Bit:

When I downloaded the latest zip/7z file from the "my custom builds" link above and flashed my WP-34s real calculator, all of these extra integer functions as well as the "StopWatch" work. But when I run the compiled Emulator "wp34sgui_Bit.exe" included in the zip file's "Win34GUI" subdirectory, it does not contain the "StopWatch", why is that? Is it possible to include the StopWatch features in the wp34sgui_Bit.exe file? Both the QT emulator and the standard NONQT emulator without
the _Bit suffix DO INCLUDE the StopWatch feature, so I thought to be consistent with the other builds it would be reasonable to request that the StopWatch be part of the emulator. What do you think?

Thanks again for these great improvements I use your improved versions exclusively.

That wasn't intentional. I compiled the Windows version from the source tree that was prepared last for the builds without the stopwatch. I'll change my build procedure to fix this issue. Thank you for reporting it.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-27-2015 12:35 AM

(01-26-2015 05:22 AM)BarryMead Wrote:  This works fine on the real calculator and the NON-QT emulator, but if this feature ever becomes part of the official source tree and gets compiled into the QT emulator then the "HOLD f" or "HOLD g" plus a button quits working, so the SL1 and SR1 functions become more important.
You can double click the shift keys in the Qt emulator to hold them and invoke the shift/rotate by 1 bit functions that way. It's not an ideal user interface as it's cumbersome but I'm sure a new feature could be added to the Qt code to allow holding shift keys in some more convenient way. But it's not something I've looked into already.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-27-2015 01:35 AM

(01-26-2015 06:31 AM)BarryMead Wrote:  
(01-26-2015 05:57 AM)John Galt Wrote:  It would make sense to label the top row A - F all the way left to right.
See the attached modified text version of the legend that incorporates John's suggestions along with mine.

I've added a new set of PDFs to the first post. It includes A - F labels in the top row (plus the arrow above E because it's available as the indirection operator when programming in integer mode). I've also added the digit 1 as a subscript to all shift and rotate commands to act as a reminder that they can be used in a shift/rotate by one bit mode.

While it could make sense to indicate in some way that [f] can be used with the hotkeys, marking the hotkeys in the same way as f-shifted functions in the lower left corner is misleading IMO because they do not work the same way as f-shifted functions: they turn into XEQ A-D if corresponding programs are defined. Sqrt(x) in the top row isn't the same as sqrt(x) under the multiply key.

Therefore I've created three versions of the PDFs to satisfy everyone and to test out these ideas: One without any special markings on the hotkeys, one with the hotkey labels colored yellow (perhaps a good middle ground), and one where they hotkey functions are shown as if they were [f] functions as you requested. Enjoy!


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-27-2015 01:54 AM

(01-27-2015 12:35 AM)Bit Wrote:  You can double click the shift keys in the Qt emulator to hold them and invoke the shift/rotate by 1 bit functions that way.
Thanks Bit, I never knew about the "Double Click" shift lock feature of the QT emulator. I learn something new every time I read this forum.


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-27-2015 01:55 AM

(01-27-2015 12:27 AM)Bit Wrote:  I compiled the Windows version from the source tree that was prepared last for the builds without the stopwatch. I'll change my build procedure to fix this issue. Thank you for reporting it.
Thanks, I look forward to the next build.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-27-2015 02:09 AM

(01-26-2015 05:57 AM)John Galt Wrote:  This is very cool stuff Bit. Thank you!

A couple of thoughts: considering that a programmer is going to make almost exclusive use of programming functions, in other words no need for trig, etc. have you given any thought to creating a permanent, custom adhesive label? The idea would be that a programmer might want to have a dedicated WP34S just for that purpose.

I am at a disadvantage because I am not familiar with how Eric Rechlin came to take on that project, but it seems the hard part would be creating the dies, not the artwork. It might not be all that difficult for him to create a new one, perhaps from artwork you supply.

Along those lines, if that were an option, it would make sense to label the top row A - F all the way left to right.

It would be a better 16C than the 16C ever was (already is, IMO).

My original intention was to allow very efficient access to bitwise operations if you already have a WP 34S. No new overlay necessary, just flash the updated firmware and you get a layout that's easy to learn and use without changing anything on the 34S and without making the scientific functionality any less accessible. I consider this an important goal in its own right and I'd like to provide a good solution.

I'm not sure how useful it'd be to create an overlay that's basically the same as the cheat sheets I produced because I think it's much easier to learn that shifts are on S and rotates on R and so on than to remember which statistical functions are where. That said, I wouldn't mind spending some time on it if there's demand for it. I can't manufacture the overlays but I could create the artwork.


RE: WP 34S: Quick access to bitwise operations as on the 16C - BarryMead - 01-27-2015 02:16 AM

(01-27-2015 02:09 AM)Bit Wrote:  My original intention was to allow very efficient access to bitwise operations if you already have a WP 34S. No new overlay necessary, just flash the updated firmware and you get a layout that's easy to learn and use without changing anything on the 34S and without making the scientific functionality any less accessible. I consider this an important goal in its own right and I'd like to provide a good solution.

I'm not sure how useful it'd be to create an overlay that's basically the same as the cheat sheets I produced because I think it's much easier to learn that shifts are on S and rotates on R and so on than to remember which statistical functions are where. That said, I wouldn't mind spending some time on it if there's demand for it. I can't manufacture the overlays but I could create the artwork.
I agree. As a cheat sheet you can refer to it (until memorized) and it doesn't COVER UP any of the very valuable key legends or button-top legends. If you covered up the WP-34s with these stickers then the calculator would LOSE UTILITY and would be reduced to a "Programmers Only" calculator. Some may want a Programmers Only calculator, but I prefer the full utility and versatility of the WP-34s.


RE: WP 34S: Quick access to bitwise operations as on the 16C - Bit - 01-27-2015 02:24 AM

A dedicated overlay designed specifically for a device that's primarily a programmer's calculator (while of course also supports every single function the 34S has) could be useful. However, that's not a small undertaking because we have to provide very easy access to four related operations: directly switching to binary, octal, decimal and hexadecimal modes, and that requires a major reshuffling of the keys.

The only place those functions can go is the top 6 by 2 block and 6 keys are already taken up by the digits A-F, and those six keys don't fit anywhere else. Therefore the shifts must go and there's only one place the shifts can end up: XEQ and the arrows, so the arrows must also be relocated. I've given it some thought and I think these changes are unavoidable.

Below is a diagram of the only reasonable starting point for a programmer's layout I could come up with, given the HP 30b's keyboard. Three things could possibly be changed:
1. The bin/oct/dec/hex keys could be reversed or moved to the left side (but then STO/RCL would need to be relocated).
2. The window operations, <( and )>, could be moved anywhere. But both window operations must be on the same shift to allow fast operation when switching back and forth, [f] for left and [g] for right as on the original 34S is slow.
3. The arrows could be made f-shifted instead of h-shifted. (It wouldn't be optimal to have them g-shifted because your finger can more easily find [h] below the large ENTER key or [f] above the lowered EXIT key.)

The arrows are shifted but since there are no letters assigned to those keys, the + and - keys could be used to navigate in catalogs without a shift, so it wouldn't be very painful. STO and RCL should probably remain in the original positions, stack rotate could be on the right of ENTER, pushing x<>y and +/- to the right while getting rid of EEX. EEX in floating point mode could be to the right of the decimal mark, so either EEX or R/S would need to be in a shifted position.

Some food for thought...

Code:

   --------    --------    --------    --------    --------    --------
  |   A    |  |   B    |  |   C    |  |   D    |  |   E    |  |   F    |
  |        |  |        |  |   <(   |  |   )>   |  |        |  |        |
 A --------  B --------  C --------  D --------  E --------  F --------

   --------    --------    --------    --------    --------    --------
  |        |  |        |  |  BIN   |  |  OCT   |  |  DEC   |  |  HEX   |
  |        |  |        |  |        |  |        |  |        |  |        |
 G --------  H --------  I --------  J --------  K --------  L --------

   --------------------    --------    --------    --------    --------
  |       ENTER^       |  |        |  |        |  |        |  |   <-   |
  |                    |  |        |  |        |  |        |  |  CLx   |
   --------------------  M --------  N --------  O --------    --------

  ----------     ----------     ----------     ----------     ----------
 |    h     |   |    7     |   |    8     |   |    9     |   |    /     |
 |          |   |          |   |          |   |          |   |   RMDR   |
  ----------   P ----------   Q ----------   R ----------   S ----------

  ----------     ----------     ----------     ----------     ----------
 |    g     |   |    4     |   |    5     |   |    6     |   |    *     |
 |          |   |          |   |          |   |          |   |          |
  ----------   T ----------   U ----------   V ----------   W ----------

  ----------     ----------     ----------     ----------     ----------
 |    f     |   |    1     |   |    2     |   |    3     |   |    -     |
 |          |   |          |   |          |   |          |   |    /\    |
  ----------     ----------   X ----------   Y ----------     ----------

  ----------     ----------     ----------     ----------     ----------
 |   EXIT   |   |    0     |   |    .     |   |          |   |    +     |
 |          |   |          |   |          |   |          |   |    \/    |
  ----------     ----------     ----------   Z ----------     ----------