Post Reply 
RPN Keystroke Program Listing
03-06-2020, 03:19 AM
Post: #1
RPN Keystroke Program Listing
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-06-2020, 03:30 AM
Post: #2
RE: RPN Keystroke Program Listing
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
Find all posts by this user
Quote this message in a reply
03-06-2020, 01:16 PM
Post: #3
RE: RPN Keystroke Program Listing
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

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
03-06-2020, 01:41 PM
Post: #4
RE: RPN Keystroke Program Listing
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
Find all posts by this user
Quote this message in a reply
03-06-2020, 03:17 PM
Post: #5
RE: RPN Keystroke Program Listing
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.
Find all posts by this user
Quote this message in a reply
03-06-2020, 03:37 PM
Post: #6
RE: RPN Keystroke Program Listing
Line numbers if it's a model with line-number addressing, key codes if it's a model with 7-segment (non-alpha) display.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-06-2020, 03:58 PM
Post: #7
RE: RPN Keystroke Program Listing
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?

Remember kids, "In a democracy, you get the government you deserve."
Find all posts by this user
Quote this message in a reply
03-06-2020, 05:19 PM
Post: #8
RE: RPN Keystroke Program Listing
(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.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
03-07-2020, 01:30 AM
Post: #9
RE: RPN Keystroke Program Listing
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)

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
03-07-2020, 02:21 AM
Post: #10
RE: RPN Keystroke Program Listing
(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.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2020, 02:59 AM
Post: #11
RE: RPN Keystroke Program Listing
(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...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
03-07-2020, 05:21 AM
Post: #12
RE: RPN Keystroke Program Listing
(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.

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
03-07-2020, 07:34 AM
Post: #13
RE: RPN Keystroke Program Listing
I'm in the Notepad++ camp. :)

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2020, 07:41 AM
Post: #14
RE: RPN Keystroke Program Listing
(03-06-2020 03:30 AM)Paul Dale Wrote:  Style 1 without the second colon.

That's a really strange digestive system!

Greetings,
    Massimo

-+×÷ ↔ left is right and right is wrong
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2020, 10:21 PM
Post: #15
RE: RPN Keystroke Program Listing
(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!
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2020, 10:27 PM
Post: #16
RE: RPN Keystroke Program Listing
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
Visit this user's website Find all posts by this user
Quote this message in a reply
03-08-2020, 01:06 AM
Post: #17
RE: RPN Keystroke Program Listing
I use Character Map, found at %SystemRoot%\system32\charmap.exe for those slightly more difficult characters {° ± ½ × ÷ ∑ ≠ ∆ ∂ √ ∞ ≤}, etc. Have a go!

BEST!
SlideRule
Find all posts by this user
Quote this message in a reply
03-11-2020, 12:21 AM
Post: #18
RE: RPN Keystroke Program Listing
Just a reminder - amending this 12C listing solution for other models isn't too hard.

https://www.hpmuseum.org/forum/thread-14120.html
Find all posts by this user
Quote this message in a reply
03-15-2020, 03:52 PM
Post: #19
RE: RPN Keystroke Program Listing
(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
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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