2013-06-26 22:58:41 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: GPL - See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS Virtual DOS Machine
|
2015-09-18 17:01:49 +00:00
|
|
|
* FILE: subsystems/mvdm/ntvdm/bios/bios.h
|
2014-02-17 22:20:03 +00:00
|
|
|
* PURPOSE: VDM BIOS Support Library
|
|
|
|
* PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
|
2013-06-26 22:58:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BIOS_H_
|
|
|
|
#define _BIOS_H_
|
|
|
|
|
2015-10-04 11:49:28 +00:00
|
|
|
/* INCLUDES *******************************************************************/
|
|
|
|
|
|
|
|
#include "kbdbios.h"
|
|
|
|
#include "vidbios.h"
|
|
|
|
|
2013-06-26 22:58:41 +00:00
|
|
|
/* DEFINES ********************************************************************/
|
|
|
|
|
2014-10-04 13:36:17 +00:00
|
|
|
/* BOP Identifiers */
|
|
|
|
#define BOP_RESET 0x00 // Windows NTVDM (SoftPC) BIOS calls BOP 0x00
|
[NTVDM]
- Add some level of "Advanced debugging" (see ntvdm.h) which one can adjust to enable/disable debugging features inside NTVDM (this can be useful as long as NTVDM is under heavy bugfixing. When it will be more perfect, this stuff will be removed).
- Add the possibility to load option ROMs at a given segment. Currently their list should be specified from inside ntvdm.c (in the BiosInitialize call), but I plan to make it available from a registry option (or via command-line for NTVDM-standalone mode).
- Start to separate the initialization of "static" BIOS data (stuff that lives in ROM space) and initialization of "dynamic" BIOS data (eg. initializing the interrupt vector table, the BIOS data area at segment 40h, ...) so that we may be able to reuse part of our code to be able to more-or-less run external (16-bit) BIOSes, or the Windows NTVDM BIOS that uses BOPs to run some of its stuff in ntvdm in 32-bit (as we do for our 32-bit BIOS, except that *all* of our bios is 32-bit, not just some parts). Also, some file reorganization will be in order there soon...
- Add video BIOS version information in memory so that tools such as Microsoft Diagnostics can correctly recognize our video BIOS (btw, we try to emulate the functionality of Cirrus' CL-GD5434).
- Correctly put video BIOS ROM header (+ checksum) in memory so that it is recognized as such by diagnostics tools.
- During BIOS POST, scan for ROMs starting segment 0xC000 (where video ROMs reside).
- Store statically the BIOS configuration table.
- Fix INT 16h, AH=12h "Get extended shift states" so that it correctly returns the state of right Ctrl and Alt keys.
- Fix bit-setting state; report that our keyboard is 101/102 enhanced keyboard.
- Correctly set the error return values (AH=86h and CF set) when a function of INT 15h is unsupported.
- Implement INT 15h, AH=C9h "Get CPU Type and Mask Revision"; INT 1Ah, AH=02h "Get Real-Time Clock Time" and Ah=04h "Get Real-Time Clock Date" by reading the CMOS.
- Implement CMOS century register support.
svn path=/trunk/; revision=68598
2015-08-04 20:17:05 +00:00
|
|
|
// to let the virtual machine perform the POST.
|
2014-10-04 13:36:17 +00:00
|
|
|
#define BOP_EQUIPLIST 0x11
|
|
|
|
#define BOP_GETMEMSIZE 0x12
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-03-02 22:50:31 +00:00
|
|
|
#define BDA_SEGMENT 0x40
|
2014-02-26 01:16:56 +00:00
|
|
|
#define BIOS_SEGMENT 0xF000
|
2013-11-09 19:55:04 +00:00
|
|
|
|
2014-05-19 02:21:49 +00:00
|
|
|
#pragma pack(push, 1)
|
|
|
|
|
2013-11-09 00:28:26 +00:00
|
|
|
/*
|
|
|
|
* BIOS Data Area at 0040:XXXX
|
|
|
|
*
|
|
|
|
* See: http://webpages.charter.net/danrollins/techhelp/0093.HTM
|
|
|
|
* and: http://www.bioscentral.com/misc/bda.htm
|
|
|
|
* for more information.
|
|
|
|
*/
|
2013-07-15 01:37:38 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2013-11-09 00:28:26 +00:00
|
|
|
WORD SerialPorts[4]; // 0x00
|
|
|
|
WORD ParallelPorts[3]; // 0x08
|
|
|
|
WORD EbdaSegment; // 0x0e - ParallelPort in PC/XT
|
|
|
|
WORD EquipmentList; // 0x10
|
|
|
|
BYTE Reserved0; // 0x12 - Errors in PCjr infrared keyboard link
|
|
|
|
WORD MemorySize; // 0x13
|
|
|
|
WORD Reserved1; // 0x15 - Scratch pad for manufacturing error tests
|
|
|
|
WORD KeybdShiftFlags; // 0x17
|
|
|
|
BYTE AlternateKeypad; // 0x19
|
|
|
|
WORD KeybdBufferHead; // 0x1a
|
|
|
|
WORD KeybdBufferTail; // 0x1c
|
|
|
|
WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE]; // 0x1e
|
|
|
|
BYTE DriveRecalibrate; // 0x3e
|
|
|
|
BYTE DriveMotorStatus; // 0x3f
|
|
|
|
BYTE MotorShutdownCounter; // 0x40
|
|
|
|
BYTE LastDisketteOperation; // 0x41
|
|
|
|
BYTE Reserved2[7]; // 0x42
|
|
|
|
BYTE VideoMode; // 0x49
|
|
|
|
WORD ScreenColumns; // 0x4a
|
|
|
|
WORD VideoPageSize; // 0x4c
|
|
|
|
WORD VideoPageOffset; // 0x4e
|
|
|
|
WORD CursorPosition[BIOS_MAX_PAGES]; // 0x50
|
|
|
|
BYTE CursorEndLine; // 0x60
|
|
|
|
BYTE CursorStartLine; // 0x61
|
|
|
|
BYTE VideoPage; // 0x62
|
|
|
|
WORD CrtBasePort; // 0x63
|
|
|
|
BYTE CrtModeControl; // 0x65
|
|
|
|
BYTE CrtColorPaletteMask; // 0x66
|
2015-05-08 19:26:46 +00:00
|
|
|
|
|
|
|
union // 0x67
|
|
|
|
{
|
|
|
|
BYTE CassetteData[5]; // Cassette tape control (unused)
|
|
|
|
DWORD ResumeEntryPoint; // CS:IP for 286 return from Protected Mode
|
|
|
|
};
|
|
|
|
|
2013-11-09 00:28:26 +00:00
|
|
|
DWORD TickCounter; // 0x6c
|
|
|
|
BYTE MidnightPassed; // 0x70
|
2015-09-26 17:35:31 +00:00
|
|
|
BYTE CtrlBreakFlag; // 0x71
|
2013-11-09 00:28:26 +00:00
|
|
|
WORD SoftReset; // 0x72
|
|
|
|
BYTE LastDiskOperation; // 0x74
|
|
|
|
BYTE NumDisks; // 0x75
|
|
|
|
BYTE DriveControlByte; // 0x76
|
|
|
|
BYTE DiskPortOffset; // 0x77
|
|
|
|
BYTE LptTimeOut[4]; // 0x78
|
|
|
|
BYTE ComTimeOut[4]; // 0x7c
|
|
|
|
WORD KeybdBufferStart; // 0x80
|
|
|
|
WORD KeybdBufferEnd; // 0x82
|
|
|
|
BYTE ScreenRows; // 0x84
|
|
|
|
WORD CharacterHeight; // 0x85
|
2014-06-02 18:24:58 +00:00
|
|
|
BYTE VGAOptions; // 0x87
|
|
|
|
BYTE VGASwitches; // 0x88
|
2015-05-24 12:35:29 +00:00
|
|
|
BYTE VGAFlags; // 0x89
|
|
|
|
BYTE VGADccIDActive; // 0x8a
|
2013-11-09 00:28:26 +00:00
|
|
|
DWORD Reserved3; // 0x8b
|
|
|
|
BYTE Reserved4; // 0x8f
|
2015-09-26 17:35:31 +00:00
|
|
|
BYTE FloppyDriveState[2]; // 0x90
|
2013-11-09 00:28:26 +00:00
|
|
|
BYTE Reserved6[2]; // 0x92
|
|
|
|
BYTE Reserved7[2]; // 0x94
|
[NTVDM]
- Add some level of "Advanced debugging" (see ntvdm.h) which one can adjust to enable/disable debugging features inside NTVDM (this can be useful as long as NTVDM is under heavy bugfixing. When it will be more perfect, this stuff will be removed).
- Add the possibility to load option ROMs at a given segment. Currently their list should be specified from inside ntvdm.c (in the BiosInitialize call), but I plan to make it available from a registry option (or via command-line for NTVDM-standalone mode).
- Start to separate the initialization of "static" BIOS data (stuff that lives in ROM space) and initialization of "dynamic" BIOS data (eg. initializing the interrupt vector table, the BIOS data area at segment 40h, ...) so that we may be able to reuse part of our code to be able to more-or-less run external (16-bit) BIOSes, or the Windows NTVDM BIOS that uses BOPs to run some of its stuff in ntvdm in 32-bit (as we do for our 32-bit BIOS, except that *all* of our bios is 32-bit, not just some parts). Also, some file reorganization will be in order there soon...
- Add video BIOS version information in memory so that tools such as Microsoft Diagnostics can correctly recognize our video BIOS (btw, we try to emulate the functionality of Cirrus' CL-GD5434).
- Correctly put video BIOS ROM header (+ checksum) in memory so that it is recognized as such by diagnostics tools.
- During BIOS POST, scan for ROMs starting segment 0xC000 (where video ROMs reside).
- Store statically the BIOS configuration table.
- Fix INT 16h, AH=12h "Get extended shift states" so that it correctly returns the state of right Ctrl and Alt keys.
- Fix bit-setting state; report that our keyboard is 101/102 enhanced keyboard.
- Correctly set the error return values (AH=86h and CF set) when a function of INT 15h is unsupported.
- Implement INT 15h, AH=C9h "Get CPU Type and Mask Revision"; INT 1Ah, AH=02h "Get Real-Time Clock Time" and Ah=04h "Get Real-Time Clock Date" by reading the CMOS.
- Implement CMOS century register support.
svn path=/trunk/; revision=68598
2015-08-04 20:17:05 +00:00
|
|
|
BYTE KeybdStatusFlags; // 0x96
|
|
|
|
BYTE KeybdLedFlags; // 0x97
|
2013-11-09 00:28:26 +00:00
|
|
|
DWORD Reserved9; // 0x98
|
|
|
|
DWORD Reserved10; // 0x9c
|
|
|
|
DWORD Reserved11[2]; // 0xa0
|
|
|
|
DWORD EGAPtr; // 0xa8
|
|
|
|
BYTE Reserved12[68]; // 0xac
|
|
|
|
BYTE Reserved13[16]; // 0xf0
|
2013-07-15 01:37:38 +00:00
|
|
|
} BIOS_DATA_AREA, *PBIOS_DATA_AREA;
|
2015-06-15 23:43:16 +00:00
|
|
|
C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x100);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* User Data Area at 0050:XXXX
|
|
|
|
*
|
|
|
|
* See: http://helppc.netcore2k.net/table/memory-map
|
|
|
|
* for more information.
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
BYTE PrintScreen; // 0x00
|
|
|
|
BYTE Basic0[3]; // 0x01
|
|
|
|
BYTE SingleDisketteFlag; // 0x04
|
|
|
|
BYTE PostArea[10]; // 0x05
|
|
|
|
BYTE Basic1; // 0x0f
|
|
|
|
WORD Basic2; // 0x10
|
|
|
|
DWORD Basic3; // 0x12
|
|
|
|
DWORD Basic4; // 0x16
|
|
|
|
DWORD Basic5; // 0x1a
|
|
|
|
WORD Reserved0; // 0x1e
|
|
|
|
WORD DynStorage; // 0x20
|
|
|
|
BYTE DisketteInitStorage[14]; // 0x22
|
|
|
|
DWORD Reserved1; // 0x30
|
|
|
|
} USER_DATA_AREA, *PUSER_DATA_AREA;
|
|
|
|
C_ASSERT(sizeof(USER_DATA_AREA) == 0x34);
|
2013-11-09 00:28:26 +00:00
|
|
|
|
2014-05-19 02:21:49 +00:00
|
|
|
/*
|
|
|
|
* BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
|
|
|
|
*
|
|
|
|
* See: http://www.ctyme.com/intr/rb-1594.htm
|
|
|
|
* for more information.
|
|
|
|
*/
|
|
|
|
typedef struct _BIOS_CONFIG_TABLE
|
|
|
|
{
|
2015-08-07 16:10:18 +00:00
|
|
|
WORD Length; // 0x00 - Number of bytes following
|
2014-05-19 02:21:49 +00:00
|
|
|
BYTE Model; // 0x02
|
|
|
|
BYTE SubModel; // 0x03
|
2014-09-18 00:16:17 +00:00
|
|
|
BYTE Revision; // 0x04
|
|
|
|
BYTE Feature[5]; // 0x05 -- 0x09
|
2014-05-19 02:21:49 +00:00
|
|
|
// Other BIOSes may extend this table. We don't.
|
|
|
|
} BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2013-06-26 22:58:41 +00:00
|
|
|
/* FUNCTIONS ******************************************************************/
|
|
|
|
|
2013-08-15 01:40:50 +00:00
|
|
|
extern PBIOS_DATA_AREA Bda;
|
2014-05-19 02:21:49 +00:00
|
|
|
extern PBIOS_CONFIG_TABLE Bct;
|
2013-08-15 01:40:50 +00:00
|
|
|
|
2014-03-02 22:50:31 +00:00
|
|
|
VOID WINAPI BiosEquipmentService(LPWORD Stack);
|
|
|
|
VOID WINAPI BiosGetMemorySize(LPWORD Stack);
|
|
|
|
|
2014-02-27 03:05:42 +00:00
|
|
|
BOOLEAN
|
[NTVDM]
- Add some level of "Advanced debugging" (see ntvdm.h) which one can adjust to enable/disable debugging features inside NTVDM (this can be useful as long as NTVDM is under heavy bugfixing. When it will be more perfect, this stuff will be removed).
- Add the possibility to load option ROMs at a given segment. Currently their list should be specified from inside ntvdm.c (in the BiosInitialize call), but I plan to make it available from a registry option (or via command-line for NTVDM-standalone mode).
- Start to separate the initialization of "static" BIOS data (stuff that lives in ROM space) and initialization of "dynamic" BIOS data (eg. initializing the interrupt vector table, the BIOS data area at segment 40h, ...) so that we may be able to reuse part of our code to be able to more-or-less run external (16-bit) BIOSes, or the Windows NTVDM BIOS that uses BOPs to run some of its stuff in ntvdm in 32-bit (as we do for our 32-bit BIOS, except that *all* of our bios is 32-bit, not just some parts). Also, some file reorganization will be in order there soon...
- Add video BIOS version information in memory so that tools such as Microsoft Diagnostics can correctly recognize our video BIOS (btw, we try to emulate the functionality of Cirrus' CL-GD5434).
- Correctly put video BIOS ROM header (+ checksum) in memory so that it is recognized as such by diagnostics tools.
- During BIOS POST, scan for ROMs starting segment 0xC000 (where video ROMs reside).
- Store statically the BIOS configuration table.
- Fix INT 16h, AH=12h "Get extended shift states" so that it correctly returns the state of right Ctrl and Alt keys.
- Fix bit-setting state; report that our keyboard is 101/102 enhanced keyboard.
- Correctly set the error return values (AH=86h and CF set) when a function of INT 15h is unsupported.
- Implement INT 15h, AH=C9h "Get CPU Type and Mask Revision"; INT 1Ah, AH=02h "Get Real-Time Clock Time" and Ah=04h "Get Real-Time Clock Date" by reading the CMOS.
- Implement CMOS century register support.
svn path=/trunk/; revision=68598
2015-08-04 20:17:05 +00:00
|
|
|
BiosInitialize(IN LPCSTR BiosFileName,
|
|
|
|
IN LPCSTR RomFiles OPTIONAL);
|
2014-02-27 03:05:42 +00:00
|
|
|
|
|
|
|
VOID
|
|
|
|
BiosCleanup(VOID);
|
2013-11-09 22:15:40 +00:00
|
|
|
|
2015-10-04 11:49:28 +00:00
|
|
|
#endif // _BIOS_H_
|
|
|
|
|
|
|
|
/* EOF */
|