Hello @thomasokken,
When progamming, I often find myself testing X against a register...
So naturally I do something like :
RCL NN
X?Y
GTO xx
and then I find myself always adding :
Rv OR X<>Y (to get either the stack or X back)
...
I think that's why the instructions set "X?NN" was added to the X functions CX : you save 2 instructions and increase readability!
Thomas any chance this instructions make it to Free42/DM42?
Sincerely,
Boubker.
X?NN in future version?
X?NN in future version?
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: X?NN in future version?
Yes, that's certainly possible. I've never liked those specific functions, though, I think I'd prefer something more generic: X=? <param> and 0=? <param>, plus corresponding functions for ≠, <, >, ≤, and ≥. That would cover the CX versions: X=NN? would be equivalent to X=? IND ST Y, and so on.
Re: X?NN in future version?
I never liked the X=NN? functions either - your suggestion, on the other hand, looks awesome!
Werner
Werner
41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE, DM15L
Re: X?NN in future version?
Indeed, those type of functions could be interesting.
In case it helps, although not ideal, a way to implement those functions with the user code could be the following.
1) Introduce in the Alpha register the name of the variable or number of the register to check against X-register
2) Run XEQ "X=?" where the function is listed below
LBL "X=?"
FUNC 00
ASTO ST Y
RCL IND ST Y
X=Y?
RTNYES
RTNNO
The variant for comparison with numbered registers would be
LBL "X=NN?"
FUNC 00
ANUM
RCL IND ST X
RCL ST Z
X=Y?
RTNYES
RTNNO
What do you think?
In case it helps, although not ideal, a way to implement those functions with the user code could be the following.
1) Introduce in the Alpha register the name of the variable or number of the register to check against X-register
2) Run XEQ "X=?" where the function is listed below
LBL "X=?"
FUNC 00
ASTO ST Y
RCL IND ST Y
X=Y?
RTNYES
RTNNO
The variant for comparison with numbered registers would be
LBL "X=NN?"
FUNC 00
ANUM
RCL IND ST X
RCL ST Z
X=Y?
RTNYES
RTNNO
What do you think?
Re: X?NN in future version?
In X=? IND ST Y you still have to modify the stack by puting NN in Y...
Whereas in X=NN? the stack/alpha is untouched... that's the whole point of using X?NN instructions...
Whereas in X=NN? the stack/alpha is untouched... that's the whole point of using X?NN instructions...
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
-
- Posts: 1107
- Joined: Tue May 02, 2017 5:48 pm
- Location: Netherlands
- Contact:
Re: X?NN in future version?
No, the 41CX X=NN? functions compare X to the register pointed to by Y. That is exactly the same as X=? IND ST Y in the functions I'm proposing.
The difference is that X=? <param> is more flexible. If you want to compare X to register 06, that's X=? 06. If you want to compare X to the named variable "FOO", that's X=? "FOO". If you want to compare X to the register or variable pointed to by register 00, that's X=? IND 00. And so on.
Re: X?NN in future version?
Ok Thomas I understand now what you meant by X=? <param>
Great then !
You are right! your proposal is much more flexible and your solution will provide either X=? 06 or X=? "FOO" which is exactly what I am looking for! A test without touching the stack
will X=? IND "FOO" be also available? I suppose!
PS: I had a flase understanding of X?NN that is, you are all right, useless as is...
Great then !
You are right! your proposal is much more flexible and your solution will provide either X=? 06 or X=? "FOO" which is exactly what I am looking for! A test without touching the stack
will X=? IND "FOO" be also available? I suppose!
PS: I had a flase understanding of X?NN that is, you are all right, useless as is...
Sincèrement, Sincerely, 73,
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boubker
DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)