reactos.git
10 years ago[NTVDM] : Implement getMSW and setMSW for getting and setting the Machine Status...
Hermès Bélusca-Maïto [Mon, 18 Nov 2013 20:25:10 +0000 (20:25 +0000)]
[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

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Mon, 18 Nov 2013 01:16:19 +0000 (01:16 +0000)]
[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

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Mon, 18 Nov 2013 00:45:00 +0000 (00:45 +0000)]
[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

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sun, 17 Nov 2013 20:44:23 +0000 (20:44 +0000)]
[NTVDM]
Initialize LastClockUpdate, LastVerticalRefresh and LastCyclePrintout with the value of StartTickCount.

svn path=/branches/ntvdm/; revision=61021

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sat, 16 Nov 2013 23:11:54 +0000 (23:11 +0000)]
[NTVDM]
- Use MAX/MINSHORT instead of CRT macros.
- Include only the relevant headers.

svn path=/branches/ntvdm/; revision=61014

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 15 Nov 2013 20:49:48 +0000 (20:49 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 15 Nov 2013 04:16:25 +0000 (04:16 +0000)]
[FAST486]
The CS cached descriptor has the default operand size, even for stack
operations.

svn path=/branches/ntvdm/; revision=60996

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 15 Nov 2013 02:32:08 +0000 (02:32 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 14 Nov 2013 03:11:33 +0000 (03:11 +0000)]
[FAST486]
Fix the previous fix. ESI was already updated earlier in the function.

svn path=/branches/ntvdm/; revision=60990

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 14 Nov 2013 03:03:23 +0000 (03:03 +0000)]
[FAST486]
Fix previous fix.

svn path=/branches/ntvdm/; revision=60989

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 14 Nov 2013 02:54:20 +0000 (02:54 +0000)]
[FAST486]
Update the register values in REP LODS.

svn path=/branches/ntvdm/; revision=60988

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 14 Nov 2013 02:39:54 +0000 (02:39 +0000)]
[FAST486]
Fix the BSF and BSR instructions. Partially fix SHLD and SHRD.

svn path=/branches/ntvdm/; revision=60987

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 22:34:38 +0000 (22:34 +0000)]
[FAST486]
Fix previous fix.

svn path=/branches/ntvdm/; revision=60985

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 22:33:37 +0000 (22:33 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 19:20:04 +0000 (19:20 +0000)]
[FAST486]
LOOP and JECXZ use the ADSIZE attribute, not OPSIZE.

svn path=/branches/ntvdm/; revision=60977

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 18:14:01 +0000 (18:14 +0000)]
[FAST486]
The bit number should be normalized to [0, DataSize- 1], not [0, 2 ^ DataSize - 1].

svn path=/branches/ntvdm/; revision=60975

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 13:32:00 +0000 (13:32 +0000)]
[FAST486]
Fix a bug in the ROL and ROR instructions.

svn path=/branches/ntvdm/; revision=60972

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 13 Nov 2013 02:38:36 +0000 (02:38 +0000)]
[FAST486]
Fix several bugs in Fast486RotateOperation.

svn path=/branches/ntvdm/; revision=60969

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 12 Nov 2013 21:55:05 +0000 (21:55 +0000)]
[FAST486]
Don't return uninitialized variables.

svn path=/branches/ntvdm/; revision=60967

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 12 Nov 2013 19:25:50 +0000 (19:25 +0000)]
[FAST486]
In rotate operations, the count is always masked with 0x1F, regardless
of the operand size.

svn path=/branches/ntvdm/; revision=60966

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 12 Nov 2013 18:40:13 +0000 (18:40 +0000)]
[FAST486]
Don't forget to check for the operand/address size prefix.

svn path=/branches/ntvdm/; revision=60964

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 12 Nov 2013 18:21:30 +0000 (18:21 +0000)]
[FAST486]
Fix the 3-byte IMUL instruction. If the operand size is 16-bit, the
result should be written in 16-bit too.

