Rev 476 | Rev 1168 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 476 | Rev 593 | ||
---|---|---|---|
1 | $Revision: 476 $ |
- | |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
2 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
5 | ;; ;; |
7 | ;; VGA.INC ;; |
6 | ;; VGA.INC ;; |
8 | ;; ;; |
7 | ;; ;; |
9 | ;; 640x480 mode 0x12 VGA functions for MenuetOS ;; |
8 | ;; 640x480 mode 0x12 VGA functions for MenuetOS ;; |
10 | ;; ;; |
9 | ;; ;; |
11 | ;; Paul Butcher, paul.butcher@asa.co.uk ;; |
10 | ;; Paul Butcher, paul.butcher@asa.co.uk ;; |
12 | ;; ;; |
11 | ;; ;; |
13 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
- | 13 | ||
14 | 14 | $Revision: 593 $ |
|
15 | 15 | ||
16 | 16 | ||
17 | paletteVGA: |
17 | paletteVGA: |
18 | 18 | ||
19 | ;16 colour palette |
19 | ;16 colour palette |
20 | mov dx,0x3c8 |
20 | mov dx,0x3c8 |
21 | mov al,0 |
21 | mov al,0 |
22 | out dx,al |
22 | out dx,al |
23 | 23 | ||
24 | mov ecx,16 |
24 | mov ecx,16 |
25 | mov dx,0x3c9 |
25 | mov dx,0x3c9 |
26 | xor eax,eax |
26 | xor eax,eax |
27 | 27 | ||
28 | palvganew: |
28 | palvganew: |
29 | 29 | ||
30 | mov al,0 |
30 | mov al,0 |
31 | test ah,4 |
31 | test ah,4 |
32 | jz palvgalbl1 |
32 | jz palvgalbl1 |
33 | add al,31 |
33 | add al,31 |
34 | test ah,8 |
34 | test ah,8 |
35 | jz palvgalbl1 |
35 | jz palvgalbl1 |
36 | add al,32 |
36 | add al,32 |
37 | palvgalbl1: |
37 | palvgalbl1: |
38 | out dx,al ; red 0,31 or 63 |
38 | out dx,al ; red 0,31 or 63 |
39 | mov al,0 |
39 | mov al,0 |
40 | test ah,2 |
40 | test ah,2 |
41 | jz palvgalbl2 |
41 | jz palvgalbl2 |
42 | add al,31 |
42 | add al,31 |
43 | test ah,8 |
43 | test ah,8 |
44 | jz palvgalbl2 |
44 | jz palvgalbl2 |
45 | add al,32 |
45 | add al,32 |
46 | palvgalbl2: |
46 | palvgalbl2: |
47 | out dx,al ; blue 0,31 or 63 |
47 | out dx,al ; blue 0,31 or 63 |
48 | mov al,0 |
48 | mov al,0 |
49 | test ah,1 |
49 | test ah,1 |
50 | jz palvgalbl3 |
50 | jz palvgalbl3 |
51 | add al,31 |
51 | add al,31 |
52 | test ah,8 |
52 | test ah,8 |
53 | jz palvgalbl3 |
53 | jz palvgalbl3 |
54 | add al,32 |
54 | add al,32 |
55 | palvgalbl3: |
55 | palvgalbl3: |
56 | out dx,al ; green 0,31 or 63 |
56 | out dx,al ; green 0,31 or 63 |
57 | add ah,1 |
57 | add ah,1 |
58 | loop palvganew |
58 | loop palvganew |
59 | ; mov dx, 3ceh |
59 | ; mov dx, 3ceh |
60 | ; mov ax, 0005h |
60 | ; mov ax, 0005h |
61 | ; out dx, ax |
61 | ; out dx, ax |
62 | ret |
62 | ret |
63 | 63 | ||
64 | palette320x200: |
64 | palette320x200: |
65 | 65 | ||
66 | mov edx,0x3c8 |
66 | mov edx,0x3c8 |
67 | xor eax, eax |
67 | xor eax, eax |
68 | out dx,al |
68 | out dx,al |
69 | mov ecx,256 |
69 | mov ecx,256 |
70 | mov edx,0x3c9 |
70 | mov edx,0x3c9 |
71 | xor eax,eax |
71 | xor eax,eax |
72 | 72 | ||
73 | palnew: |
73 | palnew: |
74 | mov al,0 |
74 | mov al,0 |
75 | test ah,64 |
75 | test ah,64 |
76 | jz pallbl1 |
76 | jz pallbl1 |
77 | add al,21 |
77 | add al,21 |
78 | pallbl1: |
78 | pallbl1: |
79 | test ah,128 |
79 | test ah,128 |
80 | jz pallbl2 |
80 | jz pallbl2 |
81 | add al,42 |
81 | add al,42 |
82 | pallbl2: |
82 | pallbl2: |
83 | out dx,al |
83 | out dx,al |
84 | mov al,0 |
84 | mov al,0 |
85 | test ah,8 |
85 | test ah,8 |
86 | jz pallbl3 |
86 | jz pallbl3 |
87 | add al,8 |
87 | add al,8 |
88 | pallbl3: |
88 | pallbl3: |
89 | test ah,16 |
89 | test ah,16 |
90 | jz pallbl4 |
90 | jz pallbl4 |
91 | add al,15 |
91 | add al,15 |
92 | pallbl4: |
92 | pallbl4: |
93 | test ah,32 |
93 | test ah,32 |
94 | jz pallbl5 |
94 | jz pallbl5 |
95 | add al,40 |
95 | add al,40 |
96 | pallbl5: |
96 | pallbl5: |
97 | out dx,al |
97 | out dx,al |
98 | mov al,0 |
98 | mov al,0 |
99 | test ah,1 |
99 | test ah,1 |
100 | jz pallbl6 |
100 | jz pallbl6 |
101 | add al,8 |
101 | add al,8 |
102 | pallbl6: |
102 | pallbl6: |
103 | test ah,2 |
103 | test ah,2 |
104 | jz pallbl7 |
104 | jz pallbl7 |
105 | add al,15 |
105 | add al,15 |
106 | pallbl7: |
106 | pallbl7: |
107 | test ah,4 |
107 | test ah,4 |
108 | jz pallbl8 |
108 | jz pallbl8 |
109 | add al,40 |
109 | add al,40 |
110 | pallbl8: |
110 | pallbl8: |
111 | out dx,al |
111 | out dx,al |
112 | add ah,1 |
112 | add ah,1 |
113 | loop palnew |
113 | loop palnew |
114 | 114 | ||
115 | ret |
115 | ret |
116 | 116 | ||
117 | uglobal |
117 | uglobal |
118 | novesachecksum dd 0x0 |
118 | novesachecksum dd 0x0 |
119 | EGA_counter db 0 |
119 | EGA_counter db 0 |
120 | VGA_drawing_screen db 0 |
120 | VGA_drawing_screen db 0 |
121 | VGA_8_pixels: |
121 | VGA_8_pixels: |
122 | rb 16 |
122 | rb 16 |
123 | temp: |
123 | temp: |
124 | .cx dd 0 |
124 | .cx dd 0 |
125 | endg |
125 | endg |
126 | 126 | ||
127 | checkVga_N13: |
127 | checkVga_N13: |
128 | 128 | ||
129 | cmp [SCR_MODE],dword 0x13 |
129 | cmp [SCR_MODE],dword 0x13 |
130 | jne @f |
130 | jne @f |
131 | 131 | ||
132 | ; cnvl: |
132 | ; cnvl: |
133 | pushad |
133 | pushad |
134 | cmp [EGA_counter],1 |
134 | cmp [EGA_counter],1 |
135 | je novesal |
135 | je novesal |
136 | mov ecx,[MOUSE_X] |
136 | mov ecx,[MOUSE_X] |
137 | cmp ecx,[novesachecksum] |
137 | cmp ecx,[novesachecksum] |
138 | jne novesal |
138 | jne novesal |
139 | popad |
139 | popad |
140 | @@: |
140 | @@: |
141 | ret |
141 | ret |
142 | 142 | ||
143 | novesal: |
143 | novesal: |
144 | mov [novesachecksum],ecx |
144 | mov [novesachecksum],ecx |
145 | mov ecx,0 |
145 | mov ecx,0 |
146 | movzx eax,word [MOUSE_Y] |
146 | movzx eax,word [MOUSE_Y] |
147 | cmp eax,100 |
147 | cmp eax,100 |
148 | jge m13l3 |
148 | jge m13l3 |
149 | mov eax,100 |
149 | mov eax,100 |
150 | m13l3: |
150 | m13l3: |
151 | cmp eax,480-100 |
151 | cmp eax,480-100 |
152 | jbe m13l4 |
152 | jbe m13l4 |
153 | mov eax,480-100 |
153 | mov eax,480-100 |
154 | m13l4: |
154 | m13l4: |
155 | sub eax,100 |
155 | sub eax,100 |
156 | imul eax,640*4 |
156 | imul eax,640*4 |
157 | add ecx,eax |
157 | add ecx,eax |
158 | movzx eax,word [MOUSE_X] |
158 | movzx eax,word [MOUSE_X] |
159 | cmp eax,160 |
159 | cmp eax,160 |
160 | jge m13l1 |
160 | jge m13l1 |
161 | mov eax,160 |
161 | mov eax,160 |
162 | m13l1: |
162 | m13l1: |
163 | cmp eax,640-160 |
163 | cmp eax,640-160 |
164 | jbe m13l2 |
164 | jbe m13l2 |
165 | mov eax,640-160 |
165 | mov eax,640-160 |
166 | m13l2: |
166 | m13l2: |
167 | sub eax,160 |
167 | sub eax,160 |
168 | shl eax,2 |
168 | shl eax,2 |
169 | add ecx,eax |
169 | add ecx,eax |
170 | mov esi,[LFBAddress] |
170 | mov esi,[LFBAddress] |
171 | add esi,ecx |
171 | add esi,ecx |
172 | mov edi,VGABasePtr |
172 | mov edi,VGABasePtr |
173 | mov edx,200 |
173 | mov edx,200 |
174 | mov ecx,320 |
174 | mov ecx,320 |
175 | cld |
175 | cld |
176 | m13pix: |
176 | m13pix: |
177 | lodsd |
177 | lodsd |
178 | cmp eax,0 |
178 | cmp eax,0 |
179 | je .save_pixel |
179 | je .save_pixel |
180 | push eax |
180 | push eax |
181 | mov ebx,eax |
181 | mov ebx,eax |
182 | and eax,(128+64+32) ; blue |
182 | and eax,(128+64+32) ; blue |
183 | shr eax,5 |
183 | shr eax,5 |
184 | and ebx,(128+64+32)*256 ; green |
184 | and ebx,(128+64+32)*256 ; green |
185 | shr ebx,8+2 |
185 | shr ebx,8+2 |
186 | add eax,ebx |
186 | add eax,ebx |
187 | pop ebx |
187 | pop ebx |
188 | and ebx,(128+64)*256*256 ; red |
188 | and ebx,(128+64)*256*256 ; red |
189 | shr ebx,8+8 |
189 | shr ebx,8+8 |
190 | add eax,ebx |
190 | add eax,ebx |
191 | .save_pixel: |
191 | .save_pixel: |
192 | stosb |
192 | stosb |
193 | loop m13pix |
193 | loop m13pix |
194 | mov ecx,320 |
194 | mov ecx,320 |
195 | add esi,4*(640-320) |
195 | add esi,4*(640-320) |
196 | dec edx |
196 | dec edx |
197 | jnz m13pix |
197 | jnz m13pix |
198 | mov [EGA_counter],0 |
198 | mov [EGA_counter],0 |
199 | popad |
199 | popad |
200 | ret |
200 | ret |
201 | 201 | ||
202 | VGA_drawbackground: |
202 | VGA_drawbackground: |
203 | ; draw all |
203 | ; draw all |
204 | cmp [SCR_MODE],dword 0x12 |
204 | cmp [SCR_MODE],dword 0x12 |
205 | jne .end |
205 | jne .end |
206 | pushad |
206 | pushad |
207 | mov esi,[LFBAddress] |
207 | mov esi,[LFBAddress] |
208 | mov edi,VGABasePtr |
208 | mov edi,VGABasePtr |
209 | mov ebx,640/32 ; 640*480/(8*4) |
209 | mov ebx,640/32 ; 640*480/(8*4) |
210 | mov edx,480 |
210 | mov edx,480 |
211 | @@: |
211 | @@: |
212 | push ebx edx esi edi |
212 | push ebx edx esi edi |
213 | shl edx,9 |
213 | shl edx,9 |
214 | lea edx,[edx+edx*4] |
214 | lea edx,[edx+edx*4] |
215 | add esi,edx |
215 | add esi,edx |
216 | shr edx,5 |
216 | shr edx,5 |
217 | add edi,edx |
217 | add edi,edx |
218 | call VGA_draw_long_line |
218 | call VGA_draw_long_line |
219 | pop edi esi edx ebx |
219 | pop edi esi edx ebx |
220 | dec edx |
220 | dec edx |
221 | jnz @r |
221 | jnz @r |
222 | call VGA_draw_long_line_1 |
222 | call VGA_draw_long_line_1 |
223 | popad |
223 | popad |
224 | .end: |
224 | .end: |
225 | ret |
225 | ret |
226 | 226 | ||
227 | VGA_draw_long_line: |
227 | VGA_draw_long_line: |
228 | mov dx,3ceh |
228 | mov dx,3ceh |
229 | mov ax,0ff08h |
229 | mov ax,0ff08h |
230 | cli |
230 | cli |
231 | out dx, ax |
231 | out dx, ax |
232 | mov ax,0005h |
232 | mov ax,0005h |
233 | out dx, ax |
233 | out dx, ax |
234 | m12pix: |
234 | m12pix: |
235 | call VGA_draw_32_pixels |
235 | call VGA_draw_32_pixels |
236 | dec ebx |
236 | dec ebx |
237 | jnz m12pix |
237 | jnz m12pix |
238 | mov dx,3c4h |
238 | mov dx,3c4h |
239 | mov ax,0ff02h |
239 | mov ax,0ff02h |
240 | out dx,ax |
240 | out dx,ax |
241 | mov dx,3ceh |
241 | mov dx,3ceh |
242 | mov ax,0205h |
242 | mov ax,0205h |
243 | out dx,ax |
243 | out dx,ax |
244 | mov dx,3ceh |
244 | mov dx,3ceh |
245 | mov al,08h |
245 | mov al,08h |
246 | out dx,al |
246 | out dx,al |
247 | sti |
247 | sti |
248 | ret |
248 | ret |
249 | 249 | ||
250 | VGA_draw_32_pixels: |
250 | VGA_draw_32_pixels: |
251 | xor eax,eax |
251 | xor eax,eax |
252 | mov ebp,VGA_8_pixels |
252 | mov ebp,VGA_8_pixels |
253 | mov [ebp],eax |
253 | mov [ebp],eax |
254 | mov [ebp+4],eax |
254 | mov [ebp+4],eax |
255 | mov [ebp+8],eax |
255 | mov [ebp+8],eax |
256 | mov [ebp+12],eax |
256 | mov [ebp+12],eax |
257 | mov ch,4 |
257 | mov ch,4 |
258 | .main_loop: |
258 | .main_loop: |
259 | mov cl,8 |
259 | mov cl,8 |
260 | .convert_pixels_to_VGA: |
260 | .convert_pixels_to_VGA: |
261 | lodsd ; eax = 24bit colour |
261 | lodsd ; eax = 24bit colour |
262 | cmp eax,0 |
262 | cmp eax,0 |
263 | je .end |
263 | je .end |
264 | rol eax,8 |
264 | rol eax,8 |
265 | mov al,ch |
265 | mov al,ch |
266 | ror eax,8 |
266 | ror eax,8 |
267 | mov ch,1 |
267 | mov ch,1 |
268 | dec cl |
268 | dec cl |
269 | shl ch,cl |
269 | shl ch,cl |
270 | cmp al,85 |
270 | cmp al,85 |
271 | jbe .p13green |
271 | jbe .p13green |
272 | or [ebp],ch |
272 | or [ebp],ch |
273 | cmp al,170 |
273 | cmp al,170 |
274 | jbe .p13green |
274 | jbe .p13green |
275 | or [ebp+12],ch |
275 | or [ebp+12],ch |
276 | .p13green: |
276 | .p13green: |
277 | cmp ah,85 |
277 | cmp ah,85 |
278 | jbe .p13red |
278 | jbe .p13red |
279 | or [ebp+4],ch |
279 | or [ebp+4],ch |
280 | cmp ah,170 |
280 | cmp ah,170 |
281 | jbe .p13red |
281 | jbe .p13red |
282 | or [ebp+12],ch |
282 | or [ebp+12],ch |
283 | .p13red: |
283 | .p13red: |
284 | shr eax,8 |
284 | shr eax,8 |
285 | cmp ah,85 |
285 | cmp ah,85 |
286 | jbe .p13cont |
286 | jbe .p13cont |
287 | or [ebp+8],ch |
287 | or [ebp+8],ch |
288 | cmp ah,170 |
288 | cmp ah,170 |
289 | jbe .p13cont |
289 | jbe .p13cont |
290 | or [ebp+12],ch |
290 | or [ebp+12],ch |
291 | .p13cont: |
291 | .p13cont: |
292 | ror eax,8 |
292 | ror eax,8 |
293 | mov ch,ah |
293 | mov ch,ah |
294 | inc cl |
294 | inc cl |
295 | .end: |
295 | .end: |
296 | dec cl |
296 | dec cl |
297 | jnz .convert_pixels_to_VGA |
297 | jnz .convert_pixels_to_VGA |
298 | inc ebp |
298 | inc ebp |
299 | dec ch |
299 | dec ch |
300 | jnz .main_loop |
300 | jnz .main_loop |
301 | push esi |
301 | push esi |
302 | sub ebp,4 |
302 | sub ebp,4 |
303 | mov esi,ebp |
303 | mov esi,ebp |
304 | mov dx, 3c4h |
304 | mov dx, 3c4h |
305 | mov ah, 1h |
305 | mov ah, 1h |
306 | @@: |
306 | @@: |
307 | mov al, 02h |
307 | mov al, 02h |
308 | out dx,ax |
308 | out dx,ax |
309 | xchg ax,bp |
309 | xchg ax,bp |
310 | lodsd |
310 | lodsd |
311 | mov [edi],eax |
311 | mov [edi],eax |
312 | xchg ax,bp |
312 | xchg ax,bp |
313 | shl ah, 1 |
313 | shl ah, 1 |
314 | cmp ah, 10h |
314 | cmp ah, 10h |
315 | jnz @r |
315 | jnz @r |
316 | add edi,4 |
316 | add edi,4 |
317 | pop esi |
317 | pop esi |
318 | ret |
318 | ret |
319 | 319 | ||
320 | VGA_putpixel: |
320 | VGA_putpixel: |
321 | ; eax = x |
321 | ; eax = x |
322 | ; ebx = y |
322 | ; ebx = y |
323 | mov ecx,eax |
323 | mov ecx,eax |
324 | mov eax, [esp+32-8+4] ; color |
324 | mov eax, [esp+32-8+4] ; color |
325 | shl ebx,9 |
325 | shl ebx,9 |
326 | lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
326 | lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
327 | lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) |
327 | lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) |
328 | mov edi,edx |
328 | mov edi,edx |
329 | add edi, [LFBAddress] ; + LFB address |
329 | add edi, [LFBAddress] ; + LFB address |
330 | mov [edi], eax ; write to LFB for Vesa2.0 |
330 | mov [edi], eax ; write to LFB for Vesa2.0 |
331 | shr edx,5 ; change BytesPerPixel to 1/8 |
331 | shr edx,5 ; change BytesPerPixel to 1/8 |
332 | mov edi,edx |
332 | mov edi,edx |
333 | add edi, VGABasePtr ; address of pixel in VGA area |
333 | add edi, VGABasePtr ; address of pixel in VGA area |
334 | and ecx,0x07 ; bit no. (modulo 8) |
334 | and ecx,0x07 ; bit no. (modulo 8) |
335 | pushfd |
335 | pushfd |
336 | ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) |
336 | ; edi = address, eax = 24bit colour, ecx = bit no. (modulo 8) |
337 | xor edx,edx |
337 | xor edx,edx |
338 | cmp eax,0 |
338 | cmp eax,0 |
339 | je .p13cont |
339 | je .p13cont |
340 | cmp al,85 |
340 | cmp al,85 |
341 | jbe .p13green |
341 | jbe .p13green |
342 | or dl,0x01 |
342 | or dl,0x01 |
343 | cmp al,170 |
343 | cmp al,170 |
344 | jbe .p13green |
344 | jbe .p13green |
345 | or dl,0x08 |
345 | or dl,0x08 |
346 | .p13green: |
346 | .p13green: |
347 | cmp ah,85 |
347 | cmp ah,85 |
348 | jbe .p13red |
348 | jbe .p13red |
349 | or dl,0x02 |
349 | or dl,0x02 |
350 | cmp ah,170 |
350 | cmp ah,170 |
351 | jbe .p13red |
351 | jbe .p13red |
352 | or dl,0x08 |
352 | or dl,0x08 |
353 | .p13red: |
353 | .p13red: |
354 | shr eax,8 |
354 | shr eax,8 |
355 | cmp ah,85 |
355 | cmp ah,85 |
356 | jbe .p13cont |
356 | jbe .p13cont |
357 | or dl,0x04 |
357 | or dl,0x04 |
358 | cmp ah,170 |
358 | cmp ah,170 |
359 | jbe .p13cont |
359 | jbe .p13cont |
360 | or dl,0x08 |
360 | or dl,0x08 |
361 | .p13cont: |
361 | .p13cont: |
362 | ror edx,8 |
362 | ror edx,8 |
363 | inc cl |
363 | inc cl |
364 | xor eax,eax |
364 | xor eax,eax |
365 | inc ah |
365 | inc ah |
366 | shr ax,cl |
366 | shr ax,cl |
367 | mov dx,3cfh |
367 | mov dx,3cfh |
368 | cli |
368 | cli |
369 | out dx,al |
369 | out dx,al |
370 | mov al,[edi] ; dummy read |
370 | mov al,[edi] ; dummy read |
371 | rol edx,8 |
371 | rol edx,8 |
372 | mov [edi],dl |
372 | mov [edi],dl |
373 | popfd |
373 | popfd |
374 | ;.end: |
374 | ;.end: |
375 | ret |
375 | ret |
376 | 376 | ||
377 | VGA__putimage: |
377 | VGA__putimage: |
378 | ; ecx = size [x|y] |
378 | ; ecx = size [x|y] |
379 | ; edx = coordinates [x|y] |
379 | ; edx = coordinates [x|y] |
380 | cmp [SCR_MODE],dword 0x12 |
380 | cmp [SCR_MODE],dword 0x12 |
381 | jne @f |
381 | jne @f |
382 | pushad |
382 | pushad |
383 | rol edx,16 |
383 | rol edx,16 |
384 | movzx eax,dx |
384 | movzx eax,dx |
385 | rol edx,16 |
385 | rol edx,16 |
386 | movzx ebx,dx |
386 | movzx ebx,dx |
387 | movzx edx,cx |
387 | movzx edx,cx |
388 | rol ecx,16 |
388 | rol ecx,16 |
389 | movzx ecx,cx |
389 | movzx ecx,cx |
390 | call VGA_draw_bar_1 |
390 | call VGA_draw_bar_1 |
391 | popad |
391 | popad |
392 | @@: |
392 | @@: |
393 | ret |
393 | ret |
394 | 394 | ||
395 | VGA_draw_bar: |
395 | VGA_draw_bar: |
396 | ; eax cx |
396 | ; eax cx |
397 | ; ebx cy |
397 | ; ebx cy |
398 | ; ecx xe |
398 | ; ecx xe |
399 | ; edx ye |
399 | ; edx ye |
400 | cmp [SCR_MODE],dword 0x12 |
400 | cmp [SCR_MODE],dword 0x12 |
401 | jne @f |
401 | jne @f |
402 | pushad |
402 | pushad |
403 | sub ecx,eax |
403 | sub ecx,eax |
404 | sub edx,ebx |
404 | sub edx,ebx |
405 | and eax,0xffff |
405 | and eax,0xffff |
406 | and ebx,0xffff |
406 | and ebx,0xffff |
407 | and ecx,0xffff |
407 | and ecx,0xffff |
408 | and edx,0xffff |
408 | and edx,0xffff |
409 | call VGA_draw_bar_1 |
409 | call VGA_draw_bar_1 |
410 | popad |
410 | popad |
411 | @@: |
411 | @@: |
412 | ret |
412 | ret |
413 | 413 | ||
414 | VGA_draw_bar_1: |
414 | VGA_draw_bar_1: |
415 | mov [temp.cx],eax |
415 | mov [temp.cx],eax |
416 | mov eax, [TASK_BASE] |
416 | mov eax, [TASK_BASE] |
417 | add ebx, [eax-twdw + 4] |
417 | add ebx, [eax-twdw + 4] |
418 | mov eax, [eax-twdw + 0] |
418 | mov eax, [eax-twdw + 0] |
419 | add eax, [temp.cx] |
419 | add eax, [temp.cx] |
420 | and eax,0xfff8 |
420 | and eax,0xfff8 |
421 | shl ebx,9 |
421 | shl ebx,9 |
422 | lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
422 | lea ebx,[ebx+ebx*4] ; óìíîæåíèå íà 5 |
423 | lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) |
423 | lea ebx, [ebx+eax*4] ; + x*BytesPerPixel (Vesa2.0 32) |
424 | mov esi,ebx |
424 | mov esi,ebx |
425 | add esi, [LFBAddress] ; + LFB address |
425 | add esi, [LFBAddress] ; + LFB address |
426 | shr ebx,5 ; change BytesPerPixel to 1/8 |
426 | shr ebx,5 ; change BytesPerPixel to 1/8 |
427 | mov edi,ebx |
427 | mov edi,ebx |
428 | add edi, VGABasePtr ; address of pixel in VGA area |
428 | add edi, VGABasePtr ; address of pixel in VGA area |
429 | mov ebx,ecx |
429 | mov ebx,ecx |
430 | shr ebx,5 |
430 | shr ebx,5 |
431 | inc ebx |
431 | inc ebx |
432 | .main_loop: |
432 | .main_loop: |
433 | call VGA_draw_long_line_1 |
433 | call VGA_draw_long_line_1 |
434 | dec edx |
434 | dec edx |
435 | jnz .main_loop |
435 | jnz .main_loop |
436 | call VGA_draw_long_line_1 |
436 | call VGA_draw_long_line_1 |
437 | ret |
437 | ret |
438 | 438 | ||
439 | VGA_draw_long_line_1: |
439 | VGA_draw_long_line_1: |
440 | push ebx edx esi edi |
440 | push ebx edx esi edi |
441 | shl edx,9 |
441 | shl edx,9 |
442 | lea edx,[edx+edx*4] |
442 | lea edx,[edx+edx*4] |
443 | add esi,edx |
443 | add esi,edx |
444 | shr edx,5 |
444 | shr edx,5 |
445 | add edi,edx |
445 | add edi,edx |
446 | call VGA_draw_long_line |
446 | call VGA_draw_long_line |
447 | pop edi esi edx ebx |
447 | pop edi esi edx ebx |
448 | ret |
448 | ret |