Commit graph

55268 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto a106a3b21e [FAST486]: Code formatting only (remove endlines spaces).
svn path=/branches/ntvdm/; revision=60894
2013-11-09 14:23:40 +00:00
Hermès Bélusca-Maïto aab2a03dc2 [FAST486]: Fix OUT instruction (IoWrite instead of IoRead).
svn path=/branches/ntvdm/; revision=60893
2013-11-09 14:15:39 +00:00
Aleksandar Andrejevic 43ee57f2f7 [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
2013-11-09 03:30:27 +00:00
Hermès Bélusca-Maïto e971f67673 [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
2013-11-09 00:28:26 +00:00
Hermès Bélusca-Maïto 860c121da8 [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
2013-11-08 23:15:58 +00:00
Aleksandar Andrejevic da4af40329 [NTVDM]
For better visibility, double the screen size if the resolution is too low.


svn path=/branches/ntvdm/; revision=60888
2013-11-08 21:56:30 +00:00
Hermès Bélusca-Maïto 3a1ae6ee3b [NTVDM]: Further modularize initialization/resetting of the VGA palette code.
svn path=/branches/ntvdm/; revision=60887
2013-11-08 20:06:10 +00:00
Aleksandar Andrejevic fd61c2cba3 [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
2013-11-08 19:30:58 +00:00
Aleksandar Andrejevic 4f4d9fe5d2 [FAST486]
Implement LFS, LGS and MOVZX.


svn path=/branches/ntvdm/; revision=60878
2013-11-07 01:06:39 +00:00
Aleksandar Andrejevic 01c10ef5aa [FAST486]
Implement BSF, BSR and MOVSX.


svn path=/branches/ntvdm/; revision=60877
2013-11-07 00:57:08 +00:00
Hermès Bélusca-Maïto 248dda401d [NTVDM]: Code formatting only.
svn path=/branches/ntvdm/; revision=60876
2013-11-06 22:43:40 +00:00
Hermès Bélusca-Maïto b41ec9f332 [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
2013-11-04 00:22:29 +00:00
Hermès Bélusca-Maïto 92ce0174ac [FAST486]: Code formatting only.
svn path=/branches/ntvdm/; revision=60857
2013-11-03 23:13:53 +00:00
Hermès Bélusca-Maïto 3b6b1a7f37 [FAST486]: Replace (boolean_condition) ? TRUE : FALSE; by: (boolean_condition) .
svn path=/branches/ntvdm/; revision=60856
2013-11-03 22:44:55 +00:00
Aleksandar Andrejevic 3fbe4cb107 [NTVDM]
Use BiosConsoleInput instead of calling GetStdHandle in the keyboard input thread.


svn path=/branches/ntvdm/; revision=60855
2013-11-03 21:52:58 +00:00
Aleksandar Andrejevic 36afa0ea12 [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
2013-11-03 21:33:22 +00:00
Hermès Bélusca-Maïto e9f8b230a6 [NTVDM]
Start to implement a basic emulated PC speaker, using the Beep driver.

svn path=/branches/ntvdm/; revision=60853
2013-11-03 20:31:19 +00:00
Aleksandar Andrejevic 6ecc2dfd24 [FAST486]
BP is certainly not the same register as BX.


svn path=/branches/ntvdm/; revision=60851
2013-11-03 18:31:00 +00:00
Aleksandar Andrejevic a0587b741a [NTVDM]
Improve the I/O read/write callbacks to allow multiple reads or writes
at once.


svn path=/branches/ntvdm/; revision=60849
2013-11-03 14:37:30 +00:00
Hermès Bélusca-Maïto c0a85cdfce [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
2013-11-03 13:25:01 +00:00
Aleksandar Andrejevic 67d77ecebe [NTVDM]
Halfplement the BIOS palette control command (INT 10h, AH = 10h).


svn path=/branches/ntvdm/; revision=60842
2013-11-03 03:22:36 +00:00
Aleksandar Andrejevic 6e6e0bac08 [FAST486]
The RCL, RCR, ROL and ROR instructions do not update SF, ZF or PF.


svn path=/branches/ntvdm/; revision=60841
2013-11-03 01:05:40 +00:00
Aleksandar Andrejevic fde9609542 [NTVDM]
Fix resolution calculation when scanline doubling is enabled.


svn path=/branches/ntvdm/; revision=60827
2013-11-02 01:51:27 +00:00
Hermès Bélusca-Maïto e9a30e1068 [NTVDM]: Add a DPRINT1 that can be useful later on...
svn path=/branches/ntvdm/; revision=60826
2013-11-02 01:24:27 +00:00
Aleksandar Andrejevic d80b788ff4 [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
2013-11-02 00:47:43 +00:00
Aleksandar Andrejevic dcbdbb7d9f [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
2013-11-01 22:39:43 +00:00
Aleksandar Andrejevic 20c0db9f08 [FAST486]
Implement the XADD instruction.


svn path=/branches/ntvdm/; revision=60819
2013-11-01 02:48:28 +00:00
Hermès Bélusca-Maïto 5c220ef022 [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
2013-11-01 02:28:47 +00:00
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
Aleksandar Andrejevic 90d7fbd4a8 [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
2013-11-01 01:57:40 +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
Aleksandar Andrejevic b7ac8cf58e [NTVDM]
Fix an EOI condition in the BIOS IRQ handler.


svn path=/branches/ntvdm/; revision=60801
2013-10-30 22:42:32 +00:00
Hermès Bélusca-Maïto da33c5532e Fix a comment.
svn path=/branches/ntvdm/; revision=60791
2013-10-29 21:46:47 +00:00
Hermès Bélusca-Maïto 4784c22d50 [NTVDM]: DOS:
- The DosErrorLevel is stored as a WORD: its LOWORD is the return code and the HIWORD is the termination code.
- When copying CurrentDirectories[...], be sure that we copy maximum DOS_DIR_LENGTH chars.
- Implement (or stubplement) bunch of INT 21h functions: 0x03, 0x04, 0x05, 0x0C, 0x0D, 0x26, 0x37, 0x47, 0x4D and 0x50. Functions 0x18, 0x1D, 0x1E and 0x20 are NULL functions present in DOS for CP/M compatibility only.
- Fix DOS version querying.
- Use set/getAX() instead of EmulatorSet/GetRegister, and use setCF instead of EmulatorSetFlag.

svn path=/branches/ntvdm/; revision=60790
2013-10-29 01:55:54 +00:00
Aleksandar Andrejevic 1c1febed17 [NTVDM]
Save the error code returned by applications.


svn path=/branches/ntvdm/; revision=60789
2013-10-29 00:10:14 +00:00
Aleksandar Andrejevic 97acc35c7c [NTVDM]
Improve performance by computing the resolution required by the PIT,
and then using the standard tick count instead of performance counters
when that resolution is low.


svn path=/branches/ntvdm/; revision=60783
2013-10-28 02:25:54 +00:00
Hermès Bélusca-Maïto b8d8b21ebd Code formatting only.
svn path=/branches/ntvdm/; revision=60782
2013-10-27 23:42:16 +00:00
Hermès Bélusca-Maïto 76708ef246 [NTVDM]
- DOS: the DOS file attributes are one byte.
- BIOS: don't use hardcoded values; use the SEG_OFF_TO_PTR macro introduced earlier; use get/setAX instead of EmulatorGet/SetRegister.

svn path=/branches/ntvdm/; revision=60781
2013-10-27 23:39:52 +00:00
Hermès Bélusca-Maïto 09d991b838 [NTVDM]
DOS: Make use of get/setAX and consorts instead of EmulatorGet/SetRegister(EMULATOR_REG_AX, ...).
Start to implement real (but undocumented?) behaviour according to http://www.delorie.com/djgpp/doc/rbinter/
and http://www.datadoctor.biz/fr/data_recovery_programming_book_chapter6-pageXX.html (change XX by a valid page number)
and http://spike.scu.edu.au/~barry/interrupts.html

svn path=/branches/ntvdm/; revision=60778
2013-10-27 22:31:53 +00:00
Hermès Bélusca-Maïto d35b972d75 [NTVDM]: Use SEG_OFF_TO_PTR ( $+ \epsilon * code _eorganization$ ).
svn path=/branches/ntvdm/; revision=60776
2013-10-27 22:13:18 +00:00
Hermès Bélusca-Maïto 720ab73ec3 [NTVDM]: DPRINT1 ReadConsoleInput failures (for debugging purposes) and remove an unneeded comment.
svn path=/branches/ntvdm/; revision=60775
2013-10-27 22:10:51 +00:00
Hermès Bélusca-Maïto b8fa6d1de4 [NTVDM]: Introduce the SEG_OFF_TO_PTR macro for code simplification purposes.
svn path=/branches/ntvdm/; revision=60774
2013-10-27 22:08:41 +00:00
Aleksandar Andrejevic 7e0285b710 [NTVDM]
The PS/2 should latch the last value that was read in the case of multiple reads.
Modify the BIOS keyboard IRQ handler to support hooks.


svn path=/branches/ntvdm/; revision=60773
2013-10-27 19:08:58 +00:00
Aleksandar Andrejevic 37430c188b [NTVDM]
Simplify BiosPeekCharacter.
Implement DOS direct console I/O functions.


svn path=/branches/ntvdm/; revision=60772
2013-10-27 16:34:27 +00:00
Aleksandar Andrejevic 161fc791e4 [NTVDM]
Implement the BIOS keyboard shift flags.


svn path=/branches/ntvdm/; revision=60771
2013-10-27 14:57:12 +00:00
Hermès Bélusca-Maïto d9c072aba2 [NTVDM]
Implement all the missing INT 16h functions but 03h. Also, for simplification purposes (should be fixed later on) act exactly the same for INT 00h and 10h, and for INT 01h and 11h.
Finally, one has to implement setting the BIOS KeybdShiftFlags flag.

svn path=/branches/ntvdm/; revision=60770
2013-10-27 14:17:34 +00:00
Hermès Bélusca-Maïto 4d28af9bb5 [NTVDM]: Fix the callback prototypes.
svn path=/branches/ntvdm/; revision=60769
2013-10-27 12:17:06 +00:00