svn path=/branches/ntvdm/; revision=60963

10 years ago[NTVDM]
Aleksandar Andrejevic [Tue, 12 Nov 2013 01:56:18 +0000 (01:56 +0000)]
[NTVDM]
The command line in the PSP consists only of the parameters, the program
name is omitted.

svn path=/branches/ntvdm/; revision=60959

10 years ago[NTVDM]
Aleksandar Andrejevic [Tue, 12 Nov 2013 00:49:02 +0000 (00:49 +0000)]
[NTVDM]
Report the correct number of paragraphs in the PSP of a COM program.

svn path=/branches/ntvdm/; revision=60958

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 20:55:33 +0000 (20:55 +0000)]
[FAST486]
Check for interrupts at the end of a cycle, to avoid confusing
debug output.

svn path=/branches/ntvdm/; revision=60956

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 20:41:55 +0000 (20:41 +0000)]
[NTVDM]
Implement vertical scrolling in BiosScrollWindow.

svn path=/branches/ntvdm/; revision=60955

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 19:08:28 +0000 (19:08 +0000)]
[FAST486]
Fix the previous fix in the Mod-Reg-R/M parser. EBP is still used
if the mode is 1 or 2.

svn path=/branches/ntvdm/; revision=60948

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 17:59:04 +0000 (17:59 +0000)]
[NTVDM]
Implement CMOS registers 15h, 16h, 17h and 18h.

svn path=/branches/ntvdm/; revision=60946

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 17:24:22 +0000 (17:24 +0000)]
[FAST486]
Fix the Mod-Reg-R/M parser. EBP cannot be used as a SIB byte base,
instead it's used to mark that the base is an immediate operand.

svn path=/branches/ntvdm/; revision=60944

10 years ago[NTVDM]: Display more detailed information about which unknown interruption was called.
Hermès Bélusca-Maïto [Mon, 11 Nov 2013 17:05:02 +0000 (17:05 +0000)]
[NTVDM]: Display more detailed information about which unknown interruption was called.

svn path=/branches/ntvdm/; revision=60943

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 16:47:10 +0000 (16:47 +0000)]
[NTVDM]
Implement INT 15h, AH = 87h, "Copy Extended Memory".

svn path=/branches/ntvdm/; revision=60942

10 years ago[FAST486]: Put the inlined function in its proper file. No code changes.
Hermès Bélusca-Maïto [Mon, 11 Nov 2013 15:34:18 +0000 (15:34 +0000)]
[FAST486]: Put the inlined function in its proper file. No code changes.

svn path=/branches/ntvdm/; revision=60940

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 15:27:54 +0000 (15:27 +0000)]
[FAST486]
Fix Fast486GetCurrentPrivLevel.

svn path=/branches/ntvdm/; revision=60939

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 04:00:10 +0000 (04:00 +0000)]
[NTVDM]
Implement the miscellaneous BIOS system service (INT 15h) handler.
Implement INT 15h, AH = 88h, "Get Extended Memory Size".

svn path=/branches/ntvdm/; revision=60938

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 03:45:39 +0000 (03:45 +0000)]
[NTVDM]
Give the virtual machine 16 MB of memory, for DOS extenders,
protected mode programs, etc...
EMS is still not implemented.

svn path=/branches/ntvdm/; revision=60937

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 03:16:07 +0000 (03:16 +0000)]
[FAST486]
Fix a bug in the LDS and LES instructions.

svn path=/branches/ntvdm/; revision=60936

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 03:14:18 +0000 (03:14 +0000)]
[FAST486]
Implement the LSS instruction.
Fix a bug in LFS and LGS.

svn path=/branches/ntvdm/; revision=60935

