HP-65 Financial Software request
01-07-2019, 11:22 PM
Post: #21
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 08:51 PM)Thomas Klemm Wrote:  There's still missing a RTN statement before LBL E:

Yes, of course, sorry. #-)
I will fix the listing right after this post.

(01-07-2019 08:51 PM)Thomas Klemm Wrote:  PS: And I thought that the HP-65 Microcode Emulator is buggy.

I have not tried the emulator. Does the program work as it is supposed to?
Alberto seems to get weird results.

Dieter
01-07-2019, 11:34 PM (This post was last modified: 01-07-2019 11:36 PM by Dieter.)
Post: #22
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 09:35 PM)albertofenini Wrote:  I initialize the program with LBL E

Then I key in 40 LBL A,

You must not key in 40 [LBL] [A], but 40 [A].

(01-07-2019 09:35 PM)albertofenini Wrote:  and then sometimes it returns 0.00, while sometimes it returns 0.03

Any input different from 0 should return 0. This confirms that the input has been stored.
If you see anything else the program has calculated that value.

Take a look at the test commands, i.e. the x≠y? tests following LBL A, B and C.
The sequence alsways is...

Code:
LBL (A, B or C) STO (1, 2 or 3) 0 g x≠y? RTN g NOP ...

Be sure to use the "x not equal to y" test.

(01-07-2019 09:35 PM)albertofenini Wrote:  When it returns 0.00 if I key in 50 LBL B then the program returns 0.00 and pressing C returns the right value as in the example.

You must not press 50 [LBL] [B] but 50 [B].

(01-07-2019 09:35 PM)albertofenini Wrote:  However when 0.03 was returned after keying a value for LBL A, even pressing Clx, typing 50 for B will return 0.07 and C
will return a weird value.

I can't reproduce this. May someone else try the program in post #5 and report his results?

(01-07-2019 09:35 PM)albertofenini Wrote:  I don't want to bother you more than I already did, and I have the HP14B and 10B that have this feature,
but I would like to understand what am I doing wrong, so if you have time I will appreciate any further comment

We will get this running, even if it takes more posts. Maybe there still is an error in the program, maybe you entered something wrong. Have you compared the key codes?

Dieter
01-08-2019, 06:56 PM (This post was last modified: 01-08-2019 07:04 PM by Dieter.)
Post: #23
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 06:21 PM)PedroLeiva Wrote:  Sorry, it doesn´t work for me. I checked key stroking twice. When I press [C] in the sequence as 4th. step, I got =0, not 20. The same happens when I use HP67

This was caused by the missing RTN (fixed yesterday). That way the margin calculation was directly followed by routine E which cleared all values. #-)

(01-07-2019 09:35 PM)albertofenini Wrote:  I have keyed in the program, including the RTN instruction before LBL E as pointed out in one of the latest posts.
I have double checked the listing and recorded on a card, it works but not always, let me explain.

OK, I have now tested both programs (post #5 and #10) in the HP65 emulator that Thomas linked to. Both versions work fine and behave as intented.

Alberto, this means there must be an error somewhere in your program.
What about this: take your HP65, switch to PRGM mode and post the keycodes here. This way the problem should be resolved easily.

Dieter
01-08-2019, 07:10 PM
Post: #24
 Don Shepherd Senior Member Posts: 627 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-08-2019 06:56 PM)Dieter Wrote:  Alberto, this means there must be an error somewhere in your program.

Alberto, I would add here that you may have entered the program exactly as Dieter showed, but sometimes the 65 adds keystrokes to the stored program without you being aware of it. I have two 65's and each sometimes do this. After I enter a new program I step through it (SST in PRGM mode) and check each line with what I thought I entered. I frequently find keystrokes that shouldn't be there, in which case I delete them.

So make sure your keycodes match exactly with Dieter's.
01-08-2019, 08:00 PM (This post was last modified: 01-08-2019 08:02 PM by Dieter.)
Post: #25
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 10:15 PM)PedroLeiva Wrote:  It works perfect for HP67. Thank´s. Pedro

