Commit graph

55383 commits

Author SHA1 Message Date
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
Aleksandar Andrejevic f8861a562a [FAST486]
Remove the waiting code for the HLT instruction until I figure out how to do it properly.


svn path=/branches/ntvdm/; revision=61276
2013-12-15 05:08:57 +00:00
Aleksandar Andrejevic ec32b3ef34 [FAST486]
Fix the calculation of PageLength for the last page.


svn path=/branches/ntvdm/; revision=61275
2013-12-15 05:02:59 +00:00
Aleksandar Andrejevic 4c80791d47 [FAST486]
Fix linear memory access when paging is enabled.


svn path=/branches/ntvdm/; revision=61274
2013-12-15 04:15:03 +00:00
Aleksandar Andrejevic efcf73c467 [FAST486]
The LDT can be loaded with a NULL descriptor. That invalidates the LDT but doesn't cause
any exception.


svn path=/branches/ntvdm/; revision=61269
2013-12-14 02:30:42 +00:00
Aleksandar Andrejevic 18b844dffa [FAST486]
Fix the emulation of the Local Descriptor Table.


svn path=/branches/ntvdm/; revision=61268
2013-12-14 02:13:01 +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
Aleksandar Andrejevic 5303c91efa [FAST486]
Implement the extended opcode group 0x0F, 0x00 (SLDT, STR, LLDT, LTR, VERR, VERW).


svn path=/branches/ntvdm/; revision=61264
2013-12-13 03:32:41 +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 a2bd742ecd [FAST486]
- Call Fast486GetCurrentPrivLevel only when needed.
- Fix a type.

svn path=/branches/ntvdm/; revision=61211
2013-12-03 23:51:51 +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 978c08c15c [FAST486]
Implement the BOUND instruction.


svn path=/branches/ntvdm/; revision=61205
2013-12-03 01:30:15 +00:00
Aleksandar Andrejevic 2064d10bad [FAST486]
Check for division by zero, and generate the appropriate exception.


svn path=/branches/ntvdm/; revision=61204
2013-12-03 00:56:47 +00:00
Aleksandar Andrejevic e7a6deb93f [FAST486]
The current "fast" method used in MOVS gives incorrect results. It has been temporarily
replaced with a slow method that works correctly.
The string functions do nothing when CX is 0 on entry, fix CMPS and SCAS.


svn path=/branches/ntvdm/; revision=61203
2013-12-03 00:12:55 +00:00
Aleksandar Andrejevic 84662d3de9 [NTVDM]
Compile NTVDM even on non-i386 architectures.


svn path=/branches/ntvdm/; revision=61194
2013-12-02 01:02:17 +00:00
Aleksandar Andrejevic 03ecfdff3f [FAST486]
Fix MOVS and STOS when DF = 1. The starting position in the block was off by 1.


svn path=/branches/ntvdm/; revision=61163
2013-12-01 03:16:49 +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
Aleksandar Andrejevic ba237b0251 [FAST486]
Revert r61158, and fix the prefix issue correctly, but resetting the flags
again after the call to Fast486InterruptInternal.


svn path=/branches/ntvdm/; revision=61160
2013-11-30 23:45:59 +00:00
Aleksandar Andrejevic 7393337fcf [FAST486]
Use the size of CS, and not SS, in Fast486OpcodePopReg.


svn path=/branches/ntvdm/; revision=61159
2013-11-30 23:14:54 +00:00
Aleksandar Andrejevic 2cbcfd75c5 [FAST486]
Move the prefix reset below the interrupt check, because Fast486InterruptInternal
might set OPSIZE in some circumstances.


