ReactOS  0.4.14-dev-317-g96040ec
emulator.h File Reference
#include <fast486.h>
Include dependency graph for emulator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MEM_ALIGN_DOWN(ptr, align)   (PVOID)((ULONG_PTR)(ptr) & ~((align) - 1l))
 
#define MEM_ALIGN_UP(ptr, align)   MEM_ALIGN_DOWN((ULONG_PTR)(ptr) + (align) - 1l, (align))
 
#define TO_LINEAR(seg, off)   (((seg) << 4) + (off))
 
#define MAX_SEGMENT   0xFFFF
 
#define MAX_OFFSET   0xFFFF
 
#define MAX_ADDRESS   0x1000000
 
#define SEG_OFF_TO_PTR(seg, off)   (PVOID)((ULONG_PTR)BaseAddress + TO_LINEAR((seg), (off)))
 
#define FAR_POINTER(x)   SEG_OFF_TO_PTR(HIWORD(x), LOWORD(x))
 
#define REAL_TO_PHYS(ptr)   (PVOID)((ULONG_PTR)(ptr) + (ULONG_PTR)BaseAddress)
 
#define PHYS_TO_REAL(ptr)   (PVOID)((ULONG_PTR)(ptr) - (ULONG_PTR)BaseAddress)
 
#define ARRAY_INDEX(ptr, array)   ((ULONG)(((ULONG_PTR)(ptr) - (ULONG_PTR)(array)) / sizeof(*array)))
 

Enumerations

enum  {
  EMULATOR_EXCEPTION_DIVISION_BY_ZERO, EMULATOR_EXCEPTION_DEBUG, EMULATOR_EXCEPTION_NMI, EMULATOR_EXCEPTION_BREAKPOINT,
  EMULATOR_EXCEPTION_OVERFLOW, EMULATOR_EXCEPTION_BOUND, EMULATOR_EXCEPTION_INVALID_OPCODE, EMULATOR_EXCEPTION_NO_FPU,
  EMULATOR_EXCEPTION_DOUBLE_FAULT, EMULATOR_EXCEPTION_FPU_SEGMENT, EMULATOR_EXCEPTION_INVALID_TSS, EMULATOR_EXCEPTION_NO_SEGMENT,
  EMULATOR_EXCEPTION_STACK_SEGMENT, EMULATOR_EXCEPTION_GPF, EMULATOR_EXCEPTION_PAGE_FAULT
}
 

Functions

 C_ASSERT (0x100000<=MAX_ADDRESS)
 
FORCEINLINE USHORT BINARY_TO_BCD (USHORT Value)
 
FORCEINLINE USHORT BCD_TO_BINARY (USHORT Value)
 
VOID DumpMemory (BOOLEAN TextFormat)
 
VOID MountFloppy (IN ULONG DiskNumber)
 
VOID EjectFloppy (IN ULONG DiskNumber)
 
UCHAR FASTCALL EmulatorIntAcknowledge (PFAST486_STATE State)
 
VOID FASTCALL EmulatorFpu (PFAST486_STATE State)
 
VOID EmulatorInterruptSignal (VOID)
 
VOID EmulatorException (BYTE ExceptionNumber, LPWORD Stack)
 
VOID EmulatorPause (VOID)
 
VOID EmulatorResume (VOID)
 
VOID EmulatorTerminate (VOID)
 
BOOLEAN EmulatorInitialize (HANDLE ConsoleInput, HANDLE ConsoleOutput)
 
VOID EmulatorCleanup (VOID)
 

Variables

FAST486_STATE EmulatorContext
 
LPVOID BaseAddress
 
BOOLEAN VdmRunning
 

Macro Definition Documentation

◆ ARRAY_INDEX

#define ARRAY_INDEX (   ptr,
  array 
)    ((ULONG)(((ULONG_PTR)(ptr) - (ULONG_PTR)(array)) / sizeof(*array)))

Definition at line 36 of file emulator.h.

◆ FAR_POINTER

#define FAR_POINTER (   x)    SEG_OFF_TO_PTR(HIWORD(x), LOWORD(x))

Definition at line 31 of file emulator.h.

◆ MAX_ADDRESS

#define MAX_ADDRESS   0x1000000

Definition at line 25 of file emulator.h.

◆ MAX_OFFSET

#define MAX_OFFSET   0xFFFF

Definition at line 24 of file emulator.h.

◆ MAX_SEGMENT

#define MAX_SEGMENT   0xFFFF

