1 /* 2 * COPYRIGHT: GPL - See COPYING in the top level directory 3 * PROJECT: ReactOS Virtual DOS Machine 4 * FILE: subsystems/mvdm/ntvdm/bios/vidbios.h 5 * PURPOSE: VDM 32-bit Video BIOS Support Library 6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org> 7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr) 8 */ 9 10 #ifndef _VIDBIOS_H_ 11 #define _VIDBIOS_H_ 12 13 /* DEFINES ********************************************************************/ 14 15 #define BIOS_VIDEO_INTERRUPT 0x10 16 17 #define CONSOLE_FONT_HEIGHT 8 18 #define BIOS_DEFAULT_VIDEO_MODE 0x03 19 #define BIOS_MAX_PAGES 8 20 #define BIOS_MAX_VIDEO_MODE 0x13 21 #define DEFAULT_ATTRIBUTE 0x07 22 23 #define GRAPHICS_VIDEO_SEG 0xA000 24 #define TEXT_VIDEO_SEG 0xB800 25 #define CGA_EVEN_VIDEO_SEG 0xB800 26 #define CGA_ODD_VIDEO_SEG 0xBA00 27 #define VIDEO_BIOS_DATA_SEG 0xC000 28 29 #define FONT_8x8_OFFSET 0x0100 30 #define FONT_8x8_HIGH_OFFSET 0x0500 31 #define FONT_8x16_OFFSET 0x0900 32 #define FONT_8x14_OFFSET 0x1900 33 34 #define FONT_8x8_COMPAT_OFFSET 0xFA6E 35 36 #define VIDEO_STATE_INFO_OFFSET 0x3000 // == 0x1900 + (sizeof(Font8x14) == 0x0E00) + 0x0900 for padding 37 38 #define VIDEO_BIOS_ROM_SIZE 0x4000 39 40 typedef enum 41 { 42 SCROLL_UP, 43 SCROLL_DOWN, 44 SCROLL_LEFT, 45 SCROLL_RIGHT 46 } SCROLL_DIRECTION; 47 48 #pragma pack(push, 1) 49 50 typedef struct _VGA_STATIC_FUNC_TABLE 51 { 52 BYTE SupportedModes[3]; // 0x00 53 DWORD Reserved0; // 0x03 54 BYTE SupportedScanlines; // 0x07 55 BYTE TextCharBlocksNumber; // 0x08 56 BYTE MaxActiveTextCharBlocksNumber; // 0x09 57 WORD VGAFuncSupportFlags; // 0x0a 58 WORD Reserved1; // 0x0c 59 BYTE VGASavePtrFuncFlags; // 0x0e 60 BYTE Reserved2; // 0x0f 61 } VGA_STATIC_FUNC_TABLE, *PVGA_STATIC_FUNC_TABLE; 62 63 typedef struct _VGA_DYNAMIC_FUNC_TABLE 64 { 65 DWORD StaticFuncTablePtr; // 0x00 66 67 /* 68 * The following fields follow the same order as in the BDA, 69 * from offset 0x49 up to offset 0x66... 70 */ 71 BYTE VideoMode; // 0x04 72 WORD ScreenColumns; // 0x05 73 WORD VideoPageSize; // 0x07 74 WORD VideoPageOffset; // 0x09 75 WORD CursorPosition[BIOS_MAX_PAGES]; // 0x0b 76 BYTE CursorEndLine; // 0x1b 77 BYTE CursorStartLine; // 0x1c 78 BYTE VideoPage; // 0x1d 79 WORD CrtBasePort; // 0x1e 80 BYTE CrtModeControl; // 0x20 81 BYTE CrtColorPaletteMask; // 0x21 82 /* ... and offsets 0x84 and 0x85. */ 83 BYTE ScreenRows; // 0x22 84 WORD CharacterHeight; // 0x23 85 86 BYTE VGADccIDActive; // 0x25 87 BYTE VGADccIDAlternate; // 0x26 88 WORD CurrModeSupportedColorsNum; // 0x27 89 BYTE CurrModeSupportedPagesNum; // 0x29 90 BYTE Scanlines; // 0x2a 91 BYTE PrimaryCharTable; // 0x2b 92 BYTE SecondaryCharTable; // 0x2c 93 94 /* Contains part of information from BDA::VGAFlags (offset 0x89) */ 95 BYTE VGAFlags; // 0x2d 96 97 BYTE Reserved0[3]; // 0x2e 98 BYTE VGAAvailMemory; // 0x31 99 BYTE VGASavePtrStateFlags; // 0x32 100 BYTE VGADispInfo; // 0x33 101 102 BYTE Reserved1[12]; // 0x34 - 0x40 103 } VGA_DYNAMIC_FUNC_TABLE, *PVGA_DYNAMIC_FUNC_TABLE; 104 105 #pragma pack(pop) 106 107 /* MACROS *********************************************************************/ 108 109 // 110 // These macros are defined for ease-of-use of some VGA I/O ports 111 // whose addresses depend whether we are in Monochrome or Colour mode. 112 // 113 #define VGA_INSTAT1_READ Bda->CrtBasePort + 6 // VGA_INSTAT1_READ_MONO or VGA_INSTAT1_READ_COLOR 114 #define VGA_CRTC_INDEX Bda->CrtBasePort // VGA_CRTC_INDEX_MONO or VGA_CRTC_INDEX_COLOR 115 #define VGA_CRTC_DATA Bda->CrtBasePort + 1 // VGA_CRTC_DATA_MONO or VGA_CRTC_DATA_COLOR 116 117 /* FUNCTIONS ******************************************************************/ 118 119 VOID WINAPI VidBiosVideoService(LPWORD Stack); 120 121 VOID VidBiosDetachFromConsole(VOID); 122 VOID VidBiosAttachToConsole(VOID); 123 124 VOID VidBiosPost(VOID); 125 BOOLEAN VidBiosInitialize(VOID); 126 VOID VidBiosCleanup(VOID); 127 128 #endif /* _VIDBIOS_H_ */ 129