[HP 35s] Hosoda's trig program affected by bug 20?
07-29-2015, 07:21 PM (This post was last modified: 07-29-2015 07:32 PM by Dieter.)
Post: #7
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: [HP 35s] Hosoda's trig program affected by bug 20?
(07-29-2015 06:56 PM)Thomas Klemm Wrote:  If that's the only reason that the solver fails then you could use a loop-unrolling:
Code:
J004 X<> 00 J005 ABS J006 RCL 03 J007 RCL 02 J008 RCL 01 J009 RCL 00 J010 RTN

Code:
J015 RPN J016 STO 00 J017 R↓ J018 STO 01 J019 R↓ J020 STO 02 J021 R↓ J022 STO 03 J023 R↓

The 35s does not use direct numeric registers like the classic calculators. It uses 26 lettered variables A...Z instead. These can be accessed indirectly by negative (!) addresses, i.e. A is –1, B is –2 etc. Of course your idea can be implemented by replacing R00...R03 with A...D – or X, Y, Z and T, if you like.

The Hosoda program uses positive addresses instead. These refer to the 800+ indirect registers of the 35s. So a STO (I) with I=3 stores a value in register (003). I assume this was the preferred solution because this way the program does not interfere with the regular variables A...Z that can be accessed directly by the user.

(07-29-2015 06:56 PM)Thomas Klemm Wrote:  I must admit that I don't understand the following lines:
Code:
J018 4 J019 STO I J020 STO(I) J021 DSE I

Why do we need the value 4 in register 04?

I think the author wanted to make sure that at least four indirect registers are allocated. On the 35s this is done by storing a non-zero value in the highest register (here (004). Since the values on the stack may be zero, explicitly storing a non-zero number (here: 4) there (resp. the first one beyond it) makes sure that registers up to (004) are allocated. Finally (000)...(003) hold the original stack, and (004) contains a 4, which merely tells the 35s to allocate sufficient memory.

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread [HP 35s] Hosoda's trig program affected by bug 20? - Marcio - 07-24-2015, 11:10 AM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Gerald H - 07-24-2015, 11:19 AM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Marcio - 07-24-2015, 11:34 AM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Gerald H - 07-24-2015, 11:49 AM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Marcio - 07-29-2015, 01:42 PM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Thomas Klemm - 07-29-2015, 06:56 PM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Dieter - 07-29-2015 07:21 PM RE: [HP 35s] Hosoda's trig program affected by bug 20? - Thomas Klemm - 07-29-2015, 07:52 PM

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