HP Forums
34S Mini-Challenge : A to Z - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: 34S Mini-Challenge : A to Z (/thread-6733.html)



34S Mini-Challenge : A to Z - Nick - 08-26-2016 02:44 PM

Here's a compressed menu/scan routine for converting key scan codes for A-Z to 1-26 and all others to negative values (for demo display) in 39 steps. This includes a full set of labels (1 for A-Z as a group, and 1 each for the other keys; Y and EXIT are excluded by firmware) for the user to insert their code:

http://www.hpmuseum.org/forum/thread-6732-post-60137.html

The challenge is can this demo/routine be compressed further?

Yip,
Nick (=


RE: 34S Mini-Challenge : A to Z - Didier Lachieze - 08-26-2016 03:49 PM

Nice job! It's pretty well compressed already.
But ... as it is a challenge, here is a 37 steps version:
Code:
01 LBL 'KEY'
02 LBL 00
03 VIEW X
04 PSE 99
05 KEY? X
06 GTO 00
07 LBL?->X
08 GTO->X
09 ENTER
10 SDR 001
11 IP
12 LBL?->X
13 GTO->X
14 SKIP 006
15 LBL 01
16 DEC Y
17 DEC Y
18 LBL 03
19 LBL 04
20 DEC Y
21 # 007
22 *
23 -
24 GTO 00
25 LBL 24
26 LBL 25
27 LBL 26
28 LBL 31
29 LBL 35
30 LBL 41
31 LBL 51
32 LBL 61
33 LBL 62
34 LBL 72
35 +/-
36 GTO 00
37 RTN



RE: 34S Mini-Challenge : A to Z - Nick - 08-26-2016 11:43 PM

(08-26-2016 03:49 PM)Didier Lachieze Wrote:  Nice job! It's pretty well compressed already.
But ... as it is a challenge, here is a 37 steps version:

Wow! I love it -- great idea!

Works out well that most of the codes have a 0-offset Y value too..... 4 whole steps (net 2)... *poofed*.

Congrats!

I added a linkback from the listing thread with credit for your improvement.

Yip!
Nick (=


RE: 34S Mini-Challenge : A to Z - rprosperi - 08-27-2016 01:23 AM

(08-26-2016 11:43 PM)Nick Wrote:  I added a linkback from the listing thread with credit for your improvement.

Nick - Challenges and replies do belong in topical threads like this, but the Library Forums are intended for completed solutions, sort of like a reference library with working solutions.

So it's great to create these and encourage participation, and possibly even post the final (best) reply in a library forum, but cross-posting while the dialogue is evolving is both confusing and unnecessary.

Thanks for the challenge.


RE: 34S Mini-Challenge : A to Z - Nick - 08-27-2016 03:52 AM

Bob,

You were right -- I just showed this to someone and it was confusing to present it to them across two threads.

If you look at the library code though, it's maintained neatly with revision commentary. I think it's the separate discussion that's confusing which does belong here, but how can you tell when something like this can't be optimized further?

I considered brute-forcing the problem, trying a number of potential iterations over a cluster computer but that would be cheating. (It worked for Google and the Rubik's Cube.)

Thanks,
Nick

Edit: Was more confusing than I had realized.


RE: 34S Mini-Challenge : A to Z - Paul Dale - 08-27-2016 03:53 AM

Make this a separate program (with and END) and put it in your flash library. Then the label use doesn't impact any other program.

Almost seems like we should have implemented an [alpha]KY? command Smile Although, your solution is definitely smaller than a native implementation would be.


Pauli


RE: 34S Mini-Challenge : A to Z - Nick - 08-27-2016 03:59 AM

(08-27-2016 03:53 AM)Paul Dale Wrote:  Make this a separate program (with and END) and put it in your flash library. Then the label use doesn't impact any other program.

Almost seems like we should have implemented an [alpha]KY? command Smile Although, your solution is definitely smaller than a native implementation would be.

Pauli

Pauli,

Hi from a fan! *waves*

Oh, yea. I considered adding a comment to the library thread about referencing external programs and maybe a version with a toggle mode between numeric and alpha for fun (as a different snipplet). But if you do that, then you have to add lowercase... where does it end?

If the HP 82240A could print one character at a time on a single line, I'd have a typewriter!

But I don't need anything other than A-Z for where this is going. I completed some routines for a port of a lesser-known but significant program that is uniquely better suited for a calculator than a PC and am still working out the UI. I plan to release it open-source and reveal the name at the same time.

Thanks!
Nick

Edit: Someone said she loves your avatar! Davros?


RE: 34S Mini-Challenge : A to Z - Paul Dale - 08-27-2016 06:59 AM

(08-27-2016 03:59 AM)Nick Wrote:  If the HP 82240A could print one character at a time on a single line, I'd have a typewriter!

This is Marcus's domain, not mine Sad


Quote:Edit: Someone said she loves your avatar! Davros?

My avatar is of the three Davros miniatures I've painted thus far. The first two are metal and are properly based. The third is a plastic cast I made of another metal one and it is waiting to be suitably frozen in an acrylic cryotube -- I didn't want to risk any metallic interactions (outgassing) with the resin I'll be using. For those unaware, Davros is a character from the 1970's (& later) Dr Who series.

She is clearly very well educated and knowledgable Smile


Pauli


RE: 34S Mini-Challenge : A to Z - Nick - 08-27-2016 09:37 AM

Printing Word Processor (It's not my typewriter, but it does print stuff...)

Usage:

f, g, h are all [Shift] with = as the annunciator (Flag A)
A-Z appends a character
[Shift]A-Z appends a lowercase character
ENTER will Print + Clear
[Shift]ENTER will Print (without Clear)
<- will Backspace
[Shift]<- will Clear
0 is Space
Y is forgotten Sad

Code:
01 LBL 'WP'
02 LBL 00
03 VIEW X
04 PSE 99
05 KEY? X
06 GTO 00
07 LBL?->X
08 GTO->X
09 ENTER
10 SDR 001
11 IP
12 LBL?->X
13 GTO->X
14 SKIP 006
15 LBL 01
16 DEC Y
17 DEC Y
18 LBL 03
19 LBL 04
20 DEC Y
21 # 007
22 *
23 -
24 # 064
25 +
26 FC? A
27 SKIP 002
28 # 032
29 +
30 aRCL X
31 GTO 00
32 LBL 24
33 LBL 25
34 LBL 26
35 FF A
36 GTO 00
37 LBL 31
38 PRINTa
39 FC?C A
40 CLa
41 GTO 00
42 LBL 35
43 FS?C A
44 SKIP 003
45 aRR 01
46 aSL 01
47 GTO 00
48 CLa
49 LBL 41
50 LBL 51
51 LBL 61
52 LBL 62
53 GTO 00
54 LBL 72
55 a[SPACE]
56 GTO 00
57 RTN

Comments:

- There's room to tweak when the shift keys clear or not.
- Other annunciators such as 360/GRAD could be used for additional Shift keys.
- Numerics / punctuation could be added.
- Bold / Underline / Mode 1 / Mode 2 could be added.
- The 82240A font could be selected if you're using an 82240B.
- A blinking ViewA could be used to render a cursor for text editing.
- CPX could simplify every operation.
- The forgotten Y key could be asked for forgiveness.

Inspiration:

- Special thanks to Someone Special who's Someone other than Someone, Pauli, the Daleks, and these words from the 3.1 manual: "Nevertheless, do not forget that your WP 34S is mainly designed as a programmable calculator."


RE: 34S Mini-Challenge : A to Z - Nick - 08-27-2016 09:52 AM

(08-27-2016 06:59 AM)Paul Dale Wrote:  
(08-27-2016 03:59 AM)Nick Wrote:  If the HP 82240A could print one character at a time on a single line, I'd have a typewriter!

This is Marcus's domain, not mine Sad

I've read the technical guide and through my highly scientific process of fiddling around, I have a feeling it's a hardware problem.

Q. How many programmers does it take to screw in a light bulb?
A. None! It's a hardware problem!


...but while we're on the subject, my wish list would include monospace as an option for Mode 1 and Mode 2.

Nick (:


RE: 34S Mini-Challenge : A to Z - Marcus von Cube - 08-30-2016 03:30 PM

(08-27-2016 09:52 AM)Nick Wrote:  
(08-27-2016 06:59 AM)Paul Dale Wrote:  This is Marcus's domain, not mine Sad

I've read the technical guide and through my highly scientific process of fiddling around, I have a feeling it's a hardware problem.

I agree. The printer only prints when a line is complete.

(08-27-2016 09:52 AM)Nick Wrote:  ...but while we're on the subject, my wish list would include monospace as an option for Mode 1 and Mode 2.

This is what ⎙MODE 0 is for.Wink
You can position the cursor with ⎙TAB n to align output in any mode.


RE: 34S Mini-Challenge : A to Z - Nick - 08-31-2016 01:40 AM

(08-30-2016 03:30 PM)Marcus von Cube Wrote:  
(08-27-2016 09:52 AM)Nick Wrote:  ...monospace as an option for Mode 1 and Mode 2.

...You can position the cursor with ⎙TAB n to align output in any mode.

*light bulb* Thanks, Marcus! I'm trying that out tonight to see how it looks... I never considered using it per character -- that's great...