Post Reply 
need help with FCAT program for HP 42S
05-21-2024, 06:11 AM
Post: #1
need help with FCAT program for HP 42S
In the HP-42S RPN Scientific Programming Examples and Techniques manual, Edition 1 July 1988, page 54, program FCAT line :

50 LBL 14

what is the purpose of this line?

I spent 4 hours keying in this program - GTO A is hardly intuitive. My first and previous calculator was the 32S and the 42S (actually Free42) is several levels more complex. So I am relearning with a view to writing a superior circle-triangle-circle program with all the bells and whistles.

FCAT seemed a good program to learn from but this step has me stumped.

Was there an erratum about this?

Thanks.
Find all posts by this user
Quote this message in a reply
05-21-2024, 04:21 PM
Post: #2
RE: need help with FCAT program for HP 42S
After a cursory glance at page 54 of ‘Programming Examples and Techniques’, it can be assumed that in the case of this programme (and only for this programme) it will be a kind of placeholder for ‘Do nothing’.
Find all posts by this user
Quote this message in a reply
05-21-2024, 05:56 PM
Post: #3
RE: need help with FCAT program for HP 42S
For those who want to try the program:
Code:
00 { 234-Byte Prgm }
01▸LBL "FCAT"
02 0.09606
03 STO 00
04▸LBL A
05 RCL 00
06 XEQ 00
07 KEY 1 GTO 01
08 XEQ 00
09 KEY 2 GTO 02
10 XEQ 00
11 KEY 3 GTO 03
12 XEQ 00
13 KEY 4 GTO 04
14 XEQ 00
15 KEY 5 GTO 05
16 XEQ 00
17 KEY 6 GTO 06
18 KEY 7 GTO 07
19 KEY 8 GTO 08
20 "FLAG CATALOG"
21 MENU
22 6
23 STO 01
24 PROMPT
25 GTO A
26▸LBL 00
27 CLA
28 99.1
29 X<>Y
30 X>Y?
31 RTN
32 AIP
33 FS? IND ST X
34 ├"•"
35 1
36 +
37 RTN
38▸LBL 01
39 DSE 01
40▸LBL 02
41 DSE 01
42▸LBL 03
43 DSE 01
44▸LBL 04
45 DSE 01
46▸LBL 05
47 DSE 01
48▸LBL 06
49 DSE 01
50▸LBL 14
51 RCL 01
52 RCL+ 00
53 SF 25
54 FC?C IND ST X
55 GTO 09
56 GTO A
57▸LBL 09
58 FC?C 25
59 GTO 10
60 SF IND ST X
61 GTO A
62▸LBL 07
63 RCL 00
64 6
65 -
66 X<0?
67 96.09606
68 STO 00
69 GTO A
70▸LBL 08
71 ISG 00
72 GTO A
73 GTO "FCAT"
74▸LBL 10
75 FS?C 21
76 GTO 11
77 XEQ 12
78 GTO A
79▸LBL 11
80 XEQ 12
81 SF 21
82 GTO A
83▸LBL 12
84 BEEP
85 "Restricted "
86 ├"Operation"
87 AVIEW
88 PSE
89 RTN
90 END
Find all posts by this user
Quote this message in a reply
05-22-2024, 01:26 AM
Post: #4
RE: need help with FCAT program for HP 42S
Appears to be a NO-OP.

Curiously, there is also a >LBL 14 at line 53 of FL (see p. 168) of the PPC ROM manual.

17bii | 32s | 32sii | 41c | 41cv | 41cx | 42s | 48g | 48g+ | 48gx | 50g | 30b

Find all posts by this user
Quote this message in a reply
05-22-2024, 07:17 AM (This post was last modified: 05-23-2024 12:55 AM by Thomas Klemm.)
Post: #5
RE: need help with FCAT program for HP 42S
If you wonder why LBL 14 is used and not LBL 99 to indicate a NO-OP: it is the highest one-byte label.
From LBL 15 on they consume two bytes.

And then they give the precious byte away with a useless use of a RTN statement:
Code:
89 RTN
90 END
Find all posts by this user
Quote this message in a reply
05-23-2024, 12:17 AM
Post: #6
RE: need help with FCAT program for HP 42S
(05-22-2024 07:17 AM)Thomas Klemm Wrote:  If you wonder why LBL 14 is used and not LBL 99 to indicate a NO-OP: it is highest one-byte label.
From LBL 15 on they consume two bytes.

And then they give the precious byte away with a useless use of a RTN statement:
Code:
89 RTN
90 END

Although END returns from a subroutine the same way as RTN, RTN is a tad faster, which is especially noticeable when the subroutine is called many times in a loop. So RTN END is not a useless waste of one byte, but rather slightly improves execution time.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
05-23-2024, 12:51 AM
Post: #7
RE: need help with FCAT program for HP 42S
(05-23-2024 12:17 AM)Joe Horn Wrote:  So RTN END is not a useless waste of one byte, but rather slightly improves execution time.

To make up for this, a pause was added beforehand:
Code:
88 PSE
89 RTN
90 END
Find all posts by this user
Quote this message in a reply
05-23-2024, 02:55 AM
Post: #8
RE: need help with FCAT program for HP 42S
(05-23-2024 12:51 AM)Thomas Klemm Wrote:  
(05-23-2024 12:17 AM)Joe Horn Wrote:  So RTN END is not a useless waste of one byte, but rather slightly improves execution time.

To make up for this, a pause was added beforehand:
Code:
88 PSE
89 RTN
90 END

This made me laugh out loud. Smile

I'm only glad my wife didn't hear, can you imagine trying to explain why this is funny to a non-calculator nerd...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-23-2024, 04:35 AM
Post: #9
RE: need help with FCAT program for HP 42S
Thanks for the answers.

Pg 131 of the owner's manual states:

"Without the PSE instructions (lines 03 and 06) the program would run
too fast to see the first two messages. A PSE is not needed after the
last AVIEW because the viewed information remains in the display
after the program stops. "

So in the case of FCAT, the PSE is unnecessary.

According to my deconstruction of FCAT, LBL 12 is a subroutine so it may
be entered elsewhere thus RTN is required there. Regardless, I have enough
OCD to require that.

Wow, we now have a working FCAT that is 231 bytes in size.

I wonder how the exalted HP engineers/editor missed these?

Or is this a test ?

Should I expect an invite into a secret society?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
05-23-2024, 06:56 AM
Post: #10
RE: need help with FCAT program for HP 42S
Erratum:

88 PSE

turns out to be necessary.

If you attempted to set/clear a system flag, the
87 AVIEW would be rapidly replaced by
20 "FLAG CATALOG"

I saved one byte.

I don't think there is anything else to add to this thread.

PS I worked for IBM, 30 years.
Find all posts by this user
Quote this message in a reply
05-28-2024, 06:04 AM (This post was last modified: 05-28-2024 06:06 AM by ELye.)
Post: #11
RE: need help with FCAT program for HP 42S
(05-22-2024 01:26 AM)Allen Wrote:  Appears to be a NO-OP.

Curiously, there is also a >LBL 14 at line 53 of FL (see p. 168) of the PPC ROM manual.

You are absolutely right. See attached jpg.


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Post Reply 




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