Definition at line 23 of file emulator.h.

◆ MEM_ALIGN_DOWN

#define MEM_ALIGN_DOWN (   ptr,
  align 
)    (PVOID)((ULONG_PTR)(ptr) & ~((align) - 1l))

Definition at line 19 of file emulator.h.

◆ MEM_ALIGN_UP

#define MEM_ALIGN_UP (   ptr,
  align 
)    MEM_ALIGN_DOWN((ULONG_PTR)(ptr) + (align) - 1l, (align))

Definition at line 20 of file emulator.h.

◆ PHYS_TO_REAL

#define PHYS_TO_REAL (   ptr)    (PVOID)((ULONG_PTR)(ptr) - (ULONG_PTR)BaseAddress)

Definition at line 34 of file emulator.h.

◆ REAL_TO_PHYS

#define REAL_TO_PHYS (   ptr)    (PVOID)((ULONG_PTR)(ptr) + (ULONG_PTR)BaseAddress)

Definition at line 33 of file emulator.h.

◆ SEG_OFF_TO_PTR

#define SEG_OFF_TO_PTR (   seg,
  off 
)    (PVOID)((ULONG_PTR)BaseAddress + TO_LINEAR((seg), (off)))

Definition at line 28 of file emulator.h.

◆ TO_LINEAR

#define TO_LINEAR (   seg,
  off 
)    (((seg) << 4) + (off))

Definition at line 22 of file emulator.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
EMULATOR_EXCEPTION_DIVISION_BY_ZERO 
EMULATOR_EXCEPTION_DEBUG 
EMULATOR_EXCEPTION_NMI 
EMULATOR_EXCEPTION_BREAKPOINT 
EMULATOR_EXCEPTION_OVERFLOW 
EMULATOR_EXCEPTION_BOUND 
EMULATOR_EXCEPTION_INVALID_OPCODE 
EMULATOR_EXCEPTION_NO_FPU 
EMULATOR_EXCEPTION_DOUBLE_FAULT 
EMULATOR_EXCEPTION_FPU_SEGMENT 
EMULATOR_EXCEPTION_INVALID_TSS 
EMULATOR_EXCEPTION_NO_SEGMENT 
EMULATOR_EXCEPTION_STACK_SEGMENT 
EMULATOR_EXCEPTION_GPF 
EMULATOR_EXCEPTION_PAGE_FAULT 

Definition at line 74 of file emulator.h.

Function Documentation

◆ BCD_TO_BINARY()

FORCEINLINE USHORT BCD_TO_BINARY ( USHORT  Value)

Definition at line 59 of file emulator.h.

