Rev 2434 | Rev 2465 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2434 | Rev 2441 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | $Revision: 2434 $ |
8 | $Revision: 2441 $ |
9 | 9 | ||
10 | struc VBE_VGAInfo { |
10 | struc VBE_VGAInfo { |
11 | .VESASignature dd ? ; char |
11 | .VESASignature dd ? ; char |
12 | .VESAVersion dw ? ; short |
12 | .VESAVersion dw ? ; short |
13 | .OemStringPtr dd ? ; char * |
13 | .OemStringPtr dd ? ; char * |
14 | .Capabilities dd ? ; ulong |
14 | .Capabilities dd ? ; ulong |
15 | .VideoModePtr dd ? ; ulong |
15 | .VideoModePtr dd ? ; ulong |
16 | .TotalMemory dw ? ; short |
16 | .TotalMemory dw ? ; short |
17 | ; VBE 2.0+ |
17 | ; VBE 2.0+ |
18 | .OemSoftwareRev db ? ; short |
18 | .OemSoftwareRev db ? ; short |
19 | .OemVendorNamePtr dw ? ; char * |
19 | .OemVendorNamePtr dw ? ; char * |
20 | .OemProductNamePtr dw ? ; char * |
20 | .OemProductNamePtr dw ? ; char * |
21 | .OemProductRevPtr dw ? ; char * |
21 | .OemProductRevPtr dw ? ; char * |
22 | .reserved rb 222 ; char |
22 | .reserved rb 222 ; char |
23 | .OemData rb 256 ; char |
23 | .OemData rb 256 ; char |
24 | } |
24 | } |
25 | 25 | ||
26 | struc VBE_ModeInfo { |
26 | struc VBE_ModeInfo { |
27 | .ModeAttributes dw ? ; short |
27 | .ModeAttributes dw ? ; short |
28 | .WinAAttributes db ? ; char |
28 | .WinAAttributes db ? ; char |
29 | .WinBAttributes db ? ; char |
29 | .WinBAttributes db ? ; char |
30 | .WinGranularity dw ? ; short |
30 | .WinGranularity dw ? ; short |
31 | .WinSize dw ? ; short |
31 | .WinSize dw ? ; short |
32 | .WinASegment dw ? ; ushort |
32 | .WinASegment dw ? ; ushort |
33 | .WinBSegment dw ? ; ushort |
33 | .WinBSegment dw ? ; ushort |
34 | .WinFuncPtr dd ? ; void * |
34 | .WinFuncPtr dd ? ; void * |
35 | .BytesPerScanLine dw ? ; short |
35 | .BytesPerScanLine dw ? ; short |
36 | .XRes dw ? ; short |
36 | .XRes dw ? ; short |
37 | .YRes dw ? ; short |
37 | .YRes dw ? ; short |
38 | .XCharSize db ? ; char |
38 | .XCharSize db ? ; char |
39 | .YCharSize db ? ; char |
39 | .YCharSize db ? ; char |
40 | .NumberOfPlanes db ? ; char |
40 | .NumberOfPlanes db ? ; char |
41 | .BitsPerPixel db ? ; char |
41 | .BitsPerPixel db ? ; char |
42 | .NumberOfBanks db ? ; char |
42 | .NumberOfBanks db ? ; char |
43 | .MemoryModel db ? ; char |
43 | .MemoryModel db ? ; char |
44 | .BankSize db ? ; char |
44 | .BankSize db ? ; char |
45 | .NumberOfImagePages db ? ; char |
45 | .NumberOfImagePages db ? ; char |
46 | .res1 db ? ; char |
46 | .res1 db ? ; char |
47 | .RedMaskSize db ? ; char |
47 | .RedMaskSize db ? ; char |
48 | .RedFieldPosition db ? ; char |
48 | .RedFieldPosition db ? ; char |
49 | .GreenMaskSize db ? ; char |
49 | .GreenMaskSize db ? ; char |
50 | .GreenFieldPosition db ? ; char |
50 | .GreenFieldPosition db ? ; char |
51 | .BlueMaskSize db ? ; char |
51 | .BlueMaskSize db ? ; char |
52 | .BlueFieldPosition db ? ; char |
52 | .BlueFieldPosition db ? ; char |
53 | .RsvedMaskSize db ? ; char |
53 | .RsvedMaskSize db ? ; char |
54 | .RsvedFieldPosition db ? ; char |
54 | .RsvedFieldPosition db ? ; char |
55 | .DirectColorModeInfo db ? ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE |
55 | .DirectColorModeInfo db ? ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE |
56 | ; VBE 2.0+ |
56 | ; VBE 2.0+ |
57 | .PhysBasePtr dd ? ; ulong |
57 | .PhysBasePtr dd ? ; ulong |
58 | .OffScreenMemOffset dd ? ; ulong |
58 | .OffScreenMemOffset dd ? ; ulong |
59 | .OffScreenMemSize dw ? ; short |
59 | .OffScreenMemSize dw ? ; short |
60 | ; VBE 3.0+ |
60 | ; VBE 3.0+ |
61 | .LinbytesPerScanLine dw ? ; short |
61 | .LinbytesPerScanLine dw ? ; short |
62 | .BankNumberOfImagePages db ? ; char |
62 | .BankNumberOfImagePages db ? ; char |
63 | .LinNumberOfImagePages db ? ; char |
63 | .LinNumberOfImagePages db ? ; char |
64 | .LinRedMaskSize db ? ; char |
64 | .LinRedMaskSize db ? ; char |
65 | .LinRedFieldPosition db ? ; char |
65 | .LinRedFieldPosition db ? ; char |
66 | .LingreenMaskSize db ? ; char |
66 | .LingreenMaskSize db ? ; char |
67 | .LinGreenFieldPosition db ? ; char |
67 | .LinGreenFieldPosition db ? ; char |
68 | .LinBlueMaskSize db ? ; char |
68 | .LinBlueMaskSize db ? ; char |
69 | .LinBlueFieldPosition db ? ; char |
69 | .LinBlueFieldPosition db ? ; char |
70 | .LinRsvdMaskSize db ? ; char |
70 | .LinRsvdMaskSize db ? ; char |
71 | .LinRsvdFieldPosition db ? ; char |
71 | .LinRsvdFieldPosition db ? ; char |
72 | .MaxPixelClock dd ? ; ulong |
72 | .MaxPixelClock dd ? ; ulong |
73 | .res2 rb 190 ; char |
73 | .res2 rb 190 ; char |
74 | } |
74 | } |
75 | 75 | ||
76 | virtual at $A000 |
76 | virtual at $A000 |
77 | vi VBE_VGAInfo |
77 | vi VBE_VGAInfo |
78 | mi VBE_ModeInfo |
78 | mi VBE_ModeInfo |
79 | modes_table: |
79 | modes_table: |
80 | end virtual |
80 | end virtual |
81 | cursor_pos dw 0 ;âðåìåííîå õðàíåíèå êóðñîðà. |
81 | cursor_pos dw 0 ;âðåìåííîå õðàíåíèå êóðñîðà. |
82 | home_cursor dw 0 ;current shows rows a table |
82 | home_cursor dw 0 ;current shows rows a table |
83 | end_cursor dw 0 ;end of position current shows rows a table |
83 | end_cursor dw 0 ;end of position current shows rows a table |
84 | scroll_start dw 0 ;start position of scroll bar |
84 | scroll_start dw 0 ;start position of scroll bar |
85 | scroll_end dw 0 ;end position of scroll bar |
85 | scroll_end dw 0 ;end position of scroll bar |
86 | long_v_table equ 9 ;long of visible video table |
86 | long_v_table equ 9 ;long of visible video table |
87 | size_of_step equ 10 |
87 | size_of_step equ 10 |
88 | scroll_area_size equ (long_v_table-2) |
88 | scroll_area_size equ (long_v_table-2) |
89 | int2str: |
89 | int2str: |
90 | dec bl |
90 | dec bl |
91 | jz @f |
91 | jz @f |
92 | xor edx, edx |
92 | xor edx, edx |
93 | div ecx |
93 | div ecx |
94 | push edx |
94 | push edx |
95 | call int2str |
95 | call int2str |
96 | pop eax |
96 | pop eax |
97 | @@: |
97 | @@: |
98 | or al, 0x30 |
98 | or al, 0x30 |
99 | mov [ds:di], al |
99 | mov [ds:di], al |
100 | inc di |
100 | inc di |
101 | ret |
101 | ret |
102 | 102 | ||
103 | int2strnz: |
103 | int2strnz: |
104 | cmp eax, ecx |
104 | cmp eax, ecx |
105 | jb @f |
105 | jb @f |
106 | xor edx, edx |
106 | xor edx, edx |
107 | div ecx |
107 | div ecx |
108 | push edx |
108 | push edx |
109 | call int2strnz |
109 | call int2strnz |
110 | pop eax |
110 | pop eax |
111 | @@: |
111 | @@: |
112 | or al, 0x30 |
112 | or al, 0x30 |
113 | mov [es:di], al |
113 | mov [es:di], al |
114 | inc di |
114 | inc di |
115 | ret |
115 | ret |
116 | 116 | ||
117 | ;------------------------------------------------------- |
117 | ;------------------------------------------------------- |
118 | ;Write message about incorrect v_mode and write message about jmp on swith v_mode |
118 | ;Write message about incorrect v_mode and write message about jmp on swith v_mode |
119 | v_mode_error: |
119 | v_mode_error: |
120 | _setcursor 19,2 |
120 | _setcursor 19,2 |
121 | mov si, fatalsel |
121 | mov si, fatalsel |
122 | call printplain |
122 | call printplain |
123 | _setcursor 20,2 |
123 | _setcursor 20,2 |
124 | mov si, pres_key |
124 | mov si, pres_key |
125 | call printplain |
125 | call printplain |
126 | xor eax, eax |
126 | xor eax, eax |
127 | int 16h |
127 | int 16h |
128 | jmp cfgmanager.d |
128 | jmp cfgmanager.d |
129 | ;------------------------------------------------------- |
129 | ;------------------------------------------------------- |
130 | ; |
130 | ; |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | ;------------------------------------------------------- |
134 | ;------------------------------------------------------- |
135 | print_vesa_info: |
135 | print_vesa_info: |
136 | _setcursor 5,2 |
136 | _setcursor 5,2 |
137 | 137 | ||
138 | mov [es:vi.VESASignature], 'VBE2' |
138 | mov [es:vi.VESASignature], 'VBE2' |
139 | mov ax, 0x4F00 |
139 | mov ax, 0x4F00 |
140 | mov di, vi ;0xa000 |
140 | mov di, vi ;0xa000 |
141 | int 0x10 |
141 | int 0x10 |
142 | or ah, ah |
142 | or ah, ah |
143 | jz @f |
143 | jz @f |
144 | mov [es:vi.VESASignature], 'VESA' |
144 | mov [es:vi.VESASignature], 'VESA' |
145 | mov ax, $4F00 |
145 | mov ax, $4F00 |
146 | mov di, vi |
146 | mov di, vi |
147 | int 0x10 |
147 | int 0x10 |
148 | or ah, ah |
148 | or ah, ah |
149 | jnz .exit |
149 | jnz .exit |
150 | @@: |
150 | @@: |
151 | cmp [es:vi.VESASignature], 'VESA' |
151 | cmp [es:vi.VESASignature], 'VESA' |
152 | jne .exit |
152 | jne .exit |
153 | cmp [es:vi.VESAVersion], 0x0100 |
153 | cmp [es:vi.VESAVersion], 0x0100 |
154 | jb .exit |
154 | jb .exit |
155 | jmp .vesaok2 |
155 | jmp .vesaok2 |
156 | 156 | ||
157 | .exit: |
157 | .exit: |
158 | mov si, novesa |
158 | mov si, novesa |
159 | call printplain |
159 | call printplain |
160 | ret |
160 | ret |
161 | 161 | ||
162 | .vesaok2: |
162 | .vesaok2: |
163 | mov ax, [es:vi.VESAVersion] |
163 | mov ax, [es:vi.VESAVersion] |
164 | add ax, '00' |
164 | add ax, '00' |
165 | 165 | ||
166 | mov [s_vesa.ver], ah |
166 | mov [s_vesa.ver], ah |
167 | mov [s_vesa.ver+2], al |
167 | mov [s_vesa.ver+2], al |
168 | mov si, s_vesa |
168 | mov si, s_vesa |
169 | call printplain |
169 | call printplain |
170 | 170 | ||
171 | _setcursor 4,2 |
171 | _setcursor 4,2 |
172 | mov si, word[es:vi.OemStringPtr] |
172 | mov si, word[es:vi.OemStringPtr] |
173 | mov di, si |
173 | mov di, si |
174 | 174 | ||
175 | push ds |
175 | push ds |
176 | mov ds, word[es:vi.OemStringPtr+2] |
176 | mov ds, word[es:vi.OemStringPtr+2] |
177 | call printplain |
177 | call printplain |
178 | pop ds |
178 | pop ds |
179 | 179 | ||
180 | ret |
180 | ret |
181 | ;----------------------------------------------------------------------------- |
181 | ;----------------------------------------------------------------------------- |
182 | 182 | ||
183 | calc_vmodes_table: |
183 | calc_vmodes_table: |
184 | pushad |
184 | pushad |
185 | 185 | ||
186 | ; push 0 |
186 | ; push 0 |
187 | ; pop es |
187 | ; pop es |
188 | 188 | ||
189 | lfs si, [es:vi.VideoModePtr] |
189 | lfs si, [es:vi.VideoModePtr] |
190 | 190 | ||
191 | mov bx, modes_table |
191 | mov bx, modes_table |
192 | ;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢ |
192 | ;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢ |
193 | mov word [es:bx], 640 |
193 | mov word [es:bx], 640 |
194 | mov word [es:bx+2], 480 |
194 | mov word [es:bx+2], 480 |
195 | mov word [es:bx+6], 0x13 |
195 | mov word [es:bx+6], 0x13 |
196 | 196 | ||
197 | mov word [es:bx+10], 640 |
197 | mov word [es:bx+10], 640 |
198 | mov word [es:bx+12], 480 |
198 | mov word [es:bx+12], 480 |
199 | mov word [es:bx+16], 0x12 |
199 | mov word [es:bx+16], 0x12 |
200 | add bx, 20 |
200 | add bx, 20 |
201 | .next_mode: |
201 | .next_mode: |
202 | mov cx, word [fs:si]; mode number |
202 | mov cx, word [fs:si]; mode number |
203 | cmp cx, -1 |
203 | cmp cx, -1 |
204 | je .modes_ok.2 |
204 | je .modes_ok.2 |
205 | 205 | ||
206 | mov ax, 0x4F01 |
206 | mov ax, 0x4F01 |
207 | mov di, mi |
207 | mov di, mi |
208 | int 0x10 |
208 | int 0x10 |
209 | 209 | ||
210 | or ah, ah |
210 | or ah, ah |
211 | jnz .modes_ok.2;vesa_info.exit |
211 | jnz .modes_ok.2;vesa_info.exit |
212 | 212 | ||
213 | test [es:mi.ModeAttributes], 00000001b ;videomode support ? |
213 | test [es:mi.ModeAttributes], 00000001b ;videomode support ? |
214 | jz @f |
214 | jz @f |
215 | test [es:mi.ModeAttributes], 00010000b ;picture ? |
215 | test [es:mi.ModeAttributes], 00010000b ;picture ? |
216 | jz @f |
216 | jz @f |
217 | test [es:mi.ModeAttributes], 10000000b ;LFB ? |
217 | test [es:mi.ModeAttributes], 10000000b ;LFB ? |
218 | jz @f |
218 | jz @f |
219 | 219 | ||
220 | cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp |
220 | cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp |
221 | jb @f |
221 | jb @f |
222 | 222 | ||
223 | ; cmp [es:mi.BitsPerPixel],16 |
223 | ; cmp [es:mi.BitsPerPixel],16 |
224 | ; jne .l0 |
224 | ; jne .l0 |
225 | ; cmp [es:mi.GreenMaskSize],5 |
225 | ; cmp [es:mi.GreenMaskSize],5 |
226 | ; jne .l0 |
226 | ; jne .l0 |
227 | ; mov [es:mi.BitsPerPixel],15 |
227 | ; mov [es:mi.BitsPerPixel],15 |
228 | 228 | ||
229 | 229 | ||
230 | .l0: |
230 | .l0: |
231 | cmp [es:mi.XRes], 640 |
231 | cmp [es:mi.XRes], 640 |
232 | jb @f |
232 | jb @f |
233 | cmp [es:mi.YRes], 480 |
233 | cmp [es:mi.YRes], 480 |
234 | jb @f |
234 | jb @f |
235 | ; cmp [es:mi.BitsPerPixel],8 |
235 | ; cmp [es:mi.BitsPerPixel],8 |
236 | ; jb @f |
236 | ; jb @f |
237 | 237 | ||
238 | mov ax, [es:mi.XRes] |
238 | mov ax, [es:mi.XRes] |
239 | mov [es:bx+0], ax ; +0[2] : resolution X |
239 | mov [es:bx+0], ax ; +0[2] : resolution X |
240 | mov ax, [es:mi.YRes] |
240 | mov ax, [es:mi.YRes] |
241 | mov [es:bx+2], ax ; +2[2] : resolution Y |
241 | mov [es:bx+2], ax ; +2[2] : resolution Y |
242 | mov ax, [es:mi.ModeAttributes] |
242 | mov ax, [es:mi.ModeAttributes] |
243 | mov [es:bx+4], ax ; +4[2] : attributes |
243 | mov [es:bx+4], ax ; +4[2] : attributes |
244 | 244 | ||
245 | cmp [s_vesa.ver], '2' |
245 | cmp [s_vesa.ver], '2' |
246 | ; jb .lp1 |
246 | ; jb .lp1 |
247 | jb @f ; We do not use Vesa 1.2 mode is now |
247 | jb @f ; We do not use Vesa 1.2 mode is now |
248 | 248 | ||
249 | or cx, 0x4000 ; use LFB |
249 | or cx, 0x4000 ; use LFB |
250 | .lp1: |
250 | .lp1: |
251 | mov [es:bx+6], cx ; +6 : mode number |
251 | mov [es:bx+6], cx ; +6 : mode number |
252 | movzx ax, byte [es:mi.BitsPerPixel] |
252 | movzx ax, byte [es:mi.BitsPerPixel] |
253 | mov word [es:bx+8], ax ; +8 : bits per pixel |
253 | mov word [es:bx+8], ax ; +8 : bits per pixel |
254 | add bx, size_of_step ; size of record |
254 | add bx, size_of_step ; size of record |
255 | 255 | ||
256 | @@: |
256 | @@: |
257 | add si, 2 |
257 | add si, 2 |
258 | jmp .next_mode |
258 | jmp .next_mode |
259 | 259 | ||
260 | .modes_ok.2: |
260 | .modes_ok.2: |
261 | 261 | ||
262 | mov word[es:bx], -1 ;end video table |
262 | mov word[es:bx], -1 ;end video table |
263 | mov word[end_cursor], bx ;save end cursor position |
263 | mov word[end_cursor], bx ;save end cursor position |
264 | ;;;;;;;;;;;;;;;;;; |
264 | ;;;;;;;;;;;;;;;;;; |
265 | ;Sort array |
265 | ;Sort array |
266 | ; mov si,modes_table |
266 | ; mov si,modes_table |
267 | ;.new_mode: |
267 | ;.new_mode: |
268 | ; mov ax,word [es:si] |
268 | ; mov ax,word [es:si] |
269 | ; cmp ax,-1 |
269 | ; cmp ax,-1 |
270 | ; je .exxit |
270 | ; je .exxit |
271 | ; add ax,word [es:si+2] |
271 | ; add ax,word [es:si+2] |
272 | ; add ax,word [es:si+8] |
272 | ; add ax,word [es:si+8] |
273 | ; mov bp,si |
273 | ; mov bp,si |
274 | ;.again: |
274 | ;.again: |
275 | ; add bp,12 |
275 | ; add bp,12 |
276 | ; mov bx,word [es:bp] |
276 | ; mov bx,word [es:bp] |
277 | ; cmp bx,-1 |
277 | ; cmp bx,-1 |
278 | ; je .exit |
278 | ; je .exit |
279 | ; add bx,word [es:bp+2] |
279 | ; add bx,word [es:bp+2] |
280 | ; add bx,word [es:bp+8] |
280 | ; add bx,word [es:bp+8] |
281 | ; |
281 | ; |
282 | ; cmp ax,bx |
282 | ; cmp ax,bx |
283 | ; ja .loops |
283 | ; ja .loops |
284 | ; jmp .again |
284 | ; jmp .again |
285 | ;.loops: |
285 | ;.loops: |
286 | ; push dword [es:si] |
286 | ; push dword [es:si] |
287 | ; push dword [es:si+4] |
287 | ; push dword [es:si+4] |
288 | ; push dword [es:si+8] |
288 | ; push dword [es:si+8] |
289 | ; push dword [es:bp] |
289 | ; push dword [es:bp] |
290 | ; push dword [es:bp+4] |
290 | ; push dword [es:bp+4] |
291 | ; push dword [es:bp+8] |
291 | ; push dword [es:bp+8] |
292 | ; |
292 | ; |
293 | ; pop dword [es:si+8] |
293 | ; pop dword [es:si+8] |
294 | ; pop dword [es:si+4] |
294 | ; pop dword [es:si+4] |
295 | ; pop dword [es:si] |
295 | ; pop dword [es:si] |
296 | ; pop dword [es:bp+8] |
296 | ; pop dword [es:bp+8] |
297 | ; pop dword [es:bp+4] |
297 | ; pop dword [es:bp+4] |
298 | ; pop dword [es:bp] |
298 | ; pop dword [es:bp] |
299 | ; jmp .new_mode |
299 | ; jmp .new_mode |
300 | ; |
300 | ; |
301 | ;.exit: add si,12 |
301 | ;.exit: add si,12 |
302 | ; jmp .new_mode |
302 | ; jmp .new_mode |
303 | ;.exxit: |
303 | ;.exxit: |
304 | popad |
304 | popad |
305 | ret |
305 | ret |
306 | 306 | ||
307 | ;----------------------------------------------------------------------------- |
307 | ;----------------------------------------------------------------------------- |
308 | 308 | ||
309 | draw_current_vmode: |
309 | draw_current_vmode: |
310 | push 0 |
310 | push 0 |
311 | pop es |
311 | pop es |
312 | 312 | ||
313 | mov si, word [cursor_pos] |
313 | mov si, word [cursor_pos] |
314 | 314 | ||
315 | cmp word [es:si+6], 0x12 |
315 | cmp word [es:si+6], 0x12 |
316 | je .no_vesa_0x12 |
316 | je .no_vesa_0x12 |
317 | 317 | ||
318 | cmp word [es:si+6], 0x13 |
318 | cmp word [es:si+6], 0x13 |
319 | je .no_vesa_0x13 |
319 | je .no_vesa_0x13 |
320 | 320 | ||
321 | if defined extended_primary_loader |
321 | if defined extended_primary_loader |
322 | mov di, config_file_variables |
322 | mov di, config_file_variables |
323 | else |
323 | else |
324 | mov di, loader_block_error |
324 | mov di, loader_block_error |
325 | end if |
325 | end if |
326 | movzx eax, word[es:si+0] |
326 | movzx eax, word[es:si+0] |
327 | mov ecx, 10 |
327 | mov ecx, 10 |
328 | call int2strnz |
328 | call int2strnz |
329 | mov byte[es:di], 'x' |
329 | mov byte[es:di], 'x' |
330 | inc di |
330 | inc di |
331 | movzx eax, word[es:si+2] |
331 | movzx eax, word[es:si+2] |
332 | call int2strnz |
332 | call int2strnz |
333 | mov byte[es:di], 'x' |
333 | mov byte[es:di], 'x' |
334 | inc di |
334 | inc di |
335 | movzx eax, word[es:si+8] |
335 | movzx eax, word[es:si+8] |
336 | call int2strnz |
336 | call int2strnz |
337 | mov dword[es:di], 0x00000d0a |
337 | mov dword[es:di], 0x00000d0a |
338 | if defined extended_primary_loader |
338 | if defined extended_primary_loader |
339 | mov si, config_file_variables |
339 | mov si, config_file_variables |
340 | else |
340 | else |
341 | mov si, loader_block_error |
341 | mov si, loader_block_error |
342 | end if |
342 | end if |
343 | push ds |
343 | push ds |
344 | push es |
344 | push es |
345 | pop ds |
345 | pop ds |
346 | call printplain |
346 | call printplain |
347 | pop ds |
347 | pop ds |
348 | ret |
348 | ret |
349 | .no_vesa_0x13: |
349 | .no_vesa_0x13: |
350 | mov si, mode0 |
350 | mov si, mode0 |
351 | jmp .print |
351 | jmp .print |
352 | .no_vesa_0x12: |
352 | .no_vesa_0x12: |
353 | mov si, mode9 |
353 | mov si, mode9 |
354 | .print: |
354 | .print: |
355 | call printplain |
355 | call printplain |
356 | ret |
356 | ret |
357 | ;----------------------------------------------------------------------------- |
357 | ;----------------------------------------------------------------------------- |
358 | check_first_parm: |
358 | check_first_parm: |
359 | if defined extended_primary_loader |
359 | if defined extended_primary_loader |
360 | mov cx, [number_vm] |
360 | mov cx, [number_vm] |
361 | jcxz .novbemode |
361 | jcxz .novbemode |
362 | mov si, modes_table |
362 | mov si, modes_table |
363 | .findvbemode: |
363 | .findvbemode: |
364 | cmp [es:si+6], cx |
364 | cmp [es:si+6], cx |
365 | jnz @f |
365 | jnz @f |
366 | cmp word [es:si+8], 32 |
366 | cmp word [es:si+8], 32 |
367 | je .ok_found_mode |
367 | je .ok_found_mode |
368 | cmp word [es:si+8], 24 |
368 | cmp word [es:si+8], 24 |
369 | je .ok_found_mode |
369 | je .ok_found_mode |
370 | @@: |
370 | @@: |
371 | add si, size_of_step |
371 | add si, size_of_step |
372 | cmp word [es:si], -1 |
372 | cmp word [es:si], -1 |
373 | jnz .findvbemode |
373 | jnz .findvbemode |
374 | .novbemode: |
374 | .novbemode: |
375 | mov ax, [x_save] |
375 | mov ax, [x_save] |
376 | test ax, ax |
376 | test ax, ax |
377 | jz .zerro |
377 | jz .zerro |
378 | mov bx, [y_save] |
378 | mov bx, [y_save] |
379 | mov si, modes_table |
379 | mov si, modes_table |
380 | call .loops |
380 | call .loops |
381 | test ax, ax |
381 | test ax, ax |
382 | jz .ok_found_mode |
382 | jz .ok_found_mode |
383 | else |
383 | else |
384 | mov si, word [preboot_graph] |
384 | mov si, word [preboot_graph] |
385 | test si, si |
385 | test si, si |
386 | jnz .no_zero ;if no zero |
386 | jnz .no_zero ;if no zero |
387 | end if |
387 | end if |
388 | .zerro: |
388 | .zerro: |
389 | ; mov ax,modes_table |
389 | ; mov ax,modes_table |
390 | ; mov word [cursor_pos],ax |
390 | ; mov word [cursor_pos],ax |
391 | ; mov word [home_cursor],ax |
391 | ; mov word [home_cursor],ax |
392 | ; mov word [preboot_graph],ax |
392 | ; mov word [preboot_graph],ax |
393 | ;SET default video of mode first probe will fined a move of work 1024x768@32 |
393 | ;SET default video of mode first probe will fined a move of work 1024x768@32 |
394 | 394 | ||
395 | mov ax, 1024 |
395 | mov ax, 1024 |
396 | mov bx, 768 |
396 | mov bx, 768 |
397 | mov si, modes_table |
397 | mov si, modes_table |
398 | call .loops |
398 | call .loops |
399 | test ax, ax |
399 | test ax, ax |
400 | jz .ok_found_mode |
400 | jz .ok_found_mode |
401 | mov ax, 800 |
401 | mov ax, 800 |
402 | mov bx, 600 |
402 | mov bx, 600 |
403 | mov si, modes_table |
403 | mov si, modes_table |
404 | call .loops |
404 | call .loops |
405 | test ax, ax |
405 | test ax, ax |
406 | jz .ok_found_mode |
406 | jz .ok_found_mode |
407 | mov ax, 640 |
407 | mov ax, 640 |
408 | mov bx, 480 |
408 | mov bx, 480 |
409 | mov si, modes_table |
409 | mov si, modes_table |
410 | call .loops |
410 | call .loops |
411 | test ax, ax |
411 | test ax, ax |
412 | jz .ok_found_mode |
412 | jz .ok_found_mode |
413 | 413 | ||
414 | mov si, modes_table |
414 | mov si, modes_table |
415 | if ~ defined extended_primary_loader |
415 | if ~ defined extended_primary_loader |
416 | jmp .ok_found_mode |
416 | jmp .ok_found_mode |
417 | 417 | ||
418 | 418 | ||
419 | 419 | ||
420 | .no_zero: |
420 | .no_zero: |
421 | mov bp, word [number_vm] |
421 | mov bp, word [number_vm] |
422 | cmp bp, word [es:si+6] |
422 | cmp bp, word [es:si+6] |
423 | jz .ok_found_mode |
423 | jz .ok_found_mode |
424 | mov ax, word [x_save] |
424 | mov ax, word [x_save] |
425 | mov bx, word [y_save] |
425 | mov bx, word [y_save] |
426 | mov si, modes_table |
426 | mov si, modes_table |
427 | call .loops |
427 | call .loops |
428 | test ax, ax |
428 | test ax, ax |
429 | jz .ok_found_mode |
429 | jz .ok_found_mode |
430 | 430 | ||
431 | mov si, modes_table |
431 | mov si, modes_table |
432 | ; cmp ax,modes_table |
432 | ; cmp ax,modes_table |
433 | ; jb .zerro ;check on correct if bellow |
433 | ; jb .zerro ;check on correct if bellow |
434 | ; cmp ax,word [end_cursor] |
434 | ; cmp ax,word [end_cursor] |
435 | ; ja .zerro ;check on correct if anymore |
435 | ; ja .zerro ;check on correct if anymore |
436 | end if |
436 | end if |
437 | 437 | ||
438 | .ok_found_mode: |
438 | .ok_found_mode: |
439 | mov word [home_cursor], si |
439 | mov word [home_cursor], si |
440 | ; mov word [cursor_pos],si |
440 | ; mov word [cursor_pos],si |
441 | mov word [preboot_graph], si |
441 | mov word [preboot_graph], si |
442 | mov ax, si |
442 | mov ax, si |
443 | 443 | ||
444 | mov ecx, long_v_table |
444 | mov ecx, long_v_table |
445 | 445 | ||
446 | .loop: |
446 | .loop: |
447 | add ax, size_of_step |
447 | add ax, size_of_step |
448 | cmp ax, word [end_cursor] |
448 | cmp ax, word [end_cursor] |
449 | jae .next_step |
449 | jae .next_step |
450 | loop .loop |
450 | loop .loop |
451 | .next_step: |
451 | .next_step: |
452 | sub ax, size_of_step*long_v_table |
452 | sub ax, size_of_step*long_v_table |
453 | cmp ax, modes_table |
453 | cmp ax, modes_table |
454 | jae @f |
454 | jae @f |
455 | mov ax, modes_table |
455 | mov ax, modes_table |
456 | @@: |
456 | @@: |
457 | 457 | ||
458 | mov word [home_cursor], ax |
458 | mov word [home_cursor], ax |
459 | mov si, [preboot_graph] |
459 | mov si, [preboot_graph] |
460 | mov word [cursor_pos], si |
460 | mov word [cursor_pos], si |
461 | 461 | ||
462 | push word [es:si] |
462 | push word [es:si] |
463 | pop word [x_save] |
463 | pop word [x_save] |
464 | push word [es:si+2] |
464 | push word [es:si+2] |
465 | pop word [y_save] |
465 | pop word [y_save] |
466 | push word [es:si+6] |
466 | push word [es:si+6] |
467 | pop word [number_vm] |
467 | pop word [number_vm] |
468 | 468 | ||
469 | ret |
469 | ret |
470 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; |
470 | ;;;;;;;;;;;;;;;;;;;;;;;;;;; |
471 | .loops: |
471 | .loops: |
472 | cmp ax, word [es:si] |
472 | cmp ax, word [es:si] |
473 | jne .next |
473 | jne .next |
474 | cmp bx, word [es:si+2] |
474 | cmp bx, word [es:si+2] |
475 | jne .next |
475 | jne .next |
476 | cmp word [es:si+8], 32 |
476 | cmp word [es:si+8], 32 |
477 | je .ok |
477 | je .ok |
478 | cmp word [es:si+8], 24 |
478 | cmp word [es:si+8], 24 |
479 | je .ok |
479 | je .ok |
480 | .next: |
480 | .next: |
481 | add si, size_of_step |
481 | add si, size_of_step |
482 | cmp word [es:si], -1 |
482 | cmp word [es:si], -1 |
483 | je .exit |
483 | je .exit |
484 | jmp .loops |
484 | jmp .loops |
485 | .ok: |
485 | .ok: |
486 | xor ax, ax |
486 | xor ax, ax |
487 | ret |
487 | ret |
488 | .exit: |
488 | .exit: |
489 | or ax, -1 |
489 | or ax, -1 |
490 | ret |
490 | ret |
491 | 491 | ||
492 | 492 | ||
493 | ;----------------------------------------------------------------------------- |
493 | ;----------------------------------------------------------------------------- |
494 | 494 | ||
495 | ;default_vmode: |
495 | ;default_vmode: |
496 | 496 | ||
497 | ;----------------------------------------------------------------------------- |
497 | ;----------------------------------------------------------------------------- |
498 | draw_vmodes_table: |
498 | draw_vmodes_table: |
499 | _setcursor 9, 2 |
499 | _setcursor 9, 2 |
500 | mov si, gr_mode |
500 | mov si, gr_mode |
501 | call printplain |
501 | call printplain |
502 | 502 | ||
503 | mov si, _st |
503 | mov si, _st |
504 | call printplain |
504 | call printplain |
505 | 505 | ||
506 | push word [cursor_pos] |
506 | push word [cursor_pos] |
507 | pop ax |
507 | pop ax |
508 | push word [home_cursor] |
508 | push word [home_cursor] |
509 | pop si |
509 | pop si |
510 | mov cx, si |
510 | mov cx, si |
511 | 511 | ||
512 | cmp ax, si |
512 | cmp ax, si |
513 | je .ok |
513 | je .ok |
514 | jb .low |
514 | jb .low |
515 | 515 | ||
516 | 516 | ||
517 | add cx, size_of_step*long_v_table |
517 | add cx, size_of_step*long_v_table |
518 | 518 | ||
519 | cmp ax, cx |
519 | cmp ax, cx |
520 | jb .ok |
520 | jb .ok |
521 | 521 | ||
522 | sub cx, size_of_step*long_v_table |
522 | sub cx, size_of_step*long_v_table |
523 | add cx, size_of_step |
523 | add cx, size_of_step |
524 | cmp cx, word[end_cursor] |
524 | cmp cx, word[end_cursor] |
525 | jae .ok |
525 | jae .ok |
526 | add si, size_of_step |
526 | add si, size_of_step |
527 | push si |
527 | push si |
528 | pop word [home_cursor] |
528 | pop word [home_cursor] |
529 | jmp .ok |
529 | jmp .ok |
530 | 530 | ||
531 | 531 | ||
532 | .low: |
532 | .low: |
533 | sub cx, size_of_step |
533 | sub cx, size_of_step |
534 | cmp cx, modes_table |
534 | cmp cx, modes_table |
535 | jb .ok |
535 | jb .ok |
536 | push cx |
536 | push cx |
537 | push cx |
537 | push cx |
538 | pop word [home_cursor] |
538 | pop word [home_cursor] |
539 | pop si |
539 | pop si |
540 | 540 | ||
541 | 541 | ||
542 | .ok: |
542 | .ok: |
543 | ; calculate scroll position |
543 | ; calculate scroll position |
544 | push si |
544 | push si |
545 | mov ax, [end_cursor] |
545 | mov ax, [end_cursor] |
546 | sub ax, modes_table |
546 | sub ax, modes_table |
547 | mov bx, size_of_step |
547 | mov bx, size_of_step |
548 | cwd |
548 | cwd |
549 | div bx |
549 | div bx |
550 | mov si, ax ; si = size of list |
550 | mov si, ax ; si = size of list |
551 | mov ax, [home_cursor] |
551 | mov ax, [home_cursor] |
552 | sub ax, modes_table |
552 | sub ax, modes_table |
553 | cwd |
553 | cwd |
554 | div bx |
554 | div bx |
555 | mov di, ax |
555 | mov di, ax |
556 | mov ax, scroll_area_size*long_v_table |
556 | mov ax, scroll_area_size*long_v_table |
557 | cwd |
557 | cwd |
558 | div si |
558 | div si |
559 | test ax, ax |
559 | test ax, ax |
560 | jnz @f |
560 | jnz @f |
561 | inc ax |
561 | inc ax |
562 | @@: |
562 | @@: |
563 | cmp al, scroll_area_size |
563 | cmp al, scroll_area_size |
564 | jb @f |
564 | jb @f |
565 | mov al, scroll_area_size |
565 | mov al, scroll_area_size |
566 | @@: |
566 | @@: |
567 | mov cx, ax |
567 | mov cx, ax |
568 | ; cx = scroll height |
568 | ; cx = scroll height |
569 | ; calculate scroll pos |
569 | ; calculate scroll pos |
570 | xor bx, bx ; initialize scroll pos |
570 | xor bx, bx ; initialize scroll pos |
571 | sub al, scroll_area_size+1 |
571 | sub al, scroll_area_size+1 |
572 | neg al |
572 | neg al |
573 | sub si, long_v_table-1 |
573 | sub si, long_v_table-1 |
574 | jbe @f |
574 | jbe @f |
575 | mul di |
575 | mul di |
576 | div si |
576 | div si |
577 | mov bx, ax |
577 | mov bx, ax |
578 | @@: |
578 | @@: |
579 | inc bx |
579 | inc bx |
580 | imul ax, bx, size_of_step |
580 | imul ax, bx, size_of_step |
581 | add ax, [home_cursor] |
581 | add ax, [home_cursor] |
582 | mov [scroll_start], ax |
582 | mov [scroll_start], ax |
583 | imul cx, size_of_step |
583 | imul cx, size_of_step |
584 | add ax, cx |
584 | add ax, cx |
585 | mov [scroll_end], ax |
585 | mov [scroll_end], ax |
586 | pop si |
586 | pop si |
587 | mov bp, long_v_table ;show rows |
587 | mov bp, long_v_table ;show rows |
588 | .@@_next_bit: |
588 | .@@_next_bit: |
589 | ;clear cursor |
589 | ;clear cursor |
590 | mov ax, ' ' |
590 | mov ax, ' ' |
591 | mov word[ds:_r1+21], ax |
591 | mov word[ds:_r1+21], ax |
592 | mov word[ds:_r1+50], ax |
592 | mov word[ds:_r1+50], ax |
593 | 593 | ||
594 | mov word[ds:_r2+21], ax |
594 | mov word[ds:_r2+21], ax |
595 | mov word[ds:_r2+45], ax |
595 | mov word[ds:_r2+45], ax |
596 | 596 | ||
597 | mov word[ds:_rs+21], ax |
597 | mov word[ds:_rs+21], ax |
598 | mov word[ds:_rs+46], ax |
598 | mov word[ds:_rs+46], ax |
599 | ; draw string |
599 | ; draw string |
600 | cmp word [es:si+6], 0x12 |
600 | cmp word [es:si+6], 0x12 |
601 | je .show_0x12 |
601 | je .show_0x12 |
602 | cmp word [es:si+6], 0x13 |
602 | cmp word [es:si+6], 0x13 |
603 | je .show_0x13 |
603 | je .show_0x13 |
604 | 604 | ||
605 | movzx eax, word[es:si] |
605 | movzx eax, word[es:si] |
606 | cmp ax, -1 |
606 | cmp ax, -1 |
607 | je .@@_end |
607 | je .@@_end |
608 | mov di, _rs+23 |
608 | mov di, _rs+23 |
609 | mov ecx, 10 |
609 | mov ecx, 10 |
610 | mov bl, 4 |
610 | mov bl, 4 |
611 | call int2str |
611 | call int2str |
612 | movzx eax, word[es:si+2] |
612 | movzx eax, word[es:si+2] |
613 | inc di |
613 | inc di |
614 | mov bl, 4 |
614 | mov bl, 4 |
615 | call int2str |
615 | call int2str |
616 | 616 | ||
617 | movzx eax, word[es:si+8] |
617 | movzx eax, word[es:si+8] |
618 | inc di |
618 | inc di |
619 | mov bl, 2 |
619 | mov bl, 2 |
620 | call int2str |
620 | call int2str |
621 | 621 | ||
622 | cmp si, word [cursor_pos] |
622 | cmp si, word [cursor_pos] |
623 | jne .next |
623 | jne .next |
624 | ;draw cursor |
624 | ;draw cursor |
625 | mov word[ds:_rs+21], '>>' |
625 | mov word[ds:_rs+21], '>>' |
626 | mov word[ds:_rs+46], '<<' |
626 | mov word[ds:_rs+46], '<<' |
627 | 627 | ||
628 | 628 | ||
629 | 629 | ||
630 | .next: |
630 | .next: |
631 | push si |
631 | push si |
632 | mov si, _rs |
632 | mov si, _rs |
633 | .@@_sh: |
633 | .@@_sh: |
634 | ; add to the string pseudographics for scrollbar |
634 | ; add to the string pseudographics for scrollbar |
635 | pop bx |
635 | pop bx |
636 | push bx |
636 | push bx |
637 | mov byte [si+53], ' ' |
637 | mov byte [si+53], ' ' |
638 | cmp bx, [scroll_start] |
638 | cmp bx, [scroll_start] |
639 | jb @f |
639 | jb @f |
640 | cmp bx, [scroll_end] |
640 | cmp bx, [scroll_end] |
641 | jae @f |
641 | jae @f |
642 | mov byte [si+53], 0xDB ; filled bar |
642 | mov byte [si+53], 0xDB ; filled bar |
643 | @@: |
643 | @@: |
644 | push bx |
644 | push bx |
645 | add bx, size_of_step |
645 | add bx, size_of_step |
646 | cmp bx, [end_cursor] |
646 | cmp bx, [end_cursor] |
647 | jnz @f |
647 | jnz @f |
648 | mov byte [si+53], 31 ; 'down arrow' symbol |
648 | mov byte [si+53], 31 ; 'down arrow' symbol |
649 | @@: |
649 | @@: |
650 | sub bx, [home_cursor] |
650 | sub bx, [home_cursor] |
651 | cmp bx, size_of_step*long_v_table |
651 | cmp bx, size_of_step*long_v_table |
652 | jnz @f |
652 | jnz @f |
653 | mov byte [si+53], 31 ; 'down arrow' symbol |
653 | mov byte [si+53], 31 ; 'down arrow' symbol |
654 | @@: |
654 | @@: |
655 | pop bx |
655 | pop bx |
656 | cmp bx, [home_cursor] |
656 | cmp bx, [home_cursor] |
657 | jnz @f |
657 | jnz @f |
658 | mov byte [si+53], 30 ; 'up arrow' symbol |
658 | mov byte [si+53], 30 ; 'up arrow' symbol |
659 | @@: |
659 | @@: |
660 | call printplain |
660 | call printplain |
661 | pop si |
661 | pop si |
662 | add si, size_of_step |
662 | add si, size_of_step |
663 | 663 | ||
664 | dec bp |
664 | dec bp |
665 | jnz .@@_next_bit |
665 | jnz .@@_next_bit |
666 | 666 | ||
667 | .@@_end: |
667 | .@@_end: |
668 | mov si, _bt |
668 | mov si, _bt |
669 | call printplain |
669 | call printplain |
670 | ret |
670 | ret |
671 | .show_0x13: |
671 | .show_0x13: |
672 | push si |
672 | push si |
673 | 673 | ||
674 | cmp si, word [cursor_pos] |
674 | cmp si, word [cursor_pos] |
675 | jne @f |
675 | jne @f |
676 | mov word[ds:_r1+21], '>>' |
676 | mov word[ds:_r1+21], '>>' |
677 | mov word[ds:_r1+50], '<<' |
677 | mov word[ds:_r1+50], '<<' |
678 | @@: |
678 | @@: |
679 | mov si, _r1 |
679 | mov si, _r1 |
680 | jmp .@@_sh |
680 | jmp .@@_sh |
681 | .show_0x12: |
681 | .show_0x12: |
682 | push si |
682 | push si |
683 | cmp si, word [cursor_pos] |
683 | cmp si, word [cursor_pos] |
684 | jne @f |
684 | jne @f |
685 | 685 | ||
686 | mov word[ds:_r2+21], '>>' |
686 | mov word[ds:_r2+21], '>>' |
687 | mov word[ds:_r2+45], '<<' |
687 | mov word[ds:_r2+45], '<<' |
688 | @@: |
688 | @@: |
689 | mov si, _r2 |
689 | mov si, _r2 |
690 | jmp .@@_sh |
690 | jmp .@@_sh |
691 | 691 | ||
692 | ;----------------------------------------------------------------------------- |
692 | ;----------------------------------------------------------------------------- |
693 | ;Clear arrea of current video page (0xb800) |
693 | ;Clear arrea of current video page (0xb800) |
694 | clear_vmodes_table: |
694 | clear_vmodes_table: |
695 | pusha |
695 | pusha |
696 | ; draw frames |
696 | ; draw frames |
697 | push es |
697 | push es |
698 | push 0xb800 |
698 | push 0xb800 |
699 | pop es |
699 | pop es |
700 | mov di, 1444 |
700 | mov di, 1444 |
701 | xor ax, ax |
701 | xor ax, ax |
702 | mov ah, 1*16+15 |
702 | mov ah, 1*16+15 |
703 | mov cx, 70 |
703 | mov cx, 70 |
704 | mov bp, 12 |
704 | mov bp, 12 |
705 | .loop_start: |
705 | .loop_start: |
706 | rep stosw |
706 | rep stosw |
707 | mov cx, 70 |
707 | mov cx, 70 |
708 | add di, 20 |
708 | add di, 20 |
709 | dec bp |
709 | dec bp |
710 | jns .loop_start |
710 | jns .loop_start |
711 | pop es |
711 | pop es |
712 | popa |
712 | popa |
713 | ret |
713 | ret |
714 | 714 | ||
715 | ;----------------------------------------------------------------------------- |
715 | ;----------------------------------------------------------------------------- |
716 | 716 | ||
717 | set_vmode: |
717 | set_vmode: |
718 | push 0 ;0;x1000 |
718 | push 0 ;0;x1000 |
719 | pop es |
719 | pop es |
720 | 720 | ||
721 | mov si, word [preboot_graph] ;[preboot_graph] |
721 | mov si, word [preboot_graph] ;[preboot_graph] |
722 | mov cx, word [es:si+6] ; number of mode |
722 | mov cx, word [es:si+6] ; number of mode |
723 | 723 | ||
724 | 724 | ||
725 | mov ax, word [es:si+0] ; resolution X |
725 | mov ax, word [es:si+0] ; resolution X |
726 | mov bx, word [es:si+2] ; resolution Y |
726 | mov bx, word [es:si+2] ; resolution Y |
727 | 727 | ||
728 | 728 | ||
729 | mov word [es:0x900A], ax ; resolution X |
729 | mov word [es:BOOT_X_RES], ax ; resolution X |
730 | mov word [es:0x900C], bx ; resolution Y |
730 | mov word [es:BOOT_Y_RES], bx ; resolution Y |
731 | mov word [es:0x9008], cx ; number of mode |
731 | mov word [es:BOOT_VESA_MODE], cx ; number of mode |
732 | 732 | ||
733 | cmp cx, 0x12 |
733 | cmp cx, 0x12 |
734 | je .mode0x12_0x13 |
734 | je .mode0x12_0x13 |
735 | cmp cx, 0x13 |
735 | cmp cx, 0x13 |
736 | je .mode0x12_0x13 |
736 | je .mode0x12_0x13 |
737 | 737 | ||
738 | 738 | ||
739 | ; cmp byte [s_vesa.ver], '2' |
739 | ; cmp byte [s_vesa.ver], '2' |
740 | ; jb .vesa12 |
740 | ; jb .vesa12 |
741 | 741 | ||
742 | ; VESA 2 and Vesa 3 |
742 | ; VESA 2 and Vesa 3 |
743 | 743 | ||
744 | mov ax, 0x4f01 |
744 | mov ax, 0x4f01 |
745 | and cx, 0xfff |
745 | and cx, 0xfff |
746 | mov di, mi;0xa000 |
746 | mov di, mi;0xa000 |
747 | int 0x10 |
747 | int 0x10 |
748 | ; LFB |
748 | ; LFB |
749 | mov eax, [es:mi.PhysBasePtr];di+0x28] |
749 | mov eax, [es:mi.PhysBasePtr];di+0x28] |
750 | mov [es:0x9018], eax |
750 | mov [es:BOOT_LFB], eax |
751 | ; ---- vbe voodoo |
751 | ; ---- vbe voodoo |
752 | BytesPerLine equ 0x10 |
752 | BytesPerLine equ 0x10 |
753 | mov ax, [es:di+BytesPerLine] |
753 | mov ax, [es:di+BytesPerLine] |
754 | mov [es:0x9001], ax |
754 | mov [es:BOOT_PITCH], ax |
755 | ; BPP |
755 | ; BPP |
756 | cmp [es:mi.BitsPerPixel], 16 |
756 | cmp [es:mi.BitsPerPixel], 16 |
757 | jne .l0 |
757 | jne .l0 |
758 | cmp [es:mi.GreenMaskSize], 5 |
758 | cmp [es:mi.GreenMaskSize], 5 |
759 | jne .l0 |
759 | jne .l0 |
760 | mov [es:mi.BitsPerPixel], 15 |
760 | mov [es:mi.BitsPerPixel], 15 |
761 | .l0: |
761 | .l0: |
762 | mov al, byte [es:di+0x19] |
762 | mov al, byte [es:di+0x19] |
763 | mov [es:0x9000], al |
763 | mov [es:BOOT_BPP], al |
764 | jmp .exit |
764 | jmp .exit |
765 | 765 | ||
766 | .mode0x12_0x13: |
766 | .mode0x12_0x13: |
767 | mov byte [es:0x9000], 32 |
767 | mov byte [es:BOOT_BPP], 32 |
768 | or dword [es:0x9018], 0xFFFFFFFF; 0x800000 |
768 | or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000 |
769 | 769 | ||
770 | 770 | ||
771 | ; VESA 1.2 PM BANK SWITCH ADDRESS |
771 | ; VESA 1.2 PM BANK SWITCH ADDRESS |
772 | 772 | ||
773 | ;.vesa12: |
773 | ;.vesa12: |
774 | ; mov ax, 0x4f0A |
774 | ; mov ax, 0x4f0A |
775 | ; xor bx, bx |
775 | ; xor bx, bx |
776 | ; int 0x10 |
776 | ; int 0x10 |
777 | ; xor eax, eax |
777 | ; xor eax, eax |
778 | ; xor ebx, ebx |
778 | ; xor ebx, ebx |
779 | ; mov ax, es |
779 | ; mov ax, es |
780 | ; shl eax, 4 |
780 | ; shl eax, 4 |
781 | ; mov bx, di |
781 | ; mov bx, di |
782 | ; add eax, ebx |
782 | ; add eax, ebx |
783 | ; movzx ebx, word[es:di] |
783 | ; movzx ebx, word[es:di] |
784 | ; add eax, ebx |
784 | ; add eax, ebx |
785 | ; push 0x0000 |
785 | ; push 0x0000 |
786 | ; pop es |
786 | ; pop es |
787 | ; mov [es:0x9014], eax |
787 | ; mov [es:0x9014], eax |
788 | .exit: |
788 | .exit: |
789 | ret |
789 | ret |
790 | - | ||
791 | - | ||
792 | ; mov dword[es:0x9018],0x000A0000 |
- | |
793 | ; ret |
- | |
794 | 790 | ||
795 | ;============================================================================= |
791 | ;============================================================================= |
796 | ;============================================================================= |
792 | ;============================================================================= |
797 | ;=============================================================================' |
793 | ;=============================================================================' |
798 | @@: |
794 | @@: |
799 | ><' |
795 | ><' |
800 | @@: |
796 | @@: |
801 | >' |
797 | >' |
802 | @@: |
798 | @@: |
803 | ><' |
799 | ><' |
804 | @@: |
800 | @@: |
805 | >' |
801 | >' |
806 | ><' |
802 | |
807 | > |
803 | |
- | 804 | ||
- | 805 | .next: |
|
- | 806 | ><' |
|
- | 807 | ||
- | 808 | ||
- | 809 | ||
- | 810 | .next: |
|
- | 811 | > |