Two-key rollover causing duplicate keystrokes

Please report issues with the DM41X Beta Firmware in this sub-forum
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Two-key rollover causing duplicate keystrokes

Post by Dave Britten »

There seems to be a fairly significant issue with two-key rollover at the moment. Try this:

Press and hold 1.
Press and hold 2.
Release 1.
Release 2.

You should see 122 entered into the X register. The 1 is entered when pressing 1, the first 2 is entered when pressing 2, and the second 2 is entered when releasing the 1 key.

This also affects function keys. Enter 10 into X, and do the same sequence with the square root and log keys, for example. You'll get -0.3010 from LOG being executed twice.

I'm on DM41X 2.0, DMCP 3.20.
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: Two-key rollover causing duplicate keystrokes

Post by rprosperi »

Don't press two keys at once. :mrgreen:

Multi-key rollover sequences cannot be relied on for deterministic results. For example, on real 41CX's your example results in 12 on multiple machines here, and it appears results are 122 on one of your 41's (since you're saying the 41X 'should' produce that).

It shouldn't and can't be considered 'spec' behavior to have any specific results. Any user can notice what a machine does, and if it seems consistent, then rely on that if they choose, but any missed key sequence, which multi-key hits must be considered, should be abandoned and re-keyed properly.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Two-key rollover causing duplicate keystrokes

Post by Dave Britten »

I should probably clarify a bit that pressing that key sequence will incorrectly produce 122 on the DM41X, rather than the expected result of 12 that I get on my 41CX, with the 2 not being entered until the 1 key is released. On the DM41X, a 2 is entered when 2 is depressed, and again when 1 is released, which is not correct.

2-key rollover was one of the features added to the 41C and Voyager lines. Page 6 of this HP Journal mentions it under the CPU section:

https://www.hpl.hp.com/hpjournal/pdfs/I ... 980-03.pdf
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Two-key rollover causing duplicate keystrokes

Post by Thomas Okken »

rprosperi wrote:
Wed Oct 14, 2020 12:43 am
it appears results are 122 on one of your 41's (since you're saying the 41X 'should' produce that).
I parsed that "should" as "that's what happens on my 41X and I expect others to see the same" -- but regardless, true two-key rollover would produce consistent results for the sequence "press 1, then press 2 while still holding 1" regardless of the order in which the keys are released, and my 41CX doesn't do that. With rollover, you'd also expect the 2 to appear in the display the moment the 2 key is pressed, and my 41CX doesn't do that, either.

Rollover is a good feature because it supports quick typing, but it appears it was not implemented on the original calculator, so it does seem a bit optimistic to expect it on an emulator...

UPDATE: Ninja'd by Dave. I'll have to read that article. But I'll maintain that my 41CX does not have two-key rollover, or at least not for any definition of "rollover" that I'm familiar with.
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Two-key rollover causing duplicate keystrokes

Post by Dave Britten »

Thomas Okken wrote:
Wed Oct 14, 2020 1:06 am
rprosperi wrote:
Wed Oct 14, 2020 12:43 am
it appears results are 122 on one of your 41's (since you're saying the 41X 'should' produce that).
I parsed that "should" as "that's what happens on my 41X and I expect others to see the same" -- but regardless, true two-key rollover would produce consistent results for the sequence "press 1, then press 2 while still holding 1" regardless of the order in which the keys are released, and my 41CX doesn't do that. With rollover, you'd also expect the 2 to appear in the display the moment the 2 key is pressed, and my 41CX doesn't do that, either.

Rollover is a good feature because it supports quick typing, but it appears it was not implemented on the original calculator, so it does seem a bit optimistic to expect it on an emulator...

UPDATE: Ninja'd by Dave. I'll have to read that article. But I'll maintain that my 41CX does not have two-key rollover, or at least not for any definition of "rollover" that I'm familiar with.
Yeah, my original explanation wasn't terribly clear. I think you might be correct that going left to right vs. right to left gives slightly different results with respect to the timing of the second digit appearing on screen, but the net result should be either 12 if you press 1 then 2, or 21 if you press 2 then 1. Digits should not be duplicated, in either case.

