Author: hbelusca
Date: Sun Oct 26 15:57:21 2014
New Revision: 65015
URL: http://svn.reactos.org/svn/reactos?rev=65015&view=rev
Log:
[NTVDM]: No need to re-change to a given video mode when it is already set. Fixes strange changes for e.g. some apps that find intelligent to switch 256 times to mode 13h (for example) before continuing to run.
Modified:
trunk/reactos/subsystems/ntvdm/bios/vidbios.c
Modified: trunk/reactos/subsystems/ntvdm/bios/vidbios.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/bios/vidb…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/bios/vidbios.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/bios/vidbios.c [iso-8859-1] Sun Oct 26 15:57:21 2014
@@ -2308,6 +2308,9 @@
return FALSE;
}
+ /* Check if this is the same mode */
+ if (ModeNumber == Bda->VideoMode) return TRUE;
+
VgaMode = VideoModes[ModeNumber];
DPRINT1("Switching to mode %02Xh %s clearing the screen; VgaMode = 0x%p\n",
Author: hbelusca
Date: Sun Oct 26 15:01:14 2014
New Revision: 65012
URL: http://svn.reactos.org/svn/reactos?rev=65012&view=rev
Log:
[NTVDM]: Return the latched data for keyboard ps/2 port only. Also when starting an app put a ENTER key release into the keyboard buffer because some apps expect it.
Modified:
trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
trunk/reactos/subsystems/ntvdm/hardware/keyboard.c
trunk/reactos/subsystems/ntvdm/hardware/ps2.c
Modified: trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/dos/dos32…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/dos/dos32krnl/dos.c [iso-8859-1] Sun Oct 26 15:01:14 2014
@@ -19,6 +19,9 @@
#include "dos/dem.h"
#include "bios/bios.h"
+
+#include "io.h"
+#include "hardware/ps2.h"
/* PRIVATE VARIABLES **********************************************************/
@@ -1164,6 +1167,12 @@
/* Attach to the console */
VidBiosAttachToConsole(); // FIXME: And in fact, attach the full NTVDM UI to the console
+ // HACK: Simulate a ENTER key release scancode on the PS/2 port because
+ // some apps expect to read a key release scancode (> 0x80) when they
+ // are started.
+ IOWriteB(PS2_CONTROL_PORT, 0xD2); // Next write is for the first PS/2 port
+ IOWriteB(PS2_DATA_PORT, 0x80 | 0x1C); // ENTER key release
+
/* Start simulation */
SetEvent(VdmTaskEvent);
CpuSimulate();
Modified: trunk/reactos/subsystems/ntvdm/hardware/keyboard.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/keyboard.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/keyboard.c [iso-8859-1] Sun Oct 26 15:01:14 2014
@@ -47,7 +47,7 @@
BOOLEAN KeyboardInit(BYTE PS2Connector)
{
- /* Finish to plug the mouse to the specified PS/2 port */
+ /* Finish to plug the keyboard to the specified PS/2 port */
PS2Port = PS2Connector;
PS2SetDeviceCmdProc(PS2Port, NULL, KeyboardCommand);
Modified: trunk/reactos/subsystems/ntvdm/hardware/ps2.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/ps2.c [iso-8859-1] Sun Oct 26 15:01:14 2014
@@ -80,11 +80,14 @@
if (StatusRegister & (1 << 0)) // || StatusRegister & (1 << 5) for second PS/2 port
StatusRegister &= ~(1 << 0); // StatusRegister &= ~(1 << 5);
+ // FIXME: We may check there whether there is data latched in
+ // PS2 ports 1 or 2 (keyboard or mouse) and retrieve it there...
+
/* Always return the available byte stored in the output buffer */
return OutputBuffer;
}
- return 0;
+ return 0x00;
}
static VOID WINAPI PS2WritePort(USHORT Port, BYTE Data)
@@ -270,7 +273,18 @@
if (!Port->IsEnabled) return FALSE;
/* Make sure the queue is not empty (fast check) */
- if (Port->QueueEmpty) return FALSE;
+ if (Port->QueueEmpty)
+ {
+ /* Only the keyboard should have its last data latched */
+ // FIXME: Alternatively this can be done in PS2ReadPort when
+ // we read PS2_DATA_PORT. What is the best solution??
+ if (PS2Port == 0)
+ {
+ OutputBuffer = Port->Queue[(Port->QueueStart - 1) % BUFFER_SIZE];
+ }
+
+ return FALSE;
+ }
WaitForSingleObject(Port->QueueMutex, INFINITE);
@@ -337,7 +351,7 @@
Port->QueueEnd++;
Port->QueueEnd %= BUFFER_SIZE;
- /* Since we inserted a value, it's not empty anymore */
+ /* The queue is not empty anymore */
Port->QueueEmpty = FALSE;
/*
Author: aandrejevic
Date: Sun Oct 26 14:57:44 2014
New Revision: 65011
URL: http://svn.reactos.org/svn/reactos?rev=65011&view=rev
Log:
[NTVDM]
Signal the next IRQ on EOI.
Modified:
trunk/reactos/subsystems/ntvdm/hardware/pic.c
Modified: trunk/reactos/subsystems/ntvdm/hardware/pic.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/hardware/…
==============================================================================
--- trunk/reactos/subsystems/ntvdm/hardware/pic.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/ntvdm/hardware/pic.c [iso-8859-1] Sun Oct 26 14:57:44 2014
@@ -84,6 +84,12 @@
{
/* Otherwise, clear all of them */
Pic->InServiceRegister = 0;
+ }
+
+ if (MasterPic.IntRequestRegister || SlavePic.IntRequestRegister)
+ {
+ /* Signal the next IRQ */
+ EmulatorInterruptSignal();
}
}
}