In the past much more sophisticated cost-price-margin-markup programs have been posted here, also for the HP67. And since the 67 has a percent and %CH function the code can be significantly shorter than the direct translation of the HP65 version I posted. For instance the margin can be calculated in merely four steps: RCL 2 RCL 1 %CH CHS.

So I hope you don't keep this program for the HP67 – there are much better ones.

Dieter
01-08-2019, 08:18 PM
Post: #26
 Thomas Klemm Senior Member Posts: 1,448 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 11:22 PM)Dieter Wrote:  I have not tried the emulator. Does the program work as it is supposed to?

(01-08-2019 06:56 PM)Dieter Wrote:  OK, I have now tested both programs (post #5 and #10) in the HP65 emulator that Thomas linked to.

I can confirm that the program from your post #5 works with the emulator.

The need of a NOP after a conditional test surprised me:
Quote:Note that in cases where only a single step needs to be executed or skipped based on a condition, you should place a g NOP in the 2nd skippable step.

That's why I assumed a faulty emulator.

Cheers
Thomas
01-09-2019, 03:31 PM
Post: #27
 Thomas Klemm Senior Member Posts: 1,448 Joined: Dec 2013
RE: HP-65 Financial Software request
From HP-65 Programming:
Quote:Note that the HP-65 powers up with programs entered to give default functions to the A-E keys (1/x etc.). Pressing f PRGM removes these programs.

And then later:
Quote:This program uses label A which was used in other examples. The calculator will allow you to use the same label again and this can be a useful feature but it can also lead to confusion as the calculator will always go to the next A downward in memory from the current position.

Thus I assume that you're still having the initial program or part of it in the calculator:
Code:
001: 23    : LBL 002: 11    : A 003: 35    : g 004: 04    : 1/x 005: 24    : RTN 006: 23    : LBL 007: 12    : B 008: 31    : f 009: 09    : SQRT 010: 24    : RTN 011: 23    : LBL 012: 13    : C 013: 35    : g 014: 05    : y^x 015: 24    : RTN 016: 23    : LBL 017: 14    : D 018: 35 08 : g Rv 019: 24    : RTN 020: 23    : LBL 021: 15    : E 022: 35 07 : g x<>y 023: 24    : RTN

(01-07-2019 09:35 PM)albertofenini Wrote:  I initialize the program with LBL E
Then I key in 40 LBL A, and then sometimes it returns 0.00, while sometimes it returns 0.03

That's what I get with:

40
1/x
0.03

Quote:However when 0.03 was returned after keying a value for LBL A, even pressing Clx, typing 50 for B will return 0.07 and C will return a weird value.

Could it rather be 7.07?
That's what I get with:

50
√x
7.07

Thus make sure to press f CLEAR PRGM in W/PRGM mode before entering Dieter's program.

HTH
Thomas
01-09-2019, 03:55 PM
Post: #28
 Dave Britten Senior Member Posts: 1,140 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-07-2019 05:48 PM)Dieter Wrote:  And finally here is another way of handling input and output with the same label keys: The COMPUTE key, which can be found on some classic, vintage HP65 programs.

Initialize (clear all three values) with [E].
Enter cost at [A], price at [B] and margin at [C].

To compute a value use the same keys preceded by [D]. This is the "compute" key. ;-)

That's a clever way of doing it. Sharp and TI financial calculators work that way. You could probably simplify this further by using R/S as the "compute key", and pressing it after the variable key. Something like this:

Code:
LBL A STO 0 R/S ...compute value for A-key variable here... GTO A

So you'd press A, R/S to calculate A. The value stored by pressing A could either be ignored, or used as an initial guess for an iterative solver.
01-09-2019, 04:13 PM
Post: #29
 Thomas Klemm Senior Member Posts: 1,448 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-09-2019 03:55 PM)Dave Britten Wrote:  That's a clever way of doing it. (…) You could probably simplify this further by using R/S as the "compute key", and pressing it after the variable key.

Cheers
Thomas
01-09-2019, 04:59 PM
Post: #30
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
That's EXACTLY what it happens to me,
I always do a CLEAR PRGM but still happens,
also, when it doesn't happen it works only the first time,
if I change one of the variables, say I want to increase the margin and
get the new selling value, it doesn't work.
I hadn't realized that 3.03 and 7.07 are the result of the pre-assigned functions to KEYS A and B with my input values.
I'll check better tonight and let you know, thank you so much take care Alberto

