HP-65 Question
03-31-2017, 08:16 PM
Post: #1
 Greg Junior Member Posts: 25 Joined: Jan 2016
HP-65 Question
The HP-65 only supports one layer of subroutines. You can call one from a main program but you shouldn't call another from there.

The HP-65 Owners Manual says, if you do call lower level subroutines, the first RTN will take you back to the main program.

That suggests that starting with 0.00 in X and pressing [D] in the following:

PHP Code:
001: 23 : LBL002: 11 : A003: 01 : 1004: 61 : +005: 24 : RTN006: 23 : LBL007: 12 : B008: 02 : 2009: 61 : +010: 11 : A011: 03 : 3012: 61 : +013: 24 : RTN014: 23 : LBL015: 13 : C016: 04 : 4017: 61 : +018: 12 : B019: 05 : 5020: 61 : +021: 24 : RTN022: 23 : LBL023: 14 : D024: 06 : 6025: 61 : +026: 13 : C027: 07 : 7028: 61 : +029: 24 : RTN

will produce (6 + 4 + 2 + 1 + 7 +) 20.

Does anyone have a physical HP-65 that can confirm that for me?

- Greg from sydneysmith.com
Post: #2
 Brad Barton Member Posts: 190 Joined: Jan 2014
RE: HP-65 Question
(03-31-2017 08:16 PM)Greg Wrote:  will produce (6 + 4 + 2 + 1 + 7 +) 20.

Does anyone have a physical HP-65 that can confirm that for me?

Yes, the result is 20 on a physical 65. As you suspected, when the program encountered the RTN in the A subroutine, it was sent back to finish up the originally executed D subroutine, rather than run sequentially through the other subs.

03-31-2017, 11:33 PM
Post: #3
 teenix Senior Member Posts: 1,713 Joined: May 2016
RE: HP-65 Question
(03-31-2017 08:16 PM)Greg Wrote:  will produce (6 + 4 + 2 + 1 + 7 +) 20.

Does anyone have a physical HP-65 that can confirm that for me?

Yes, the result is 20 on a physical 65. As you suspected, when the program encountered the RTN in the A subroutine, it was sent back to finish up the originally executed D subroutine, rather than run sequentially through the other subs.

Oops, I missed that point in the 65 manual.

I rewrote the 65 emulator's Mark and Search code to manage the subroutines in the same way. The emulator now returns 20 as well.

cheers

Tony
04-01-2017, 12:59 AM
Post: #4
 Greg Junior Member Posts: 25 Joined: Jan 2016
RE: HP-65 Question
Wow that was fast Tony. I haven't even put up the fix I developed for mine yet, as I wanted to confirm the behaviour on the real thing first.

I'd noticed the problem on other emulators too. Yours always looks so good.

- Greg from sydneysmith.com
04-01-2017, 02:34 AM
Post: #5
 teenix Senior Member Posts: 1,713 Joined: May 2016
RE: HP-65 Question
(04-01-2017 12:59 AM)Greg Wrote:  Wow that was fast Tony. I haven't even put up the fix I developed for mine yet, as I wanted to confirm the behaviour on the real thing first.

I'd noticed the problem on other emulators too. Yours always looks so good.

Hi Greg,

Thanks

It's been awhile since I got the 65 working so it was a bit of a brain strain remembering how the code for the program buffer worked :-)

Just now, I had to upload again because I forgot to update the PICmicro code for the 65 hardware emulator as well.

Cheers

Tony
04-01-2017, 03:30 AM
Post: #6
 Brad Barton Member Posts: 190 Joined: Jan 2014
RE: HP-65 Question
Amazing response! Thanks for updating the app so quickly.