0b6320fef49b73535282bb3ac69df0c48ce96209
[reactos.git] / subsystems / ntvdm / bios.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: bios.h
5 * PURPOSE: VDM BIOS (header file)
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _BIOS_H_
10 #define _BIOS_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "ntvdm.h"
15
16 /* DEFINES ********************************************************************/
17
18 #define ROM_AREA_START 0xE0000
19 #define ROM_AREA_END 0xFFFFF
20 #define BDA_SEGMENT 0x40
21 #define BIOS_PIC_MASTER_INT 0x08
22 #define BIOS_PIC_SLAVE_INT 0x70
23 #define BIOS_SEGMENT 0xF000
24 #define BIOS_VIDEO_INTERRUPT 0x10
25 #define BIOS_EQUIPMENT_INTERRUPT 0x11
26 #define BIOS_KBD_INTERRUPT 0x16
27 #define BIOS_TIME_INTERRUPT 0x1A
28 #define BIOS_SYS_TIMER_INTERRUPT 0x1C
29 #define CONSOLE_FONT_HEIGHT 8
30 #define BIOS_KBD_BUFFER_SIZE 16
31 #define BIOS_EQUIPMENT_LIST 0x2C // HACK: Disable FPU for now
32 #define BIOS_DEFAULT_VIDEO_MODE 0x03
33 #define BIOS_MAX_PAGES 8
34 #define BIOS_PAGE_SIZE 0x1000
35 #define BIOS_MAX_VIDEO_MODE 0x13
36 #define DEFAULT_ATTRIBUTE 0x07
37 #define GRAPHICS_VIDEO_SEG 0xA000
38 #define TEXT_VIDEO_SEG 0xB800
39
40 enum
41 {
42 SCROLL_DIRECTION_UP,
43 SCROLL_DIRECTION_DOWN,
44 SCROLL_DIRECTION_LEFT,
45 SCROLL_DIRECTION_RIGHT
46 };
47
48 #pragma pack(push, 1)
49
50 typedef struct
51 {
52 WORD SerialPorts[4];
53 WORD ParallelPorts[3];
54 WORD EbdaSegment;
55 WORD EquipmentList;
56 BYTE Reserved0;
57 WORD MemorySize;
58 WORD Reserved1;
59 WORD KeyboardFlags;
60 BYTE AlternateKeypad;
61 WORD KeybdBufferHead;
62 WORD KeybdBufferTail;
63 WORD KeybdBuffer[BIOS_KBD_BUFFER_SIZE];
64 BYTE DriveRecalibrate;
65 BYTE DriveMotorStatus;
66 BYTE MotorShutdownCounter;
67 BYTE LastDisketteOperation;
68 BYTE Reserved2[7];
69 BYTE VideoMode;
70 WORD ScreenColumns;
71 WORD VideoPageSize;
72 WORD VideoPageOffset;
73 WORD CursorPosition[BIOS_MAX_PAGES];
74 BYTE CursorEndLine;
75 BYTE CursorStartLine;
76 BYTE VideoPage;
77 WORD CrtBasePort;
78 BYTE CrtModeControl;
79 BYTE CrtColorPaletteMask;
80 DWORD Uptime;
81 BYTE Reserved3;
82 DWORD TickCounter;
83 BYTE MidnightPassed;
84 BYTE BreakFlag;
85 WORD SoftReset;
86 BYTE LastDiskOperation;
87 BYTE NumDisks;
88 BYTE DriveControlByte;
89 BYTE DiskPortOffset;
90 BYTE LptTimeOut[4];
91 BYTE ComTimeOut[4];
92 WORD KeybdBufferStart;
93 WORD KeybdBufferEnd;
94 BYTE ScreenRows;
95 WORD CharacterHeight;
96 } BIOS_DATA_AREA, *PBIOS_DATA_AREA;
97
98 #pragma pack(pop)
99
100 /* FUNCTIONS ******************************************************************/
101
102 extern PBIOS_DATA_AREA Bda;
103
104 BOOLEAN BiosInitialize(VOID);
105 VOID BiosCleanup(VOID);
106 BYTE BiosGetVideoMode(VOID);
107 BOOLEAN BiosSetVideoMode(BYTE ModeNumber);
108 WORD BiosPeekCharacter(VOID);
109 WORD BiosGetCharacter(VOID);
110 VOID BiosSetCursorPosition(BYTE Row, BYTE Column, BYTE Page);
111 VOID BiosVideoService(LPWORD Stack);
112 VOID BiosEquipmentService(LPWORD Stack);
113 VOID BiosKeyboardService(LPWORD Stack);
114 VOID BiosTimeService(LPWORD Stack);
115 VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack);
116 VOID BiosSystemTimerInterrupt(LPWORD Stack);
117 VOID BiosPrintCharacter(CHAR Character, BYTE Attribute, BYTE Page);
118 BOOLEAN BiosScrollWindow(
119 INT Direction,
120 DWORD Amount,
121 SMALL_RECT Rectangle,
122 BYTE Page,
123 BYTE FillAttribute
124 );
125
126 #endif // _BIOS_H_
127
128 /* EOF */