Commit graph

233 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto af24ac79df [NTVDM]
- Export and use IORead/WriteXX (instead of PicRead/WriteXX or VgaRead/WritePort)
- static'ify some functions.

svn path=/branches/ntvdm/; revision=61580
2014-01-11 14:40:03 +00:00
Hermès Bélusca-Maïto 0042be70fb [NTVDM]
Fix few problems in BiosCopyTextConsoleToVgaMemory (copied screen region and temp buffer freeing).

svn path=/branches/ntvdm/; revision=61544
2014-01-06 00:17:59 +00:00
Hermès Bélusca-Maïto 98e367f291 [NTVDM]
Save console in/out modes and cursor shape, and restore them at cleanup.

svn path=/branches/ntvdm/; revision=61543
2014-01-05 22:21:57 +00:00
Hermès Bélusca-Maïto 425717c483 [NTVDM]
- Move console text buffer copy into VGA memory, to the BIOS (function BiosCopyTextConsoleToVgaMemory), and do it just after the BIOS sets its default display mode.
- Try to resize "correctly" the console to its original size when cleaning BIOS (Part 2/2, see revision 61538). Still WIP.
- Code cleaning in vga.c

svn path=/branches/ntvdm/; revision=61542
2014-01-05 21:26:33 +00:00
Hermès Bélusca-Maïto 2a053222a7 [NTVDM]
Fix changing console size when entering a given text-mode. Inspired from our telnet console tconsole.cpp!SetWindowSize function.
Part 1/2

svn path=/branches/ntvdm/; revision=61538
2014-01-05 14:14:26 +00:00
Aleksandar Andrejevic 08b3bef080 [NTVDM]
Fix the interleaved shift mode.
Don't halve the vertical resolution twice.


svn path=/branches/ntvdm/; revision=61535
2014-01-04 22:33:05 +00:00
Aleksandar Andrejevic 4d933b0747 [NTVDM]
Implement DOS functions 0x4E (Find First File) and 0x4F (Find Next File). Not tested yet.


svn path=/branches/ntvdm/; revision=61507
2014-01-03 23:41:40 +00:00
Hermès Bélusca-Maïto 2b13376ad5 [NTVDM]
Rework the resource files, and add a nice old-ish IBM PC AT icon (C) myself :) (only 32x32 256 colors for now).

svn path=/branches/ntvdm/; revision=61462
2013-12-29 22:38:10 +00:00
Hermès Bélusca-Maïto e8d3c3e4bd [NTVDM]: Don't display an error message if the VDD registry key (or value) just doesn't exist: it significates we just don't have any VDD to load...
Thanks to Lee Schroeder and oldman on the forum for having detected this :)

svn path=/branches/ntvdm/; revision=61459
2013-12-28 22:22:12 +00:00
Hermès Bélusca-Maïto d944afa5c7 [NTVDM]
Shut up few DPRINT1s, and demote some DPRINT1s to DPRINTs but disable NDEBUG for now (enable it and you'll shut up the DPRINTs).

svn path=/branches/ntvdm/; revision=61451
2013-12-27 19:51:43 +00:00
Hermès Bélusca-Maïto cc98f9be4f [NTVDM]
Make colors appearing in CGA mode 4, but still buggy concerning the computation of the resolution (either the X-dimension is twice big or the Y-dimension is twice small), and the position of the pixels...
However the VGA registers are (almost) similar to http://www.brokenthorn.com/Resources/OSDevVid2.html and putting them equal to the settings given there don't change anything new...

svn path=/branches/ntvdm/; revision=61435
2013-12-26 21:40:20 +00:00
Hermès Bélusca-Maïto 2752c69839 [NTVDM]: Code "formatting" + fix types.
svn path=/branches/ntvdm/; revision=61434
2013-12-26 21:37:06 +00:00
Hermès Bélusca-Maïto 0cf85b9296 [NTVDM]
- Fix palette setting for EGA modes, fixes Rescue-Rover menu colors amongst others.
  Some of the palettes were adapted (read: translated from DAC registers settings) from DOSBox;
  and I've also used http://www.brokenthorn.com/Resources/OSDevVid2.html for some settings.
  This should be reviewed to fix / remove redundancies or errors.
- Attempt to implement basic palette enablig/disabling flag (via AC palette regs).
- I've introduced (commented) DbgPrint's for testing AC regs setting. I will remove them when everything is ok.

svn path=/branches/ntvdm/; revision=61419
2013-12-25 21:40:18 +00:00
Hermès Bélusca-Maïto 1a873828b6 [NTVDM]
- BIOS: Fix setting video page parameters when setting mode, and effectively fix setting of video page (fix the involved CRTC registers !!).
  Now Advanced NetWars works without flickering.
- VGA: Fix code presentation.

svn path=/branches/ntvdm/; revision=61390
2013-12-24 22:40:15 +00:00
Hermès Bélusca-Maïto 5c45aa50d1 [NTVDM]: DOS: Add some description / fix a comment.
svn path=/branches/ntvdm/; revision=61389
2013-12-24 22:33:16 +00:00
Hermès Bélusca-Maïto ec409b401e [NTVDM]: We know that .h files are header files ;)
svn path=/branches/ntvdm/; revision=61375
2013-12-24 15:53:30 +00:00
Hermès Bélusca-Maïto 8331d27b2b [NTVDM]: Implement and export VDDTerminateVDM.
svn path=/branches/ntvdm/; revision=61374
2013-12-24 15:52:31 +00:00
Hermès Bélusca-Maïto 4f99547f7d [NTVDM]
Implement and export (and define in vddsvc.h) call_ica_hw_interrupt and VDDSimulateInterrupt macro.
ICA = Interrupt Controller Adapter (in windows terminology)

