Clearing Last X Register "L"
Clearing Last X Register "L"
Is it possible to clear the Last X Register "L" without having to operate on the X Register holding a Zero? It doesn't clear when you do a CLSK command. I know it clears if you do a Clear All, but that not a viable situation on anything but a brand new calculator with no stored programs or constants. i don't even know why I would want to do this except to initialize the stack before running a program, but that seems to be a good reason.
DM42 (#6476), DM41X (#458), DM15, 12 - HP 12, 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 41CX, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
I may have a problem!
Re: Clearing Last X Register "L"
There's no explicit way that I am aware of. What I usually do isamafan wrote: ↑Sat Oct 24, 2020 10:04 pmIs it possible to clear the Last X Register "L" without having to operate on the X Register holding a Zero? It doesn't clear when you do a CLSK command. I know it clears if you do a Clear All, but that not a viable situation on anything but a brand new calculator with no stored programs or constants. i don't even know why I would want to do this except to initialize the stack before running a program, but that seems to be a good reason.
Code: Select all
CLST
+
DM41X #542, DM42 #650, DM41L #801, HP 41CX, HP 41CV, HP 50G, HP11C, TI 89
-
- Posts: 49
- Joined: Tue Jun 19, 2018 11:01 am
- Location: France
Re: Clearing Last X Register "L"
What about :
LASTX
ST- ST L
but with this, X hold the previous value of L
DM15L - DM42 - DM41x
-
- Posts: 1100
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: Clearing Last X Register "L"
Setting LASTx to zero with no side effects is possible...
X<> ST L
CLX
X<> ST L
X<> ST L
CLX
X<> ST L
Re: Clearing Last X Register "L"
This is what I do now. It’s not bad and it can be easily programmed. I was just surprised to find out that CLST didn’t clear “L” at the same time.gmac42 wrote: ↑Sat Oct 24, 2020 10:39 pmThere's no explicit way that I am aware of. What I usually do isamafan wrote: ↑Sat Oct 24, 2020 10:04 pmIs it possible to clear the Last X Register "L" without having to operate on the X Register holding a Zero? It doesn't clear when you do a CLSK command. I know it clears if you do a Clear All, but that not a viable situation on anything but a brand new calculator with no stored programs or constants. i don't even know why I would want to do this except to initialize the stack before running a program, but that seems to be a good reason.Code: Select all
CLST +
DM42 (#6476), DM41X (#458), DM15, 12 - HP 12, 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 41CX, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
I may have a problem!
Re: Clearing Last X Register "L"
Technically, L is not part of the stack, but I've always found that a bit weird, too.
Does anyone know a better reason why CLST does not clear L?
Is there a common use case where you want to CLST but still need L?
DM41X #542, DM42 #650, DM41L #801, HP 41CX, HP 41CV, HP 50G, HP11C, TI 89
Re: Clearing Last X Register "L"
Yes, you're right that its not part of the stack and the behavior emulates the behavior of the original HP41s to maintain software compatibility. My OP was meant to see if there was something I had missed in the clear commands. Since not, I imagine the HP developers had some reasoning behind not Clearing "L" during CLST. So OK, it is what it is. Now that I know that I can deal with it.
DM42 (#6476), DM41X (#458), DM15, 12 - HP 12, 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 41CX, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
I may have a problem!
Re: Clearing Last X Register "L"
I found a discussion about the general topic of LASTX at https://www.hpmuseum.org/forum/thread-3345.html. The reason seems to between not considering L as part of the (operational) stack and a bit of tradition starting from HP-45. If you use a variant of the swap operation Thomas suggested (CLST instead of CLX), then you could also use this quirk/feature to wipe the rest of the stack (including L) but still keep x without storing to a variable or register. I suppose the reason why someone would want to do that would be similar to the reason why someone would want to clear the stack in the first place.
Sam