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