60 {
61  USHORT Result;
62 
63  Result = Value & 0xF;
64  Value >>= 4;
65  Result += (Value & 0xF) * 10;
66  Value >>= 4;
67  Result += (Value & 0xF) * 100;
68  Value >>= 4;
69  Result += Value * 1000;
70 
71  return Result;
72 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
unsigned short USHORT
Definition: pedump.c:61

◆ BINARY_TO_BCD()

FORCEINLINE USHORT BINARY_TO_BCD ( USHORT  Value)

Definition at line 42 of file emulator.h.

43 {
44  USHORT Result;
45 
46  Result = (Value / 1000) << 12;
47  Value %= 1000;
48  Result |= (Value / 100) << 8;
49  Value %= 100;
50  Result |= (Value / 10) << 4;
51  Value %= 10;
52  Result |= Value;
53 
54  return Result;
55 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
unsigned short USHORT
Definition: pedump.c:61

◆ C_ASSERT()

C_ASSERT ( 0x100000<=  MAX_ADDRESS)

◆ DumpMemory()

VOID DumpMemory ( BOOLEAN  TextFormat)

Definition at line 369 of file emulator.c.

370 {
371  static ULONG DumpNumber = 0;
372 
373  HANDLE hFile;
375 
376  /* Build a suitable file name */
378  L"memdump%lu.%s",
379  DumpNumber,
380  TextFormat ? L"txt" : L"dat");
381  ++DumpNumber;
382 
383  DPRINT1("Creating memory dump file '%S'...\n", FileName);
384 
385  /* Always create the dump file */
388  0,
389  NULL,
392  NULL);
393 
395  {
396  DPRINT1("Error when creating '%S' for memory dumping, GetLastError() = %u\n",
398  return;
399  }
400 
401  /* Dump the VM memory in the chosen format */
402  if (TextFormat)
404  else
406 
407  /* Close the file */
409 
410  DPRINT1("Memory dump done\n");
411 }
static VOID DumpMemoryRaw(HANDLE hFile)
Definition: emulator.c:304
#define CloseHandle
Definition: compat.h:398
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static VOID DumpMemoryTxt(HANDLE hFile)
Definition: emulator.c:317
#define GENERIC_WRITE
Definition: nt_native.h:90
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const WCHAR L[]
Definition: oid.c:1250
_In_ HANDLE hFile
Definition: mswsock.h:90
#define CREATE_ALWAYS
Definition: disk.h:72
#define DPRINT1
Definition: precomp.h:8
#define CreateFileW
Definition: compat.h:400
unsigned int ULONG
Definition: retypes.h:1

Referenced by MenuEventHandler().

◆ EjectFloppy()

VOID EjectFloppy ( IN ULONG  DiskNumber)

Definition at line 467 of file emulator.c.

468 {
470 
471  /* Unmount the disk */
472  if (!UnmountDisk(FLOPPY_DISK, DiskNumber))
473  DisplayMessage(L"An error happened when ejecting disk %d", DiskNumber);
474 
475  /* Free the old string */
476  if (GlobalSettings.FloppyDisks[DiskNumber].Buffer)
477  {
479  RtlInitEmptyUnicodeString(&GlobalSettings.FloppyDisks[DiskNumber], NULL, 0);
480  }
481 
482  /* Refresh the menu state */
484 }
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
smooth NULL
Definition: ftsmooth.c:416
UNICODE_STRING FloppyDisks[2]
Definition: ntvdm.h:78
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN UnmountDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber)
Definition: disk.c:602
void DisplayMessage(BOOL bConsole, BOOL bSilent, LPCTSTR lpMessage, LPCTSTR lpTitle, UINT uType)
Definition: regsvr32.c:239
NTVDM_SETTINGS GlobalSettings
Definition: ntvdm.c:25
VOID UpdateVdmMenuDisks(VOID)
Definition: console.c:146

Referenced by MenuEventHandler().

◆ EmulatorCleanup()

VOID EmulatorCleanup ( VOID  )

Definition at line 639 of file emulator.c.

640 {
641  DiskCtrlCleanup();
642 
643  VgaCleanup();
644 
645  /* Close the input thread handle */
647  InputThread = NULL;
648 
649  /* Close the task event */
651  VdmTaskEvent = NULL;
652 
653  PS2Cleanup();
654 
655  SpeakerCleanup();
656  CmosCleanup();
657  // PitCleanup();
658  // PicCleanup();
659 
660  // DmaCleanup();
661 
662  CpuCleanup();
663  MemCleanup();
664 }
#define CloseHandle
Definition: compat.h:398
HANDLE VdmTaskEvent
Definition: emulator.c:51
VOID CmosCleanup(VOID)
Definition: cmos.c:519
smooth NULL
Definition: ftsmooth.c:416
VOID PS2Cleanup(VOID)
Definition: ps2.c:546
VOID VgaCleanup(VOID)
Definition: svga.c:2145
static HANDLE InputThread
Definition: emulator.c:52
VOID MemCleanup(VOID)
Definition: memory.c:780
VOID SpeakerCleanup(VOID)
Definition: speaker.c:294
VOID DiskCtrlCleanup(VOID)
Definition: disk.c:637
VOID CpuCleanup(VOID)
Definition: cpu.c:243

Referenced by EmulatorInitialize(), and VdmShutdown().

◆ EmulatorException()

VOID EmulatorException ( BYTE  ExceptionNumber,
LPWORD  Stack 
)

Definition at line 85 of file emulator.c.

