Trigonometric Functions for the HP-38C/HP-12C
07-12-2017, 09:25 PM
Post: #21
 tiptongrange Junior Member Posts: 5 Joined: Jul 2017
RE: Trigonometric Functions for the HP-38C/HP-12C
Here's the program for this simulator adapted to run on the 12C. Since the regular 12C doesn't have the x^2 function, whenever it's called, I use GTO ###, where ### is a register at the end of the program leading the sequence (2, y^x, GTO %%%) where %%% sends it back to the line after GTO ###. This is done to preserve the correct references for the rest of the GTO functions throughout the program--if I had entered (2, y^x) in place of (y^2) directly into the code, the extra step would have thrown all of the references off.

I also included the program for the solution you wrote the year before for the regular 12C. (http://www.hpmuseum.org/cgi-sys/cgiwrap/...i?read=487) Since the current simulator has extra registers, I was able to append an initialization routine to load the constants, similar to what's done in the program above. This one works fairly well while the one above has problems. To load the constants just enter (g GTO 101, R/S).

https://www.fastmail.com/files/45537103/?u=3d0c41af
07-12-2017, 09:36 PM (This post was last modified: 07-12-2017 09:37 PM by Dieter.)
Post: #22
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Trigonometric Functions for the HP-38C/HP-12C
(07-12-2017 09:25 PM)tiptongrange Wrote:  Since the regular 12C doesn't have the x^2 function, whenever it's called, I use GTO ###, where ### is a register at the end of the program leading the sequence (2, y^x, GTO %%%) where %%% sends it back to the line after GTO ###.

Please, do not use 2 y^x for squaring. [ENTER] [x] is much faster and less prone to roundoff errors. It even sets LastX correctly.

(07-12-2017 09:25 PM)tiptongrange Wrote:  This is done to preserve the correct references for the rest of the GTO functions throughout the program--if I had entered (2, y^x) in place of (y^2) directly into the code, the extra step would have thrown all of the references off.

You could adjust these references and thus avoid all those slow forward and backward jumps. Since you got the listing you can easily do it on paper, doublecheck everything and then simply enter the modified program. ;-)

Dieter
07-12-2017, 10:14 PM
Post: #23
 tiptongrange Junior Member Posts: 5 Joined: Jul 2017
RE: Trigonometric Functions for the HP-38C/HP-12C
Thanks for the tips! Actually, using [Enter] [x] instead of [2] [y^x] solved my problems, I'm now getting correct results.

I preserved the references because I think he purposely had [g GTO 090] [R/S] and [g GTO 100] [R/S] as an easy mnemonic for the cosine and tangent functions. Anyway, I'm getting almost instant results when I run the program, a blink, 'running', and then the answer in less than a second.
07-12-2017, 11:04 PM
Post: #24
 Gerson W. Barbosa Senior Member Posts: 1,429 Joined: Dec 2013
RE: Trigonometric Functions for the HP-38C/HP-12C
(07-12-2017 10:14 PM)tiptongrange Wrote:  I preserved the references because I think he purposely had [g GTO 090] [R/S] and [g GTO 100] [R/S] as an easy mnemonic for the cosine and tangent functions. Anyway, I'm getting almost instant results when I run the program, a blink, 'running', and then the answer in less than a second.

That was just a lucky coincidence. So 137 and 157. It wouldn't t be difficult to save a line somewhere so that the other address changes to 177 :-) Actually the program is not size-optimized as it could have been because there was plenty of space available.

Been busy all afternoon. Glad to know it's been solved!
 « Next Oldest | Next Newest »

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