reactos.git
10 years ago[NTVDM]: Code formatting only.
Hermès Bélusca-Maïto [Tue, 3 Dec 2013 23:50:33 +0000 (23:50 +0000)]
[NTVDM]: Code formatting only.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 3 Dec 2013 01:30:15 +0000 (01:30 +0000)]
[FAST486]
Implement the BOUND instruction.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 3 Dec 2013 00:56:47 +0000 (00:56 +0000)]
[FAST486]
Check for division by zero, and generate the appropriate exception.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 3 Dec 2013 00:12:55 +0000 (00:12 +0000)]
[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

10 years ago[NTVDM]
Aleksandar Andrejevic [Mon, 2 Dec 2013 01:02:17 +0000 (01:02 +0000)]
[NTVDM]
Compile NTVDM even on non-i386 architectures.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Sun, 1 Dec 2013 03:16:49 +0000 (03:16 +0000)]
[FAST486]
Fix MOVS and STOS when DF = 1. The starting position in the block was off by 1.

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

10 years ago[NTVDM]
Aleksandar Andrejevic [Sun, 1 Dec 2013 00:17:46 +0000 (00:17 +0000)]
[NTVDM]
Set AL to 0 for unimplemented functions in INT 21h.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 30 Nov 2013 23:45:59 +0000 (23:45 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 30 Nov 2013 23:14:54 +0000 (23:14 +0000)]
[FAST486]
Use the size of CS, and not SS, in Fast486OpcodePopReg.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 30 Nov 2013 22:17:18 +0000 (22:17 +0000)]
[FAST486]
Move the prefix reset below the interrupt check, because Fast486InterruptInternal
might set OPSIZE in some circumstances.

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

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

10 years ago[NTVDM]
Aleksandar Andrejevic [Sat, 30 Nov 2013 03:59:26 +0000 (03:59 +0000)]
[NTVDM]
Fix the PIT square wave generator.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 30 Nov 2013 02:03:51 +0000 (02:03 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 29 Nov 2013 03:00:59 +0000 (03:00 +0000)]
[FAST486]
Start implementing the FPU. Stubplement the FPU opcode handlers.

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

10 years ago[NTVDM]
Hermès Bélusca-Maïto [Tue, 26 Nov 2013 20:20:51 +0000 (20:20 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 26 Nov 2013 18:11:53 +0000 (18:11 +0000)]
[FAST486]
Fix the order of operations.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 26 Nov 2013 17:56:18 +0000 (17:56 +0000)]
[FAST486]
Complete the previous commit with a fix for Fast486WriteLinearMemory too.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Tue, 26 Nov 2013 17:55:07 +0000 (17:55 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Sat, 23 Nov 2013 01:34:03 +0000 (01:34 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 22 Nov 2013 02:47:48 +0000 (02:47 +0000)]
[FAST486]
Fix CF calculation in SHRD/SHLD.

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

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

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 22 Nov 2013 01:22:00 +0000 (01:22 +0000)]
[FAST486]
Fix the calculation of AF in ADC and the calculation of AF and CF in SBB.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Fri, 22 Nov 2013 00:46:28 +0000 (00:46 +0000)]
[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

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 21 Nov 2013 04:07:15 +0000 (04:07 +0000)]
[FAST486]
Put the conditional expression in parenthesis so that the addition happens after it.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Thu, 21 Nov 2013 03:18:34 +0000 (03:18 +0000)]
[FAST486]
Fix a bug in Fast486LoadSegment.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 20 Nov 2013 14:21:47 +0000 (14:21 +0000)]
[FAST486]
The top half of EIP is cleared after a 16-bit jump.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 20 Nov 2013 10:48:26 +0000 (10:48 +0000)]
[FAST486]
Read the LDT instead of the GDT when the table indicator is set.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 20 Nov 2013 10:43:12 +0000 (10:43 +0000)]
[FAST486]
Implement privilege checks when loading the code selector.

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

10 years ago[FAST486]
Aleksandar Andrejevic [Wed, 20 Nov 2013 08:01:10 +0000 (08:01 +0000)]
[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

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