thomasokken / free42

Free42 : An HP-42S Calculator Simulator
https://thomasokken.com/free42/
GNU General Public License v2.0
280 stars 54 forks source link

How to reassign the Σ+ key without blocking menus? #61

Closed sbridger closed 9 months ago

sbridger commented 9 months ago

I was wanting to reassign the Σ+ key as either CUSTOM or a menu program. (it is the only button I never use) I can't work out how to do it in the layout file, without blocking it working as a menu button when any menu is showing.

Unless I am missing something, the layout file needs to do something like this: Key: 41,42,1 ..... last is button # when menu is active ie do key1 Macro: 41 "CUSTOM" Macro: 42 "MYMENU"

I was hopeful when I found KEYASN (f mode,dn,key) but I can't see it do anything.

Is there a way for my program to press a button? I also want to try the "E" button create a menu of multipliers (M,K,m,u,n,p) then press E so numeric exponent can be entered as normal

As an aside, with the new shift flag, it occurred to me that menus could have a shift. That would be pretty nice in the custom menu, both in doubling the number of menu items, and also I can see plenty of ways that it is both logical, and saves a keypress ie f-SOMETHING compared to UP SOMETHING DN

It would also be (mildly) useful for the menu f-STAT Σ+ to change to "Σ-" on shift... not to me as I have yet to ever use it

thomasokken commented 9 months ago

I was wanting to reassign the Σ+ key as either CUSTOM or a menu program. (it is the only button I never use) I can't work out how to do it in the layout file, without blocking it working as a menu button when any menu is showing.

That's not possible.

I was hopeful when I found KEYASN (f mode,dn,key) but I can't see it do anything.

KEYASN doesn't do what you're looking for (which is impossible) but if you're interested in what it does do, it's covered in the HP-42S manual, page 167.

Is there a way for my program to press a button?

No.

As an aside, with the new shift flag, it occurred to me that menus could have a shift. That would be pretty nice in the custom menu, both in doubling the number of menu items, and also I can see plenty of ways that it is both logical, and saves a keypress ie f-SOMETHING compared to UP SOMETHING DN

You can use flag 64 with CUSTOM menu items, and also with the programmable menu (KEYG/KEYX).

sbridger commented 9 months ago

Thanks Thomas,

Is there and easier way to run programs from keys than entering the whole thing in by alpha menu key numbers?

To make a key XEQ "CMX" I have to do this Macro: 40 6 28 13 1 3 3 4 6 2 15 13 I tried "CMX" which is what I was expecting. (also "XEQ" "CMX" "XEQ "CMX"" and some others)

You can use flag 64 with CUSTOM menu items, and also with the programmable menu (KEYG/KEYX).

Yes I use that now for a couple of things where I will remember the obvious inverse f function, but it is pretty obscure without a KEY n event that can update the menu text when shift is pressed. Was there a hard reason for HP using 9 KEY events - doesn't exactly match a 3 bit field limit (or did it just seem enough to them)?

it's covered in the HP-42S manual, page 167

thx, it's in "Using HP41 programs" so I probably never read it.

thomasokken commented 9 months ago

Is there and easier way to run programs from keys than entering the whole thing in by alpha menu key numbers?

In a skin layout? No

Was there a hard reason for HP using 9 KEY events

The nine keys are the top row, the up and down arrows, and EXIT. Those are the keys you need to be able to control in order to implement elaborate menu systems with multi-row menus and sub-menus.

thx, it's in "Using HP41 programs" so I probably never read it.

Yes, it really just an HP-41 compatibility feature. (Or rather, LCLBL is the compatibility feature, and KEYASN is how you get back to normal 42S behavior.) If you're not trying to use HP-41 programs, you probably won't ever want to use it. But in HP-41 programs, it was common to use labels A-E and a-e which were automatically assigned to the top row in USER mode... which itself was mainly for HP-67 compatibility.

sbridger commented 9 months ago

If you feel like it you could add this to the readme


To make a macro that executes a program, you need to enter the numbered-key sequence to do this. So the macro for "XEQ CMX" is: Macro: 40 6 28 13 1 3 3 4 6 2 13 On the keyboard this is means: XEQ Shift ENTER <program name entered via alpha menu as 2 key pairs> ENTER


(btw, I did add RECT and POLAR annunciators to a couple of skins when I was fiddling about with them, should you ever feel like trying it)