HP Forums
need help with FCAT program for HP 42S - 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: need help with FCAT program for HP 42S (/thread-21773.html)



need help with FCAT program for HP 42S - ELye - 05-21-2024 06:11 AM

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.


RE: need help with FCAT program for HP 42S - ThirdPoliceMan - 05-21-2024 04:21 PM

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’.


RE: need help with FCAT program for HP 42S - Thomas Klemm - 05-21-2024 05:56 PM

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



RE: need help with FCAT program for HP 42S - Allen - 05-22-2024 01:26 AM

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.


RE: need help with FCAT program for HP 42S - Thomas Klemm - 05-22-2024 07:17 AM

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



RE: need help with FCAT program for HP 42S - Joe Horn - 05-23-2024 12:17 AM

(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.


RE: need help with FCAT program for HP 42S - Thomas Klemm - 05-23-2024 12:51 AM

(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



RE: need help with FCAT program for HP 42S - rprosperi - 05-23-2024 02:55 AM

(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...


RE: need help with FCAT program for HP 42S - ELye - 05-23-2024 04:35 AM

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?


RE: need help with FCAT program for HP 42S - ELye - 05-23-2024 06:56 AM

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.


RE: need help with FCAT program for HP 42S - ELye - 05-28-2024 06:04 AM

(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.