HP Forums
RPN Keystroke Program Listing - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: RPN Keystroke Program Listing (/thread-14611.html)



RPN Keystroke Program Listing - Eddie W. Shore - 03-06-2020 03:19 AM

Which of the following style of program listings is preferred?

Style 1:
Code:
STEP:  KEY CODE:  KEY
01:  36:  ENTER
02:  36:  ENTER
03:  1:  1
04:  40:  +
05:  20:  *
06:  2:   2
07  10:  ÷
08:  43,33,00:  GTO 00

Style 2:
Keys Only:
Code:
ENTER
ENTER
1
+
2
*
÷
GTO 00

The above is code to calculate ∑x (x=0 to n) for the HP 12.


RE: RPN Keystroke Program Listing - Paul Dale - 03-06-2020 03:30 AM

Style 1 without the second colon.

The line numbers are useful as a cross reference. The key codes less so but handy on a verification pass.


Pauli


RE: RPN Keystroke Program Listing - Werner - 03-06-2020 01:16 PM

Key codes are unnecessary, I'd say.
And there's a typo in listing 2 (lines with 2 and * are swapped).
Also, I'd do it as

Code:
 50
 %
 x
 LASTX
 +

Shorter, and uses only two stack levels.

Cheers, Werner


RE: RPN Keystroke Program Listing - Maximilian Hohmann - 03-06-2020 01:41 PM

Hello!

(03-06-2020 01:16 PM)Werner Wrote:  Key codes are unnecessary, I'd say.

Me too. They are different for different calculators anyway even if the program itself is almost identical.

(03-06-2020 01:16 PM)Werner Wrote:  Also, I'd do it as

Code:
 50
 %
 x
 LASTX
 +

Shorter, and uses only two stack levels.

Yes, but ... this kind of optimised program requires comments, otherwise people have a very hard time to figure out how it works. And may lose interest quickly... Simple programs tend to be rather self explanatory and I presonally do not really care how many program steps and stack levels they waste.

Regards
Max


RE: RPN Keystroke Program Listing - freelanzr - 03-06-2020 03:17 PM

Certainly Line numbers are a useful reference, particularly with programs that have a large # of steps.
I also agree that the key codes could be dropped, the simpler the better.
I occasionally add a 3rd column for Comments, but use it sparingly.


RE: RPN Keystroke Program Listing - Dave Britten - 03-06-2020 03:37 PM

Line numbers if it's a model with line-number addressing, key codes if it's a model with 7-segment (non-alpha) display.


RE: RPN Keystroke Program Listing - mfleming - 03-06-2020 03:58 PM

I'd second Dave's judgement. As someone who has transcribed some poorly scanned, terribly unreadable program thermal printouts, keycodes can be the only way to determine what key that smudge of dots represent. What will your listing look like 40 years from now?


RE: RPN Keystroke Program Listing - rprosperi - 03-06-2020 05:19 PM

(03-06-2020 03:30 AM)Paul Dale Wrote:  Style 1 without the second colon.

The line numbers are useful as a cross reference. The key codes less so but handy on a verification pass.

1 +

Pauli nailed it. Dave's suggestion about key-code only listings is good as well, though far harder for the person posting the listing to do, unless coming from an emulator where you can copy/paste.


RE: RPN Keystroke Program Listing - cdmackay - 03-07-2020 01:30 AM

just my opinion, but for entering, having the "key" column aligned helps considerably, so your eye can just follow down…

That can be tedious to generate manually, especially if using spaces (since TAB doesn't expand equally everywhere)


RE: RPN Keystroke Program Listing - Dave Britten - 03-07-2020 02:21 AM

(03-07-2020 01:30 AM)cdmackay Wrote:  just my opinion, but for entering, having the "key" column aligned helps considerably, so your eye can just follow down…

That can be tedious to generate manually, especially if using spaces (since TAB doesn't expand equally everywhere)

Notepad++ makes this easy. Configure your tab width, then use Edit, Blank Operations, Tabs to Spaces. That's what I do for listings with columns of line numbers and key codes, after copying the listing from Excel.


RE: RPN Keystroke Program Listing - rprosperi - 03-07-2020 02:59 AM

(03-07-2020 02:21 AM)Dave Britten Wrote:  Notepad++ makes this easy. Configure your tab width, then use Edit, Blank Operations, Tabs to Spaces. That's what I do for listings with columns of line numbers and key codes, after copying the listing from Excel.

Same for TextPad, which is broadly similar, but is updated less often. Once you get used to this treatment of spaces/tabs, using Notepad is barbaric...


RE: RPN Keystroke Program Listing - Mark Hardman - 03-07-2020 05:21 AM

(03-07-2020 02:59 AM)rprosperi Wrote:  Same for TextPad, which is broadly similar, but is updated less often.

Bob, you are a true soulmate. I spend 50% of my day pounding out code using TextPad. I could not live without it.


RE: RPN Keystroke Program Listing - Massimo Gnerucci - 03-07-2020 07:34 AM

I'm in the Notepad++ camp. :)


RE: RPN Keystroke Program Listing - Massimo Gnerucci - 03-07-2020 07:41 AM

(03-06-2020 03:30 AM)Paul Dale Wrote:  Style 1 without the second colon.

That's a really strange digestive system!


RE: RPN Keystroke Program Listing - Eddie W. Shore - 03-07-2020 10:21 PM

(03-06-2020 01:16 PM)Werner Wrote:  Key codes are unnecessary, I'd say.
And there's a typo in listing 2 (lines with 2 and * are swapped).
Also, I'd do it as

Code:
 50
 %
 x
 LASTX
 +

Shorter, and uses only two stack levels.

Cheers, Werner

Wow - I didn't think of using parenthesis. Amazing!


RE: RPN Keystroke Program Listing - Eddie W. Shore - 03-07-2020 10:27 PM

I have been using Wordpad because Wordpad allows for ASCII codes (Alt+X), which the plain Textpad doesn't.

I will give Notepad++ a shot.

How about this (example):

Area of a circle:

#1 x^2
#2 PI
#3 *
#4 GTO 00


RE: RPN Keystroke Program Listing - SlideRule - 03-08-2020 01:06 AM

I use Character Map, found at %SystemRoot%\system32\charmap.exe for those slightly more difficult characters {° ± ½ × ÷ ∑ ≠ ∆ ∂ √ ∞ ≤}, etc. Have a go!

BEST!
SlideRule


RE: RPN Keystroke Program Listing - BruceH - 03-11-2020 12:21 AM

Just a reminder - amending this 12C listing solution for other models isn't too hard.

https://www.hpmuseum.org/forum/thread-14120.html


RE: RPN Keystroke Program Listing - Orome - 03-15-2020 03:52 PM

(03-06-2020 03:37 PM)Dave Britten Wrote:  Line numbers if it's a model with line-number addressing, key codes if it's a model with 7-segment (non-alpha) display.

QFT