Oracle VM VirtualBox: Ticket #58: In MS-DOS main cursor movement keys are pressed twicehttps://www.virtualbox.org/ticket/58
<p>
When I press cursor movement keys in main group(arrows, home, end, pgup, pgdn, ins, del) in DOS systems they are pressing twice. Keys on numpad are working normally.
</p>
en-usOracle VM VirtualBox/graphics/vbox_logo2_gradient.pnghttps://www.virtualbox.org/ticket/58
Trac 0.12ghrSat, 07 Apr 2007 17:06:24 GMThttps://www.virtualbox.org/ticket/58#comment:1
https://www.virtualbox.org/ticket/58#comment:1
<p>
Acknowledged, same here. E.g. DOS 6.22 and VB 1.3.8.
</p>
TicketLelikMon, 23 Jul 2007 19:33:30 GMThttps://www.virtualbox.org/ticket/58#comment:2
https://www.virtualbox.org/ticket/58#comment:2
<p>
Still reproducible with <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> 1.4.0? I'm unable to reproduce it here.
</p>
TicketghrWed, 25 Jul 2007 11:31:55 GMThttps://www.virtualbox.org/ticket/58#comment:3
https://www.virtualbox.org/ticket/58#comment:3
<p>
Hi Lelik,
after playing a little more: this is basically the pattern I see/experience with 1.4.0 under Win XP Home SP1 (and in a DOS 6.22 UK guest; I have a so-called AT style keyboard layout, Logitech, wired, all very standard hardware):<br />
</p>
<ul><li>initially it seems to go fine<br />
</li><li>after a while it (the VM) sees double action from single keyclick, e.g. main cursor keys (inverted T layout), and Delete key<br />
</li><li>my workaround is to use arrow keys and del etc. on the numerical keypad<br />
</li><li>sometimes if i do that and return to the other ones they work ok for a little while<br />
</li><li>in DOS EDIT.COM i get strange behaviour: using main arrow keys sometimes cursor moves horizontally by two chars, sometimes by one. In vertical dir I seem to be stuck (by then) at moving by two lines with each key press.<br />
</li></ul><p>
By now I'm more or less used to it; and <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> is mucb better than Qemu as far as my experience goes... but it is NOT quite right.
</p>
<p>
Behaviour (also) seems to depend on the DOS application.. e.g. in PFM, an old DOS-style shell it NEVER seems to go up/down by two lines when pressing once....
</p>
<p>
I hope this helps - even though i am aware that intermittent problems can be quite hard to solve.
</p>
<p>
PS: I have an Intel motherboard which is fine with two remarks: sometimes mouse is erratic (jumping suddenly , happens NOT often); and sometimes I suspect the on-board graphics but that's really rare.
</p>
Ticketsandervl73Sun, 28 Oct 2007 21:08:26 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/58#comment:4
https://www.virtualbox.org/ticket/58#comment:4
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
Should work fine now. If not, reopen.
</p>
TicketmcwThu, 13 Mar 2008 14:24:20 GMTstatus changed; resolution deletedhttps://www.virtualbox.org/ticket/58#comment:5
https://www.virtualbox.org/ticket/58#comment:5
<ul>
<li><strong>status</strong>
changed from <em>closed</em> to <em>reopened</em>
</li>
<li><strong>resolution</strong>
<em>fixed</em> deleted
</li>
</ul>
<p>
Hi,
</p>
<p>
I am using Windows XP Pro SP2 32 Bit (german) as host with VB 1.5.6. I still got the same problem using FreeDOS (different versions) and MS-DOS 7.0 (as part of Win95B). DOS EDIT.COM works fine, my own application (using turbo vision, bp7.01) behaves strange as describes above... arrow keys seem to be pressed twice, numpad arrow keys are ok. Numpad Enter key ist pressed twice, "normal" Enter key works fine. Home, End, PgUp/Dn, Ins, Del are all pressed twice. Very strange: on MessageBoxes and -dialogs (generated by turbo vision), none of the arrow keys work, the only way out is the Tabulator key...
</p>
<p>
If needed, ask for a floppy image to reproduce this behaviour. I don't want to attach this one here.
</p>
<p>
Best regards
</p>
TicketPSLSun, 24 Aug 2008 13:30:44 GMThttps://www.virtualbox.org/ticket/58#comment:6
https://www.virtualbox.org/ticket/58#comment:6
<p>
<a class="closed ticket" href="https://www.virtualbox.org/ticket/1599" title="defect: DOS Navigator, problem with cursor keys (closed: duplicate)">#1599</a> has a disk with FreeDOS to replicate the issue.
</p>
TicketakraievoyThu, 29 Jan 2009 19:35:31 GMThttps://www.virtualbox.org/ticket/58#comment:7
https://www.virtualbox.org/ticket/58#comment:7
<p>
Reproduced in <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> v. 2.1.2, Dos 6.22.
Apps used: NC, Turbo/Borland Pascal...
</p>
Ticketsandervl73Fri, 30 Jan 2009 08:36:45 GMTversion changedhttps://www.virtualbox.org/ticket/58#comment:8
https://www.virtualbox.org/ticket/58#comment:8
<ul>
<li><strong>version</strong>
changed from <em>VirtualBox 1.3.4</em> to <em>VirtualBox 2.1.2</em>
</li>
</ul>
Ticketsandervl73Fri, 30 Jan 2009 08:38:16 GMThttps://www.virtualbox.org/ticket/58#comment:9
https://www.virtualbox.org/ticket/58#comment:9
<p>
<a class="closed ticket" href="https://www.virtualbox.org/ticket/1599" title="defect: DOS Navigator, problem with cursor keys (closed: duplicate)">#1599</a> has been marked as a duplicate. Some additional information about FreeDOS there.
</p>
TicketanachronSun, 10 May 2009 09:17:23 GMThttps://www.virtualbox.org/ticket/58#comment:10
https://www.virtualbox.org/ticket/58#comment:10
<p>
Confirm that. I have figured out the following:
</p>
<ul><li>Caldera OpenDOS 7.01: cursor movement keys are pressed twice (numpad keys work OK), in any application (including command line prompt)
</li><li>FreeDOS: real mode applications work OK, 16-bit DPMI executables receive cursor key presses as digits.
</li></ul>
TicketanachronSun, 10 May 2009 09:25:37 GMThttps://www.virtualbox.org/ticket/58#comment:11
https://www.virtualbox.org/ticket/58#comment:11
<p>
I forgot the version, sorry.
</p>
<p>
The <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> install mentioned in the above message is 2.2.2 OSE, the host OS is openSUSE 11.1.
</p>
TicketmichaelMon, 11 May 2009 14:43:32 GMTversion changedhttps://www.virtualbox.org/ticket/58#comment:12
https://www.virtualbox.org/ticket/58#comment:12
<ul>
<li><strong>version</strong>
changed from <em>VirtualBox 2.1.2</em> to <em>VirtualBox 2.2.2</em>
</li>
</ul>
<p>
Does this behaviour only occur with Windows hosts, or are any of you using Linux or other hosts?
</p>
TicketanachronTue, 12 May 2009 07:24:47 GMThttps://www.virtualbox.org/ticket/58#comment:13
https://www.virtualbox.org/ticket/58#comment:13
<p>
Replying to <a href="https://www.virtualbox.org/ticket/58#comment:12" title="Comment 12 for Ticket #58">michael</a>:
</p>
<blockquote class="citation">
<p>
Does this behaviour only occur with Windows hosts, or are any of you using Linux or other hosts?
</p>
</blockquote>
<p>
I'm running VB on Linux (openSUSE 11.1), the problem exists.
</p>
TicketUnknown_2Fri, 17 Jul 2009 11:46:59 GMThttps://www.virtualbox.org/ticket/58#comment:14
https://www.virtualbox.org/ticket/58#comment:14
<p>
I have the same problem on MS DOS with many old programs, that work fine on real hardware.
<br />
<br />
I made sample virtual box Machine to demonstrate how this bug happens
<br />
<a class="ext-link" href="http://rapidshare.com/files/256801891/Ticket__58_sample.7z.html"><span class="icon"> </span>http://rapidshare.com/files/256801891/Ticket__58_sample.7z.html</a> (~3Mb)
<br />
or alternative link if you have problems with rapidShare:
<br />
<a class="ext-link" href="ftp://raduga.mk.ua/Public/Ticket%20%2358%20sample.7z"><span class="icon"> </span>ftp://raduga.mk.ua/Public/Ticket%20%2358%20sample.7z</a>
</p>
<p>
I'll be glad to help you with bug localization.
</p>
TicketUnknown_2Fri, 17 Jul 2009 12:00:52 GMThttps://www.virtualbox.org/ticket/58#comment:15
https://www.virtualbox.org/ticket/58#comment:15
<p>
I places version inside archive...
but I'll place it here too
</p>
<p>
<a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> Version 3.0.2 <a class="changeset" href="https://www.virtualbox.org/changeset/49928/vbox" title="OS X host: HID LEDs sync: do not resync when kbd resumed.">r49928</a>
</p>
TicketRingdingTue, 01 Dec 2009 18:10:27 GMThttps://www.virtualbox.org/ticket/58#comment:16
https://www.virtualbox.org/ticket/58#comment:16
<p>
I’ve written a patch for QEMU that would fix this. I tried to port it to <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> a few months ago and got bitten by various sizeof-assertions during the build process (I guess some structs cannot be easily changed because they might be written out to disk during snapshotting a running machine). Unfortunately, I have not had the time to look into the issue since then, but I would really like to see this bug fixed some day. As a workaround, one can always use various keyboard drivers for DOS, but I have an intense aversion to workarounds.
</p>
<p>
The QEMU patch and some discussion can be found <a class="ext-link" href="http://news.gmane.org/find-root.php?message_id=%3cpatchbomb.1251024893%40macbook%2d3.chello.at%3e"><span class="icon"> </span>here</a>.
</p>
TicketmichaelTue, 01 Dec 2009 19:49:10 GMThttps://www.virtualbox.org/ticket/58#comment:17
https://www.virtualbox.org/ticket/58#comment:17
<p>
Ringding: so if I understood that correctly, the problem is that the virtual keyboard controller in the VM lets applications read keyboard data much faster than a physical one would, and that said TurboVision and other applications rely on the fact that the chained OS IRQ handler will read port 60h before the keyboard handler has been able to update its value with the next scan code in the pair?
</p>
TicketRingdingTue, 01 Dec 2009 22:33:44 GMThttps://www.virtualbox.org/ticket/58#comment:18
https://www.virtualbox.org/ticket/58#comment:18
<p>
It sounds like you understood correctly ;).
</p>
<p>
With regard to “much faster”, it actually delivers the next data byte immediately after the first one has been read. The delay seems to be about a few hundred CPU cycles. Bochs has good emulation for it. Actually I’m quite surprised that this ever worked as well as it did…
</p>
TicketmichalnWed, 02 Dec 2009 12:31:30 GMThttps://www.virtualbox.org/ticket/58#comment:19
https://www.virtualbox.org/ticket/58#comment:19
<p>
If anyone relied on being able to read a byte from the keyboard and having someone else read the same byte just based on timing, their code was already broken. Even if interrupts were disabled, there are still SMIs and NMIs which can affect timing.
</p>
<p>
That's why modern operating systems don't make any such silly assumptions about how many instructions can be executed between two externally signaled events. And that's why those OSes have no trouble with the <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a>/qemu keyboard emulation.
</p>
<p>
I agree with Jamie L on the qemu mailing list that the patch is a hack, which may work around some specific problems but generally makes the keyboard emulation even less correct than it was before, unfortunately.
</p>
<p>
It might also help if we knew how to reproduce the problem *without* any 3rd-party software, i.e. pure MS- or PC-DOS with only the keyboard/mouse drivers supplied with DOS.
</p>
TicketRingdingWed, 02 Dec 2009 12:49:54 GMThttps://www.virtualbox.org/ticket/58#comment:20
https://www.virtualbox.org/ticket/58#comment:20
<p>
If I build a bootable floppy image with MS DOS 6.22 on it and some TVision-based program, can I post that here without anyone getting sued?
</p>
<p>
Of course you need <em>some</em> third-party software (the TVision program) because it only happens there. Any TVision program will do; for example the Turbo Pascal 7 IDE or Borland C++ 3.1's IDE.
</p>
TicketmichalnWed, 02 Dec 2009 14:53:59 GMThttps://www.virtualbox.org/ticket/58#comment:21
https://www.virtualbox.org/ticket/58#comment:21
<p>
No, TurboVision doesn't count, sorry. We already know Borland produced badly written code which does not work on modern PCs (see e.g. <a class="ext-link" href="http://www.merlyn.demon.co.uk/pas-r200.htm"><span class="icon"> </span>http://www.merlyn.demon.co.uk/pas-r200.htm</a> ).
</p>
TicketRingdingWed, 02 Dec 2009 15:05:01 GMThttps://www.virtualbox.org/ticket/58#comment:22
https://www.virtualbox.org/ticket/58#comment:22
<p>
I certainly understand your motivation; as I already said, I hate workarounds.
</p>
<p>
However, emulating old machines is necessarily full of workarounds. Doesn't <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> have a mechanism for various optional hacks/quirks/workarounds. I think VMWare has hundreds of these; QEMU also seems to have some flags. I remember having seen a curious Win2K installation workaround flag in QEMU.
</p>
<p>
Wouldn't it be possible to add a "tvision_compatible_keyboard_behavior" flag? ;)
</p>
TicketPSLWed, 02 Dec 2009 15:10:35 GMThttps://www.virtualbox.org/ticket/58#comment:23
https://www.virtualbox.org/ticket/58#comment:23
<p>
Issue <a class="closed ticket" href="https://www.virtualbox.org/ticket/1599" title="defect: DOS Navigator, problem with cursor keys (closed: duplicate)">#1599</a> links to file FreeDOS_DN.zip; it is ready to use image with FreeDOS and Dos Navigator; all free SW, ready to replicate the keyboard issue; can be used with VMware player (no issue) and <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> (keyboard issue).
</p>
TicketRingdingWed, 02 Dec 2009 15:30:10 GMThttps://www.virtualbox.org/ticket/58#comment:24
https://www.virtualbox.org/ticket/58#comment:24
<blockquote class="citation">
<p>
Wouldn't it be possible to add a "tvision_compatible_keyboard_behavior" flag? ;)
</p>
</blockquote>
<p>
Btw., this is not a "i'm-so-poor-and-helpless-please-let-me-have-my-little-flag-for-playing-around-pretty-please"-smiley but rather a "what-a-stupid-name-for-an-option-flag"-smiley.
</p>
<p>
:) (what a stupid comment)
</p>
TicketRingdingMon, 07 Dec 2009 19:54:58 GMThttps://www.virtualbox.org/ticket/58#comment:25
https://www.virtualbox.org/ticket/58#comment:25
<p>
PSL, Dos Navigator is also built using Turbo Vision.
</p>
<p>
The only non-TVision-based software I know of, which is also suffering from this problem, is <a class="ext-link" href="http://www.deskwork.de/"><span class="icon"> </span>DeskWork</a>, a strange German "Operating System", apparently DOS-like. The only reason I know about this is because I googled for this very keyboard problem with QEMU/VirtualBox.
</p>
TicketununoctioSat, 23 Jan 2010 16:18:46 GMThttps://www.virtualbox.org/ticket/58#comment:26
https://www.virtualbox.org/ticket/58#comment:26
<p>
Excuse me for my bad English, but I want to show the data of my experience:
The problem afflicts <a class="wiki" href="https://www.virtualbox.org/wiki/VirtualBox">VirtualBox</a> 3.1.2, it is not present on VMware Workstation 7.
The problem comes with Turbo Pascal, Borland Pascal 7 on FreeDOS on Windows 3.1.
The problem occurs even with the MS-DOS prompt in Windows 3.1 and probably whith other programs that have nothing to do with Pascal.
The problem can be solved using the numeric keypad, but does "Block Num", and indeed there is a real problem with key mapping.
I am Italian and use an Italian keyboard, buttons such as "ALT" not go, so do not go for example, "<a class="missing wiki">?</a>", and should not be either ASCII (ALT + numpad).
</p>
TicketRingdingSat, 14 May 2011 14:15:08 GMThttps://www.virtualbox.org/ticket/58#comment:27
https://www.virtualbox.org/ticket/58#comment:27
<p>
To my great surprise, this seems to be fixed in 4.0.0 and later. I'm not sure, but I tend to attribute it to this simple changeset: <a class="ext-link" href="http://www.virtualbox.org/changeset/34371"><span class="icon"> </span>http://www.virtualbox.org/changeset/34371</a>
</p>
TicketmichalnMon, 16 May 2011 09:36:51 GMTstatus changed; resolution sethttps://www.virtualbox.org/ticket/58#comment:28
https://www.virtualbox.org/ticket/58#comment:28
<ul>
<li><strong>status</strong>
changed from <em>reopened</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
I can confirm that it's fixed (DOS Navigator and KeyRus testcases), the cursor key presses are no longer doubled. It's hard to say whether the above mentioned changeset really did it, but it may have. The original code was definitely wrong, disabling the keyboard does <em>not</em> prevent the keyboard controller (an entirely different device) from generating interrupts. I'll mark this as fixed.
</p>
Ticket