Author: hbelusca
Date: Thu Dec 12 20:09:24 2013
New Revision: 61263
URL:
http://svn.reactos.org/svn/reactos?rev=61263&view=rev
Log:
[NTVDM]
- Add/fix few comments;
- Don't forget to redisable access to AC registers after modifying them in int 10h.
Usurp, please retest Rescue Rover 2 :)
- Make EmulatorGet/Set/ClearFlag internal functions only and use set/get<FLAG>
instead.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.c
branches/ntvdm/subsystems/ntvdm/emulator.c
branches/ntvdm/subsystems/ntvdm/registers.c
branches/ntvdm/subsystems/ntvdm/registers.h
Modified: branches/ntvdm/subsystems/ntvdm/bios.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Thu Dec 12 20:09:24 2013
@@ -260,7 +260,7 @@
&VideoMode_40x25_text, /* Mode 01h */ // 16 color
&VideoMode_80x25_text, /* Mode 02h */ // 16 color (mono)
&VideoMode_80x25_text, /* Mode 03h */ // 16 color
- &VideoMode_320x200_4color, /* Mode 04h */
+ &VideoMode_320x200_4color, /* Mode 04h */ // 4 color
&VideoMode_320x200_4color, /* Mode 05h */ // same (m)
&VideoMode_640x200_2color, /* Mode 06h */ // 640*200 2 color
NULL, /* Mode 07h */ // MDA monochrome text 80*25
@@ -274,8 +274,8 @@
NULL, /* Mode 0Fh */ // EGA 640*350 mono
&VideoMode_640x350_16color, /* Mode 10h */ // EGA 640*350 16 color
&VideoMode_640x480_2color, /* Mode 11h */ // VGA 640*480 mono
- &VideoMode_640x480_16color, /* Mode 12h */
- &VideoMode_320x200_256color, /* Mode 13h */
+ &VideoMode_640x480_16color, /* Mode 12h */ // VGA
+ &VideoMode_320x200_256color, /* Mode 13h */ // VGA
};
/* PRIVATE FUNCTIONS **********************************************************/
@@ -385,7 +385,7 @@
if (Registers == NULL) return FALSE;
- /* Clear interrupts */
+ /* Disable interrupts */
setIF(0);
/*
@@ -453,7 +453,7 @@
VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index state
VgaWritePort(VGA_AC_INDEX, 0x20);
- /* Set interrupts */
+ /* Enable interrupts */
setIF(1);
return TRUE;
@@ -702,7 +702,7 @@
else
{
/* No key available. Set the handler CF to repeat the BOP */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ setCF(1);
// CharacterData = 0xFFFF;
}
@@ -1079,6 +1079,9 @@
/* Write the data */
VgaWritePort(VGA_AC_WRITE, getBH());
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
@@ -1092,6 +1095,9 @@
/* Write the data */
VgaWritePort(VGA_AC_WRITE, getBH());
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
@@ -1116,6 +1122,9 @@
VgaWritePort(VGA_AC_INDEX, VGA_AC_OVERSCAN_REG);
VgaWritePort(VGA_AC_WRITE, Buffer[VGA_AC_PAL_F_REG + 1]);
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
@@ -1129,6 +1138,9 @@
/* Read the data */
setBH(VgaReadPort(VGA_AC_READ));
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
@@ -1142,6 +1154,9 @@
/* Read the data */
setBH(VgaReadPort(VGA_AC_READ));
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
@@ -1166,6 +1181,9 @@
VgaWritePort(VGA_AC_INDEX, VGA_AC_OVERSCAN_REG);
Buffer[VGA_AC_PAL_F_REG + 1] = VgaReadPort(VGA_AC_READ);
+ /* Enable screen and disable palette access */
+ VgaReadPort(VGA_INSTAT1_READ); // Put the AC register into index
state
+ VgaWritePort(VGA_AC_INDEX, 0x20);
break;
}
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Thu Dec 12 20:09:24 2013
@@ -111,7 +111,7 @@
NULL /* TODO: Use a TLB */);
/* Enable interrupts */
- EmulatorSetFlag(EMULATOR_FLAG_IF);
+ setIF(1);
return TRUE;
}
Modified: branches/ntvdm/subsystems/ntvdm/registers.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/register…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/registers.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/registers.c [iso-8859-1] Thu Dec 12 20:09:24 2013
@@ -15,17 +15,17 @@
/* PUBLIC FUNCTIONS ***********************************************************/
-BOOLEAN EmulatorGetFlag(ULONG Flag)
+static inline BOOLEAN EmulatorGetFlag(ULONG Flag)
{
return (EmulatorContext.Flags.Long & Flag) ? TRUE : FALSE;
}
-VOID EmulatorSetFlag(ULONG Flag)
+static inline VOID EmulatorSetFlag(ULONG Flag)
{
EmulatorContext.Flags.Long |= Flag;
}
-VOID EmulatorClearFlag(ULONG Flag)
+static inline VOID EmulatorClearFlag(ULONG Flag)
{
EmulatorContext.Flags.Long &= ~Flag;
}
Modified: branches/ntvdm/subsystems/ntvdm/registers.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/register…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/registers.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/registers.h [iso-8859-1] Thu Dec 12 20:09:24 2013
@@ -11,9 +11,6 @@
/* INCLUDES *******************************************************************/
-BOOLEAN EmulatorGetFlag(ULONG Flag);
-VOID EmulatorSetFlag(ULONG Flag);
-VOID EmulatorClearFlag(ULONG Flag);
VOID EmulatorSetStack(WORD Segment, DWORD Offset);