Commit graph

183 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto aadb980c95 [NTVDM]
- Remove some DPRINTs.
- Fix a bug in VgaEnterGraphicsMode (erroneous change of the real saved resolution when going into DoubleVision(TM) mode).
- Do not update the text cursor when being in graphics mode (otherwise I've already hit some ScanlineSize==0 problems) <-- [TheFlash], can you recheck that, please?
- Little optimisation: do not do anything in VgaRefreshDisplay if nothing has to be done.

svn path=/branches/ntvdm/; revision=61157
2013-11-30 22:01:44 +00:00
Aleksandar Andrejevic d49a1c16b2 [NTVDM]
Fix the PIT square wave generator.


svn path=/branches/ntvdm/; revision=61151
2013-11-30 03:59:26 +00:00
Hermès Bélusca-Maïto 4fb7f6e1d7 [NTVDM]
- Move some PS/2 initialization from bios.c to ps2.c
- NULLify interrupt entries which are in fact pointers to data tables.
- Add a framework for adding I/O port handlers.

svn path=/branches/ntvdm/; revision=61107
2013-11-26 20:20:51 +00:00
Aleksandar Andrejevic 8e356f7a95 [FAST486]
The 486 doesn't have AC, VIF, VIP or ID.
Fix and simplify POPF.
[NTVDM]
Fix the count in the XMS copy function (INT 15h, AH = 87h).


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

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

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

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

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

svn path=/branches/ntvdm/; revision=61014
2013-11-16 23:11:54 +00:00
Aleksandar Andrejevic cf559336a1 [NTVDM]
The command line in the PSP consists only of the parameters, the program
name is omitted.


svn path=/branches/ntvdm/; revision=60959
2013-11-12 01:56:18 +00:00
Aleksandar Andrejevic 1ff6bc0f8f [NTVDM]
Report the correct number of paragraphs in the PSP of a COM program.


svn path=/branches/ntvdm/; revision=60958
2013-11-12 00:49:02 +00:00
Aleksandar Andrejevic b781febbfe [NTVDM]
Implement vertical scrolling in BiosScrollWindow.


svn path=/branches/ntvdm/; revision=60955
2013-11-11 20:41:55 +00:00
Aleksandar Andrejevic eaf248fe87 [NTVDM]
Implement CMOS registers 15h, 16h, 17h and 18h.


svn path=/branches/ntvdm/; revision=60946
2013-11-11 17:59:04 +00:00
Hermès Bélusca-Maïto 0d174d717c [NTVDM]: Display more detailed information about which unknown interruption was called.
svn path=/branches/ntvdm/; revision=60943
2013-11-11 17:05:02 +00:00
Aleksandar Andrejevic 9ccaa9f1c4 [NTVDM]
Implement INT 15h, AH = 87h, "Copy Extended Memory".


svn path=/branches/ntvdm/; revision=60942
2013-11-11 16:47:10 +00:00
Aleksandar Andrejevic e53821aed0 [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
2013-11-11 04:00:10 +00:00
Aleksandar Andrejevic 442302eeb3 [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
2013-11-11 03:45:39 +00:00
Hermès Bélusca-Maïto ff2d706fb5 [NTVDM]: Fix CMOS file sharing access (so that we allow multiple ntvdm running with the same cmos data).
svn path=/branches/ntvdm/; revision=60934
2013-11-11 02:35:06 +00:00
Aleksandar Andrejevic cc1f7c6985 [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
2013-11-11 02:27:29 +00:00
Aleksandar Andrejevic c3c7bb89c1 [FAST486]
Modularize linear memory access by adding two new functions:
Fast486ReadLinearMemory and Fast486WriteLinearMemory.
Implement Fast486GetPageTableEntry.


svn path=/branches/ntvdm/; revision=60923
2013-11-10 22:27:24 +00:00
Aleksandar Andrejevic 7c036fd0f7 [NTVDM]
Remove unnecessary indentation and clarify the code a bit.


svn path=/branches/ntvdm/; revision=60919
2013-11-10 18:14:40 +00:00
Hermès Bélusca-Maïto e4946e8b85 [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
2013-11-10 16:22:33 +00:00
Hermès Bélusca-Maïto bf2731fb9f [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
2013-11-10 13:12:02 +00:00
Aleksandar Andrejevic e62c987917 [NTVDM]
Fix the jump instruction offset. Spotted by Hermes Belusca-Maito.


svn path=/branches/ntvdm/; revision=60911
2013-11-10 01:19:50 +00:00
Aleksandar Andrejevic cc89902e00 [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
2013-11-10 00:53:05 +00:00
Hermès Bélusca-Maïto dd9dafc7ff [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
2013-11-09 23:01:11 +00:00
Hermès Bélusca-Maïto 6da6a5ce56 [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
2013-11-09 22:15:40 +00:00
Hermès Bélusca-Maïto bf61aa1278 [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
2013-11-09 19:55:04 +00:00
Aleksandar Andrejevic 81a5adf885 [NTVDM]
Allow COM programs to exit with a simple near return to PSP:0000. Spotted by Thomas Faber.


svn path=/branches/ntvdm/; revision=60904
2013-11-09 18:10:21 +00:00
Aleksandar Andrejevic f4f6809d67 [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
2013-11-09 17:16:04 +00:00
Hermès Bélusca-Maïto 53d6212640 [NTVDM]: Fix informative comment.
svn path=/branches/ntvdm/; revision=60901
2013-11-09 16:19:14 +00:00
Aleksandar Andrejevic c6b2a6efc7 [NTVDM]
Instead of repeating the BOP, simply handle both 0x51 and 0x62 as the same function.


svn path=/branches/ntvdm/; revision=60900
2013-11-09 16:15:24 +00:00
Hermès Bélusca-Maïto fa940c2075 [NTVDM]
DOS: Implement INT 21h, AH 62h as a call to INT 21h, AH 51h.

svn path=/branches/ntvdm/; revision=60899
2013-11-09 16:11:52 +00:00
Hermès Bélusca-Maïto 592a3383e5 [NTVDM]: Improve DisplayMessage by also displaying the message in the debug log.
svn path=/branches/ntvdm/; revision=60898
2013-11-09 15:53:52 +00:00
Aleksandar Andrejevic e801e2f0ea [NTVDM]
Display the opcode when an unhandled exception occurs.


svn path=/branches/ntvdm/; revision=60897
2013-11-09 15:48:07 +00:00
Hermès Bélusca-Maïto ecd0b33743 [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
2013-11-09 15:00:19 +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
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
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 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