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