reactos/subsystems/mvdm/ntvdm/bios/vidbios.h

129 lines
4.6 KiB
C
Raw Normal View History

/*
* COPYRIGHT: GPL - See COPYING in the top level directory
* PROJECT: ReactOS Virtual DOS Machine
* FILE: subsystems/mvdm/ntvdm/bios/vidbios.h
* PURPOSE: VDM 32-bit Video BIOS Support Library
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
* Hermes Belusca-Maito (hermes.belusca@sfr.fr)
*/
#ifndef _VIDBIOS_H_
#define _VIDBIOS_H_
/* DEFINES ********************************************************************/
#define BIOS_VIDEO_INTERRUPT 0x10
#define CONSOLE_FONT_HEIGHT 8
#define BIOS_DEFAULT_VIDEO_MODE 0x03
#define BIOS_MAX_PAGES 8
#define BIOS_MAX_VIDEO_MODE 0x13
#define DEFAULT_ATTRIBUTE 0x07
#define GRAPHICS_VIDEO_SEG 0xA000
#define TEXT_VIDEO_SEG 0xB800
#define CGA_EVEN_VIDEO_SEG 0xB800
#define CGA_ODD_VIDEO_SEG 0xBA00
#define VIDEO_BIOS_DATA_SEG 0xC000
[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
#define FONT_8x8_OFFSET 0x0100
#define FONT_8x8_HIGH_OFFSET 0x0500
#define FONT_8x16_OFFSET 0x0900
#define FONT_8x14_OFFSET 0x1900
#define FONT_8x8_COMPAT_OFFSET 0xFA6E
[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
#define VIDEO_STATE_INFO_OFFSET 0x3000 // == 0x1900 + (sizeof(Font8x14) == 0x0E00) + 0x0900 for padding
#define VIDEO_BIOS_ROM_SIZE 0x4000
typedef enum
{
SCROLL_UP,
SCROLL_DOWN,
SCROLL_LEFT,
SCROLL_RIGHT
} SCROLL_DIRECTION;
#pragma pack(push, 1)
typedef struct _VGA_STATIC_FUNC_TABLE
{
BYTE SupportedModes[3]; // 0x00
DWORD Reserved0; // 0x03
BYTE SupportedScanlines; // 0x07
BYTE TextCharBlocksNumber; // 0x08
BYTE MaxActiveTextCharBlocksNumber; // 0x09
WORD VGAFuncSupportFlags; // 0x0a
WORD Reserved1; // 0x0c
BYTE VGASavePtrFuncFlags; // 0x0e
BYTE Reserved2; // 0x0f
} VGA_STATIC_FUNC_TABLE, *PVGA_STATIC_FUNC_TABLE;
typedef struct _VGA_DYNAMIC_FUNC_TABLE
{
DWORD StaticFuncTablePtr; // 0x00
/*
* The following fields follow the same order as in the BDA,
* from offset 0x49 up to offset 0x66...
*/
BYTE VideoMode; // 0x04
WORD ScreenColumns; // 0x05
WORD VideoPageSize; // 0x07
WORD VideoPageOffset; // 0x09
WORD CursorPosition[BIOS_MAX_PAGES]; // 0x0b
BYTE CursorEndLine; // 0x1b
BYTE CursorStartLine; // 0x1c
BYTE VideoPage; // 0x1d
WORD CrtBasePort; // 0x1e
BYTE CrtModeControl; // 0x20
BYTE CrtColorPaletteMask; // 0x21
/* ... and offsets 0x84 and 0x85. */
BYTE ScreenRows; // 0x22
WORD CharacterHeight; // 0x23
BYTE VGADccIDActive; // 0x25
BYTE VGADccIDAlternate; // 0x26
WORD CurrModeSupportedColorsNum; // 0x27
BYTE CurrModeSupportedPagesNum; // 0x29
BYTE Scanlines; // 0x2a
BYTE PrimaryCharTable; // 0x2b
BYTE SecondaryCharTable; // 0x2c
/* Contains part of information from BDA::VGAFlags (offset 0x89) */
BYTE VGAFlags; // 0x2d
BYTE Reserved0[3]; // 0x2e
BYTE VGAAvailMemory; // 0x31
BYTE VGASavePtrStateFlags; // 0x32
BYTE VGADispInfo; // 0x33
BYTE Reserved1[12]; // 0x34 - 0x40
} VGA_DYNAMIC_FUNC_TABLE, *PVGA_DYNAMIC_FUNC_TABLE;
#pragma pack(pop)
/* MACROS *********************************************************************/
//
// These macros are defined for ease-of-use of some VGA I/O ports
// whose addresses depend whether we are in Monochrome or Colour mode.
//
#define VGA_INSTAT1_READ Bda->CrtBasePort + 6 // VGA_INSTAT1_READ_MONO or VGA_INSTAT1_READ_COLOR
#define VGA_CRTC_INDEX Bda->CrtBasePort // VGA_CRTC_INDEX_MONO or VGA_CRTC_INDEX_COLOR
#define VGA_CRTC_DATA Bda->CrtBasePort + 1 // VGA_CRTC_DATA_MONO or VGA_CRTC_DATA_COLOR
/* FUNCTIONS ******************************************************************/
VOID WINAPI VidBiosVideoService(LPWORD Stack);
VOID VidBiosDetachFromConsole(VOID);
VOID VidBiosAttachToConsole(VOID);
[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
VOID VidBiosPost(VOID);
BOOLEAN VidBiosInitialize(VOID);
VOID VidBiosCleanup(VOID);
#endif /* _VIDBIOS_H_ */