More succinct summary: Following the steps below produces different results between the HP 41CX (12) and DM41X (122). The 41CX behavior is believed to be more correct.

- Press 1.
- Press 2.
- Release 1.
- Release 2.

I seem to recall reporting a very similar issue on the DM42 around the time that the keyboard scan code was rewritten for better debouncing, so perhaps it's a similar bug.
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Two-key rollover causing duplicate keystrokes

Post by Dave Britten »

Just did a little bit more thorough test on my halfnut 41CX and compared to the DM41X. For each sequence of keys, press the first, press the second, release the first, then release the second. Each model produces the indicated entry in the X register.

1, then 2
41CX: 12
DM41X: 122

2, then 1
41CX: 21
DM41X: 221

1, then 4
41CX: 14
DM41X: 144

4, then 1
41CX: 41
DM41X: 441 - This one is particularly egregious ;)

2, then 1, then release 1 before releasing 2:
41CX: 2
DM41X: 222

In all cases, the 41CX doesn't enter the second digit until the first key is released. The DM41X seems to double the key that is either to the right or top, and the superfluous digit happens when the second key is depressed.

I found the tests I did when the DM42 was having rollover issues, and the symptoms were very similar, though not exactly the same.
rprosperi
Posts: 1703
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

Re: Two-key rollover causing duplicate keystrokes

Post by rprosperi »

This testing and results are interesting, but I want to stress that this is not likely to be changed, though there is no harm in seeing results and possible patterns, in case there is a true bug.

Key handling in the 41X and the 42 are completely different and David has confirmed one should not expect any similarities or analogous patterns.

While initially maybe it's not intuitive that they should be different, keep in mind this makes perfect sense, considering the 42S keyboard handling is native code (via DMCP) while the 41X handling is using the emulation layer via DMCP but also interacting with the real 41OS.

Other things to note: a 41XX FullNut may behave different in this respect from a 41CX HalfNut (I've not seen this, just noting it's possible), and also, I believe it's possible that installed modules can also feasibly affect this, so testing really should be done on 'bare' machine, which results may not align with how you want to use your 41X.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
Dave Britten
Posts: 137
Joined: Wed Jun 14, 2017 9:27 pm

Re: Two-key rollover causing duplicate keystrokes

Post by Dave Britten »

I respectfully disagree; I think it's totally reasonable to expect the DM41X to behave like the 41CX, at least in the simple cases where a second key is pressed before the first has been released during basic stack or alpha entry, and not inside of any non-mainframe MCode. Two-key rollover was a notable feature introduced with the Nut-based models, enough so to be mentioned in HP Journal, and it's an extremely important feature for any sort of fast keying of numbers.
User avatar
Mark Hardman
Posts: 118
Joined: Wed May 03, 2017 3:26 am
Location: Houston, TX

Re: Two-key rollover causing duplicate keystrokes

Post by Mark Hardman »

I reported this bug during the DM41X beta. I believe it was the very first bug reported (30-Jan-2020):

Keyboard Rollover Bug

As I pointed out in that bug report, it does matter because the DM41X behavior is different from the HP-41CX.
DM42: β00043, β00065, 00357 / DM41X: β00054, 00445 / DM32: β00278
DM10L: 017/100, DM11L: 00121, DM12L: 02005, DM15L: 00523, DM16L: 00008, DM41L: 00111
User avatar
Mark Hardman
Posts: 118
Joined: Wed May 03, 2017 3:26 am
Location: Houston, TX

Re: Two-key rollover causing duplicate keystrokes

Post by Mark Hardman »

I might add that even the lowly HP EasyCalc 100 4-banger supports two-key rollover.

hp-easycalc-100.jpg
hp-easycalc-100.jpg (21.71 KiB) Viewed 3929 times
DM42: β00043, β00065, 00357 / DM41X: β00054, 00445 / DM32: β00278
DM10L: 017/100, DM11L: 00121, DM12L: 02005, DM15L: 00523, DM16L: 00008, DM41L: 00111
Post Reply