Edoardo & Alberto
01-09-2019, 07:08 PM (This post was last modified: 01-09-2019 07:17 PM by Dieter.)
Post: #31
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-09-2019 04:59 PM)albertofenini Wrote:  That's EXACTLY what it happens to me,
I always do a CLEAR PRGM but still happens

Wait a minute. You press f CLEAR PROGRAM, i.e. [f] [CLX], in PRGM mode (!) and the program is not cleared?
Check this: Press RTN, switch to W/PRGM and press f CLEAR PROGRAM. You will see "00 00".
Press SST. If you now see "23" program memory indeed has not been cleared.
If you see "35 01" the default programs have been successfully deleted.

(01-09-2019 04:59 PM)albertofenini Wrote:  I hadn't realized that 3.03 and 7.07 are the result of the pre-assigned functions to KEYS A and B with my input values.

If this is what happened the results are 0,03 and 7,07 which are the two-digit rounded values for 1/40 = 0,025 and √50 = 7,0710678... This would also explain the "weird results" you mentioned if the C key is pressed – by default that's the y^x power function which operates on both X and Y.

(01-09-2019 04:59 PM)albertofenini Wrote:  I'll check better tonight and let you know, thank you so much take care Alberto

Let us know if it finally works as it is suppsed to.

Dieter
01-09-2019, 09:51 PM
Post: #32
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
Hi everyone, this is what actually happens :

Turn the calculator, Switch to W/PRGM, SST reveals the following code :

23
11
35
04
24
...

That should be the default code for LBL A loaded at the startup, right ?

Then, I switch back to RUN and I read my magnetic card where I have recorded the code for CST, SEL and MAR (Cost, Sell and Margin from post #5),
now if I switch to W/PRGM SST reveals the following code :

23
11
33 01
00
35 21
...

I have checked all the listing and it looks like this :

LBL 23
A 11
STO 1 33 01
0 00
g x≠y? 35 21
RTN 24
g NOP 35 01
RCL 2 34 02
RCL 2 34 02
RCL 3 34 03
x 71
EEX 43
2 02
÷ 81
- 51
STO 1 33 01
RTN 24
LBL 23
B 12
STO 2 33 02
0 00
g x≠y? 35 21
RTN 24
g NOP 35 01
RCL 1 34 01
1 01
RCL 3 34 03
EEX 43
2 02
÷ 81
- 51
÷ 81
STO 2 33 02
RTN 24
LBL 23
C 13
STO 3 33 03
0 00
g x≠y? 35 21
RTN 24
g NOP 35 01
1 01
RCL 1 34 01
RCL 2 34 02
÷ 81
- 51
EEX 43
2 02
x 71
STO 3 33 03
RTN 24
LBL 23
E 15
DSP 21
. 83
2 02
CLx 44
STO 1 33 01
STO 2 33 02
STO 3 33 03
RTN 24

This IS the correct listing, in fact, if I switch again to RUN and I type :

40 A -> 0.00
50 B -> 0.00
C -> 20.00

The problem is when I try to execute it a second time, in fact, if I type now :

40 A I get 0.03 (which is 1/40 in DSP.2 mode)

Somehow it looks like after the first execution is not returning at the beginning of the code, ready for a second run.
If I switch to W/PRGM and I go after the LAST line of the code written from the forum this is what I find :

23
11
35
04
24

It looks like somehow the original code loaded at startup has been shifted at the end
of the code read from the magnetic card.

I must said that if after the first successful run of the code I press RTN then I can execute
the code a second time with no problem.

What am I missing here ?
thanks again Alberto

Edoardo & Alberto
01-09-2019, 10:45 PM (This post was last modified: 01-09-2019 10:46 PM by Dieter.)
Post: #33
 Dieter Senior Member Posts: 2,398 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-09-2019 09:51 PM)albertofenini Wrote:  Turn the calculator, Switch to W/PRGM, SST reveals the following code :