10 years ago[NTVDM]: Fix CMOS file sharing access (so that we allow multiple ntvdm running with...
Hermès Bélusca-Maïto [Mon, 11 Nov 2013 02:35:06 +0000 (02:35 +0000)]
[NTVDM]: Fix CMOS file sharing access (so that we allow multiple ntvdm running with the same cmos data).

svn path=/branches/ntvdm/; revision=60934

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 11 Nov 2013 02:27:29 +0000 (02:27 +0000)]
[NTVDM]
To make debugging easier, put the interrupt handlers at offset 0x1000,
and reserve 16 bytes for each. Also, move the common stub to offset
0x2000. That way the entry point of, for example, INT 0x21 is at
F000:1210.

svn path=/branches/ntvdm/; revision=60933

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 01:14:24 +0000 (01:14 +0000)]
[FAST486]
We don't support in-circuit emulation opcodes such as USERMOV.
The 486 does not have the JMPE or POPCNT instructions.

svn path=/branches/ntvdm/; revision=60932

10 years ago[FAST486]: Remove an extra "return TRUE;"
Hermès Bélusca-Maïto [Mon, 11 Nov 2013 01:02:48 +0000 (01:02 +0000)]
[FAST486]: Remove an extra "return TRUE;"

svn path=/branches/ntvdm/; revision=60931

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 00:57:59 +0000 (00:57 +0000)]
[FAST486]
Implement SHLD and SHRD.

svn path=/branches/ntvdm/; revision=60930

10 years ago[FAST486]
Aleksandar Andrejevic [Mon, 11 Nov 2013 00:10:46 +0000 (00:10 +0000)]
[FAST486]
Implement the two operand version of IMUL.

svn path=/branches/ntvdm/; revision=60929

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 10 Nov 2013 23:42:57 +0000 (23:42 +0000)]
[FAST486]
Don't mix up ADSIZE and OPSIZE (continued).

svn path=/branches/ntvdm/; revision=60927

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 10 Nov 2013 23:34:34 +0000 (23:34 +0000)]
[FAST486]
Don't mix up ADSIZE and OPSIZE.

svn path=/branches/ntvdm/; revision=60926

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 10 Nov 2013 22:49:19 +0000 (22:49 +0000)]
[FAST486]
Increment SP, not ESP for 16-bit stacks.

svn path=/branches/ntvdm/; revision=60925

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 10 Nov 2013 22:27:24 +0000 (22:27 +0000)]
[FAST486]
Modularize linear memory access by adding two new functions:
Fast486ReadLinearMemory and Fast486WriteLinearMemory.
Implement Fast486GetPageTableEntry.

svn path=/branches/ntvdm/; revision=60923

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 10 Nov 2013 18:14:40 +0000 (18:14 +0000)]
[NTVDM]
Remove unnecessary indentation and clarify the code a bit.

svn path=/branches/ntvdm/; revision=60919

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sun, 10 Nov 2013 16:22:33 +0000 (16:22 +0000)]
[NTVDM]
Instead of reassembling each time the very same common stub code for each interrupt, do it once, and then assemble just a little part for each interrupt and jump to the common stub.
Now the 4DOS Ctrl-C exception bug changes, but I have an idea what's happening in there...

svn path=/branches/ntvdm/; revision=60917

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sun, 10 Nov 2013 13:12:02 +0000 (13:12 +0000)]
[NTVDM]
- BIOS: Reorganize a bit the header, and close the input thread before closing the input handle (and not after).
- INT32: Fix a comment.
- CMOS: Put CMOS data into a structure called CMOS_MEMORY, introduce READ/WRITE_CMOS_DATA macros for simplifying code. Save CMOS memory into a file (à la Windows' NTVDM), which is loaded at startup.

svn path=/branches/ntvdm/; revision=60913

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 10 Nov 2013 03:11:56 +0000 (03:11 +0000)]
[FAST486]
The number of bit places in a shift operation is ANDed by the width of the type
when it is in a register, so (1 << c), when c is 32, is actually 1, and not 0.
Fix the calculation of MaxValue by using SignFlag | (SignFlag - 1) instead.

svn path=/branches/ntvdm/; revision=60912

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 10 Nov 2013 01:19:50 +0000 (01:19 +0000)]
[NTVDM]
Fix the jump instruction offset. Spotted by Hermes Belusca-Maito.

