Commit graph

263 commits

Author SHA1 Message Date
Aleksandar Andrejevic 13b771ac15 [FAST486]
Fix a bug in the IRET instruction.


svn path=/branches/ntvdm/; revision=60817
2013-11-01 02:08:34 +00:00
Hermès Bélusca-Maïto f62b9a81d4 Fix a comment...
svn path=/branches/ntvdm/; revision=60815
2013-11-01 01:51:15 +00:00
Hermès Bélusca-Maïto 861776bd7e [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
2013-11-01 01:46:58 +00:00
Aleksandar Andrejevic 1c12c6fe0d [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
2013-11-01 00:30:26 +00:00
Hermès Bélusca-Maïto 39a527a21e [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
2013-11-01 00:01:07 +00:00
Hermès Bélusca-Maïto 2c8e8ba5d3 [FAST486]
- Remove an unneeded inclusion to the CRT header: limits.h (and use instead NDK definitions for max/min long values).
- Remove unneeded comments...
[NTVDM]
Remove an unneeded add_dependencies(...) command.

svn path=/branches/ntvdm/; revision=60767
2013-10-27 11:42:44 +00:00
Aleksandar Andrejevic f5d3c9254c [FAST486]
Separate external interrupts from interrupt signals (which are
interrupts whose number is not known until they can be serviced,
just like hardware interrupts on a real CPU).
[NTVDM]
Improve the PIC emulation code (IRQ priorities, etc...).
Instead of checking for interrupts in the main loop, move the
PS/2 input parsing to a different thread.
Improve BIOS keyboard IRQ handling.


svn path=/branches/ntvdm/; revision=60761
2013-10-27 00:37:01 +00:00
Aleksandar Andrejevic e954b0db71 [SOFTX86]
Remove softx86, as it is no longer used by anything.


svn path=/branches/ntvdm/; revision=60757
2013-10-26 20:53:33 +00:00
Aleksandar Andrejevic dfd1c031d6 [FAST486]
Implement the CLTS instruction.


svn path=/branches/ntvdm/; revision=60752
2013-10-26 17:33:10 +00:00
Aleksandar Andrejevic 1525a235a2 [FAST486]
Implement the MOV instruction for control and debug registers.
Remove definitions for non-existant registers CR1, CR4, CR5, CR6 and CR7.
The standard 80486 doesn't have a CR4 register (although some implementations
of the 80486 had large page support and CR4, it was not reliable).
As for the debug registers, DR4 is the same as DR6, and DR5 is the same as DR7.


svn path=/branches/ntvdm/; revision=60747
2013-10-26 00:56:11 +00:00
Aleksandar Andrejevic 87f5903d48 [FAST486]
Implement extended opcode groups 0xB9 (UD2) and 0xBA (BT/BTS/BTR/BTC).


svn path=/branches/ntvdm/; revision=60745
2013-10-25 18:15:24 +00:00
Aleksandar Andrejevic 5eb7c07bb8 Sync with trunk for console graphics palettes.
svn path=/branches/ntvdm/; revision=60735
2013-10-23 00:26:50 +00:00
Aleksandar Andrejevic 67b093f38c [FAST486]
Create a macro SWAP (swaps two variables) to shorten the code.
Implement the BSWAP instruction.


svn path=/branches/ntvdm/; revision=60717
2013-10-20 00:55:31 +00:00
Aleksandar Andrejevic a93095e678 [FAST486]
Implement BT, BTS, BTR and BTC.


svn path=/branches/ntvdm/; revision=60716
2013-10-20 00:25:41 +00:00
Aleksandar Andrejevic 1a968e6f61 [FAST486]
Fix more prefix handling.
Create the macros TOGGLE_ADSIZE and TOGGLE_OPSIZE to shorten the code.


svn path=/branches/ntvdm/; revision=60715
2013-10-19 23:43:53 +00:00
Aleksandar Andrejevic 97c51f53c4 [FAST486]
Fix prefix handling.
Create a macro NO_LOCK_PREFIX to shorten the code.


svn path=/branches/ntvdm/; revision=60714
2013-10-19 23:03:40 +00:00
Aleksandar Andrejevic 75a0ca07a1 [FAST486]
Implement CMPXCHG.


svn path=/branches/ntvdm/; revision=60712
2013-10-19 18:56:58 +00:00
Aleksandar Andrejevic a98544e517 [FAST486]
Implement PUSH/POP FS/GS.


svn path=/branches/ntvdm/; revision=60711
2013-10-19 18:36:04 +00:00
Aleksandar Andrejevic ca7d21eff4 [FAST486]
The 80486 doesn't have any time stamp counter (TSC) at all.


svn path=/branches/ntvdm/; revision=60710
2013-10-19 18:28:27 +00:00
Aleksandar Andrejevic d3bc33ee5d [FAST486]
And add those newly implemented opcodes into the table...


svn path=/branches/ntvdm/; revision=60708
2013-10-19 18:00:19 +00:00
Aleksandar Andrejevic 7105c52d86 [FAST486]
Implement SETO, SETNO, SETC, SETNC, SETZ, SETNZ, SETBE, SETNBE, SETS, SETNS, SETP
SETNP, SETL, SETNL, SETLE and SETNLE.


svn path=/branches/ntvdm/; revision=60706
2013-10-19 17:57:26 +00:00
Aleksandar Andrejevic 2583e4f51e [FAST486]
Remove TODOs for instructions that don't exist on the 80486.


svn path=/branches/ntvdm/; revision=60704
2013-10-19 17:29:44 +00:00
Hermès Bélusca-Maïto 51040fc61e Bye bye Soft386, welcome Fast486, courtesy Aleksandar Andrejevic.
[NTVDM]: Define by default NEW_EMULATOR, i.e. use Fast486 instead of softx86.

svn path=/branches/ntvdm/; revision=60703
2013-10-19 16:55:51 +00:00
Aleksandar Andrejevic 9b02129308 [SOFT386]
Implement extended conditional jumps.


svn path=/branches/ntvdm/; revision=60699
2013-10-19 00:35:06 +00:00
Aleksandar Andrejevic 2095b2a844 [SOFT386]
Number the opcodes in the TODO list.


svn path=/branches/ntvdm/; revision=60698
2013-10-19 00:19:57 +00:00
Aleksandar Andrejevic 0e8be812b0 [SOFT386]
Implement the hardware interrupt system.
Modify Soft386Interrupt to assume hardware interrupts, because
software interrupts from outside the emulator may cause race conditions.


svn path=/branches/ntvdm/; revision=60696
2013-10-18 22:50:00 +00:00
Aleksandar Andrejevic 3041ad0330 [SOFT386]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60695
2013-10-18 22:01:35 +00:00
Aleksandar Andrejevic fb5036618e [SOFT386]
Fix typecasts to make sure the value is sign-extended.


svn path=/branches/ntvdm/; revision=60694
2013-10-18 21:45:10 +00:00
Amine Khaldi 25445ea35f * Sync up to trunk head (r60691).
svn path=/branches/ntvdm/; revision=60692
2013-10-17 11:19:05 +00:00
Aleksandar Andrejevic 6bbc6fef9a [SOFT386]
Allow the DS segment to overriden in LODS, MOVS and CMPS.


svn path=/branches/ntvdm/; revision=60689
2013-10-16 03:44:06 +00:00
Aleksandar Andrejevic 40ed113494 [SOFT386]
Implement the far absolute indirect JMP/CALL instructions in group 0xFF.


svn path=/branches/ntvdm/; revision=60688
2013-10-16 03:14:12 +00:00
Aleksandar Andrejevic 489dfb314e [SOFT386]
Fix bugs in SF calculation.


svn path=/branches/ntvdm/; revision=60687
2013-10-16 02:22:40 +00:00
Aleksandar Andrejevic 1df88c9d1d [SOFT386]
Implement the near absolute indirect JMP/CALL in opcode group 0xFF.


svn path=/branches/ntvdm/; revision=60686
2013-10-16 01:44:39 +00:00
Aleksandar Andrejevic 4b14d9a672 [SOFT386]
Start implementing call gate support.
Implement the direct far call opcode (0x9A).


svn path=/branches/ntvdm/; revision=60685
2013-10-16 00:41:24 +00:00
Aleksandar Andrejevic 2f4594cf30 [SOFT386]
Implement the PUSH instruction in opcode group 0xFF.


svn path=/branches/ntvdm/; revision=60681
2013-10-15 19:03:40 +00:00
Aleksandar Andrejevic 151db5ddd0 [SOFT386]
Implement far returns (both versions in Soft386OpcodeRetFar).


svn path=/branches/ntvdm/; revision=60680
2013-10-15 18:54:11 +00:00
Aleksandar Andrejevic 8d2a19ae5d [SOFT386]
Implement far jumps.


svn path=/branches/ntvdm/; revision=60679
2013-10-15 17:27:23 +00:00
Aleksandar Andrejevic 642b52c4e1 [SOFT386]
Halfplement REPZ/REPNZ for CMPS and SCAS.


svn path=/branches/ntvdm/; revision=60658
2013-10-13 23:59:52 +00:00
Aleksandar Andrejevic 4ad8a401ef [SOFT386]
Implement the REP prefix for MOVS.
Fix the REP prefix in INS, OUTS and STOS to simulate the DI
wrap-around even if DF is set.


svn path=/branches/ntvdm/; revision=60645
2013-10-13 21:15:01 +00:00
Aleksandar Andrejevic c425bbc689 [SOFT386]
Implement Soft386Interrupt.
[NTVDM]
Implement EmulatorInterrupt and EmulatorExternalInterrupt for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60628
2013-10-12 13:58:34 +00:00
Aleksandar Andrejevic a2e0e03ee6 [SOFT386]
- Fix calculation of the AF flag in opcode groups 0xFE and 0xFF (INC/DEC).
- Fix a bug in the REP prefix by simulating the wrap-around of DI which
  can occur when the current address size is 16-bit.
- Exception error codes are only pushed on the stack in protected mode.


svn path=/branches/ntvdm/; revision=60625
2013-10-11 23:45:42 +00:00
Aleksandar Andrejevic 8dff09c37a [SOFT386]
Improve the performance of Soft386CalculateParity.


svn path=/branches/ntvdm/; revision=60621
2013-10-11 20:54:46 +00:00
Aleksandar Andrejevic da5b8fc439 [SOFT386]
Fix prefix handling.


svn path=/branches/ntvdm/; revision=60620
2013-10-11 20:48:19 +00:00
Aleksandar Andrejevic 47390630ed [SOFT386]
Fix a bad call to RtlFillMemory.


svn path=/branches/ntvdm/; revision=60618
2013-10-11 19:24:58 +00:00
Aleksandar Andrejevic 37059f6dfc [SOFT386]
Fix incorrect (reverse) handling of the DF flag.


svn path=/branches/ntvdm/; revision=60617
2013-10-11 19:02:06 +00:00
Aleksandar Andrejevic caf9a0a671 [SOFT386]
Implement the REP prefix for OUTS, LODS and STOS.


svn path=/branches/ntvdm/; revision=60616
2013-10-11 18:34:31 +00:00
Aleksandar Andrejevic 20486fd1b7 [SOFT386]
Clear the memory block before it's used.


svn path=/branches/ntvdm/; revision=60612
2013-10-11 16:31:35 +00:00
Aleksandar Andrejevic 800969b126 [SOFT386]
Fix a bug in Soft386ExceptionWithErrorCode. The instruction pointer exceptions can
return to should point to the instruction that caused the exception.


svn path=/branches/ntvdm/; revision=60603
2013-10-11 12:24:05 +00:00
Aleksandar Andrejevic b22da55f8f [SOFT386]
Implement the REP prefix for the INS instruction.


svn path=/branches/ntvdm/; revision=60600
2013-10-10 19:01:41 +00:00
Aleksandar Andrejevic aef0bf1635 [SOFT386]
Implement an API for external segment modification.
[NTVDM]
Implement EmulatorSetRegister for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60591
2013-10-09 21:48:52 +00:00
Aleksandar Andrejevic e9829f1830 [SOFT386]
Fix the carry flag in the SAR instruction.


svn path=/branches/ntvdm/; revision=60589
2013-10-09 19:49:41 +00:00
Aleksandar Andrejevic 10523b910e [SOFT386]
Don't single-step on a prefix. Single-step should execute one whole instruction.


svn path=/branches/ntvdm/; revision=60588
2013-10-09 19:11:42 +00:00
Aleksandar Andrejevic 182d7c8725 [SOFT386]
Fix more prefix handling code.
Implement the XLAT instruction.


svn path=/branches/ntvdm/; revision=60586
2013-10-09 00:36:37 +00:00
Aleksandar Andrejevic 9339e12e69 [SOFT386]
Fix prefix handling.


svn path=/branches/ntvdm/; revision=60585
2013-10-08 23:03:56 +00:00
Aleksandar Andrejevic 7078f183fb [SOFT386]
Fix a bug in the CMP instruction.
Implement the SBB instruction.


svn path=/branches/ntvdm/; revision=60584
2013-10-08 22:27:48 +00:00
Aleksandar Andrejevic f25d1a9f2a [SOFT386]
Implement opcode group 0xF7.


svn path=/branches/ntvdm/; revision=60582
2013-10-07 20:38:01 +00:00
Aleksandar Andrejevic 95b0bb7b60 [SOFT386]
Implement opcode group 0xF6.


svn path=/branches/ntvdm/; revision=60568
2013-10-06 23:57:41 +00:00
Aleksandar Andrejevic f10f82d938 [SOFT386]
Start implementing extended opcodes.


svn path=/branches/ntvdm/; revision=60562
2013-10-06 15:22:52 +00:00
Aleksandar Andrejevic 15a8cc4515 [SOFT386]
Set the opcode handler for the INS and OUTS instructions to be
Soft386OpcodeIns and Soft386OpcodeOuts, respectively.


svn path=/branches/ntvdm/; revision=60543
2013-10-05 20:12:08 +00:00
Aleksandar Andrejevic fbcc4ad158 [SOFT386]
Halfplement INS and OUTS.


svn path=/branches/ntvdm/; revision=60540
2013-10-05 20:06:19 +00:00
Aleksandar Andrejevic 3593b8c8ef [SOFT386]
Fix bugs in STOS and LODS (only one register is incremented).
Implement CMPS and SCAS.


svn path=/branches/ntvdm/; revision=60525
2013-10-04 19:51:11 +00:00
Aleksandar Andrejevic c190ca817c [SOFT386]
Halfplement MOVS, STOS and LODS.
Stubplement CMPS and SCAS.


svn path=/branches/ntvdm/; revision=60515
2013-10-03 20:56:36 +00:00
Aleksandar Andrejevic c2e98bca7f [SOFT386]
Implement the (undocumented) opcode SALC.


svn path=/branches/ntvdm/; revision=60492
2013-10-01 15:02:07 +00:00
Aleksandar Andrejevic 49616f8975 [SOFT386]
Halfplement group 0xFF (Only INC/DEC).


svn path=/branches/ntvdm/; revision=60487
2013-10-01 01:31:36 +00:00
Aleksandar Andrejevic 17a32f3b2a [SOFT386]
Change the license of Soft386 to GPLv2. The previous license was also
GPLv2, but it had a runtime linking exception. The new license is the
original GPLv2 with no exceptions.


svn path=/branches/ntvdm/; revision=60485
2013-09-30 22:01:38 +00:00
Aleksandar Andrejevic 1294b156ea [SOFT386]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60468
2013-09-30 03:10:38 +00:00
Aleksandar Andrejevic d4d6e6eca9 [SOFT386]
Fix limit check.


svn path=/branches/ntvdm/; revision=60467
2013-09-30 03:05:08 +00:00
Aleksandar Andrejevic 6bde6a89b7 [SOFT386]
Fix previous fix.


svn path=/branches/ntvdm/; revision=60466
2013-09-30 02:28:17 +00:00
Aleksandar Andrejevic 462be21fd0 [SOFT386]
Remove whitespace from empty line.
Fix addressing bug.


svn path=/branches/ntvdm/; revision=60465
2013-09-30 02:06:55 +00:00
Aleksandar Andrejevic 79355ae971 [SOFT386]
Fix prefix handling.


svn path=/branches/ntvdm/; revision=60464
2013-09-30 00:27:56 +00:00
Aleksandar Andrejevic b9a1962978 [SOFT386]
Fix the LOOP instruction. LOOP should loop while ECX is not zero, not otherwise.


svn path=/branches/ntvdm/; revision=60463
2013-09-30 00:02:53 +00:00
Aleksandar Andrejevic ed24b5ee8e [SOFT386]
Fetching the immediate operand once is sufficient.


svn path=/branches/ntvdm/; revision=60462
2013-09-29 23:45:06 +00:00
Aleksandar Andrejevic 747864f105 [SOFT386]
Move the code for ADD/OR/ADC/SBB/AND/SUB/XOR/CMP to Soft386ArithmeticOperation,
and use that function to implement groups 0x80, 0x81, 0x82 and 0x83.


svn path=/branches/ntvdm/; revision=60461
2013-09-29 23:38:31 +00:00
Aleksandar Andrejevic fce8b3f276 [SOFT386]
The immediate operand should be fetched before attempting to read the
MOD-REG-R/M byte operands.


svn path=/branches/ntvdm/; revision=60460
2013-09-29 22:24:46 +00:00
Aleksandar Andrejevic 6605a6f215 [SOFT386]
Implement opcode groups 0xC0 and 0xC1, also using Soft386RotateOperation.
Remove two unnecessary blank lines.


svn path=/branches/ntvdm/; revision=60459
2013-09-29 22:23:01 +00:00
Aleksandar Andrejevic e365b99113 [SOFT386]
Move the ROL/ROR/RCL/RCR/SHL/SHR/SAL/SAR handling code to Soft386RotateOperation,
then use that to implement opcode groups 0xD0, 0xD1, 0xD2 and 0xD3.


svn path=/branches/ntvdm/; revision=60458
2013-09-29 22:15:32 +00:00
Aleksandar Andrejevic 4490103840 [SOFT386]
Implement opcode group 0xD0 (instructions ROL, ROR, RCL, RCR, SHL, SHR, SAL, SAR).


svn path=/branches/ntvdm/; revision=60455
2013-09-29 18:39:59 +00:00
Aleksandar Andrejevic 9328c2226b [SOFT386]
Implement opcode group 0xFE.


svn path=/branches/ntvdm/; revision=60453
2013-09-29 16:07:06 +00:00
Aleksandar Andrejevic f7a2f36dd0 [SOFT386]
Implement opcode groups 0xC6 and 0xC7.


svn path=/branches/ntvdm/; revision=60452
2013-09-29 16:01:10 +00:00
Aleksandar Andrejevic 87a7896249 [SOFT386]
Implement opcode group 0x8F.


svn path=/branches/ntvdm/; revision=60451
2013-09-29 15:52:20 +00:00
Aleksandar Andrejevic 9331ef28b9 [SOFT386]
Implement opcode group 0x80. Group 0x82 is just an alias to group 0x80.


svn path=/branches/ntvdm/; revision=60450
2013-09-29 15:04:43 +00:00
Aleksandar Andrejevic abf9647dd9 [SOFT386]
Stubplement opcode group handlers.


svn path=/branches/ntvdm/; revision=60441
2013-09-28 18:56:58 +00:00
Aleksandar Andrejevic 2812f2f8a5 [SOFT386]
Disallow direct writing to CS. Changing CS must be done with a far jump.


svn path=/branches/ntvdm/; revision=60399
2013-09-28 03:15:48 +00:00
Aleksandar Andrejevic 6db4f4e558 [SOFT386]
Implement MOV for segment registers.


svn path=/branches/ntvdm/; revision=60398
2013-09-28 03:01:07 +00:00
Aleksandar Andrejevic cad18120fa [SOFT386]
Fix the BOP opcode. It's LES AX, SP not LES AX, BP.


svn path=/branches/ntvdm/; revision=60396
2013-09-28 00:46:04 +00:00
Aleksandar Andrejevic 7e119cf40b [SOFT386]
Implement the LES and LDS instructions.
Add optional support for BOPs (NTVDM-specific).
Fix prefix handling in some functions.
[NTVDM]
Enable BOPs for Soft386 (when NEW_EMULATOR is defined).
Fix the calling convention issue (softx86 uses cdecl, soft386 uses stdcall).


svn path=/branches/ntvdm/; revision=60395
2013-09-28 00:29:16 +00:00
Aleksandar Andrejevic dc29fa9ab1 [SOFT386]
Fix the return to VM86 mode. The VM flag must be set before the call to Soft386LoadSegment.


svn path=/branches/ntvdm/; revision=60393
2013-09-27 21:23:34 +00:00
Aleksandar Andrejevic 78e8653765 [SOFT386]
Halfplement the IRET instruction (everything except task switching).


svn path=/branches/ntvdm/; revision=60392
2013-09-27 21:18:09 +00:00
Aleksandar Andrejevic e05e583e56 [SOFT386]
Implement the ENTER instruction.


svn path=/branches/ntvdm/; revision=60350
2013-09-25 18:34:57 +00:00
Aleksandar Andrejevic 597a77ed3c [SOFT386]
Implement the IMUL instruction. Both versions have been implemented in Soft386OpcodeImulModrm.


svn path=/branches/ntvdm/; revision=60344
2013-09-23 17:29:42 +00:00
Aleksandar Andrejevic 442b56b45b [SOFT386]
Implement the AAM and AAD instructions.


svn path=/branches/ntvdm/; revision=60342
2013-09-23 16:03:23 +00:00
Aleksandar Andrejevic b5a9d7490a [SOFT386]
Implement the POPF instruction.


svn path=/branches/ntvdm/; revision=60341
2013-09-23 14:10:14 +00:00
Aleksandar Andrejevic 432372c3b6 [SOFT386]
Implement the MOV AL/AX/EAX, off16/32 and MOV off16/32, AL/AX/EAX instructions.


svn path=/branches/ntvdm/; revision=60289
2013-09-21 18:44:59 +00:00
Aleksandar Andrejevic 60a7ff2e92 [SOFT386]
Implement the PUSHF instruction.


svn path=/branches/ntvdm/; revision=60261
2013-09-21 02:33:01 +00:00
Aleksandar Andrejevic 6a2d76ab68 [SOFT386]
Fix prefix handling.


svn path=/branches/ntvdm/; revision=60260
2013-09-21 02:18:41 +00:00
Aleksandar Andrejevic 9d7137b757 [SOFT386]
Fix the CALL instruction. The offset must be fetched before EIP is pushed.


svn path=/branches/ntvdm/; revision=60259
2013-09-21 01:00:36 +00:00
Aleksandar Andrejevic 56948f4801 [SOFT386]
Remove whitespace from empty line.


svn path=/branches/ntvdm/; revision=60258
2013-09-21 00:45:28 +00:00
Aleksandar Andrejevic 7328873681 [SOFT386]
Implement external stack modification.
[NTVDM]
Implement EmulatorSetStack for NEW_EMULATOR.


svn path=/branches/ntvdm/; revision=60257
2013-09-21 00:41:41 +00:00
Aleksandar Andrejevic 34157419d7 [SOFT386]
Implement the INT, INT3 and INTO instructions (all 3 in Soft386OpcodeInt).


svn path=/branches/ntvdm/; revision=60256
2013-09-21 00:18:59 +00:00
Aleksandar Andrejevic 1d3d2fc07a [SOFT386]
Implement the RET instruction.


svn path=/branches/ntvdm/; revision=60229
2013-09-19 23:24:05 +00:00
Aleksandar Andrejevic d3a6556ea5 [SOFT386]
Implement JECXZ, LOOP, LOOPZ and LOOPNZ.


svn path=/branches/ntvdm/; revision=60226
2013-09-19 22:48:45 +00:00
Aleksandar Andrejevic 3dc329ae81 [SOFT386]
Implement the LEAVE instruction.


svn path=/branches/ntvdm/; revision=60201
2013-09-18 21:13:40 +00:00
Hermès Bélusca-Maïto 9620dafb0c [SOFT386]
Use SOFT386_EXCEPTIONS instead of INT for the ExceptionCode parameter in Soft386ExceptionWithErrorCode and Soft386Exception.

svn path=/branches/ntvdm/; revision=60196
2013-09-17 23:17:50 +00:00
Aleksandar Andrejevic f9dd2776ab [SOFT386]
Fix the ARPL instruction.
Use "inline" instead of FORCEINLINE for static functions.


svn path=/branches/ntvdm/; revision=60195
2013-09-17 23:12:25 +00:00
Hermès Bélusca-Maïto 9e913c05f5 Fix a compilation error.
svn path=/branches/ntvdm/; revision=60194
2013-09-17 23:10:26 +00:00
Hermès Bélusca-Maïto 85f05060e4 [SOFT386]
- Put inlined functions in a .inl file, which gets included by the corresponding header file (i.e. fix MSVC builds).
- Use enums types instead of "only" INTs...

svn path=/branches/ntvdm/; revision=60193
2013-09-17 23:02:22 +00:00
Hermès Bélusca-Maïto c27ff5b52f [SOFT386]
- Code formatting (align on 4-space)
- Fix union / struct problem in _SOFT386_PAGE_TABLE.

svn path=/branches/ntvdm/; revision=60189
2013-09-17 21:47:38 +00:00
Aleksandar Andrejevic 593f4baf1a [SOFT386]
Fix struct/union mixup.


svn path=/branches/ntvdm/; revision=60186
2013-09-17 20:57:35 +00:00
Hermès Bélusca-Maïto 1baee6b6b5 [SOFT386]: Fix compilation with MSVC.
svn path=/branches/ntvdm/; revision=60185
2013-09-17 20:41:26 +00:00
Aleksandar Andrejevic bbb37c9152 [SOFT386]
Implement Soft386OpcodeTestAl and Soft386OpcodeTestEax.
These functions were declared and referenced, but never defined.
Why the compiler allowed that without even a warning remains a mystery.


svn path=/branches/ntvdm/; revision=60183
2013-09-17 20:28:26 +00:00
Aleksandar Andrejevic b78a6cb212 [SOFT386]
Implement the direct relative near call (CALL rel16/32) instruction.


svn path=/branches/ntvdm/; revision=60147
2013-09-15 18:26:25 +00:00
Aleksandar Andrejevic 429d182d64 [SOFT386]
Implement JMP rel16/32


svn path=/branches/ntvdm/; revision=60146
2013-09-15 18:18:58 +00:00
Aleksandar Andrejevic 99dd92ffa0 [SOFT386]
Implement LAHF, SAHF, LEA and PUSH imm16/32


svn path=/branches/ntvdm/; revision=60144
2013-09-15 18:02:41 +00:00
Aleksandar Andrejevic e1e34dc171 [SOFT386]
Implement MOV (mod-reg-r/m).


svn path=/branches/ntvdm/; revision=60136
2013-09-15 15:30:55 +00:00
Aleksandar Andrejevic 5439ace9d6 [SOFT386]
Start implementing paging support.
Add support for exception error codes.


svn path=/branches/ntvdm/; revision=60089
2013-09-13 23:01:18 +00:00
Aleksandar Andrejevic a8c1104f57 [SOFT386]
Implement ARPL.


svn path=/branches/ntvdm/; revision=60050
2013-09-12 00:05:23 +00:00
Aleksandar Andrejevic 76b87315a8 [SOFT386]
Implement PUSHA and POPA.


svn path=/branches/ntvdm/; revision=60049
2013-09-11 23:31:35 +00:00
Aleksandar Andrejevic f092154985 [SOFT386]
Implement many instructions (including ADC, SUB, CDQ, CWDE, ...), and "stubplement" even more of them.


svn path=/branches/ntvdm/; revision=60011
2013-09-10 20:41:43 +00:00
Aleksandar Andrejevic 333e29b35d [SOFT386]
Add the instructions implemented in the previous commit to the opcode table.


svn path=/branches/ntvdm/; revision=59995
2013-09-05 23:50:42 +00:00
Aleksandar Andrejevic ddcbb9ee92 [SOFT386]
Implement the TEST instruction, and the XCHG instruction which uses MOD-REG-R/M for operands.


svn path=/branches/ntvdm/; revision=59994
2013-09-05 23:48:07 +00:00
Hermès Bélusca-Maïto a25c3f44b6 [SOFT386]: Fix build (addendum to revision 59990).
svn path=/branches/ntvdm/; revision=59993
2013-09-04 20:40:43 +00:00
Aleksandar Andrejevic f0040c12e8 [SOFT386]
Implement the OR, AND and XOR instructions.


svn path=/branches/ntvdm/; revision=59991
2013-09-04 18:28:58 +00:00
Aleksandar Andrejevic 9fd42c0f7d [SOFT386]
Fix a typo.
Use a macro (SOFT386_OPCODE_HANDLER) for function definitions of opcode handlers.
Implement the rest of the ADD opcodes.


svn path=/branches/ntvdm/; revision=59990
2013-09-04 16:36:39 +00:00
Aleksandar Andrejevic 5f874178e7 [SOFT386]
Implement helper functions for reading/writing operands of instructions that use
the MOD-REG-R/M byte.
Implement the MOD-REG-R/M ADD instruction for bytes.


svn path=/branches/ntvdm/; revision=59981
2013-09-04 01:11:12 +00:00
Aleksandar Andrejevic 6f2f5335c2 [SOFT386]
Implement "MOD-REG-R/M" byte decoding.


svn path=/branches/ntvdm/; revision=59959
2013-09-01 23:49:57 +00:00
Aleksandar Andrejevic b61bbb9d66 [SOFT386]
Implement the "MOV reg8, imm8" instruction.


svn path=/branches/ntvdm/; revision=59952
2013-09-01 17:54:51 +00:00
Aleksandar Andrejevic 179627bf40 [SOFT386]
Implement the opcodes for MOV reg16/32, imm16/32


svn path=/branches/ntvdm/; revision=59949
2013-09-01 16:19:29 +00:00
Aleksandar Andrejevic 50e90be14b [SOFT386]
Implement the short unconditional jump instruction (JMP imm8).


svn path=/branches/ntvdm/; revision=59932
2013-08-31 21:23:31 +00:00
Aleksandar Andrejevic c6c282fd70 [SOFT386]
Increment the TSC on every instruction cycle.


svn path=/branches/ntvdm/; revision=59931
2013-08-31 19:26:13 +00:00
Aleksandar Andrejevic 758bdf41d9 [SOFT386]
Fix the "persistant prefix" bug.
Fix the conditional jump bug.
Implement Soft386ExecuteAt.
[NTVDM]
Add Soft386 support to ntvdm.


svn path=/branches/ntvdm/; revision=59929
2013-08-31 19:18:12 +00:00
Aleksandar Andrejevic e8aa2372b7 [SOFT386]
Implement port I/O instructions.


svn path=/branches/ntvdm/; revision=59911
2013-08-31 02:13:58 +00:00
Aleksandar Andrejevic 7ecbd63471 [SOFT386]
Implement CMC instruction.


svn path=/branches/ntvdm/; revision=59892
2013-08-29 22:18:28 +00:00
Aleksandar Andrejevic 3925c4a3d8 [SOFT386]
Add Soft386OpcodeHalt to the opcode table.


svn path=/branches/ntvdm/; revision=59891
2013-08-29 22:11:33 +00:00
Aleksandar Andrejevic c0a39279ae [SOFT386]
Add checks for illegal prefixes.
Implement HLT and PAUSE.


svn path=/branches/ntvdm/; revision=59890
2013-08-29 22:07:53 +00:00
Aleksandar Andrejevic 5a14da958f [SOFT386]
Implement the CLC, STC, CLI, STI, CLD and STD instructions.


svn path=/branches/ntvdm/; revision=59876
2013-08-29 17:48:32 +00:00
Aleksandar Andrejevic 1143eab8a5 [SOFT386]
Implement short conditional jump opcodes.


svn path=/branches/ntvdm/; revision=59856
2013-08-28 17:52:21 +00:00
Aleksandar Andrejevic 3ad78aac17 [SOFT386]
Implement the following opcodes:
NOP
XCHG (E)AX, reg16/reg32


svn path=/branches/ntvdm/; revision=59819
2013-08-25 14:53:58 +00:00
Aleksandar Andrejevic 5a86737e91 [SOFT386]
Implement the following instructions:
PUSH reg16/reg32
POP reg16/reg32


svn path=/branches/ntvdm/; revision=59816
2013-08-25 12:17:24 +00:00
Aleksandar Andrejevic fffdba9eb5 [SOFT386]
Implement the following opcodes:
INC reg16/reg32
DEC reg16/reg32


svn path=/branches/ntvdm/; revision=59814
2013-08-24 21:32:45 +00:00
Aleksandar Andrejevic 610999cb63 [SOFT386]
Implement prefix support.


svn path=/branches/ntvdm/; revision=59810
2013-08-24 11:48:38 +00:00
Aleksandar Andrejevic 675c38e1b9 [SOFT386]
Halfplement Soft386ExecutionControl.


svn path=/branches/ntvdm/; revision=59795
2013-08-22 22:54:59 +00:00
Hermès Bélusca-Maïto 8e37700e5c Synchronize with trunk revision 59781.
svn path=/branches/ntvdm/; revision=59784
2013-08-19 18:55:28 +00:00
Aleksandar Andrejevic 23fbc3204c [SOFT386]
Fix minor bug.


svn path=/branches/ntvdm/; revision=59783
2013-08-19 18:52:53 +00:00
Aleksandar Andrejevic 6f769d6314 [SOFT386]
Implement instruction fetch functions.
Implement CPU exception system.


svn path=/branches/ntvdm/; revision=59782
2013-08-19 18:23:39 +00:00
Hermès Bélusca-Maïto 2672ec8ee5 [SOFT386]
- In the interface header soft386.h, do not include other particular headers (windows.h and debug.h). Those must be included by the different applications which also will include soft386.h.
- LPVOID --> PVOID (do it general, not just à-la Win32).
- The .c files include the headers, and each .c files must have its "#define NDEBUG\n#include <debug.h>" lines, to activate (or deactivate here in the example) debugging output.
- In the .c files, include the header windef.h for having the basic types, and temporarily comment out the needed #defines which will be needed if one needs to include other win***.h files. Those will be deleted if they aren't needed at the end.

svn path=/branches/ntvdm/; revision=59766
2013-08-17 21:15:55 +00:00
Aleksandar Andrejevic 99302b9d00 [SOFT386]
Implement Soft386LoadSegment.
[NTVDM]
Fix BiosPrintCharacter (Adapted from a patch by Hermes Belusca-Maito).


svn path=/branches/ntvdm/; revision=59764
2013-08-17 18:44:16 +00:00
Aleksandar Andrejevic c7b66d26f6 [SOFT386]
Implement Soft386ReadMemory, Soft386WriteMemory, Soft386StackPush and Soft386StackPop.


svn path=/branches/ntvdm/; revision=59760
2013-08-17 15:20:47 +00:00
Aleksandar Andrejevic fb158ecbe1 [SOFT386]
Add definition for Soft386Interrupt.
Implement Soft386DumpState.


svn path=/branches/ntvdm/; revision=59757
2013-08-17 01:41:22 +00:00
Aleksandar Andrejevic 005e1f0559 [SOFT386]
Start implementing a new emulator library to provide 386/486 emulation support to NTVDM
and perhaps other components aswell.


svn path=/branches/ntvdm/; revision=59752
2013-08-16 19:21:02 +00:00
Aleksandar Andrejevic a88f650367 [SOFTX86]
Fix carry/overflow flag computation for ADD instructions.


svn path=/branches/ntvdm/; revision=59725
2013-08-13 17:06:15 +00:00