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