-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathIT_VESA.ASM
226 lines (170 loc) · 8.15 KB
/
IT_VESA.ASM
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ Vesa Module ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ Functions provided: ³
;³ DetectVESA ³
;³ SetVESAMode ³
;³ ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ DetectVESA ³
;³ - No parameters required ³
;³ - Detects the presence of a VESA driver ³
;³ - Returns carry SET if no VESA driver found ³
;³ - Returns carry CLEAR if VESA driver found ³
;³ - All registers preserved ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ SetVESAMode ³
;³ - Requires AX = VESA Mode ³
;³ - Returns carry SET if VESA Mode isn't supported ³
;³ - Returns carry CLEAR if VESA mode change OK ³
;³ - All registers preserved ³
;ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
;³ VESAGetInfo ³
;³ - Requires AX = VESA Mode to get information on ³
;³ - Returns carry SET if VESA Mode isn't supported ³
;³ - Returns carry clear if information is OK ³
;³ - Returns ES:DI to Table, all other registers preserved ³
;³ ³
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Jumps
.386P
include switch.inc
IF SPECTRUMANALYSER
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ Externals ³
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ Globals ³
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
Segment Vesa BYTE Public 'Code' USE16
Assume CS:Vesa, DS:Nothing
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ Variables ³
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
VESAInformationTable Label
VESASignature DB 4 Dup (0)
VESAVersion DW 0
VESAOEMStringPrt DD 0
VESACapabilities DD 0
VESAVideoModePtr DD 0
VESATotalMemory DW 0
DB 256-($-VESAInformationTable) Dup(0)
VESAModeInformationTable Label
DB 256-($-VESAModeInformationTable) Dup (0)
ModeInformationStructure Struc
ModeAtributes DW ?
WindowAAtributes DB ?
WindowBAttributes DB ?
WindowGranularity DW ?
WindowSize DW ?
WindowASegment DW ?
WindowBSegment DW ?
WindowFunction DD ?
BytesPerScanLine DW ?
XResolution DW ?
YResolution DW ?
XCharacterSize DB ?
YCharacterSize DB ?
NumberOfPlanes DB ?
BitsPerPixel DB ?
NumberOfBanks DB ?
MemoryModel DB ?
BankSize DB ?
NumberOfImagePages DB ?
Reserved DB ?
RedMaskSize DB ?
RedFieldPosition DB ?
GreenMaskSize DB ?
GreenFieldPosition DB ?
BlueMaskSize DB ?
BlueFieldPosition DB ?
RSVDMaskSize DB ?
DirectColourModeInfo DB ?
ModeInformationStructure EndS
;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
;³ Functions ³
;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Proc VESA_Detect Far
Public VESA_Detect
PushA
Push ES
Mov AX, 4F00h
Push CS
Pop ES
Mov DI, Offset VESAInformationTable
Int 10h
Cmp AX, 4Fh
JNE DetectVESA1
Cmp [DWord Ptr ES:DI], "ASEV" ; 'VESA' identification
JNE DetectVESA1
DB 85h
DetectVESA1:
StC
Pop ES
PopA
Ret
EndP VESA_Detect
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Proc VESA_SetMode Far
Public VESA_SetMode
PushA
Push DS
Push ES
Call VESA_GetInfo
JC VESA_SetMode3
Mov BX, AX
Mov AX, 4F02h ; Set Mode
Int 10h
Cmp AX, 4Fh
JE VESA_SetMode3
StC
VESA_SetMode3:
Pop ES
Pop DS
PopA
Mov CX, [VESAModeInformationTable.XResolution]
Mov DX, [VESAModeInformationTable.YResolution]
Ret
EndP VESA_SetMode
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Proc VESA_GetInfo
Public VESA_GetInfo
Push AX
Push CX
Mov CX, AX
Push CS
Pop ES
Mov DI, Offset VESAModeInformationTable
Mov AX, 4F01h
Int 10h
Cmp AX, 4Fh
JE VESA_GetInfo1
StC
VESA_GetInfo1:
Pop CX
Pop AX
Ret
EndP VESA_GetInfo
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Proc VESA_SetBlock Far ; Gives access to a 64kb block
Public VESA_SetBlock ; Given AX = block number.
PushA
Push AX
Mov AX, 64
Xor DX, DX
Div Word Ptr [VESAModeInformationTable.WindowGranularity]
Mov DX, AX
Pop AX
Mul DX
Mov DX, AX
Xor BX, BX
Call DWord Ptr [VESAModeInformationTable.WindowFunction]
PopA
Ret
EndP VESA_SetBlock
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
EndS
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
ENDIF
End