Clearing Last X Register "L"

Discussion around the Swiss Micros DM42 calculator.
Post Reply
amafan
Posts: 33
Joined: Tue Sep 29, 2020 11:40 pm

Clearing Last X Register "L"

Post by amafan »

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.
DM41X (#6476), 42 (#458) - HP 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
gmac42
Posts: 48
Joined: Fri Jun 01, 2018 11:30 am

Re: Clearing Last X Register "L"

Post by gmac42 »

amafan wrote:
Sat Oct 24, 2020 10:04 pm
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.
There's no explicit way that I am aware of. What I usually do is

Code: Select all

CLST
+
DM42 #650, DM41L #801, HP 41CX, HP 41CV, HP 50G, TI 89
bernouilli
Posts: 29
Joined: Tue Jun 19, 2018 11:01 am
Location: France

Re: Clearing Last X Register "L"

Post by bernouilli »

amafan wrote:
Sat Oct 24, 2020 10:04 pm
Is it possible to clear the Last X Register "L" without having to operate on the X Register holding a Zero?
What about :
LASTX
ST- ST L

but with this, X hold the previous value of L
DM15L - DM42 - DM41x
Thomas Okken
Posts: 788
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Clearing Last X Register "L"

Post by Thomas Okken »

Setting LASTx to zero with no side effects is possible...

X<> ST L
CLX
X<> ST L
amafan
Posts: 33
Joined: Tue Sep 29, 2020 11:40 pm

Re: Clearing Last X Register "L"

Post by amafan »

gmac42 wrote:
Sat Oct 24, 2020 10:39 pm
amafan wrote:
Sat Oct 24, 2020 10:04 pm
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.
There's no explicit way that I am aware of. What I usually do is

Code: Select all

CLST
+
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.
DM41X (#6476), 42 (#458) - HP 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
gmac42
Posts: 48
Joined: Fri Jun 01, 2018 11:30 am

Re: Clearing Last X Register "L"

Post by gmac42 »

amafan wrote:
Sun Oct 25, 2020 1:01 am
I was just surprised to find out that CLST didn’t clear “L” at the same time.
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?
DM42 #650, DM41L #801, HP 41CX, HP 41CV, HP 50G, TI 89
amafan
Posts: 33
Joined: Tue Sep 29, 2020 11:40 pm

Re: Clearing Last X Register "L"

Post by amafan »

gmac42 wrote:
Sun Oct 25, 2020 11:53 am
amafan wrote:
Sun Oct 25, 2020 1:01 am
I was just surprised to find out that CLST didn’t clear “L” at the same time.
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?
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.
DM41X (#6476), 42 (#458) - HP 17BII, 35(2), 45, HP 27S, 28S, 30B, 41CV, 42S, 48S, 35S, HP10bII+, 12C PLAT
I may have a problem!
firai
Posts: 27
Joined: Sun Sep 27, 2020 11:38 am
Location: NYC/HK

Re: Clearing Last X Register "L"

Post by firai »

gmac42 wrote:
Sun Oct 25, 2020 11:53 am
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?
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
Post Reply