86 {
87  WORD CodeSegment, InstructionPointer;
88  PBYTE Opcode;
89 
90  ASSERT(ExceptionNumber < 8);
91 
92  /* Get the CS:IP */
93  InstructionPointer = Stack[STACK_IP];
94  CodeSegment = Stack[STACK_CS];
95  Opcode = (PBYTE)SEG_OFF_TO_PTR(CodeSegment, InstructionPointer);
96 
97  /* Display a message to the user */
98  DisplayMessage(L"Exception: %s occurred at %04X:%04X\n"
99  L"Opcode: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
100  ExceptionName[ExceptionNumber],
101  CodeSegment,
102  InstructionPointer,
103  Opcode[0],
104  Opcode[1],
105  Opcode[2],
106  Opcode[3],
107  Opcode[4],
108  Opcode[5],
109  Opcode[6],
110  Opcode[7],
111  Opcode[8],
112  Opcode[9]);
113 
115 
116  /* Stop the VDM */
118 }
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
VOID NTAPI Fast486DumpState(PFAST486_STATE State)
Definition: debug.c:127
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:28
unsigned short WORD
Definition: ntddk_ex.h:93
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
LPCWSTR ExceptionName[]
Definition: emulator.c:54
static const WCHAR L[]
Definition: oid.c:1250
#define STACK_CS
Definition: int32.h:34
VOID EmulatorTerminate(VOID)
Definition: emulator.c:503
FAST486_STATE EmulatorContext
Definition: cpu.c:39
void DisplayMessage(BOOL bConsole, BOOL bSilent, LPCTSTR lpMessage, LPCTSTR lpTitle, UINT uType)
Definition: regsvr32.c:239
#define STACK_IP
Definition: int32.h:33
BYTE * PBYTE
Definition: pedump.c:66

Referenced by BiosException().

◆ EmulatorFpu()

VOID FASTCALL EmulatorFpu ( PFAST486_STATE  State)

Definition at line 79 of file emulator.c.

80 {
81  /* The FPU is wired to IRQ 13 */
83 }
VOID PicInterruptRequest(BYTE Number)
Definition: pic.c:192

Referenced by CpuInitialize().

◆ EmulatorInitialize()

BOOLEAN EmulatorInitialize ( HANDLE  ConsoleInput,
HANDLE  ConsoleOutput 
)

Definition at line 510 of file emulator.c.