svn path=/branches/ntvdm/; revision=60911

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 10 Nov 2013 00:53:05 +0000 (00:53 +0000)]
[NTVDM]
Don't enable interrupts unless it's necessary in the interrupt handler.
[FAST486]
When handling interrupt signals, make sure at least one instruction is executed,
to prevent the CPU from being completely blocked by interrupt signals.

svn path=/branches/ntvdm/; revision=60910

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 23:01:11 +0000 (23:01 +0000)]
[NTVDM]
Finish my Interruption revamp.
- Move interrupt-related code from bop.c to int32.c
- Introduce InitializeInt32 helper so that one can initialize all the needed 16-bit stubs for the 32-bit interrupts.
- Remove unneeded defines in emulator.h and an exported variable in ntvdm.h.

svn path=/branches/ntvdm/; revision=60908

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 22:15:40 +0000 (22:15 +0000)]
[NTVDM]
Start my work on modularizing registration of "32-bit" interrupts, i.e.
interrupts that are implemented in 32-bit mode, but are stubbed with 16-bit
code (so that 16-bit apps can call them).
The 16-bit stub code uses a BOP call to our Control BOP function (BOP 0xFF) which
can handle in theory many sub-functions (as the BOP 0x58 documented here: http://www.ragestorm.net/tutorial?id=27)
specified as an additional BYTE in the call:
0xC4 0xC4 bop_code <optional_bop_subfunction>
Here, for calling 32-bit interrupts we use our BOP 0xFF, subfunction 0xFF.
The final aim would be to generate the 16-bit stub code when one calls the RegisterInt32 helper function
(contrary to what's happening now, that is, the 16-bit stub code is generated for all of the interrupts
at BIOS initialization time, and we use it for BIOS and DOS interrupts).

svn path=/branches/ntvdm/; revision=60907

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 19:55:04 +0000 (19:55 +0000)]
[NTVDM]
- Make usage of MAKEWORD;
- Introduce BiosGetCursorPosition and use it in BiosPrintCharacter;
- Use EmulatorWriteMemory instead of VgaWriteMemory somewhere in BiosPrintCharacter;
- Add support for tabs in BiosPrintCharacter (taken from DosBox).

svn path=/branches/ntvdm/; revision=60906

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 9 Nov 2013 18:10:21 +0000 (18:10 +0000)]
[NTVDM]
Allow COM programs to exit with a simple near return to PSP:0000. Spotted by Thomas Faber.

svn path=/branches/ntvdm/; revision=60904

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 9 Nov 2013 17:16:04 +0000 (17:16 +0000)]
[NTVDM]
Make the emulator callbacks non-static.
In BiosPrintCallback, use EmulatorWriteMemory instead of VgaWriteMemory, because
VgaWriteMemory does not do any input validation.
Improve EmulatorWriteMemory input validation and bound checking.

svn path=/branches/ntvdm/; revision=60903

10 years ago[NTVDM]: Fix informative comment.
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 16:19:14 +0000 (16:19 +0000)]
[NTVDM]: Fix informative comment.

svn path=/branches/ntvdm/; revision=60901

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 9 Nov 2013 16:15:24 +0000 (16:15 +0000)]
[NTVDM]
Instead of repeating the BOP, simply handle both 0x51 and 0x62 as the same function.

svn path=/branches/ntvdm/; revision=60900

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 16:11:52 +0000 (16:11 +0000)]
[NTVDM]
DOS: Implement INT 21h, AH 62h as a call to INT 21h, AH 51h.

svn path=/branches/ntvdm/; revision=60899

10 years ago[NTVDM]: Improve DisplayMessage by also displaying the message in the debug log.
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 15:53:52 +0000 (15:53 +0000)]
[NTVDM]: Improve DisplayMessage by also displaying the message in the debug log.

svn path=/branches/ntvdm/; revision=60898

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 9 Nov 2013 15:48:07 +0000 (15:48 +0000)]
[NTVDM]
Display the opcode when an unhandled exception occurs.

