Commit graph

81 commits

Author SHA1 Message Date
Hermès Bélusca-Maïto cc98f9be4f [NTVDM]
Make colors appearing in CGA mode 4, but still buggy concerning the computation of the resolution (either the X-dimension is twice big or the Y-dimension is twice small), and the position of the pixels...
However the VGA registers are (almost) similar to http://www.brokenthorn.com/Resources/OSDevVid2.html and putting them equal to the settings given there don't change anything new...

svn path=/branches/ntvdm/; revision=61435
2013-12-26 21:40:20 +00:00
Hermès Bélusca-Maïto 0cf85b9296 [NTVDM]
- Fix palette setting for EGA modes, fixes Rescue-Rover menu colors amongst others.
  Some of the palettes were adapted (read: translated from DAC registers settings) from DOSBox;
  and I've also used http://www.brokenthorn.com/Resources/OSDevVid2.html for some settings.
  This should be reviewed to fix / remove redundancies or errors.
- Attempt to implement basic palette enablig/disabling flag (via AC palette regs).
- I've introduced (commented) DbgPrint's for testing AC regs setting. I will remove them when everything is ok.

svn path=/branches/ntvdm/; revision=61419
2013-12-25 21:40:18 +00:00
Hermès Bélusca-Maïto 1a873828b6 [NTVDM]
- BIOS: Fix setting video page parameters when setting mode, and effectively fix setting of video page (fix the involved CRTC registers !!).
  Now Advanced NetWars works without flickering.
- VGA: Fix code presentation.

svn path=/branches/ntvdm/; revision=61390
2013-12-24 22:40:15 +00:00
Hermès Bélusca-Maïto de64fe5965 [NTVDM]
- Add/fix few comments;
- Don't forget to redisable access to AC registers after modifying them in int 10h. Usurp, please retest Rescue Rover 2 :)
- Make EmulatorGet/Set/ClearFlag internal functions only and use set/get<FLAG> instead.

svn path=/branches/ntvdm/; revision=61263
2013-12-12 20:09:24 +00:00
Hermès Bélusca-Maïto b20613401f [NTVDM]
Rewrite the VGA emulation.


Nah, it's a joke!
- Store VGA registers setup in VGA_REGISTERS structure.
- Improve BiosSetVideoMode and introduce a VgaSetRegisters function for setting VGA regs.
- Initialize Bda->CrtBasePort: it is used to determine the address of some I/O ports which depend on whether we are in color or monochrome mode.
- Add UnregisterIoPort in io.c (and fix some DPRINTs) (needed for VGA).
- When setting the misc. VGA register, check whether we're going to monochrome emulation, and reset some port addresses in that case.

svn path=/branches/ntvdm/; revision=61246
2013-12-08 14:22:27 +00:00
Aleksandar Andrejevic 1c9756782c [NTVDM]
Use the EGA palette for EGA modes.


svn path=/branches/ntvdm/; revision=61242
2013-12-07 03:47:58 +00:00
Aleksandar Andrejevic 1b784a5b7b [NTVDM]
Improve the keyboard event handling.
Clean up the PS/2 code a bit.


svn path=/branches/ntvdm/; revision=61229
2013-12-06 04:35:58 +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
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 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
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
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 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 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 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 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
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
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
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 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
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
Aleksandar Andrejevic 8800ea89d1 [NTVDM]
Push scancodes on to the BIOS keyboard queue even if they're not ASCII.


svn path=/branches/ntvdm/; revision=60764
2013-10-27 01:33:15 +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 01d5a36cf5 [NTVDM]
Remove the code that performs waiting in 32-bit mode since that blocks the emulator
and prevents interrupts from working.
Implement a 16-bit waiting system in the interrupt handlers.
Fix the PS/2 interrupt code.


svn path=/branches/ntvdm/; revision=60739
2013-10-24 01:01:49 +00:00
Aleksandar Andrejevic 2462a558df [NTVDM]
Add a hack to fix screen updates while waiting for a keypress.


svn path=/branches/ntvdm/; revision=60697
2013-10-19 00:04:11 +00:00
Aleksandar Andrejevic 0c91026f75 [NTVDM]
Change the instruction in the interrupt handlers to "INC SP" twice
instead of one "ADD SP, 2". It's shorter and supported by soft386 already.


svn path=/branches/ntvdm/; revision=60397
2013-09-28 00:55:28 +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
Sylvain Petreolle ec58bdeae3 [NTVDM]
Report VGA card as present.

svn path=/branches/ntvdm/; revision=59751
2013-08-16 18:33:24 +00:00
Aleksandar Andrejevic 08dc1d3e16 [NTVDM]
Make the BIOS Data Area accessible to other parts of ntvdm.
Properly redirect read/write access to the console to the keyboard and VGA systems, respectively.


svn path=/branches/ntvdm/; revision=59741
2013-08-15 01:40:50 +00:00
Aleksandar Andrejevic 05b8a9a86c [NTVDM]
Use the correct values for AC registers.


svn path=/branches/ntvdm/; revision=59734
2013-08-14 12:25:43 +00:00
Hermès Bélusca-Maïto 738d02adf2 [NTVDM]
Simplify the code

svn path=/branches/ntvdm/; revision=59730
2013-08-13 20:15:24 +00:00
Aleksandar Andrejevic 409b1ee254 [NTVDM]
Fix VGA register constants.


svn path=/branches/ntvdm/; revision=59728
2013-08-13 18:41:35 +00:00
Hermès Bélusca-Maïto e387f7f1cd [NTVDM]
- Add new BIOS video modes (obtained from DosBox with the help of Aleksander)
- Remove an unneeded comment.

svn path=/branches/ntvdm/; revision=59724
2013-08-13 16:49:54 +00:00
Hermès Bélusca-Maïto 53fa8a9cdd Formatting fix only.
svn path=/branches/ntvdm/; revision=59719
2013-08-13 11:06:02 +00:00
Aleksandar Andrejevic 5a7a26d750 [NTVDM]
Synchronize with trunk again for SetConsolePalette.
Implement VGA palettes for graphics mode and DAC register access.


svn path=/branches/ntvdm/; revision=59713
2013-08-12 19:31:54 +00:00
Aleksandar Andrejevic b34e5646dd [NTVDM]
Optimize screen clearing by implementing it as a helper function in vga.c.


svn path=/branches/ntvdm/; revision=59690
2013-08-10 19:30:14 +00:00
Aleksandar Andrejevic acf127fe24 [NTVDM]
Clear the screen when switching video modes.


svn path=/branches/ntvdm/; revision=59688
2013-08-10 19:24:00 +00:00
Aleksandar Andrejevic b62ad02740 [NTVDM]
- Enable TESTING by default until the correct way to load ntvdm is found.
- Calculate the character height instead of hardcoding in the BDA.


svn path=/branches/ntvdm/; revision=59678
2013-08-09 13:14:56 +00:00
Hermès Bélusca-Maïto d497b99734 [NTVDM]
Implement INT 10h, function 04h (Query Light Pen) (deprecated)

svn path=/branches/ntvdm/; revision=59677
2013-08-09 13:06:01 +00:00
Hermès Bélusca-Maïto 5670c032a9 Fix the fix.
svn path=/branches/ntvdm/; revision=59676
2013-08-09 11:55:31 +00:00