svn path=/branches/ntvdm/; revision=61158
2013-11-30 22:17:18 +00:00
Hermès Bélusca-Maïto aadb980c95 [NTVDM]
- Remove some DPRINTs.
- Fix a bug in VgaEnterGraphicsMode (erroneous change of the real saved resolution when going into DoubleVision(TM) mode).
- Do not update the text cursor when being in graphics mode (otherwise I've already hit some ScanlineSize==0 problems) <-- [TheFlash], can you recheck that, please?
- Little optimisation: do not do anything in VgaRefreshDisplay if nothing has to be done.

svn path=/branches/ntvdm/; revision=61157
2013-11-30 22:01:44 +00:00
Aleksandar Andrejevic d49a1c16b2 [NTVDM]
Fix the PIT square wave generator.


svn path=/branches/ntvdm/; revision=61151
2013-11-30 03:59:26 +00:00
Aleksandar Andrejevic 9c6b9c9bab [FAST486]
FPU instructions never generate #UD. If CR0.EM is set, they generate #NM.
If there is no FPU and CR0.EM is cleared, they do nothing.
Add a helper macro FPU_ST for accessing FPU registers.
Add a compile-time option to disable the FPU.


svn path=/branches/ntvdm/; revision=61150
2013-11-30 02:03:51 +00:00
Aleksandar Andrejevic 81c27b5b19 [FAST486]
Start implementing the FPU. Stubplement the FPU opcode handlers.


svn path=/branches/ntvdm/; revision=61141
2013-11-29 03:00:59 +00:00
Hermès Bélusca-Maïto 4fb7f6e1d7 [NTVDM]
- Move some PS/2 initialization from bios.c to ps2.c
- NULLify interrupt entries which are in fact pointers to data tables.
- Add a framework for adding I/O port handlers.

svn path=/branches/ntvdm/; revision=61107
2013-11-26 20:20:51 +00:00
Aleksandar Andrejevic d358641f7c [FAST486]
Fix the order of operations.


svn path=/branches/ntvdm/; revision=61106
2013-11-26 18:11:53 +00:00
Aleksandar Andrejevic 556bace69f [FAST486]
Complete the previous commit with a fix for Fast486WriteLinearMemory too.


svn path=/branches/ntvdm/; revision=61105
2013-11-26 17:56:18 +00:00
Aleksandar Andrejevic f45361126f [FAST486]
Handle the case when the last page is also the first page in Fast486ReadLinearMemory ( when paging is enabled).


svn path=/branches/ntvdm/; revision=61104
2013-11-26 17:55:07 +00:00
Aleksandar Andrejevic 8e356f7a95 [FAST486]
The 486 doesn't have AC, VIF, VIP or ID.
Fix and simplify POPF.
[NTVDM]
Fix the count in the XMS copy function (INT 15h, AH = 87h).


svn path=/branches/ntvdm/; revision=61082
2013-11-23 01:34:03 +00:00
Aleksandar Andrejevic 9a8c7e2a04 [FAST486]
Fix CF calculation in SHRD/SHLD.


svn path=/branches/ntvdm/; revision=61070
2013-11-22 02:47:48 +00:00
Aleksandar Andrejevic 24954c9d07 [FAST486]
DAA, DAS: Update the flags.
AAA, AAS: Subtract from AX instead of AL. The specification says AL, but
so far in all known CPUs and emulators, AX is subtracted.
AAD: Clear AH.


svn path=/branches/ntvdm/; revision=61069
2013-11-22 02:02:05 +00:00
Aleksandar Andrejevic 363543b325 [FAST486]
Fix the calculation of AF in ADC and the calculation of AF and CF in SBB.


svn path=/branches/ntvdm/; revision=61068
2013-11-22 01:22:00 +00:00
Aleksandar Andrejevic c0d571c92a [FAST486]
In the string functions, use ADSIZE and not OPSIZE.
In SCAS and CMPS, fix the "(1 << 32) - 1" bug.


svn path=/branches/ntvdm/; revision=61067
2013-11-22 00:46:28 +00:00
Aleksandar Andrejevic 9c999826e1 [FAST486]
Put the conditional expression in parenthesis so that the addition happens after it.


svn path=/branches/ntvdm/; revision=61063
2013-11-21 04:07:15 +00:00
Aleksandar Andrejevic 37b16fec31 [FAST486]
Fix a bug in Fast486LoadSegment.


svn path=/branches/ntvdm/; revision=61062
2013-11-21 03:18:34 +00:00
Aleksandar Andrejevic f90a1db2b7 [FAST486]
The top half of EIP is cleared after a 16-bit jump.


svn path=/branches/ntvdm/; revision=61058
2013-11-20 14:21:47 +00:00
Aleksandar Andrejevic 459e3a6f48 [FAST486]
Read the LDT instead of the GDT when the table indicator is set.


svn path=/branches/ntvdm/; revision=61057
2013-11-20 10:48:26 +00:00
Aleksandar Andrejevic e2fb91925e [FAST486]
Implement privilege checks when loading the code selector.


svn path=/branches/ntvdm/; revision=61056
2013-11-20 10:43:12 +00:00