04-18-2014, 06:10 PM
04-20-2014, 07:02 AM
Is this for the 41, Thomas? I ran into trouble with step 38, which appears to do recall arithmetic with a stack register, something my 41CX seems unwilling to do.
04-20-2014, 07:48 AM
(04-20-2014 07:02 AM)Les Bell Wrote: [ -> ]Is this for the 41, Thomas?Nah, the 42S.
Quote:I ran into trouble with step 38, which appears to do recall arithmetic with a stack register, something my 41CX seems unwilling to do.Replace it with:
Code:
38 RCL Y
39 /
But then you have to replace lines 05-07 at the beginning as well:
Code:
05 ENTER
06 XEQ 01
07 RDN
08 3
HTH
Thomas
04-20-2014, 08:44 AM
(04-20-2014 07:48 AM)Thomas Klemm Wrote: [ -> ]Nah, the 42S.
Yes, I twigged to that a few minutes later. Thanks for the update - it will save me a bit of fiddling!
Also, for any other 41 users: line 41 becomes "FRC" on the 41. And the AIP instruction on line 29 is implemented by the AIP function in the Advantage module, presumably appending the integer part of X to the Alpha register.
04-21-2014, 02:48 PM
(04-20-2014 07:48 AM)Thomas Klemm Wrote: [ -> ](04-20-2014 07:02 AM)Les Bell Wrote: [ -> ]Is this for the 41, Thomas?Nah, the 42S.
Since this is the HP41 Software Library, here is a version that runs on all 41s. Here is the code:
Code:
01 LBL "FACTOR"
02 STO 00
03 2
04 CLA
05 ENTER
06 XEQ 01
07 RDN
08 3
09 XEQ 01
10 XEQ 01
11 LBL 00
12 XEQ 01
13 +
14 XEQ 01
15 XEQ 01
16 +
17 XEQ 01
18 XEQ 01
19 +
20 XEQ 01
21 +
22 +
23 XEQ 01
24 XEQ 01
25 +
26 +
27 GTO 00
28 LBL 03
29 RCL 00
30 XEQ 04
31 PROMPT
32 LBL 02
33 +
34 ST/ 00
35 XEQ 04
36 AVIEW
37 >"X"
38 LBL 01
39 RCL 00
40 RCL Y
41 /
42 X<Y?
43 GTO 03
44 FRC
45 X=0?
46 GTO 02
47 CLX
48 +
49 +
50 RTN
51 LBL 04
52 RCL d
53 FIX 0
54 CF 29
55 ARCL Y
56 STO d
57 CLX
58 +
59 END
This version includes a short routine at LBL 04 that replaces the AIP command. There are two synthetic instructions (RCL d and STO d) that save and restore the display state. If you do not know how to handle this, simply replace that subroutine with...
Code:
51 LBL 04
52 FIX 0
53 CF 29
54 ARCL X
55 FIX 4
56 SF 29
57 END
There also is an additional AVIEW in line 36 so that you can watch the result build up. ;-) Omit it if you don't like it.
Both program versions have a slight design flaw: they stop with pending subroutine calls, to that they cannot end with a RTN or END and a final PROMPT is required. I did not take a closer look at the way FACTOR works, so I left it that way.
Dieter
Edit: corrected an error in the listing.
04-21-2014, 04:50 PM
(04-21-2014 02:48 PM)Dieter Wrote: [ -> ]Since this is the HP41 Software LibrarySorry if I placed the program in the wrong section, but I just didn't find any programs for the HP-42S at the General Software Library.And then it says here:
Quote:Contributed programs for the HP-41C Family.So I thought the HP-42S might belong to this family. If this is a problem the thread can be moved.
Quote:here is a version that runs on all 41sThanks for taking the time to put that together.
Quote:I did not take a closer look at the way FACTOR worksNothing fancy, similar to Factors and Primes for the HP-67. It was mentioned in a recent thread:What is the best BASIC Pocket Computer. I wrote that program a while ago so I thought to myself, I can just as well upload it here.
Cheers
Thomas
04-22-2014, 06:03 AM
(04-21-2014 04:50 PM)Thomas Klemm Wrote: [ -> ]Sorry if I placed the program in the wrong section, but I just didn't find any programs for the HP-42S at the General Software Library.And then it says here:
Quote:Contributed programs for the HP-41C Family.So I thought the HP-42S might belong to this family. If this is a problem the thread can be moved.
No problem as far as I can see, Thomas - I was just thrown a little when I started keying the program in and then came across the recall arithmetic; I was wondering whether it might be using synthetics (which I haven't played with, much).
Perhaps a useful guideline might be to specify at the top which particular member of the 41 family a program was developed on or for, as well as any other requirements (e.g. for modules or peripherals).
Incidentally, I pulled a WP-34S out of my drawer and easily adapted your program to run on that, too - so the "family" label seems quite appropriate.
Now, about your "Solving a Single Congruence Equation" listing . . .
04-22-2014, 07:45 AM
(04-22-2014 06:03 AM)Les Bell Wrote: [ -> ]Perhaps a useful guideline might be to specify at the top which particular member of the 41 family a program was developed on or for, as well as any other requirements (e.g. for modules or peripherals).Added [HP-42S] to the subject.
Quote:Now, about your "Solving a Single Congruence Equation" listing . . .I know. That won't be easy without RCL-arithmetic.
Cheers
Thomas
04-22-2014, 09:08 AM
(04-22-2014 07:45 AM)Thomas Klemm Wrote: [ -> ]Added [HP-42S] to the subject.Can I suggest putting the calculator type after the program name, or even just in the top of the post body somewhere? It doesn't seem as important as the program name, and the square brackets here are messing up the alphabetical listing.
Quote:Now, about your "Solving a Single Congruence Equation" listing . . .I know. That won't be easy without RCL-arithmetic.
[/quote]
Not to worry. If I need it, I'll figure it out.