Post Reply 
HP 35s Programming Question
03-06-2022, 09:28 PM
Post: #1
HP 35s Programming Question
Hi!
I love calculators and just got an HP35s (I code in assembly, so RPN just makes sense to me). But... after a few days and reading (even bought a book), I keep running into a wall. I am sure it's SUPER easy and I just am reading wrong, but I wanted to ask if any of you knew how to set me stright.

I write a simple program, call it A, and then I try to write another, but all I can seem to do is edit A. From an assembly prospective, it's like I cannot switch the code segment register.

GTO
..
[teal right arrow]
PRGM
A001 LBL A
A002 INPUT X
A003 2
A004 RCL X
A005 *
C

This works great and performs 2 * X. When I try to add a new program, call it B, I cannot get the calculator to switch to a new memory space. I am sure this is so simple, but the books I have read/bought either don't cover it or what they do show doesn't seem to work. Here's what I do next, starting from the starting input screen:
GTO
..
[teal right arrow]
PRGM <- here, I just see program A again. Typing GTO B doesn't work and says NONEXISTANT
A001 LBL B <- when I switch the label to B, the program becomes B, but A vanishes. Same code segment.
B002 INPUT X
B003 2
B004 RCL X
B005 *
C

Any ideas? This must be super simple and I just don't see it.
~Ishtar o_O
Find all posts by this user
Quote this message in a reply
03-07-2022, 01:38 AM (This post was last modified: 03-07-2022 01:43 AM by toml_12953.)
Post: #2
RE: HP 35s Programming Question
(03-06-2022 09:28 PM)Ishtar Wrote:  PRGM <- here, I just see program A again. Typing GTO B doesn't work and says NONEXISTANT
A001 LBL B <- when I switch the label to B, the program becomes B, but A vanishes. Same code segment.
B002 INPUT X
B003 2
B004 RCL X
B005 *
C

Any ideas? This must be super simple and I just don't see it.
~Ishtar o_O

You need a RTN at the end of Program A, See Page 13-4 of the HP-35s User's Guide.

Quote:Program Boundaries (LBL and RTN)
If you want more than one program stored in program memory, then a program
needs a label to mark its beginning (such as A001 LBL A) and a return to mark its
end (such as A005 RTN).
Notice that the line numbers acquire an A to match their label.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
03-07-2022, 03:52 AM
Post: #3
RE: HP 35s Programming Question
That's because in the 35S, and most of its predecessors, there is only one memory space. Smile You can put multiple programs in memory by using multiple labels, each label being a different entry point. So you can either go to the top or bottom of program memory, add a LBL B, and start entering another program.

The 41C and 42S are the only two HP RPN calculators I can think of off the top of my head that use END to partition multiple independent program areas in memory. The unreleased HP 95C was to have something kind of similar, but simpler.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-07-2022, 05:49 AM (This post was last modified: 03-07-2022 05:53 AM by toml_12953.)
Post: #4
RE: HP 35s Programming Question
(03-07-2022 03:52 AM)Dave Britten Wrote:  That's because in the 35S, and most of its predecessors, there is only one memory space. Smile You can put multiple programs in memory by using multiple labels, each label being a different entry point. So you can either go to the top or bottom of program memory, add a LBL B, and start entering another program.

The 41C and 42S are the only two HP RPN calculators I can think of off the top of my head that use END to partition multiple independent program areas in memory. The unreleased HP 95C was to have something kind of similar, but simpler.

You can't do that. Program A will run right into program B. Example

Code:
LBL A
2
*
LBL B
3
+

If you type

2, XEQ, A, Enter

you'll get 7, not 4. In order to separate programs each one has to have RTN at the end. The following would work:

Code:
LBL A
2
*
RTN
LBL B
3
+
RTN

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
03-07-2022, 09:16 PM
Post: #5
RE: HP 35s Programming Question
OMG that's it!!! Ho did I not realize this... it's not just like macro assembly... it just about is!
You have to have a RET in maocro assembly to get return to the calling memory.

So, HP uses, effectivly, a single paragraph of memory, and I some sort of program vector table with ret's. That makes sense and why it's doing what it is doing! The entire space is just one giant (mostly empty) program space until I add a return.

[Image: hp35s.jpg]

٩(^‿^)۶
Thank you all so much! \o/ ♡♡♡
It should have been obvious, but my brain is so frazzled with university stuff and work lol


Now... back to day dreaming over getting a DM42 lol

~Ishtar
Find all posts by this user
Quote this message in a reply
03-08-2022, 11:04 PM
Post: #6
RE: HP 35s Programming Question
(03-07-2022 09:16 PM)Ishtar Wrote:  OMG that's it!!! Ho did I not realize this... it's not just like macro assembly... it just about is!
You have to have a RET in maocro assembly to get return to the calling memory.

٩(^‿^)۶
Thank you all so much! \o/ ♡♡♡
It should have been obvious, but my brain is so frazzled with university stuff and work lol


Now... back to day dreaming over getting a DM42 lol

~Ishtar

You're welcome. While the DM42 is certainly worth dreaming over, it's even better to buy it! Big Grin

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




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