Commit graph

55361 commits

Author SHA1 Message Date
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
Aleksandar Andrejevic b456a8b355 [FAST486]
Make the parameters to Fast486ReadModrm*Operands optional, so that
unnecessary extra reads aren't performed. This also eliminates the
need for dummy variables.


svn path=/branches/ntvdm/; revision=61055
2013-11-20 08:01:10 +00:00
Hermès Bélusca-Maïto 8998a96d56 [NTVDM] : Implement getMSW and setMSW for getting and setting the Machine Status Word (lower word of CR0).
[FAST486]: MSW = Machine Status Word

svn path=/branches/ntvdm/; revision=61044
2013-11-18 20:25:10 +00:00
Hermès Bélusca-Maïto 74933952b5 [NTVDM]
- Get rid of EmulatorGetRegister and EmulatorSetRegister and replace their calls with the proper definitions.
- Get rid of the enums EMULATOR_REG_* and use the FAST486_REG_* definitions instead.

svn path=/branches/ntvdm/; revision=61034
2013-11-18 01:16:19 +00:00
Hermès Bélusca-Maïto c519c1610e [NTVDM]
- Implement and export getEFLAGS and setEFLAGS.
- Do some code reorganization (move all registers-related functions into "registers.c").

svn path=/branches/ntvdm/; revision=61033
2013-11-18 00:45:00 +00:00
Hermès Bélusca-Maïto fb031ba118 [NTVDM]
Initialize LastClockUpdate, LastVerticalRefresh and LastCyclePrintout with the value of StartTickCount.

svn path=/branches/ntvdm/; revision=61021
2013-11-17 20:44:23 +00:00
Hermès Bélusca-Maïto da7d643e51 [NTVDM]
- Use MAX/MINSHORT instead of CRT macros.
- Include only the relevant headers.

svn path=/branches/ntvdm/; revision=61014
2013-11-16 23:11:54 +00:00
Aleksandar Andrejevic 4b005f11bf [FAST486]
- When accessing memory using ESP, make the SS segment default.
- The INT instructions always pushes 16-bit values in real mode, regardless
  of the operand/address size attributes.


svn path=/branches/ntvdm/; revision=61000
2013-11-15 20:49:48 +00:00
Aleksandar Andrejevic f5d0d3e784 [FAST486]
The CS cached descriptor has the default operand size, even for stack
operations.


svn path=/branches/ntvdm/; revision=60996
2013-11-15 04:16:25 +00:00
Aleksandar Andrejevic bbc9efd2d9 [FAST486]
- Fix the privilege checks.
- Store the CPL in a special field, so that it doesn't get mixed up
  with the lowest 2 bits of real mode selectors while switching
  into protected mode.
- Reset the exception count after a successful ISR call.
- In Fast486OpcodeGroup0F01, check for prefix overrides after parsing
  the Mod-Reg-R/M, which might add a SS: prefix override in some cases.


svn path=/branches/ntvdm/; revision=60995
2013-11-15 02:32:08 +00:00
Aleksandar Andrejevic 5e54387a9c [FAST486]
Fix the previous fix. ESI was already updated earlier in the function.


svn path=/branches/ntvdm/; revision=60990
2013-11-14 03:11:33 +00:00
Aleksandar Andrejevic 14a31007fc [FAST486]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60989
2013-11-14 03:03:23 +00:00
Aleksandar Andrejevic 9c66549845 [FAST486]
Update the register values in REP LODS.


svn path=/branches/ntvdm/; revision=60988
2013-11-14 02:54:20 +00:00
Aleksandar Andrejevic cdf876ead9 [FAST486]
Fix the BSF and BSR instructions. Partially fix SHLD and SHRD.


svn path=/branches/ntvdm/; revision=60987
2013-11-14 02:39:54 +00:00
Aleksandar Andrejevic a3513c8f18 [FAST486]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60985
2013-11-13 22:34:38 +00:00
Aleksandar Andrejevic cd496c8e21 [FAST486]
XADD: Fix the order of operations.
POP <modrm>: The value must be popped from the stack before parsing the
Mod-Reg-R/M, because of the "POP DWORD [ESP]" case.


svn path=/branches/ntvdm/; revision=60984
2013-11-13 22:33:37 +00:00
Aleksandar Andrejevic 53dfb7da48 [FAST486]
LOOP and JECXZ use the ADSIZE attribute, not OPSIZE.


svn path=/branches/ntvdm/; revision=60977
2013-11-13 19:20:04 +00:00
Aleksandar Andrejevic ace025dca9 [FAST486]
The bit number should be normalized to [0, DataSize- 1], not [0, 2 ^ DataSize - 1].


svn path=/branches/ntvdm/; revision=60975
2013-11-13 18:14:01 +00:00
Aleksandar Andrejevic acccaf3a90 [FAST486]
Fix a bug in the ROL and ROR instructions.


svn path=/branches/ntvdm/; revision=60972
2013-11-13 13:32:00 +00:00
Aleksandar Andrejevic c7de214d81 [FAST486]
Fix several bugs in Fast486RotateOperation.


svn path=/branches/ntvdm/; revision=60969
2013-11-13 02:38:36 +00:00
Aleksandar Andrejevic 677810ea95 [FAST486]
Don't return uninitialized variables.


svn path=/branches/ntvdm/; revision=60967
2013-11-12 21:55:05 +00:00
Aleksandar Andrejevic 2da0e38fbc [FAST486]
In rotate operations, the count is always masked with 0x1F, regardless
of the operand size.


svn path=/branches/ntvdm/; revision=60966
2013-11-12 19:25:50 +00:00
Aleksandar Andrejevic ac9f8a81e3 [FAST486]
Don't forget to check for the operand/address size prefix.


svn path=/branches/ntvdm/; revision=60964
2013-11-12 18:40:13 +00:00