511 {
512  USHORT i;
513 
514  /* Initialize memory */
515  if (!MemInitialize())
516  {
517  wprintf(L"Memory initialization failed.\n");
518  return FALSE;
519  }
520 
521  /* Initialize I/O ports */
522  /* Initialize RAM */
523 
524  /* Initialize the CPU */
525 
526  /* Initialize the internal clock */
527  if (!ClockInitialize())
528  {
529  wprintf(L"FATAL: Failed to initialize the clock\n");
530  EmulatorCleanup();
531  return FALSE;
532  }
533 
534  /* Initialize the CPU */
535  CpuInitialize();
536 
537  /* Initialize DMA */
538  DmaInitialize();
539 
540  /* Initialize PIC, PIT, CMOS, PC Speaker and PS/2 */
541  PicInitialize();
542 
543  PitInitialize();
547 
548  CmosInitialize();
550  PpiInitialize();
551 
552  PS2Initialize();
553 
554  /* Initialize the keyboard and mouse and connect them to their PS/2 ports */
555  KeyboardInit(0);
556  MouseInit(1);
557 
558  /**************** ATTACH INPUT WITH CONSOLE *****************/
559  /* Create the task event */
562 
563  /* Start the input thread */
565  if (InputThread == NULL)
566  {
567  wprintf(L"FATAL: Failed to create the console input thread.\n");
568  EmulatorCleanup();
569  return FALSE;
570  }
572  /************************************************************/
573 
574  /* Initialize the VGA */
576  {
577  wprintf(L"FATAL: Failed to initialize VGA support.\n");
578  EmulatorCleanup();
579  return FALSE;
580  }
581 
582  /* Initialize the disk controller */
583  if (!DiskCtrlInitialize())
584  {
585  wprintf(L"FATAL: Failed to completely initialize the disk controller.\n");
586  EmulatorCleanup();
587  return FALSE;
588  }
589 
590  /* Mount the available floppy disks */
591  for (i = 0; i < ARRAYSIZE(GlobalSettings.FloppyDisks); ++i)
592  {
593  if (GlobalSettings.FloppyDisks[i].Length != 0 &&
596  {
598  {
599  DPRINT1("Failed to mount floppy disk file '%wZ'.\n", &GlobalSettings.FloppyDisks[i]);
601  RtlInitEmptyUnicodeString(&GlobalSettings.FloppyDisks[i], NULL, 0);
602  }
603  }
604  }
605 
606  /*
607  * Mount the available hard disks. Contrary to floppies, failing
608  * mounting a hard disk is considered as an unrecoverable error.
609  */
610  for (i = 0; i < ARRAYSIZE(GlobalSettings.HardDisks); ++i)
611  {
612  if (GlobalSettings.HardDisks[i].Length != 0 &&
614  *GlobalSettings.HardDisks[i].Buffer != L'\0')
615  {
617  {
618  wprintf(L"FATAL: Failed to mount hard disk file '%wZ'.\n", &GlobalSettings.HardDisks[i]);
619  EmulatorCleanup();
620  return FALSE;
621  }
622  }
623  }
624 
625  /* Refresh the menu state */
627 
628  /* Initialize the software callback system and register the emulator BOPs */
629  InitializeInt32();
631  // RegisterBop(BOP_UNSIMULATE, CpuUnsimulateBop);
632 
633  /* Initialize VDD support */
635 
636  return TRUE;
637 }
VOID PpiInitialize(VOID)
Definition: ppi.c:78
static VOID WINAPI PitChan1Out(LPVOID Param, BOOLEAN State)
Definition: emulator.c:142
#define TRUE
Definition: types.h:120
static VOID ResumeEventThread(VOID)
Definition: emulator.c:295
static DWORD WINAPI ConsoleEventThread(LPVOID Parameter)
Definition: emulator.c:189
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define BOP_DEBUGGER
Definition: emulator.c:67
VOID PicInitialize(VOID)
Definition: pic.c:295
BOOLEAN DiskCtrlInitialize(VOID)
Definition: disk.c:632
HANDLE VdmTaskEvent
Definition: emulator.c:51
#define wprintf(...)
Definition: whoami.c:18
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
VOID PitSetOutFunction(BYTE Channel, LPVOID Param, PIT_OUT_FUNCTION OutFunction)
Definition: pit.c:476
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
VOID VDDSupInitialize(VOID)
Definition: vddsup.c:507
UNICODE_STRING FloppyDisks[2]
Definition: ntvdm.h:78
UNICODE_STRING HardDisks[4]
Definition: ntvdm.h:79
BOOLEAN KeyboardInit(BYTE PS2Connector)
Definition: keyboard.c:188
static VOID WINAPI PitChan2Out(LPVOID Param, BOOLEAN State)
Definition: emulator.c:160
static VOID WINAPI PitChan0Out(LPVOID Param, BOOLEAN State)
Definition: emulator.c:132
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static HANDLE InputThread
Definition: emulator.c:52
VOID EmulatorCleanup(VOID)
Definition: emulator.c:639
BOOLEAN CpuInitialize(VOID)
Definition: cpu.c:216
static const WCHAR L[]
Definition: oid.c:1250
VOID DmaInitialize(VOID)
Definition: dma.c:549
BOOLEAN ClockInitialize(VOID)
Definition: clock.c:219
BOOLEAN MemInitialize(VOID)
Definition: memory.c:720
BOOLEAN VgaInitialize(HANDLE TextHandle)
Definition: svga.c:2100
BOOLEAN MountDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber, IN PCWSTR FileName, IN BOOLEAN ReadOnly)
Definition: disk.c:500
unsigned short USHORT
Definition: pedump.c:61
#define DPRINT1
Definition: precomp.h:8
VOID InitializeInt32(VOID)
Definition: int32.c:194
static HANDLE ConsoleOutput
Definition: console.c:17
VOID PitInitialize(VOID)
Definition: pit.c:503
VOID SpeakerInitialize(VOID)
Definition: speaker.c:259
BOOLEAN PS2Initialize(VOID)
Definition: ps2.c:520
BOOLEAN MouseInit(BYTE PS2Connector)
Definition: mouse.c:464
VOID CmosInitialize(VOID)
Definition: cmos.c:441
Definition: disk.h:45
NTVDM_SETTINGS GlobalSettings
Definition: ntvdm.c:25
VOID UpdateVdmMenuDisks(VOID)
Definition: console.c:146
static VOID WINAPI EmulatorDebugBreakBop(LPWORD Stack)
Definition: emulator.c:126

Referenced by wmain().

◆ EmulatorIntAcknowledge()

UCHAR FASTCALL EmulatorIntAcknowledge ( PFAST486_STATE  State)

Definition at line 71 of file emulator.c.

