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