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