svn path=/branches/ntvdm/; revision=61372
2013-12-24 15:30:59 +00:00
Hermès Bélusca-Maïto 81c28dca92 Oups, forgot to link against advapi32 too (for registry functions) xD
svn path=/branches/ntvdm/; revision=61371
2013-12-24 13:48:39 +00:00
Hermès Bélusca-Maïto f29962099c [NTVDM]
Load VDDs registered in HKLM\SYSTEM\CurrentControlSet\Control\VirtualDeviceDrivers key, value "VDD" (of type REG_MULTI_SZ).
I still don't call FreeLibrary to unload them at the end of NTVDM's lifetime (otherwise we would have to store their handles in an array).

svn path=/branches/ntvdm/; revision=61370
2013-12-24 13:33:51 +00:00
Hermès Bélusca-Maïto 5005df3ef3 [NTVDM]: Fix VDDInstallIOHook.
svn path=/branches/ntvdm/; revision=61369
2013-12-24 13:03:04 +00:00
Hermès Bélusca-Maïto bd4f41283c [NTVDM]: IO ports: put our internal handlers and Windows' ones for compatiblity into a union.
svn path=/branches/ntvdm/; revision=61368
2013-12-24 12:15:27 +00:00
Hermès Bélusca-Maïto d1398349c9 [NTVDM]: DOS: Implement INT 29h: DOS 2+ Fast Console Output.
svn path=/branches/ntvdm/; revision=61365
2013-12-23 22:01:17 +00:00
Hermès Bélusca-Maïto 936b30b601 [NTVDM]: Add support for Windows' VDD_IO_HANDLERS in our I/O ports emulation.
svn path=/branches/ntvdm/; revision=61364
2013-12-23 21:16:57 +00:00
Hermès Bélusca-Maïto da6f99a13c [NTVDM]
- Implement and export VDDInstallIOHook and VDDDeInstallIOHook; rework EmulatorRead/WriteIo to take into account for different port handlers' sizes (byte, word, dword). Still WIP and may be subject to renamings... RegisterIoPort needs to be converted.
- Stubplement and export getIntelRegistersPointer.
- Export c_get/setXX functions which are aliases to get/setXX functions, for MIPS NTVDM compatibility.

