Program menu; key press remembered?

Discussion around the Swiss Micros DM42 calculator.
Post Reply
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Program menu; key press remembered?

Post by jthole »

When I define menu keys in a program with KEYX or KEYG, are the key presses stored in a register?

That means I could do something like this:

"CHOICE 1"
KEY 1 XEQ 01
"CHOICE 2"
KEY 2 XEQ 01
...
LBL 01
<retrieve key number pressed>
<do something with the key number>
RTN

instead of having each key press jumping to its own label.
(Yes, I used the search, and read the manual, but couldn't find it.)

Thanks!
User avatar
Walter
Posts: 1743
Joined: Tue May 02, 2017 11:13 am
Location: Close to FRA, Germany

Re: Program menu; key press remembered?

Post by Walter »

How about using a flag to differentiate between two alternatives?
DM42 SN: 00041 β
WP 43S running on this device

HP-35, HP-45, ..., HP-35S, WP 34S, WP 31S, DM16L
Thomas Okken
Posts: 827
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

Re: Program menu; key press remembered?

Post by Thomas Okken »

jthole wrote:
Mon Dec 14, 2020 8:36 am
When I define menu keys in a program with KEYX or KEYG, are the key presses stored in a register?
No. You can check whether or not Shift was pressed by testing flag 64, but for which key was pressed, the only information you have is which LBL was called.

(The flag 64 thing is a DM42/Free42 feature. It does not work on a real HP-42S or in Emu42.)
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Re: Program menu; key press remembered?

Post by jthole »

Walter wrote:
Mon Dec 14, 2020 9:48 am
How about using a flag to differentiate between two alternatives?
In my case, I have five alternatives. I am going to use five different labels, and calling a common subroutine from there (with different values, of course).

Thanks @Walter and @Thomas Okken!
toml_12953
Posts: 701
Joined: Wed May 03, 2017 7:46 pm
Location: Malone, NY USA

Re: Program menu; key press remembered?

Post by toml_12953 »

jthole wrote:
Mon Dec 14, 2020 8:36 am
When I define menu keys in a program with KEYX or KEYG, are the key presses stored in a register?

That means I could do something like this:

"CHOICE 1"
KEY 1 XEQ 01
"CHOICE 2"
KEY 2 XEQ 01
...
LBL 01
<retrieve key number pressed>
<do something with the key number>
RTN

instead of having each key press jumping to its own label.
(Yes, I used the search, and read the manual, but couldn't find it.)

Thanks!
Could each key store a different address in a register rather than XEQ and then do an indirect jump to that address?
Tom L

If I buy someone a drink to congratulate them, is it a Mazel Tov cocktail?

DM10L SN: 059/100
DM41X SN: 00023 (Beta)
DM41X SN: 00506 (Shipping)
DM42 SN: 00025 (Beta)
DM42 SN: 00221 (Shipping)
jthole
Posts: 114
Joined: Mon Nov 27, 2017 8:46 pm
Location: Netherlands

Re: Program menu; key press remembered?

Post by jthole »

toml_12953 wrote:
Mon Dec 14, 2020 2:35 pm
Could each key store a different address in a register rather than XEQ and then do an indirect jump to that address?
Maybe a possibility, but I am not sure that improves my current code. I think I am not going to spend more time on it now :)
Post Reply