svn path=/branches/ntvdm/; revision=60897

10 years ago[FAST486][NTVDM]: Rename the last two IO functions parameters in the same way as...
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 15:00:19 +0000 (15:00 +0000)]
[FAST486][NTVDM]: Rename the last two IO functions parameters in the same way as some CSR functions (ElementCount == DataCount; ElementSize == DataSize).

svn path=/branches/ntvdm/; revision=60896

10 years ago[FAST486]: Code formatting only (remove endlines spaces).
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 14:23:40 +0000 (14:23 +0000)]
[FAST486]: Code formatting only (remove endlines spaces).

svn path=/branches/ntvdm/; revision=60894

10 years ago[FAST486]: Fix OUT instruction (IoWrite instead of IoRead).
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 14:15:39 +0000 (14:15 +0000)]
[FAST486]: Fix OUT instruction (IoWrite instead of IoRead).

svn path=/branches/ntvdm/; revision=60893

10 years ago[FAST486][NTVDM]
Aleksandar Andrejevic [Sat, 9 Nov 2013 03:30:27 +0000 (03:30 +0000)]
[FAST486][NTVDM]
The behavior of the I/O port bus depends on the data width. In the case
of 16-bit/32-bit access, two/four adjacent ports will be accessed.

svn path=/branches/ntvdm/; revision=60891

10 years ago[NTVDM]: Add offset information to the BIOS Data Area, and add missing fields. See...
Hermès Bélusca-Maïto [Sat, 9 Nov 2013 00:28:26 +0000 (00:28 +0000)]
[NTVDM]: Add offset information to the BIOS Data Area, and add missing fields. See the provided links in the patch for more information.

svn path=/branches/ntvdm/; revision=60890

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Fri, 8 Nov 2013 23:15:58 +0000 (23:15 +0000)]
[NTVDM]
- BIOS: Implement INT 12h (BiosGetMemorySize)
- BOP/DOS: Add some DPRINTs for INT 25h, 2Fh and for unimplemented functions of INT 21h. It's for helping in testing 4DOS.COM

svn path=/branches/ntvdm/; revision=60889

10 years ago[NTVDM]
Aleksandar Andrejevic [Fri, 8 Nov 2013 21:56:30 +0000 (21:56 +0000)]
[NTVDM]
For better visibility, double the screen size if the resolution is too low.

svn path=/branches/ntvdm/; revision=60888

10 years ago[NTVDM]: Further modularize initialization/resetting of the VGA palette code.
Hermès Bélusca-Maïto [Fri, 8 Nov 2013 20:06:10 +0000 (20:06 +0000)]
[NTVDM]: Further modularize initialization/resetting of the VGA palette code.

svn path=/branches/ntvdm/; revision=60887

10 years ago[NTVDM]
Aleksandar Andrejevic [Fri, 8 Nov 2013 19:30:58 +0000 (19:30 +0000)]
[NTVDM]
Implement the use of palettes for text mode. Adapted from a patch by Hermes Belusca-Maito.
Reset the palette during every BIOS video mode switch.

svn path=/branches/ntvdm/; revision=60886

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 7 Nov 2013 01:06:39 +0000 (01:06 +0000)]
[FAST486]
Implement LFS, LGS and MOVZX.

svn path=/branches/ntvdm/; revision=60878

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 7 Nov 2013 00:57:08 +0000 (00:57 +0000)]
[FAST486]
Implement BSF, BSR and MOVSX.

svn path=/branches/ntvdm/; revision=60877

10 years ago[NTVDM]: Code formatting only.
Hermès Bélusca-Maïto [Wed, 6 Nov 2013 22:43:40 +0000 (22:43 +0000)]
[NTVDM]: Code formatting only.

