HP Forums

Full Version: RPN Keystroke Program Listing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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
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
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
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.
Line numbers if it's a model with line-number addressing, key codes if it's a model with 7-segment (non-alpha) display.
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?
(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.
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)
(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.
(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...
(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.
I'm in the Notepad++ camp. :)
(03-06-2020 03:30 AM)Paul Dale Wrote: [ -> ]Style 1 without the second colon.

That's a really strange digestive system!
(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!
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
I use Character Map, found at %SystemRoot%\system32\charmap.exe for those slightly more difficult characters {° ± ½ × ÷ ∑ ≠ ∆ ∂ √ ∞ ≤}, etc. Have a go!

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

https://www.hpmuseum.org/forum/thread-14120.html
(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
Reference URL's