svn path=/branches/ntvdm/; revision=61358
2013-12-23 18:17:29 +00:00
Hermès Bélusca-Maïto 8e9d50c603 [NTVDM]
- Simplify EmulatorReadMemory (first MMIO-mapped devices copy their memory image back to the VM' memory area, then data is read via RtlCopyMemory), and EmulatorWriteMemory (simplify VgaBuffer computation and rename this variable accordingly, for readability purposes).
- Fix Sim32pGetVDMPointer and MGetVdmPointer prototypes.

svn path=/branches/ntvdm/; revision=61356
2013-12-23 18:09:18 +00:00
Hermès Bélusca-Maïto 64091a6600 [NTVDM]: Remove unneeded WINAPI convention calls.
svn path=/branches/ntvdm/; revision=61355
2013-12-23 18:04:32 +00:00
Hermès Bélusca-Maïto 2a6c5d51be [NTVDM]
Hackplement BOP_CMD function 0x08: "Launch external command". Still WIP.
Explanation: Launching a command from command.com starts (under certain conditions not implemented there) "cmd.exe /c <the_command>"

See https://groups.google.com/forum/#!topic/microsoft.public.win2000.cmdprompt.admin/n5KbegKJuE0
and http://technet.microsoft.com/en-us/library/cc723564.aspx#XSLTsection123121120120
subsection "CMD.EXE and COMMAND.COM":
"Be aware that a command shell is not an MS-DOS command prompt, even though it shares the same icon.
The Windows NT command shell is a full 32-bit Windows NT console application that resides in the CMD.EXE executable file.
The MS-DOS command prompt is a 16-bit DOS application that resides in the COMMAND.COM executable file.
Because COMMAND.COM is a 16-bit DOS executable, Windows NT executes this shell within a Windows NT virtual DOS machine (VDM).
COMMAND.COM is supplied primarily for compatibility with MS-DOS.
[...]
This behavior reveals a quite subtle feature of Windows NT that is very important. The 16-bit MS-DOS shell (COMMAND.COM)
that ships with Windows NT is specially designed for Windows NT. When a command is entered for execution by this shell,
it does not actually execute it. Instead, it packages the command text and sends it to a 32-bit CMD.EXE command shell for
execution. Because all commands are actually executed by CMD.EXE (the Windows NT command shell), the 16-bit shell inherits
all the features and facilities of the full Windows NT shell."


svn path=/branches/ntvdm/; revision=61290
2013-12-18 01:16:54 +00:00
Hermès Bélusca-Maïto 610ee54a1a VDD really means "Virtual Device Drivers".
svn path=/branches/ntvdm/; revision=61289
2013-12-17 23:13:11 +00:00
Hermès Bélusca-Maïto a27abed335 [NTVDM]
- Halfplement and export VdmMapFlat
- Make mention of the existence of VdmFlushCache and VdmUnmapFlat, which are not exported in x86 builds (macros are therefore defined to just return TRUE) but are exported in MIPS... builds...
See VDDSVC.H and NT_VDD.H in the DDK
(those headers don't exist in ROS; we'll have to create them later on).

svn path=/branches/ntvdm/; revision=61288
2013-12-17 23:03:23 +00:00
Hermès Bélusca-Maïto 1241dffa09 [NTVDM]
Studying the "vddtest" example mentioned in revision 61283 allowed me to see that valid VDD DLL "handles" start at 1 and cannot be equal to zero.
Add helper macros to convert from indices to handles. Fixes "vddtest" example.

Have fun at running it :)

svn path=/branches/ntvdm/; revision=61287
2013-12-17 22:34:08 +00:00
Hermès Bélusca-Maïto 90ab15cf66 [NTVDM]
- Thanks Thomas for having pointed me towards the fact that the NTVDM exports were really STDCALL and not CDECL (as I've thought first, because originally I was checking whether the getXX() functions were stdcall or not, and distinguishing VOID stdcall or cdecl functions without the symbols was hopeless).
- Halfplement and export Sim32pGetVDMPointer and MGetVdmPointer, needed to run correctly the RageStorm "galaxy" sample mentioned yesterday (see revision 61283). Now it loads and the dispatch call works \o/
- VDD_INIT_PROC and VDD_DISPATCH_PROC have the same signature --> rename them to VDD_PROC.

Have fun at testing!

svn path=/branches/ntvdm/; revision=61286
2013-12-17 22:10:58 +00:00
Hermès Bélusca-Maïto ed874b41fc [NTVDM]
Implement basic VDD support:
implement the (un)register & dispatch call BOP (called BOP_3RDPARTY): see "Undocumented DOS" by Schulman et al. page 267 (as always ;) ), as well as:
http://www.ragestorm.net/tutorial?id=27 - "Tutorial - Calling Win32 from DOS"
http://www.airborn.com.au/layout/vddtest.html - "DOS to 32 bit DLL under XP - an example" (almost the same explanations as the previous article)
http://sta.c64.org/blog/dosvddaccess.html - "Accessing Windows device drivers from DOS programs"
and...
... your lovely Win2k / Win2k3 DDK section: "Device Technologies/Other Devices/Devices Requiring VDDs" !!

Ready to test? :D

svn path=/branches/ntvdm/; revision=61283
2013-12-17 02:19:52 +00:00
Hermès Bélusca-Maïto 49b672d829 [NTVDM]: Implement BOP_DEBUGGER (see: "Undocumented DOS" by Schulman et al., page 267) which allows you to break into a debugger from a 16-bit app (Vampyre, it can be useful for you ;) ).
svn path=/branches/ntvdm/; revision=61282
2013-12-16 23:57:35 +00:00
Hermès Bélusca-Maïto 085fe5e31a [NTVDM]
- As already done for interrupts and I/O ports, add a registering system for BOPs.
- INT32: Move ControlBop to the 32-bit interrupts module where it is used only.
- DOS: Add (un)documented BOP_DOS (0x50) and BOP_CMD(0x54) used respectively by NTIO.SYS/NTDOS.SYS and by COMMAND.COM.
  It appears that they take an extra parameter (so, skip 1 byte-instruction after the BOP instruction as we do for the Control BOP 0xFF).
  See "Undocumented DOS 2nd edition" by Schulman et al., page 267.