72 {
74 
75  /* Get the interrupt number from the PIC */
76  return PicGetInterrupt();
77 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BYTE PicGetInterrupt(VOID)
Definition: pic.c:244

Referenced by CpuInitialize().

◆ EmulatorInterruptSignal()

VOID EmulatorInterruptSignal ( VOID  )

Definition at line 120 of file emulator.c.

121 {
122  /* Call the Fast486 API */
124 }
VOID NTAPI Fast486InterruptSignal(PFAST486_STATE State)
Definition: fast486.c:205
FAST486_STATE EmulatorContext
Definition: cpu.c:39

Referenced by PicInterruptRequest(), and PicWriteCommand().

◆ EmulatorPause()

VOID EmulatorPause ( VOID  )

Definition at line 487 of file emulator.c.

488 {
489  /* Pause the VDM */
493 }
static VOID PauseEventThread(VOID)
Definition: emulator.c:290
VOID VgaRefreshDisplay(VOID)
Definition: svga.c:1783
VOID VDDBlockUserHook(VOID)
Definition: vddsup.c:479

Referenced by CmdSetExitCode(), CmdStartProcess(), and DosStartProcess32().

◆ EmulatorResume()

VOID EmulatorResume ( VOID  )

Definition at line 495 of file emulator.c.

496 {
497  /* Resume the VDM */
501 }
static VOID ResumeEventThread(VOID)
Definition: emulator.c:295
VOID VgaRefreshDisplay(VOID)
Definition: svga.c:1783
VOID VDDResumeUserHook(VOID)
Definition: vddsup.c:492

Referenced by CmdSetExitCode(), CmdStartProcess(), DosStart(), and DosStartProcess32().

◆ EmulatorTerminate()

◆ MountFloppy()

VOID MountFloppy ( IN ULONG  DiskNumber)

Definition at line 413 of file emulator.c.

414 {
415 // FIXME: This should be present in PSDK commdlg.h
416 //
417 // FlagsEx Values
418 #if (_WIN32_WINNT >= 0x0500)
419 #define OFN_EX_NOPLACESBAR 0x00000001
420 #endif // (_WIN32_WINNT >= 0x0500)
421 
424  WCHAR szFile[MAX_PATH] = L"";
425 
427 
428  RtlZeroMemory(&ofn, sizeof(ofn));
429  ofn.lStructSize = sizeof(ofn);
431  ofn.lpstrTitle = L"Select a virtual floppy image";
433 // ofn.FlagsEx = OFN_EX_NOPLACESBAR;
434  ofn.lpstrFilter = L"Virtual floppy images (*.vfd;*.img;*.ima;*.dsk)\0*.vfd;*.img;*.ima;*.dsk\0All files (*.*)\0*.*\0\0";
435  ofn.lpstrDefExt = L"vfd";
436  ofn.nFilterIndex = 0;
437  ofn.lpstrFile = szFile;
438  ofn.nMaxFile = ARRAYSIZE(szFile);
439 
440  if (!GetOpenFileNameW(&ofn))
441  {
442  DPRINT1("CommDlgExtendedError = %d\n", CommDlgExtendedError());
443  return;
444  }
445 
446  /* Free the old string */
447  if (GlobalSettings.FloppyDisks[DiskNumber].Buffer)
449 
450  /* Reinitialize the string */
452  ASSERT(Success);
453 
454  /* Mount the disk */
455  if (!MountDisk(FLOPPY_DISK, DiskNumber, GlobalSettings.FloppyDisks[DiskNumber].Buffer, !!(ofn.Flags & OFN_READONLY)))
456  {
457  DisplayMessage(L"An error happened when mounting disk %d", DiskNumber);
459  RtlInitEmptyUnicodeString(&GlobalSettings.FloppyDisks[DiskNumber], NULL, 0);
460  return;
461  }
462 
463  /* Refresh the menu state */
465 }
#define OFN_FILEMUSTEXIST
Definition: commdlg.h:106
#define OFN_EXPLORER
Definition: commdlg.h:104
#define OFN_LONGNAMES
Definition: commdlg.h:108
HWND hConsoleWnd
Definition: console.c:20
HWND hwndOwner
Definition: commdlg.h:330
OPENFILENAME ofn
Definition: main.cpp:37
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
LPCSTR lpstrDefExt
Definition: commdlg.h:345
DWORD nMaxFile
Definition: commdlg.h:337
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
Definition: filedlg.c:4565
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define OFN_PATHMUSTEXIST
Definition: commdlg.h:117
UNICODE_STRING FloppyDisks[2]
Definition: ntvdm.h:78
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
DWORD lStructSize
Definition: commdlg.h:329
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define OFN_READONLY
Definition: commdlg.h:118
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN MountDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber, IN PCWSTR FileName, IN BOOLEAN ReadOnly)
Definition: disk.c:500
LPSTR lpstrFile
Definition: commdlg.h:336
LPCSTR lpstrFilter
Definition: commdlg.h:332
#define DPRINT1
Definition: precomp.h:8
LPCSTR lpstrTitle
Definition: commdlg.h:341
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
DWORD nFilterIndex
Definition: commdlg.h:335
void DisplayMessage(BOOL bConsole, BOOL bSilent, LPCTSTR lpMessage, LPCTSTR lpTitle, UINT uType)
Definition: regsvr32.c:239
#define OFN_ENABLESIZING
Definition: commdlg.h:101
DWORD WINAPI CommDlgExtendedError(void)
Definition: cdlg32.c:139
NTVDM_SETTINGS GlobalSettings
Definition: ntvdm.c:25
VOID UpdateVdmMenuDisks(VOID)
Definition: console.c:146
DWORD Flags
Definition: commdlg.h:342

