-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBIOS_VGA.C
More file actions
170 lines (150 loc) · 3.58 KB
/
BIOS_VGA.C
File metadata and controls
170 lines (150 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/********************************************************************/
/* */
/* Malte System/BIOS VGA/PS2 */
/* 1992/10/18 */
/* */
/* Copyright (C) par les Chevaliers de Malte */
/* */
/********************************************************************/
//
// *** Summary information ***
//
// The file name is : BIOS_VGA.C
// The header file name is : VIDEO\VGA\BIOS_VGA.H
// Created the : 1992/06/12
// Author is : Sylvain Maltais
//
#include "DOS.H"
#include <VIDEO\VGA\BIOS_VGA.H>
Word BIOS_GetVideoCardPrim(void)
{
asm MOV AX,0x1A00;
asm INT 0x10;
asm CMP AL,0x1A;
asm JNE Not_Support;
asm XOR AH,AH;
asm MOV AL,BL;
return(_AX);
Not_Support:
return(0xFFFF);
}
Word BIOS_GetVideoCardSec(void)
{
asm MOV AX,0x1A00;
asm INT 0x10;
asm CMP AL,0x1A;
asm JNE Not_Support;
asm XOR AH,AH;
asm MOV AL,BH;
return(_AX);
Not_Support:
return(0xFFFF);
}
Word BIOS_GetVideoCard(void)
{
asm MOV AX,0x1A00;
asm INT 0x10;
asm CMP AL,0x1A;
asm JNE Not_Support;
asm XOR AH,AH;
asm MOV AL,BL;
return(_AX);
Not_Support:
return(0xFFFF);
}
Byte BIOS_Info(Word Segment, Word Offset)
{
asm MOV ES,Segment;
asm MOV DI,Offset;
asm MOV AH,0x1B;
asm XOR BX,BX;
asm INT 0x10;
return(_AL);
}
Byte BIOS_VGA_PS2_Get_Line(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) != 0x1B) ? 0 : Table[0x22]);
}
Word BIOS_GetNumColor(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) != 0x1B) ? 0 : ((Table[0x28] << 8) + Table[0x27]));
}
Byte BIOS_GetNumPage(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) != 0x1B) ? 0 : Table[0x29]);
}
Byte BIOS_GetBlinkControl(void)
{
Word Table[31];
BIOS_Info(FP_SEG(&Table),FP_OFF(&Table));
asm MOV ES,Table[1];
asm MOV SI,Table[0];
asm ADD SI,0x0B;
asm MOV AL,ES:[SI];
#if (defined(_286)||defined(_80286))
asm SHR AL,2;
#else
asm SHR AL,1;
asm SHR AL,1;
#endif
asm AND AL,1;
return(_AL);
}
Word BIOS_GetHeightChar(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) != 0x1B) ? 0 : ((Table[0x24] << 8) + Table[0x23]));
}
Byte BIOS_GetScanLine(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) != 0x1B) ? 0 : Table[0x2A]);
}
Word BIOS_GetScanLine_(void)
{
Byte Tmp = BIOS_GetScanLine();
if(BIOS_Info_() == 0) return(0);
if(Tmp == 0) return(200);
if(Tmp == 1) return(350);
if(Tmp == 2) return(400);
if(Tmp == 3) return(480);
if(Tmp == 5) return(600);
if(Tmp == 6) return(768);
if(Tmp == 8) return(352);
if(Tmp == 9) return(364);
return(0);
}
void BIOS_SetPaletteVGA(Word Register, Byte Red, Byte Green, Byte Blue)
{
asm MOV AX,0x1010;
asm MOV BX,Register;
asm MOV CL,Blue;
asm MOV CH,Green;
asm MOV DH,Red;
asm INT 0x10;
}
void BIOS_SetMatrix8x16(Byte Table)
{
asm MOV AX,0x1114;
asm MOV BL,Table;
asm INT 0x10;
}
/**********************************************************************/
/* C -- Zone */
/**********************************************************************/
#ifndef __PASCAL__
Byte BIOS_Info_(void)
{
Byte Table[63];
return((BIOS_Info(FP_SEG(&Table),FP_OFF(&Table)) == 0x1B) ? 1 : 0);
}
Byte BIOS_GetBlink(void)
{
Byte Table[63];
BIOS_Info(FP_SEG(&Table),FP_OFF(&Table));
return((Table[0x2D] >> 5) & 1);
}
#endif