svn path=/branches/ntvdm/; revision=61278
2013-12-15 16:30:28 +00:00
Hermès Bélusca-Maïto 61fac982d5 [NTVDM]: Report the "correct" DOS version: 5.00 (or 5.50 depending on which DOS function you call) for NT+ compatibility (allows us to test windows' command.com, debug.com and so on... and therefore to know which BOPs they call).
svn path=/branches/ntvdm/; revision=61277
2013-12-15 15:35:38 +00:00
Hermès Bélusca-Maïto aac5c65456 [NTVDM]: VGA: Fix VGA_DAC_TO_COLOR macro (/me looks at [TheFlash]... :) )
svn path=/branches/ntvdm/; revision=61267
2013-12-13 23:14:33 +00:00
Hermès Bélusca-Maïto de64fe5965 [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.

svn path=/branches/ntvdm/; revision=61263
2013-12-12 20:09:24 +00:00
Aleksandar Andrejevic 7e07cd3ec5 [NTVDM]
Add echo to INT 21h, function AH = 3Fh.


svn path=/branches/ntvdm/; revision=61257
2013-12-10 02:56:42 +00:00
Aleksandar Andrejevic 76f1085bdc [NTVDM]
Fix the file reading subfunction (AH = 3Fh) of INT 21h.
When reading from the console, it always stops on a carriage return.


svn path=/branches/ntvdm/; revision=61256
2013-12-10 01:30:53 +00:00
Hermès Bélusca-Maïto b20613401f [NTVDM]
Rewrite the VGA emulation.


Nah, it's a joke!
- Store VGA registers setup in VGA_REGISTERS structure.
- Improve BiosSetVideoMode and introduce a VgaSetRegisters function for setting VGA regs.
- Initialize Bda->CrtBasePort: it is used to determine the address of some I/O ports which depend on whether we are in color or monochrome mode.
- Add UnregisterIoPort in io.c (and fix some DPRINTs) (needed for VGA).
- When setting the misc. VGA register, check whether we're going to monochrome emulation, and reset some port addresses in that case.

svn path=/branches/ntvdm/; revision=61246
2013-12-08 14:22:27 +00:00
Aleksandar Andrejevic 1c9756782c [NTVDM]
Use the EGA palette for EGA modes.


svn path=/branches/ntvdm/; revision=61242
2013-12-07 03:47:58 +00:00
Hermès Bélusca-Maïto 5a126500d4 Fix my Engrish :)
svn path=/branches/ntvdm/; revision=61240
2013-12-07 00:03:39 +00:00
Hermès Bélusca-Maïto 9b2dbb0b62 [NTVDM]
- Last race condition fix (see revision 61230).
- Add a comment why we do twice the same emptiness check (one before holding the mutex and one just after).

svn path=/branches/ntvdm/; revision=61239
2013-12-07 00:01:24 +00:00
Aleksandar Andrejevic 0f83939238 [NTVDM]
Fix race conditions.


svn path=/branches/ntvdm/; revision=61230
2013-12-06 04:51:47 +00:00
Aleksandar Andrejevic 1b784a5b7b [NTVDM]
Improve the keyboard event handling.
Clean up the PS/2 code a bit.


svn path=/branches/ntvdm/; revision=61229
2013-12-06 04:35:58 +00:00
Aleksandar Andrejevic 6dde554aa8 [NTVDM]
Also serialize access to KeyboardQueueEmpty.


svn path=/branches/ntvdm/; revision=61215
2013-12-04 00:43:11 +00:00
Aleksandar Andrejevic 73186a64bd [NTVDM]
Fix the VGA refresh rate.
Serialize access to the PS/2 keyboard queue.


svn path=/branches/ntvdm/; revision=61214
2013-12-04 00:38:52 +00:00
Hermès Bélusca-Maïto aad49cc77c [NTVDM]: Code formatting only.
svn path=/branches/ntvdm/; revision=61210
2013-12-03 23:50:33 +00:00
Aleksandar Andrejevic e765c894f0 [NTVDM]
Set AL to 0 for unimplemented functions in INT 21h.


svn path=/branches/ntvdm/; revision=61161
2013-12-01 00:17:46 +00:00