Referenced by MenuEventHandler().

Variable Documentation

◆ BaseAddress

LPVOID BaseAddress

Definition at line 404 of file mmfuncs.h.

Referenced by $endif(), __RtlImageDirectoryEntryToData(), __RtlImageRvaToVa(), _IRQL_requires_max_(), _MiFlushMappedSection(), _MiMapViewOfSegment(), AdvancedErrorChecks(), AVrfpIsVerifierProviderDll(), AVrfpLdrGetProcedureAddress(), BehaviorChecks(), BiosDiskService(), BiosMiscService(), BiosMouseEnable(), BlImgLoadImageWithProgress2(), CalcCheckSum(), CcCopyData(), CcPerformReadAhead(), CcPreparePinWrite(), CcpUnpinData(), CcRosGetVacb(), CcRosMapVacbInKernelSpace(), CcRosRequestVacb(), CheckAdjacentVADs(), CheckAlignment(), CheckSize(), CheckSomeDefaultAddresses(), CheckSumMappedFile(), CmpInitializeMachineDependentConfiguration(), CpuExceptionFilter(), CreateProcessInternalW(), DbgkMapViewOfSection(), DbgkUnMapViewOfSection(), DECLARE_INTERFACE_(), DiskBios32Post(), DosBIOSInitialize(), DosClonePsp(), DosCreatePsp(), DosInt21h(), DosLoadExecutableInternal(), DosMouseCleanup(), DosMouseDisable(), DosMouseEnable(), DosMouseInitialize(), DosTerminateProcess(), ExLockUserBuffer(), ExpComputePartialHashForAddress(), FAT12CountAvailableClusters(), FAT12FindAndMarkAvailableCluster(), FAT12GetNextCluster(), FAT12WriteCluster(), FAT16CountAvailableClusters(), FAT16FindAndMarkAvailableCluster(), FAT16GetNextCluster(), FAT16WriteCluster(), FAT32CountAvailableClusters(), FAT32FindAndMarkAvailableCluster(), FAT32GetNextCluster(), FAT32WriteCluster(), FileSectionViewPermissionCheck(), find_entry(), FlushViewOfFile(), GetEbdaLocation(), GetProcessVersion(), HalpMapPhysicalMemory64Vista(), HandlePageFault(), IMAGEHLP_RecalculateChecksum(), InitializeBiosInt32(), InitializeModeTable(), IntAgpCommitVirtual(), IntAgpFreeVirtual(), IntVideoPortImageDirectoryEntryToData(), IopLoadServiceModule(), IopLoadUnloadDriver(), is_data_file_module(), KdpSysReadControlSpace(), KdpSysWriteControlSpace(), Ke386SetGdtEntryBase(), KeSweepICache(), LdrAccessResource(), LdrAddRefDll(), LdrDisableThreadCalloutsForDll(), LdrFindResource_U(), LdrFindResourceDirectory_U(), LdrGetProcedureAddress(), LdrLoadDll(), LdrpAccessResource(), LdrpAllocateDataTableEntry(), LdrpCallInitRoutine(), LdrPEGetExportByName(), LdrpFetchAddressOfSecurityCookie(), LdrpGetProcedureAddress(), LdrpLoadDll(), LdrRelocateImage(), LdrRelocateImageWithBias(), LdrUnloadDll(), LdrVerifyMappedImageMatchesChecksum(), LlbAllocateMemoryEntry(), LoadModule(), LoadOle32Export(), main(), MapFileAndCheckSumA(), MapFileAndCheckSumW(), MemCleanup(), MemInitialize(), MiAddHalIoMappings(), MiAllocateContiguousMemory(), MiBuildPfnDatabaseFromPages(), MiCacheImageSymbols(), MiCheckForContiguousMemory(), MiCheckVadsForLockOperation(), MiCreateArm3StaticMemoryArea(), MiCreatePebOrTeb(), MiFindContiguousMemory(), MiFreeContiguousMemory(), MiInsertVadEx(), MiLoadUserSymbols(), MiLockVirtualMemory(), MiMapLockedPagesInUserSpace(), MiMapViewOfDataSection(), MiProtectVirtualMemory(), MiQueryMemoryBasicInformation(), MiQueryMemorySectionName(), MiReadPage(), MiRemoveMappedPtes(), MiRosCleanupMemoryArea(), MiRosProtectVirtualMemory(), MiRosUnmapViewOfSection(), MiUnlockVirtualMemory(), MiUnmapLockedPagesInUserSpace(), MiUnmapViewOfSection(), MmAllocateNonCachedMemory(), MmAlterRegion(), MmAlterViewAttributes(), MmCreateKernelStack(), MmCreateMemoryArea(), MmFindRegion(), MmFreeContiguousMemory(), MmFreeContiguousMemorySpecifyCache(), MmFreeNonCachedMemory(), MmMapIoSpace(), MmMapLockedPagesSpecifyCache(), MmMapViewOfArm3Section(), MmMapViewOfSection(), MmMapViewOfSegment(), MmPapAllocatePagesInRange(), MmPapAllocatePhysicalPagesInRange(), MmProtectSectionView(), MmUnloadSystemImage(), MmUnmapIoSpace(), MmUnmapLockedPages(), MmUnmapVideoDisplay(), MmUnmapViewOfCacheSegment(), MmUnmapViewOfSection(), MmUnmapViewOfSegment(), MmVerifyImageIsOkForMpUse(), NtFlushInstructionCache(), NtFlushVirtualMemory(), NtGetVersionResource(), NtGetWriteWatch(), NtLockVirtualMemory(), NtMapViewOfSection(), NtProtectVirtualMemory(), NtQueryVirtualMemory(), NtReadVirtualMemory(), NtResetWriteWatch(), NtUnlockVirtualMemory(), NtUnmapViewOfSection(), NtWriteVirtualMemory(), OpenAndMapFile(), PageFileBehaviorChecks(), PcMemGetBiosMemoryMap(), PpcGetMemoryMap(), PropertyLengthAsVariant(), RamdiskCreateDiskDevice(), RamdiskGetPartitionInfo(), RamdiskReadWriteReal(), RamdiskSetPartitionInfo(), RamdiskUnmapPages(), ReadWriteOrZero(), ReserveMemory(), RtlConvertPropertyToVariant(), RtlConvertVariantToProperty(), RtlDebugGetUserInfoHeap(), RtlDebugSetUserFlagsHeap(), RtlDebugSetUserValueHeap(), RtlDestroyHeap(), RtlFindMessage(), RtlGetUserInfoHeap(), RtlImageDirectoryEntryToData(), RtlImageRvaToVa(), RtlpDebugPageHeapValidate(), RtlpDestroyHeapSegment(), RtlpDphNormalHeapValidate(), RtlpInitEnvironment(), RtlpPageHeapGetUserInfo(), RtlpPageHeapSetUserFlags(), RtlpPageHeapSetUserValue(), RtlpPageHeapSize(), RtlSetUserFlagsHeap(), RtlSetUserValueHeap(), ScrCreate(), ScrLoadFontTable(), SE_IsShimDll(), SeiCheckComPlusImage(), SeiCreateShimModuleInfo(), SeiFindHookModuleInfo(), SeiGetShimModuleInfo(), SeiInit(), SerialDetectUartType(), SetMemory(), SimpleErrorChecks(), START_TEST(), supports_pdb(), supports_rsym(), SystemProcessWorker(), Test_ImageSection2(), test_pack_MEMORY_BASIC_INFORMATION(), Test_PageFileSection(), Test_SectionContents(), test_SymEnumSymbols(), test_SymFromAddr(), test_SymFromName(), test_SymRegCallback(), Test_Truncate(), TestMap(), UnMapFile(), VbeGetVideoMemoryBaseAddress(), VbeSetMode(), VdmpInitialize(), VidBiosDrawGlyph(), VidBiosPost(), VidBiosSetVideoMode(), VidBiosVideoService(), VideoPortLockBuffer(), VirtualLock(), VirtualUnlock(), and Write().

◆ EmulatorContext

◆ VdmRunning

BOOLEAN VdmRunning

Definition at line 49 of file emulator.c.

Referenced by ClockUpdate(), ConsoleEventThread(), CpuSimulate(), and EmulatorTerminate().