23
11
35
04
24
...

That should be the default code for LBL A loaded at the startup, right ?

Right.

(01-09-2019 09:51 PM)albertofenini Wrote:  Then, I switch back to RUN and I read my magnetic card where I have recorded the code for CST, SEL and MAR (Cost, Sell and Margin from post #5),
now if I switch to W/PRGM SST reveals the following code :

Antonio, for such listings you should use the "code" button in the message editor. This way the listing keeps its formatting and a non-proportional font ensures proper alignment.

Anyway....

(01-09-2019 09:51 PM)albertofenini Wrote:  I have checked all the listing and it looks like this :

LBL 23
A 11
STO 1 33 01
0 00
g x≠y? 35 21
RTN 24
g NOP 35 01

(...)

CLx 44
STO 1 33 01
STO 2 33 02
STO 3 33 03
RTN 24

The listing looks OK.
But now: what do you see after these steps? All next steps should be "35 01", i.e. "NOP". But I suspect there is something different.

I guess (!, and this is really just a guess) that you entered the program earlier without clearing the default programs first. This way these instructions move to the end of the program, and you should see them after the final "24" (RTN):

If you now see "23" "11" this is the proof that the magnetic card has been recorded with the default programs still in memory. So they will be loaded back into the calculator every time you read the card.

This would explain the behaviour you described:

(01-09-2019 09:51 PM)albertofenini Wrote:  The problem is when I try to execute it a second time, in fact, if I type now :

40 A I get 0.03 (which is 1/40 in DSP.2 mode)

Somehow it looks like after the first execution is not returning at the beginning of the code, ready for a second run.
If I switch to W/PRGM and I go after the LAST line of the code written from the forum this is what I find :

23
11
35
04
24

Voilà, there we are. The default programs are still there. Probably because they have been recorded when the program card was written.

So simply clear these instructions (from 23 11 onwards, until you see NOP or the end of program memory is reached) and simply re-record the program on magnetic card.

(01-09-2019 09:51 PM)albertofenini Wrote:  It looks like somehow the original code loaded at startup has been shifted at the end of the code read from the magnetic card.

In this case you would own a very ..."special" HP65. ;-)
It looks more like you have entered the program without having cleared the default programs first, so these indeed were shifted to the end, and then this combination of "my" program and the default programs has been recorded on card.

Just guessing, but for me this is the most plausibe explanation.

Dieter
01-09-2019, 10:52 PM
Post: #34
 Thomas Klemm Senior Member Posts: 1,448 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-09-2019 09:51 PM)albertofenini Wrote:  It looks like somehow the original code loaded at startup has been shifted at the end
of the code read from the magnetic card.

My naïve assumption is that the original code loaded at startup somehow made it onto the magnetic card. Thus I suggest to NOP that code and record just Dieter's program once again on a magnetic card. And then try to read that card and see what happens.

Don't ask me how the original code made it to the magnetic card.

HTH
Thomas
01-13-2019, 11:10 AM
Post: #35
 albertofenini Member Posts: 261 Joined: Mar 2014
RE: HP-65 Financial Software request
Dear All,
I have just tried and it works, I have done a f CLEAR PRGM with the switch in PRGM position
before entering the listing, entered the code at post #5 and now it works perfectly.
I can change the input parameters as I like and get the right result !
Thank you very much for the code and for the support !
Take care !

Edoardo & Alberto
01-13-2019, 08:10 PM
Post: #36
 Don Shepherd Senior Member Posts: 627 Joined: Dec 2013
RE: HP-65 Financial Software request
(01-13-2019 11:10 AM)albertofenini Wrote:  Dear All,
I have just tried and it works, I have done a f CLEAR PRGM with the switch in PRGM position
before entering the listing, entered the code at post #5 and now it works perfectly.
I can change the input parameters as I like and get the right result !
Thank you very much for the code and for the support !
Take care !

It looks like the key here was you have to be in PRGM mode when you do the CLEAR PRGM function. Always remember to do that as soon as you switch to PRGM mode and are about to enter a new program. I have also occasionally forgotten that and have regretted it!
 « Next Oldest | Next Newest »

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