svn path=/branches/ntvdm/; revision=60876

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Mon, 4 Nov 2013 00:22:29 +0000 (00:22 +0000)]
[NTVDM]
- Add a missing "goto Cleanup;"
- Add DPRINT1s at the beginning and the end of ntvdm, so that one can easily localize in debug logs where one started it. Suggested by Vampyre ;)

svn path=/branches/ntvdm/; revision=60860

10 years ago[FAST486]: Code formatting only.
Hermès Bélusca-Maïto [Sun, 3 Nov 2013 23:13:53 +0000 (23:13 +0000)]
[FAST486]: Code formatting only.

svn path=/branches/ntvdm/; revision=60857

10 years ago[FAST486]: Replace (boolean_condition) ? TRUE : FALSE; by: (boolean_condition) .
Hermès Bélusca-Maïto [Sun, 3 Nov 2013 22:44:55 +0000 (22:44 +0000)]
[FAST486]: Replace (boolean_condition) ? TRUE : FALSE; by: (boolean_condition) .

svn path=/branches/ntvdm/; revision=60856

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 3 Nov 2013 21:52:58 +0000 (21:52 +0000)]
[NTVDM]
Use BiosConsoleInput instead of calling GetStdHandle in the keyboard input thread.

svn path=/branches/ntvdm/; revision=60855

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 3 Nov 2013 21:33:22 +0000 (21:33 +0000)]
[NTVDM]
Implement the CMOS and Real Time Clock (RTC).
Improve the performance of the PIT and RTC (correctly this time).

svn path=/branches/ntvdm/; revision=60854

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sun, 3 Nov 2013 20:31:19 +0000 (20:31 +0000)]
[NTVDM]
Start to implement a basic emulated PC speaker, using the Beep driver.

svn path=/branches/ntvdm/; revision=60853

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 3 Nov 2013 18:31:00 +0000 (18:31 +0000)]
[FAST486]
BP is certainly not the same register as BX.

svn path=/branches/ntvdm/; revision=60851

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 3 Nov 2013 14:37:30 +0000 (14:37 +0000)]
[NTVDM]
Improve the I/O read/write callbacks to allow multiple reads or writes
at once.

svn path=/branches/ntvdm/; revision=60849

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Sun, 3 Nov 2013 13:25:01 +0000 (13:25 +0000)]
[NTVDM]
Implement INT 10h, AH 10h, AL 10h, 12h, 15h and 17h (set/get individual or block of DAC registers).

svn path=/branches/ntvdm/; revision=60846

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 3 Nov 2013 03:22:36 +0000 (03:22 +0000)]
[NTVDM]
Halfplement the BIOS palette control command (INT 10h, AH = 10h).

svn path=/branches/ntvdm/; revision=60842

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 3 Nov 2013 01:05:40 +0000 (01:05 +0000)]
[FAST486]
The RCL, RCR, ROL and ROR instructions do not update SF, ZF or PF.

svn path=/branches/ntvdm/; revision=60841

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 2 Nov 2013 01:51:27 +0000 (01:51 +0000)]
[NTVDM]
Fix resolution calculation when scanline doubling is enabled.

svn path=/branches/ntvdm/; revision=60827

10 years ago[NTVDM]: Add a DPRINT1 that can be useful later on...
Hermès Bélusca-Maïto [Sat, 2 Nov 2013 01:24:27 +0000 (01:24 +0000)]
[NTVDM]: Add a DPRINT1 that can be useful later on...

svn path=/branches/ntvdm/; revision=60826

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 2 Nov 2013 00:47:43 +0000 (00:47 +0000)]
[FAST486]
Fix segment initialization. The cached descriptors must have valid values
during the switch to protected mode.
For some odd reason, GCC makes the FAST486_GDT_ENTRY structure 12 bytes
instead of 8 if there is a bit field with more than 16 bits, so split
the Base field into Base and BaseMid.
Add size checks below important structure declarations.

svn path=/branches/ntvdm/; revision=60825

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 1 Nov 2013 22:39:43 +0000 (22:39 +0000)]
[FAST486]
Implement opcode group 0x0F, 0x01 (SGDT, SIDT, LGDT, LIDT, SMSW and LMSW).
Only INVLPG is not implemented yet.

svn path=/branches/ntvdm/; revision=60824

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 1 Nov 2013 02:48:28 +0000 (02:48 +0000)]
[FAST486]
Implement the XADD instruction.

svn path=/branches/ntvdm/; revision=60819

10 years ago[FAST486]
Hermès Bélusca-Maïto [Fri, 1 Nov 2013 02:28:47 +0000 (02:28 +0000)]
[FAST486]
Fix the type of a variable.

[NTVDM]
Introduce a BOP handler table for the 256 possible BOP functions and use it.

svn path=/branches/ntvdm/; revision=60818

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 1 Nov 2013 02:08:34 +0000 (02:08 +0000)]
[FAST486]
Fix a bug in the IRET instruction.

svn path=/branches/ntvdm/; revision=60817

10 years ago[NTVDM]
Aleksandar Andrejevic [Fri, 1 Nov 2013 01:57:40 +0000 (01:57 +0000)]
[NTVDM]
Revert a previous incorrect fix for the PIT.
Modify the PitDecrementCount function to take a parameter instead
of it being called multiple times (which is slower).

svn path=/branches/ntvdm/; revision=60816

10 years agoFix a comment...
Hermès Bélusca-Maïto [Fri, 1 Nov 2013 01:51:15 +0000 (01:51 +0000)]
Fix a comment...

svn path=/branches/ntvdm/; revision=60815

10 years ago[FAST486][NTVDM]
Hermès Bélusca-Maïto [Fri, 1 Nov 2013 01:46:58 +0000 (01:46 +0000)]
[FAST486][NTVDM]
- Introduce a Fast486Initialize which is used to set up the CPU callbacks (and use default ones if some of the given callbacks are NULL), and to reset it the first time. Now Fast486Reset is meant to be used for only resetting the CPU to a safe state.
- Hence we are now sure that State->WhateverCallback is never NULL (and is theoretically valid), so don't do NULL-checks when calling them, but call them directly. The default cases for those checks become the default calls for the default callbacks.
- Remove the now-unneeded EmulatorIdle function.

svn path=/branches/ntvdm/; revision=60814

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 1 Nov 2013 00:30:26 +0000 (00:30 +0000)]
[FAST486]
In real mode, the value in the IVT is a far pointer, not an IDT entry.
Fix the case when MemReadCallback is NULL.

svn path=/branches/ntvdm/; revision=60813

10 years ago[FAST486][NTVDM]
Hermès Bélusca-Maïto [Fri, 1 Nov 2013 00:01:07 +0000 (00:01 +0000)]
[FAST486][NTVDM]
BOP numbers are 1 byte and map to a function (over 255). But one can pass additional "parameters" to those functions by adding extra bytes, however such functions must advance "by hand" the instruction pointer.

[NTVDM]
- Take into account our previous remark for the BIOS interrupt stubs, and comment them.
- Rework EmulatorBiosOperation (move almost all of its existing code into subfunctions in bop.c) so that one can call many other BOP functions in the future (WIP). The BOP number (still called) EMULATOR_INT_BOP (of value 0xFF) is used for internal 16 --> 32 bit switching for our 32bit bios.
- It appears that the IoRead/WriteCallback and IdleCallback must not be NULL for using fast486. I'm committing a temporary fix that I will definitely fix in a subsequent commit.

svn path=/branches/ntvdm/; revision=60812

10 years ago[NTVDM]
Aleksandar Andrejevic [Wed, 30 Oct 2013 22:42:32 +0000 (22:42 +0000)]
[NTVDM]
Fix an EOI condition in the BIOS IRQ handler.

svn path=/branches/ntvdm/; revision=60801

10 years agoFix a comment.
Hermès Bélusca-Maïto [Tue, 29 Oct 2013 21:46:47 +0000 (21:46 +0000)]
Fix a comment.

svn path=/branches/ntvdm/; revision=60791