Rev 117 | Rev 205 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 117 | Rev 133 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; VESA20.INC ;; |
3 | ;; VESA20.INC ;; |
4 | ;; ;; |
4 | ;; ;; |
5 | ;; Vesa 2.0 functions for MenuetOS ;; |
5 | ;; Vesa 2.0 functions for MenuetOS ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;; Copyright 2002 Ville Turjanmaa ;; |
7 | ;; Copyright 2002 Ville Turjanmaa ;; |
8 | ;; Alexey, kgaz@crosswindws.net ;; |
8 | ;; Alexey, kgaz@crosswindws.net ;; |
9 | ;; - Voodoo compatible graphics ;; |
9 | ;; - Voodoo compatible graphics ;; |
10 | ;; Juan M. Caravaca ;; |
10 | ;; Juan M. Caravaca ;; |
11 | ;; - Graphics optimimizations eg. drawline ;; |
11 | ;; - Graphics optimimizations eg. drawline ;; |
12 | ;; ;; |
12 | ;; ;; |
13 | ;; See file COPYING for details ;; |
13 | ;; See file COPYING for details ;; |
14 | ;; ;; |
14 | ;; ;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
16 | 16 | ||
17 | ; If you're planning to write your own video driver I suggest |
17 | ; If you're planning to write your own video driver I suggest |
18 | ; you replace the VESA12.INC file and see those instructions. |
18 | ; you replace the VESA12.INC file and see those instructions. |
19 | 19 | ||
20 | ScreenWidth equ 0xfe00 |
20 | ScreenWidth equ 0xfe00 |
21 | ScreenHeight equ 0xfe04 |
21 | ScreenHeight equ 0xfe04 |
22 | BytesPerScanLine equ 0xfe08 |
22 | BytesPerScanLine equ 0xfe08 |
23 | LFBAddress equ 0xfe80 |
23 | LFBAddress equ 0xfe80 |
24 | ScreenBPP equ 0xfbf1 |
24 | ScreenBPP equ 0xfbf1 |
25 | WinMapAddress equ 0x460000 |
25 | WinMapAddress equ 0x460000 |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | ;************************************************* |
29 | ;************************************************* |
30 | ; getpixel |
30 | ; getpixel |
31 | ; |
31 | ; |
32 | ; in: |
32 | ; in: |
33 | ; eax = x coordinate |
33 | ; eax = x coordinate |
34 | ; ebx = y coordinate |
34 | ; ebx = y coordinate |
35 | ; |
35 | ; |
36 | ; ret: |
36 | ; ret: |
37 | ; ecx = 00 RR GG BB |
37 | ; ecx = 00 RR GG BB |
38 | 38 | ||
39 | getpixel: |
39 | getpixel: |
40 | push eax ebx edx edi |
40 | push eax ebx edx edi |
41 | call dword [0xe024] |
41 | call dword [0xe024] |
42 | pop edi edx ebx eax |
42 | pop edi edx ebx eax |
43 | ret |
43 | ret |
44 | 44 | ||
45 | Vesa20_getpixel24: |
45 | Vesa20_getpixel24: |
46 | ; eax = x |
46 | ; eax = x |
47 | ; ebx = y |
47 | ; ebx = y |
48 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
48 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
49 | lea edi, [eax+eax*2] ; edi = x*3 |
49 | lea edi, [eax+eax*2] ; edi = x*3 |
50 | add edi, ebx ; edi = x*3+(y*y multiplier) |
50 | add edi, ebx ; edi = x*3+(y*y multiplier) |
51 | add edi, [LFBAddress] ; ebx = where pixel is in memory |
51 | add edi, [LFBAddress] ; ebx = where pixel is in memory |
52 | mov ecx, [edi] |
52 | mov ecx, [edi] |
53 | and ecx, 0xffffff |
53 | and ecx, 0xffffff |
54 | ret |
54 | ret |
55 | 55 | ||
56 | 56 | ||
57 | Vesa20_getpixel32: |
57 | Vesa20_getpixel32: |
58 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
58 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
59 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
59 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
60 | add edi, [LFBAddress] ; ebx = where pixel is in memory |
60 | add edi, [LFBAddress] ; ebx = where pixel is in memory |
61 | mov ecx, [edi] |
61 | mov ecx, [edi] |
62 | and ecx, 0xffffff |
62 | and ecx, 0xffffff |
63 | ret |
63 | ret |
64 | 64 | ||
65 | ;************************************************* |
65 | ;************************************************* |
66 | 66 | ||
67 | virtual at esp |
67 | virtual at esp |
68 | putimg: |
68 | putimg: |
69 | .real_sx dd ? |
69 | .real_sx dd ? |
70 | .real_sy dd ? |
70 | .real_sy dd ? |
71 | .image_sx dd ? |
71 | .image_sx dd ? |
72 | .image_sy dd ? |
72 | .image_sy dd ? |
73 | .image_cx dd ? |
73 | .image_cx dd ? |
74 | .image_cy dd ? |
74 | .image_cy dd ? |
75 | .pti dd ? |
75 | .pti dd ? |
76 | .abs_cx dd ? |
76 | .abs_cx dd ? |
77 | .abs_cy dd ? |
77 | .abs_cy dd ? |
78 | .line_increment dd ? |
78 | .line_increment dd ? |
79 | .source_bpp dd ? |
79 | .source_bpp dd ? |
80 | .winmap_newline dd ? |
80 | .winmap_newline dd ? |
81 | .screen_newline dd ? |
81 | .screen_newline dd ? |
82 | .stack_data = 4*13 |
82 | .stack_data = 4*13 |
83 | end virtual |
83 | end virtual |
84 | 84 | ||
85 | align 4 |
85 | align 4 |
86 | ; ebx = pointer |
86 | ; ebx = pointer |
87 | ; ecx = size [x|y] |
87 | ; ecx = size [x|y] |
88 | ; edx = coordinates [x|y] |
88 | ; edx = coordinates [x|y] |
89 | vesa20_putimage: |
89 | vesa20_putimage: |
90 | pushad |
90 | pushad |
91 | call [disable_mouse] |
91 | call [disable_mouse] |
92 | 92 | ||
93 | sub esp, putimg.stack_data |
93 | sub esp, putimg.stack_data |
94 | 94 | ||
95 | mov [putimg.source_bpp], 3 |
95 | mov [putimg.source_bpp], 3 |
96 | ; test ebx, 0x80000000 |
96 | ; test ebx, 0x80000000 |
97 | ; jz @f |
97 | ; jz @f |
98 | ; inc [putimg.source_bpp] |
98 | ; inc [putimg.source_bpp] |
99 | ; @@: |
99 | ; @@: |
100 | ; and ebx, 0x7FFFFFFF |
100 | ; and ebx, 0x7FFFFFFF |
101 | 101 | ||
102 | ; save pointer to image |
102 | ; save pointer to image |
103 | mov [putimg.pti], ebx |
103 | mov [putimg.pti], ebx |
104 | 104 | ||
105 | ; unpack the size |
105 | ; unpack the size |
106 | mov eax, ecx |
106 | mov eax, ecx |
107 | and ecx, 0xFFFF |
107 | and ecx, 0xFFFF |
108 | shr eax, 16 |
108 | shr eax, 16 |
109 | mov [putimg.image_sx], eax |
109 | mov [putimg.image_sx], eax |
110 | mov [putimg.image_sy], ecx |
110 | mov [putimg.image_sy], ecx |
111 | 111 | ||
112 | ; unpack the coordinates |
112 | ; unpack the coordinates |
113 | mov eax, edx |
113 | mov eax, edx |
114 | and edx, 0xFFFF |
114 | and edx, 0xFFFF |
115 | shr eax, 16 |
115 | shr eax, 16 |
116 | mov [putimg.image_cx], eax |
116 | mov [putimg.image_cx], eax |
117 | mov [putimg.image_cy], edx |
117 | mov [putimg.image_cy], edx |
118 | 118 | ||
119 | ; calculate absolute (i.e. screen) coordinates |
119 | ; calculate absolute (i.e. screen) coordinates |
120 | mov eax, [0x3010] |
120 | mov eax, [0x3010] |
121 | mov ebx, [eax-twdw + WDATA.box.left] |
121 | mov ebx, [eax-twdw + WDATA.box.left] |
122 | add ebx, [putimg.image_cx] |
122 | add ebx, [putimg.image_cx] |
123 | mov [putimg.abs_cx], ebx |
123 | mov [putimg.abs_cx], ebx |
124 | mov ebx, [eax-twdw + WDATA.box.top] |
124 | mov ebx, [eax-twdw + WDATA.box.top] |
125 | add ebx, [putimg.image_cy] |
125 | add ebx, [putimg.image_cy] |
126 | mov [putimg.abs_cy], ebx |
126 | mov [putimg.abs_cy], ebx |
127 | 127 | ||
128 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
128 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
129 | mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
129 | mov ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx |
- | 130 | ; \begin{diamond}[20.08.2006] |
|
- | 131 | ; note that WDATA.box.width is one pixel less than real window x-size |
|
- | 132 | inc ebx |
|
- | 133 | ; \end{diamond}[20.08.2006] |
|
130 | sub ebx, [putimg.image_cx] |
134 | sub ebx, [putimg.image_cx] |
131 | ja @f |
135 | ja @f |
132 | add esp, putimg.stack_data |
136 | add esp, putimg.stack_data |
133 | popad |
137 | popad |
134 | ret |
138 | ret |
135 | @@: |
139 | @@: |
136 | cmp ebx, [putimg.image_sx] |
140 | cmp ebx, [putimg.image_sx] |
137 | jbe .end_x |
141 | jbe .end_x |
138 | mov ebx, [putimg.image_sx] |
142 | mov ebx, [putimg.image_sx] |
139 | dec ebx |
- | |
140 | .end_x: |
143 | .end_x: |
141 | inc ebx |
- | |
142 | mov [putimg.real_sx], ebx |
144 | mov [putimg.real_sx], ebx |
143 | 145 | ||
144 | ; init real_sy |
146 | ; init real_sy |
145 | mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
147 | mov ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy |
- | 148 | ; \begin{diamond}[20.08.2006] |
|
- | 149 | inc ebx |
|
- | 150 | ; \end{diamond}[20.08.2006] |
|
146 | sub ebx, [putimg.image_cy] |
151 | sub ebx, [putimg.image_cy] |
147 | ja @f |
152 | ja @f |
148 | add esp, putimg.stack_data |
153 | add esp, putimg.stack_data |
149 | popad |
154 | popad |
150 | ret |
155 | ret |
151 | @@: |
156 | @@: |
152 | cmp ebx, [putimg.image_sy] |
157 | cmp ebx, [putimg.image_sy] |
153 | jbe .end_y |
158 | jbe .end_y |
154 | mov ebx, [putimg.image_sy] |
159 | mov ebx, [putimg.image_sy] |
155 | dec ebx |
- | |
156 | .end_y: |
160 | .end_y: |
157 | inc ebx |
- | |
158 | mov [putimg.real_sy], ebx |
161 | mov [putimg.real_sy], ebx |
159 | 162 | ||
160 | ; line increment |
163 | ; line increment |
161 | mov eax, [putimg.image_sx] |
164 | mov eax, [putimg.image_sx] |
162 | sub eax, [putimg.real_sx] |
165 | sub eax, [putimg.real_sx] |
163 | ;; imul eax, [putimg.source_bpp] |
166 | ;; imul eax, [putimg.source_bpp] |
164 | lea eax, [eax + eax * 2] |
167 | lea eax, [eax + eax * 2] |
165 | mov [putimg.line_increment], eax |
168 | mov [putimg.line_increment], eax |
166 | 169 | ||
167 | ; winmap new line increment |
170 | ; winmap new line increment |
168 | mov eax, [ScreenWidth] |
171 | mov eax, [ScreenWidth] |
169 | inc eax |
172 | inc eax |
170 | sub eax, [putimg.real_sx] |
173 | sub eax, [putimg.real_sx] |
171 | mov [putimg.winmap_newline], eax |
174 | mov [putimg.winmap_newline], eax |
172 | 175 | ||
173 | ; screen new line increment |
176 | ; screen new line increment |
174 | mov eax, [BytesPerScanLine] |
177 | mov eax, [BytesPerScanLine] |
175 | mov ecx, [putimg.real_sx] |
178 | mov ecx, [putimg.real_sx] |
176 | movzx ebx, byte [ScreenBPP] |
179 | movzx ebx, byte [ScreenBPP] |
177 | shr ebx, 3 |
180 | shr ebx, 3 |
178 | imul ecx, ebx |
181 | imul ecx, ebx |
179 | sub eax, ecx |
182 | sub eax, ecx |
180 | mov [putimg.screen_newline], eax |
183 | mov [putimg.screen_newline], eax |
181 | 184 | ||
182 | ; pointer to image |
185 | ; pointer to image |
183 | mov ecx, [putimg.pti] |
186 | mov ecx, [putimg.pti] |
184 | 187 | ||
185 | ; pointer to screen |
188 | ; pointer to screen |
186 | mov edx, [putimg.abs_cy] |
189 | mov edx, [putimg.abs_cy] |
187 | imul edx, [BytesPerScanLine] |
190 | imul edx, [BytesPerScanLine] |
188 | mov eax, [putimg.abs_cx] |
191 | mov eax, [putimg.abs_cx] |
189 | movzx ebx, byte [ScreenBPP] |
192 | movzx ebx, byte [ScreenBPP] |
190 | shr ebx, 3 |
193 | shr ebx, 3 |
191 | imul eax, ebx |
194 | imul eax, ebx |
192 | add edx, eax |
195 | add edx, eax |
193 | add edx, [LFBAddress] |
196 | add edx, [LFBAddress] |
194 | 197 | ||
195 | ; pointer to pixel map |
198 | ; pointer to pixel map |
196 | mov eax, [putimg.abs_cy] |
199 | mov eax, [putimg.abs_cy] |
197 | imul eax, [ScreenWidth] |
200 | imul eax, [ScreenWidth] |
198 | add eax, [putimg.abs_cy] |
201 | add eax, [putimg.abs_cy] |
199 | add eax, [putimg.abs_cx] |
202 | add eax, [putimg.abs_cx] |
200 | add eax, WinMapAddress |
203 | add eax, WinMapAddress |
201 | xchg eax, ebp |
204 | xchg eax, ebp |
202 | 205 | ||
203 | ; get process number |
206 | ; get process number |
204 | mov ebx, [0x3000] |
207 | mov ebx, [0x3000] |
205 | 208 | ||
206 | cmp byte [ScreenBPP], 32 |
209 | cmp byte [ScreenBPP], 32 |
207 | je put_image_end_32 |
210 | je put_image_end_32 |
208 | 211 | ||
209 | ;put_image_end_24: |
212 | ;put_image_end_24: |
210 | mov edi, [putimg.real_sy] |
213 | mov edi, [putimg.real_sy] |
211 | align 4 |
214 | align 4 |
212 | .new_line: |
215 | .new_line: |
213 | mov esi, [putimg.real_sx] |
216 | mov esi, [putimg.real_sx] |
214 | 217 | ||
215 | ; push ebp edx |
218 | ; push ebp edx |
216 | align 4 |
219 | align 4 |
217 | .new_x: |
220 | .new_x: |
218 | 221 | ||
219 | cmp [ebp], bl |
222 | cmp [ebp], bl |
220 | jne .skip |
223 | jne .skip |
221 | mov eax, [ecx] ; ecx = RRBBGGRR |
224 | mov eax, [ecx] ; ecx = RRBBGGRR |
222 | mov [edx], ax |
225 | mov [edx], ax |
223 | shr eax, 16 |
226 | shr eax, 16 |
224 | mov [edx+2], al |
227 | mov [edx+2], al |
225 | .skip: |
228 | .skip: |
226 | 229 | ||
227 | add ecx, 3 ;[putimg.source_bpp] |
230 | add ecx, 3 ;[putimg.source_bpp] |
228 | add edx, 3 |
231 | add edx, 3 |
229 | inc ebp |
232 | inc ebp |
230 | 233 | ||
231 | dec esi |
234 | dec esi |
232 | jnz .new_x |
235 | jnz .new_x |
233 | ; pop edx ebp |
236 | ; pop edx ebp |
234 | 237 | ||
235 | add ecx, [putimg.line_increment] |
238 | add ecx, [putimg.line_increment] |
236 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
239 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
237 | add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
240 | add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
238 | ;inc ebp |
241 | ;inc ebp |
239 | 242 | ||
240 | dec edi |
243 | dec edi |
241 | jnz .new_line |
244 | jnz .new_line |
242 | .finish: |
245 | .finish: |
243 | add esp, putimg.stack_data |
246 | add esp, putimg.stack_data |
244 | popad |
247 | popad |
245 | ret |
248 | ret |
246 | 249 | ||
247 | put_image_end_32: |
250 | put_image_end_32: |
248 | mov edi, [putimg.real_sy] |
251 | mov edi, [putimg.real_sy] |
249 | align 4 |
252 | align 4 |
250 | .new_line: |
253 | .new_line: |
251 | mov esi, [putimg.real_sx] |
254 | mov esi, [putimg.real_sx] |
252 | 255 | ||
253 | ; push ebp edx |
256 | ; push ebp edx |
254 | align 4 |
257 | align 4 |
255 | .new_x: |
258 | .new_x: |
256 | 259 | ||
257 | cmp [ebp], bl |
260 | cmp [ebp], bl |
258 | jne .skip |
261 | jne .skip |
259 | mov eax, [ecx] ; ecx = RRBBGGRR |
262 | mov eax, [ecx] ; ecx = RRBBGGRR |
260 | mov [edx], eax |
263 | mov [edx], eax |
261 | .skip: |
264 | .skip: |
262 | 265 | ||
263 | add ecx, [putimg.source_bpp] |
266 | add ecx, [putimg.source_bpp] |
264 | add edx, 4 |
267 | add edx, 4 |
265 | inc ebp |
268 | inc ebp |
266 | 269 | ||
267 | dec esi |
270 | dec esi |
268 | jnz .new_x |
271 | jnz .new_x |
269 | ; pop edx ebp |
272 | ; pop edx ebp |
270 | 273 | ||
271 | add ecx, [putimg.line_increment] |
274 | add ecx, [putimg.line_increment] |
272 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
275 | add edx, [putimg.screen_newline] ;[BytesPerScanLine] |
273 | add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
276 | add ebp, [putimg.winmap_newline] ;[ScreenWidth] |
274 | ;inc ebp |
277 | ;inc ebp |
275 | 278 | ||
276 | dec edi |
279 | dec edi |
277 | jnz .new_line |
280 | jnz .new_line |
278 | .finish: |
281 | .finish: |
279 | add esp, putimg.stack_data |
282 | add esp, putimg.stack_data |
280 | popad |
283 | popad |
281 | call VGA__putimage |
284 | call VGA__putimage |
282 | mov [EGA_counter],1 |
285 | mov [EGA_counter],1 |
283 | ret |
286 | ret |
284 | 287 | ||
285 | 288 | ||
286 | ;************************************************* |
289 | ;************************************************* |
287 | align 4 |
290 | align 4 |
288 | __sys_putpixel: |
291 | __sys_putpixel: |
289 | 292 | ||
290 | ; eax = x coordinate |
293 | ; eax = x coordinate |
291 | ; ebx = y coordinate |
294 | ; ebx = y coordinate |
292 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
295 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
293 | ; edi = 0x00000001 force |
296 | ; edi = 0x00000001 force |
294 | 297 | ||
295 | ;;; mov [novesachecksum], dword 0 |
298 | ;;; mov [novesachecksum], dword 0 |
296 | 299 | ||
297 | pushad |
300 | pushad |
298 | test edi,1 ; force ? |
301 | test edi,1 ; force ? |
299 | jnz .forced |
302 | jnz .forced |
300 | ; not forced: |
303 | ; not forced: |
301 | push ecx ; save 24th bit in case negative pixel wanted |
304 | push ecx ; save 24th bit in case negative pixel wanted |
302 | call checkpixel |
305 | call checkpixel |
303 | test ecx,ecx |
306 | test ecx,ecx |
304 | pop ecx |
307 | pop ecx |
305 | jnz .exit |
308 | jnz .exit |
306 | .forced: |
309 | .forced: |
307 | cmp [ScreenWidth], eax |
310 | cmp [ScreenWidth], eax |
308 | jb .exit |
311 | jb .exit |
309 | cmp [ScreenHeight], ebx |
312 | cmp [ScreenHeight], ebx |
310 | jb .exit |
313 | jb .exit |
311 | .ok: |
314 | .ok: |
312 | ; check if negation |
315 | ; check if negation |
313 | test ecx,0x01000000 |
316 | test ecx,0x01000000 |
314 | jz .noneg |
317 | jz .noneg |
315 | call getpixel |
318 | call getpixel |
316 | not ecx |
319 | not ecx |
317 | mov [esp+32-8],ecx |
320 | mov [esp+32-8],ecx |
318 | .noneg: |
321 | .noneg: |
319 | ; OK to set pixel |
322 | ; OK to set pixel |
320 | call dword [0xe020] ; call the real put_pixel function |
323 | call dword [0xe020] ; call the real put_pixel function |
321 | .exit: |
324 | .exit: |
322 | popad |
325 | popad |
323 | 326 | ||
324 | ret |
327 | ret |
325 | 328 | ||
326 | align 4 |
329 | align 4 |
327 | Vesa20_putpixel24: |
330 | Vesa20_putpixel24: |
328 | 331 | ||
329 | ; eax = x |
332 | ; eax = x |
330 | ; ebx = y |
333 | ; ebx = y |
331 | 334 | ||
332 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
335 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
333 | lea edi, [eax+eax*2] ; edi = x*3 |
336 | lea edi, [eax+eax*2] ; edi = x*3 |
334 | mov eax, [esp+32-8+4] |
337 | mov eax, [esp+32-8+4] |
335 | add edi, [LFBAddress] |
338 | add edi, [LFBAddress] |
336 | add edi, ebx ; ebx = where to put pixel in memory |
339 | add edi, ebx ; ebx = where to put pixel in memory |
337 | mov [edi], ax |
340 | mov [edi], ax |
338 | shr eax, 16 |
341 | shr eax, 16 |
339 | mov [edi+2], al |
342 | mov [edi+2], al |
340 | 343 | ||
341 | ret |
344 | ret |
342 | 345 | ||
343 | 346 | ||
344 | align 4 |
347 | align 4 |
345 | Vesa20_putpixel32: |
348 | Vesa20_putpixel32: |
346 | 349 | ||
347 | ; eax = x |
350 | ; eax = x |
348 | ; ebx = y |
351 | ; ebx = y |
349 | 352 | ||
350 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
353 | imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
351 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
354 | lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier) |
352 | mov eax, [esp+32-8+4] ; eax = color |
355 | mov eax, [esp+32-8+4] ; eax = color |
353 | add edi, [LFBAddress] ; ebx = where to put pixel in memory |
356 | add edi, [LFBAddress] ; ebx = where to put pixel in memory |
354 | mov [edi], eax |
357 | mov [edi], eax |
355 | 358 | ||
356 | ret |
359 | ret |
357 | 360 | ||
358 | 361 | ||
359 | ;************************************************* |
362 | ;************************************************* |
360 | 363 | ||
361 | ;align 4 |
364 | ;align 4 |
362 | calculate_edi: |
365 | calculate_edi: |
363 | mov edi, ebx |
366 | mov edi, ebx |
364 | imul edi, [ScreenWidth] |
367 | imul edi, [ScreenWidth] |
365 | add edi, ebx |
368 | add edi, ebx |
366 | add edi, eax |
369 | add edi, eax |
367 | ret |
370 | ret |
368 | 371 | ||
369 | ;************************************************* |
372 | ;************************************************* |
370 | 373 | ||
371 | ; DRAWLINE |
374 | ; DRAWLINE |
372 | 375 | ||
373 | align 4 |
376 | align 4 |
374 | __sys_draw_line: |
377 | __sys_draw_line: |
375 | ; inc [mouse_pause] |
378 | ; inc [mouse_pause] |
376 | call [disable_mouse] |
379 | call [disable_mouse] |
377 | 380 | ||
378 | ; draw a line |
381 | ; draw a line |
379 | ; eax = HIWORD = x1 |
382 | ; eax = HIWORD = x1 |
380 | ; LOWORD = x2 |
383 | ; LOWORD = x2 |
381 | ; ebx = HIWORD = y1 |
384 | ; ebx = HIWORD = y1 |
382 | ; LOWORD = y2 |
385 | ; LOWORD = y2 |
383 | ; ecx = color |
386 | ; ecx = color |
384 | ; edi = force ? |
387 | ; edi = force ? |
385 | pusha |
388 | pusha |
386 | 389 | ||
387 | dl_x1 equ esp+20 |
390 | dl_x1 equ esp+20 |
388 | dl_y1 equ esp+16 |
391 | dl_y1 equ esp+16 |
389 | dl_x2 equ esp+12 |
392 | dl_x2 equ esp+12 |
390 | dl_y2 equ esp+8 |
393 | dl_y2 equ esp+8 |
391 | dl_dx equ esp+4 |
394 | dl_dx equ esp+4 |
392 | dl_dy equ esp+0 |
395 | dl_dy equ esp+0 |
393 | 396 | ||
394 | xor edx, edx ; clear edx |
397 | xor edx, edx ; clear edx |
395 | xor esi, esi ; unpack arguments |
398 | xor esi, esi ; unpack arguments |
396 | xor ebp, ebp |
399 | xor ebp, ebp |
397 | mov si, ax ; esi = x2 |
400 | mov si, ax ; esi = x2 |
398 | mov bp, bx ; ebp = y2 |
401 | mov bp, bx ; ebp = y2 |
399 | shr eax, 16 ; eax = x1 |
402 | shr eax, 16 ; eax = x1 |
400 | shr ebx, 16 ; ebx = y1 |
403 | shr ebx, 16 ; ebx = y1 |
401 | 404 | ||
402 | push eax ; save x1 |
405 | push eax ; save x1 |
403 | push ebx ; save y1 |
406 | push ebx ; save y1 |
404 | push esi ; save x2 |
407 | push esi ; save x2 |
405 | push ebp ; save y2 |
408 | push ebp ; save y2 |
406 | 409 | ||
407 | ; checking x-axis... |
410 | ; checking x-axis... |
408 | sub esi, eax ; esi = x2-x1 |
411 | sub esi, eax ; esi = x2-x1 |
409 | push esi ; save y2-y1 |
412 | push esi ; save y2-y1 |
410 | jl .x2lx1 ; is x2 less than x1 ? |
413 | jl .x2lx1 ; is x2 less than x1 ? |
411 | jg .no_vline ; x1 > x2 ? |
414 | jg .no_vline ; x1 > x2 ? |
412 | mov edx, ebp ; else (if x1=x2) |
415 | mov edx, ebp ; else (if x1=x2) |
413 | call vline |
416 | call vline |
414 | push edx ; necessary to rightly restore stack frame at .exit |
417 | push edx ; necessary to rightly restore stack frame at .exit |
415 | jmp .exit |
418 | jmp .exit |
416 | .x2lx1: |
419 | .x2lx1: |
417 | neg esi ; get esi absolute value |
420 | neg esi ; get esi absolute value |
418 | .no_vline: |
421 | .no_vline: |
419 | 422 | ||
420 | ; checking y-axis... |
423 | ; checking y-axis... |
421 | sub ebp, ebx ; ebp = y2-y1 |
424 | sub ebp, ebx ; ebp = y2-y1 |
422 | push ebp ; save y2-y1 |
425 | push ebp ; save y2-y1 |
423 | jl .y2ly1 ; is y2 less than y1 ? |
426 | jl .y2ly1 ; is y2 less than y1 ? |
424 | jg .no_hline ; y1 > y2 ? |
427 | jg .no_hline ; y1 > y2 ? |
425 | mov edx, [dl_x2] ; else (if y1=y2) |
428 | mov edx, [dl_x2] ; else (if y1=y2) |
426 | call hline |
429 | call hline |
427 | jmp .exit |
430 | jmp .exit |
428 | .y2ly1: |
431 | .y2ly1: |
429 | neg ebp ; get ebp absolute value |
432 | neg ebp ; get ebp absolute value |
430 | .no_hline: |
433 | .no_hline: |
431 | 434 | ||
432 | 435 | ||
433 | cmp ebp, esi |
436 | cmp ebp, esi |
434 | jle .x_rules ; |y2-y1| < |x2-x1| ? |
437 | jle .x_rules ; |y2-y1| < |x2-x1| ? |
435 | 438 | ||
436 | cmp [dl_y2], ebx ; make sure y1 is at the begining |
439 | cmp [dl_y2], ebx ; make sure y1 is at the begining |
437 | jge .no_reverse1 |
440 | jge .no_reverse1 |
438 | 441 | ||
439 | neg dword [dl_dx] |
442 | neg dword [dl_dx] |
440 | mov edx, [dl_x2] |
443 | mov edx, [dl_x2] |
441 | mov [dl_x2], eax |
444 | mov [dl_x2], eax |
442 | mov [dl_x1], edx |
445 | mov [dl_x1], edx |
443 | mov edx, [dl_y2] |
446 | mov edx, [dl_y2] |
444 | mov [dl_y2], ebx |
447 | mov [dl_y2], ebx |
445 | mov [dl_y1], edx |
448 | mov [dl_y1], edx |
446 | 449 | ||
447 | .no_reverse1: |
450 | .no_reverse1: |
448 | 451 | ||
449 | mov eax, [dl_dx] |
452 | mov eax, [dl_dx] |
450 | cdq ; extend eax sing to edx |
453 | cdq ; extend eax sing to edx |
451 | shl eax, 16 ; using 16bit fix-point maths |
454 | shl eax, 16 ; using 16bit fix-point maths |
452 | idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
455 | idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
453 | mov edx, ebp ; edx = counter (number of pixels to draw) |
456 | mov edx, ebp ; edx = counter (number of pixels to draw) |
454 | mov ebp, 1 *65536 ; <<16 ; ebp = dy = 1.0 |
457 | mov ebp, 1 *65536 ; <<16 ; ebp = dy = 1.0 |
455 | mov esi, eax ; esi = dx |
458 | mov esi, eax ; esi = dx |
456 | 459 | ||
457 | jmp .y_rules |
460 | jmp .y_rules |
458 | .x_rules: |
461 | .x_rules: |
459 | 462 | ||
460 | cmp [dl_x2], eax ; make sure x1 is at the begining |
463 | cmp [dl_x2], eax ; make sure x1 is at the begining |
461 | jge .no_reverse2 |
464 | jge .no_reverse2 |
462 | 465 | ||
463 | neg dword [dl_dy] |
466 | neg dword [dl_dy] |
464 | mov edx, [dl_x2] |
467 | mov edx, [dl_x2] |
465 | mov [dl_x2], eax |
468 | mov [dl_x2], eax |
466 | mov [dl_x1], edx |
469 | mov [dl_x1], edx |
467 | mov edx, [dl_y2] |
470 | mov edx, [dl_y2] |
468 | mov [dl_y2], ebx |
471 | mov [dl_y2], ebx |
469 | mov [dl_y1], edx |
472 | mov [dl_y1], edx |
470 | 473 | ||
471 | .no_reverse2: |
474 | .no_reverse2: |
472 | 475 | ||
473 | xor edx, edx |
476 | xor edx, edx |
474 | mov eax, [dl_dy] |
477 | mov eax, [dl_dy] |
475 | cdq ; extend eax sing to edx |
478 | cdq ; extend eax sing to edx |
476 | shl eax, 16 ; using 16bit fix-point maths |
479 | shl eax, 16 ; using 16bit fix-point maths |
477 | idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
480 | idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
478 | mov edx, esi ; edx = counter (number of pixels to draw) |
481 | mov edx, esi ; edx = counter (number of pixels to draw) |
479 | mov esi, 1 *65536 ;<< 16 ; esi = dx = 1.0 |
482 | mov esi, 1 *65536 ;<< 16 ; esi = dx = 1.0 |
480 | mov ebp, eax ; ebp = dy |
483 | mov ebp, eax ; ebp = dy |
481 | 484 | ||
482 | .y_rules: |
485 | .y_rules: |
483 | 486 | ||
484 | mov eax, [dl_x1] |
487 | mov eax, [dl_x1] |
485 | mov ebx, [dl_y1] |
488 | mov ebx, [dl_y1] |
486 | shl eax, 16 |
489 | shl eax, 16 |
487 | shl ebx, 16 |
490 | shl ebx, 16 |
488 | 491 | ||
489 | align 4 |
492 | align 4 |
490 | 493 | ||
491 | .draw: |
494 | .draw: |
492 | push eax ebx |
495 | push eax ebx |
493 | shr eax, 16 |
496 | shr eax, 16 |
494 | shr ebx, 16 |
497 | shr ebx, 16 |
495 | call [putpixel] |
498 | call [putpixel] |
496 | pop ebx eax |
499 | pop ebx eax |
497 | 500 | ||
498 | add ebx, ebp ; y = y+dy |
501 | add ebx, ebp ; y = y+dy |
499 | add eax, esi ; x = x+dx |
502 | add eax, esi ; x = x+dx |
500 | 503 | ||
501 | dec edx |
504 | dec edx |
502 | jnz .draw |
505 | jnz .draw |
503 | 506 | ||
504 | ; force last drawn pixel to be at (x2,y2) |
507 | ; force last drawn pixel to be at (x2,y2) |
505 | mov eax, [dl_x2] |
508 | mov eax, [dl_x2] |
506 | mov ebx, [dl_y2] |
509 | mov ebx, [dl_y2] |
507 | call [putpixel] |
510 | call [putpixel] |
508 | .exit: |
511 | .exit: |
509 | add esp, 6*4 |
512 | add esp, 6*4 |
510 | popa |
513 | popa |
511 | ; dec [mouse_pause] |
514 | ; dec [mouse_pause] |
512 | call [draw_pointer] |
515 | call [draw_pointer] |
513 | ret |
516 | ret |
514 | 517 | ||
515 | 518 | ||
516 | hline: |
519 | hline: |
517 | ; draw an horizontal line |
520 | ; draw an horizontal line |
518 | ; eax = x1 |
521 | ; eax = x1 |
519 | ; edx = x2 |
522 | ; edx = x2 |
520 | ; ebx = y |
523 | ; ebx = y |
521 | ; ecx = color |
524 | ; ecx = color |
522 | ; edi = force ? |
525 | ; edi = force ? |
523 | push eax edx |
526 | push eax edx |
524 | 527 | ||
525 | cmp edx, eax ; make sure x2 is above x1 |
528 | cmp edx, eax ; make sure x2 is above x1 |
526 | jge @f |
529 | jge @f |
527 | xchg eax, edx |
530 | xchg eax, edx |
528 | align 4 |
531 | align 4 |
529 | @@: |
532 | @@: |
530 | call [putpixel] |
533 | call [putpixel] |
531 | inc eax |
534 | inc eax |
532 | cmp eax, edx |
535 | cmp eax, edx |
533 | jle @b |
536 | jle @b |
534 | 537 | ||
535 | pop edx eax |
538 | pop edx eax |
536 | ret |
539 | ret |
537 | 540 | ||
538 | 541 | ||
539 | vline: |
542 | vline: |
540 | ; draw a vertical line |
543 | ; draw a vertical line |
541 | ; eax = x |
544 | ; eax = x |
542 | ; ebx = y1 |
545 | ; ebx = y1 |
543 | ; edx = y2 |
546 | ; edx = y2 |
544 | ; ecx = color |
547 | ; ecx = color |
545 | ; edi = force ? |
548 | ; edi = force ? |
546 | push ebx edx |
549 | push ebx edx |
547 | 550 | ||
548 | cmp edx, ebx ; make sure y2 is above y1 |
551 | cmp edx, ebx ; make sure y2 is above y1 |
549 | jge @f |
552 | jge @f |
550 | xchg ebx, edx |
553 | xchg ebx, edx |
551 | align 4 |
554 | align 4 |
552 | @@: |
555 | @@: |
553 | call [putpixel] |
556 | call [putpixel] |
554 | inc ebx |
557 | inc ebx |
555 | cmp ebx, edx |
558 | cmp ebx, edx |
556 | jle @b |
559 | jle @b |
557 | 560 | ||
558 | pop edx ebx |
561 | pop edx ebx |
559 | ret |
562 | ret |
560 | 563 | ||
561 | 564 | ||
562 | ;************************************************* |
565 | ;************************************************* |
563 | 566 | ||
564 | 567 | ||
565 | virtual at esp |
568 | virtual at esp |
566 | drbar: |
569 | drbar: |
567 | .bar_sx dd ? |
570 | .bar_sx dd ? |
568 | .bar_sy dd ? |
571 | .bar_sy dd ? |
569 | .bar_cx dd ? |
572 | .bar_cx dd ? |
570 | .bar_cy dd ? |
573 | .bar_cy dd ? |
571 | .abs_cx dd ? |
574 | .abs_cx dd ? |
572 | .abs_cy dd ? |
575 | .abs_cy dd ? |
573 | .real_sx dd ? |
576 | .real_sx dd ? |
574 | .real_sy dd ? |
577 | .real_sy dd ? |
575 | .color dd ? |
578 | .color dd ? |
576 | .line_inc_scr dd ? |
579 | .line_inc_scr dd ? |
577 | .line_inc_map dd ? |
580 | .line_inc_map dd ? |
578 | .stack_data = 4*11 |
581 | .stack_data = 4*11 |
579 | end virtual |
582 | end virtual |
580 | 583 | ||
581 | align 4 |
584 | align 4 |
582 | ; eax cx |
585 | ; eax cx |
583 | ; ebx cy |
586 | ; ebx cy |
584 | ; ecx xe |
587 | ; ecx xe |
585 | ; edx ye |
588 | ; edx ye |
586 | ; edi color |
589 | ; edi color |
587 | vesa20_drawbar: |
590 | vesa20_drawbar: |
588 | 591 | ||
589 | pushad |
592 | pushad |
590 | call [disable_mouse] |
593 | call [disable_mouse] |
591 | 594 | ||
592 | sub esp, drbar.stack_data |
595 | sub esp, drbar.stack_data |
593 | 596 | ||
594 | mov [drbar.color], edi |
597 | mov [drbar.color], edi |
595 | 598 | ||
596 | sub edx, ebx |
599 | sub edx, ebx |
597 | jle .exit ;// mike.dld, 2005-01-29 |
600 | jle .exit ;// mike.dld, 2005-01-29 |
598 | sub ecx, eax |
601 | sub ecx, eax |
599 | jle .exit ;// mike.dld, 2005-01-29 |
602 | jle .exit ;// mike.dld, 2005-01-29 |
600 | mov [drbar.bar_sy], edx |
603 | mov [drbar.bar_sy], edx |
601 | mov [drbar.bar_sx], ecx |
604 | mov [drbar.bar_sx], ecx |
602 | 605 | ||
603 | mov [drbar.bar_cx], eax |
606 | mov [drbar.bar_cx], eax |
604 | mov [drbar.bar_cy], ebx |
607 | mov [drbar.bar_cy], ebx |
605 | 608 | ||
606 | mov edi, [0x3010] |
609 | mov edi, [0x3010] |
607 | add eax, [edi-twdw + WDATA.box.left] ; win_cx |
610 | add eax, [edi-twdw + WDATA.box.left] ; win_cx |
608 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
611 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
609 | mov [drbar.abs_cx], eax |
612 | mov [drbar.abs_cx], eax |
610 | mov [drbar.abs_cy], ebx |
613 | mov [drbar.abs_cy], ebx |
611 | 614 | ||
612 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
615 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
613 | mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
616 | mov ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx |
- | 617 | ; \begin{diamond}[20.08.2006] |
|
- | 618 | ; note that WDATA.box.width is one pixel less than real window x-size |
|
- | 619 | inc ebx |
|
- | 620 | ; \end{diamond}[20.08.2006] |
|
614 | sub ebx, [drbar.bar_cx] |
621 | sub ebx, [drbar.bar_cx] |
615 | ja @f |
622 | ja @f |
616 | .exit: ;// mike.dld, 2005-01-29 |
623 | .exit: ;// mike.dld, 2005-01-29 |
617 | add esp, drbar.stack_data |
624 | add esp, drbar.stack_data |
618 | popad |
625 | popad |
619 | xor eax, eax |
626 | xor eax, eax |
620 | inc eax |
627 | inc eax |
621 | 628 | ||
622 | ret |
629 | ret |
623 | @@: |
630 | @@: |
624 | cmp ebx, [drbar.bar_sx] |
631 | cmp ebx, [drbar.bar_sx] |
625 | jbe .end_x |
632 | jbe .end_x |
626 | mov ebx, [drbar.bar_sx] |
633 | mov ebx, [drbar.bar_sx] |
627 | .end_x: |
634 | .end_x: |
628 | mov [drbar.real_sx], ebx |
635 | mov [drbar.real_sx], ebx |
629 | 636 | ||
630 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
637 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
631 | mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
638 | mov ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy |
- | 639 | ; \begin{diamond}[20.08.2006] |
|
- | 640 | inc ebx |
|
- | 641 | ; \end{diamond} |
|
632 | sub ebx, [drbar.bar_cy] |
642 | sub ebx, [drbar.bar_cy] |
633 | ja @f |
643 | ja @f |
634 | add esp, drbar.stack_data |
644 | add esp, drbar.stack_data |
635 | popad |
645 | popad |
636 | xor eax, eax |
646 | xor eax, eax |
637 | inc eax |
647 | inc eax |
638 | 648 | ||
639 | ret |
649 | ret |
640 | @@: |
650 | @@: |
641 | cmp ebx, [drbar.bar_sy] |
651 | cmp ebx, [drbar.bar_sy] |
642 | jbe .end_y |
652 | jbe .end_y |
643 | mov ebx, [drbar.bar_sy] |
653 | mov ebx, [drbar.bar_sy] |
644 | .end_y: |
654 | .end_y: |
645 | mov [drbar.real_sy], ebx |
655 | mov [drbar.real_sy], ebx |
646 | 656 | ||
647 | ; line_inc_map |
657 | ; line_inc_map |
648 | mov eax, [ScreenWidth] |
658 | mov eax, [ScreenWidth] |
649 | sub eax, [drbar.real_sx] |
659 | sub eax, [drbar.real_sx] |
650 | inc eax |
660 | inc eax |
651 | mov [drbar.line_inc_map], eax |
661 | mov [drbar.line_inc_map], eax |
652 | 662 | ||
653 | ; line_inc_scr |
663 | ; line_inc_scr |
654 | mov eax, [drbar.real_sx] |
664 | mov eax, [drbar.real_sx] |
655 | movzx ebx, byte [ScreenBPP] |
665 | movzx ebx, byte [ScreenBPP] |
656 | shr ebx, 3 |
666 | shr ebx, 3 |
657 | imul eax, ebx |
667 | imul eax, ebx |
658 | neg eax |
668 | neg eax |
659 | add eax, [BytesPerScanLine] |
669 | add eax, [BytesPerScanLine] |
660 | mov [drbar.line_inc_scr], eax |
670 | mov [drbar.line_inc_scr], eax |
661 | 671 | ||
662 | ; pointer to screen |
672 | ; pointer to screen |
663 | mov edx, [drbar.abs_cy] |
673 | mov edx, [drbar.abs_cy] |
664 | imul edx, [BytesPerScanLine] |
674 | imul edx, [BytesPerScanLine] |
665 | mov eax, [drbar.abs_cx] |
675 | mov eax, [drbar.abs_cx] |
666 | ; movzx ebx, byte [ScreenBPP] |
676 | ; movzx ebx, byte [ScreenBPP] |
667 | ; shr ebx, 3 |
677 | ; shr ebx, 3 |
668 | imul eax, ebx |
678 | imul eax, ebx |
669 | add edx, eax |
679 | add edx, eax |
670 | add edx, [LFBAddress] |
680 | add edx, [LFBAddress] |
671 | 681 | ||
672 | ; pointer to pixel map |
682 | ; pointer to pixel map |
673 | mov eax, [drbar.abs_cy] |
683 | mov eax, [drbar.abs_cy] |
674 | imul eax, [ScreenWidth] |
684 | imul eax, [ScreenWidth] |
675 | add eax, [drbar.abs_cy] |
685 | add eax, [drbar.abs_cy] |
676 | add eax, [drbar.abs_cx] |
686 | add eax, [drbar.abs_cx] |
677 | add eax, WinMapAddress |
687 | add eax, WinMapAddress |
678 | xchg eax, ebp |
688 | xchg eax, ebp |
679 | 689 | ||
680 | ; get process number |
690 | ; get process number |
681 | mov ebx, [0x3000] |
691 | mov ebx, [0x3000] |
682 | 692 | ||
683 | cmp byte [ScreenBPP], 24 |
693 | cmp byte [ScreenBPP], 24 |
684 | jne draw_bar_end_32 |
694 | jne draw_bar_end_32 |
685 | draw_bar_end_24: |
695 | draw_bar_end_24: |
686 | mov eax, [drbar.color] ;; BBGGRR00 |
696 | mov eax, [drbar.color] ;; BBGGRR00 |
687 | mov bh, al ;; bh = BB |
697 | mov bh, al ;; bh = BB |
688 | shr eax, 8 ;; eax = RRGG |
698 | shr eax, 8 ;; eax = RRGG |
689 | ; eax - color high RRGG |
699 | ; eax - color high RRGG |
690 | ; bl - process num |
700 | ; bl - process num |
691 | ; bh - color low BB |
701 | ; bh - color low BB |
692 | ; ecx - temp |
702 | ; ecx - temp |
693 | ; edx - pointer to screen |
703 | ; edx - pointer to screen |
694 | ; esi - counter |
704 | ; esi - counter |
695 | ; edi - counter |
705 | ; edi - counter |
696 | 706 | ||
697 | mov esi, [drbar.real_sy] |
707 | mov esi, [drbar.real_sy] |
698 | align 4 |
708 | align 4 |
699 | .new_y: |
709 | .new_y: |
700 | mov edi, [drbar.real_sx] |
710 | mov edi, [drbar.real_sx] |
701 | align 4 |
711 | align 4 |
702 | .new_x: |
712 | .new_x: |
703 | 713 | ||
704 | cmp byte [ebp], bl |
714 | cmp byte [ebp], bl |
705 | jne .skip |
715 | jne .skip |
706 | mov [edx], bh |
716 | mov [edx], bh |
707 | mov [edx + 1], ax |
717 | mov [edx + 1], ax |
708 | .skip: |
718 | .skip: |
709 | 719 | ||
710 | ; add pixel |
720 | ; add pixel |
711 | add edx, 3 |
721 | add edx, 3 |
712 | inc ebp |
722 | inc ebp |
713 | 723 | ||
714 | dec edi |
724 | dec edi |
715 | jnz .new_x |
725 | jnz .new_x |
716 | 726 | ||
717 | ; add line |
727 | ; add line |
718 | add edx, [drbar.line_inc_scr] |
728 | add edx, [drbar.line_inc_scr] |
719 | add ebp, [drbar.line_inc_map] |
729 | add ebp, [drbar.line_inc_map] |
720 | 730 | ||
721 | ; |
731 | ; |
722 | test eax, 0x00800000 |
732 | test eax, 0x00800000 |
723 | jz @f |
733 | jz @f |
724 | test bh, bh |
734 | test bh, bh |
725 | jz @f |
735 | jz @f |
726 | dec bh |
736 | dec bh |
727 | @@: |
737 | @@: |
728 | ; |
738 | ; |
729 | 739 | ||
730 | dec esi |
740 | dec esi |
731 | jnz .new_y |
741 | jnz .new_y |
732 | 742 | ||
733 | add esp, drbar.stack_data |
743 | add esp, drbar.stack_data |
734 | popad |
744 | popad |
735 | xor eax, eax |
745 | xor eax, eax |
736 | ret |
746 | ret |
737 | 747 | ||
738 | draw_bar_end_32: |
748 | draw_bar_end_32: |
739 | mov eax, [drbar.color] ;; BBGGRR00 |
749 | mov eax, [drbar.color] ;; BBGGRR00 |
740 | 750 | ||
741 | mov esi, [drbar.real_sy] |
751 | mov esi, [drbar.real_sy] |
742 | align 4 |
752 | align 4 |
743 | .new_y: |
753 | .new_y: |
744 | mov edi, [drbar.real_sx] |
754 | mov edi, [drbar.real_sx] |
745 | align 4 |
755 | align 4 |
746 | .new_x: |
756 | .new_x: |
747 | 757 | ||
748 | cmp byte [ebp], bl |
758 | cmp byte [ebp], bl |
749 | jne .skip |
759 | jne .skip |
750 | mov [edx], eax |
760 | mov [edx], eax |
751 | .skip: |
761 | .skip: |
752 | 762 | ||
753 | ; add pixel |
763 | ; add pixel |
754 | add edx, 4 |
764 | add edx, 4 |
755 | inc ebp |
765 | inc ebp |
756 | 766 | ||
757 | dec edi |
767 | dec edi |
758 | jnz .new_x |
768 | jnz .new_x |
759 | 769 | ||
760 | ; add line |
770 | ; add line |
761 | add edx, [drbar.line_inc_scr] |
771 | add edx, [drbar.line_inc_scr] |
762 | add ebp, [drbar.line_inc_map] |
772 | add ebp, [drbar.line_inc_map] |
763 | 773 | ||
764 | ; |
774 | ; |
765 | test eax, 0x80000000 |
775 | test eax, 0x80000000 |
766 | jz @f |
776 | jz @f |
767 | test al, al |
777 | test al, al |
768 | jz @f |
778 | jz @f |
769 | dec al |
779 | dec al |
770 | @@: |
780 | @@: |
771 | ; |
781 | ; |
772 | 782 | ||
773 | dec esi |
783 | dec esi |
774 | jnz .new_y |
784 | jnz .new_y |
775 | 785 | ||
776 | add esp, drbar.stack_data |
786 | add esp, drbar.stack_data |
777 | popad |
787 | popad |
778 | call VGA_draw_bar |
788 | call VGA_draw_bar |
779 | xor eax, eax |
789 | xor eax, eax |
780 | mov [EGA_counter],1 |
790 | mov [EGA_counter],1 |
781 | ret |
791 | ret |
782 | 792 | ||
783 | 793 | ||
784 | ;voodoodbcplimit: |
794 | ;voodoodbcplimit: |
785 | 795 | ||
786 | ; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer |
796 | ; ebp:=(y+Ywin)*(ScreenXSize+1)+(x+Xwin)+AddrBuffer |
787 | 797 | ||
788 | 798 | ||
789 | ; pusha |
799 | ; pusha |
790 | 800 | ||
791 | ; xor edx,edx |
801 | ; xor edx,edx |
792 | ; mov eax,ebp |
802 | ; mov eax,ebp |
793 | ; mov ebx,[ScreenWidth] ; Screen_X_size |
803 | ; mov ebx,[ScreenWidth] ; Screen_X_size |
794 | ; inc ebx ; +1 |
804 | ; inc ebx ; +1 |
795 | ; sub eax,WinMapAddress ; -AddrBuffer |
805 | ; sub eax,WinMapAddress ; -AddrBuffer |
796 | ; div ebx ; |
806 | ; div ebx ; |
797 | ; mov ebx,eax ; ebx:=Y |
807 | ; mov ebx,eax ; ebx:=Y |
798 | ; mov eax,edx ; eax:=X |
808 | ; mov eax,edx ; eax:=X |
799 | ; call cplimit |
809 | ; call cplimit |
800 | 810 | ||
801 | ; test ecx,ecx |
811 | ; test ecx,ecx |
802 | ; jne dbcpl12 |
812 | ; jne dbcpl12 |
803 | ; popa |
813 | ; popa |
804 | ; clc |
814 | ; clc |
805 | ; ret |
815 | ; ret |
806 | ; dbcpl12: |
816 | ; dbcpl12: |
807 | ; popa |
817 | ; popa |
808 | ; stc |
818 | ; stc |
809 | ; ret |
819 | ; ret |
810 | 820 | ||
811 | 821 | ||
812 | 822 | ||
813 | 823 | ||
814 | ;dbcplimit: |
824 | ;dbcplimit: |
815 | 825 | ||
816 | ; pusha |
826 | ; pusha |
817 | 827 | ||
818 | ; xor edx,edx |
828 | ; xor edx,edx |
819 | ; mov ebx,[ScreenWidth] |
829 | ; mov ebx,[ScreenWidth] |
820 | ; inc ebx |
830 | ; inc ebx |
821 | ; sub eax,WinMapAddress |
831 | ; sub eax,WinMapAddress |
822 | ; div ebx |
832 | ; div ebx |
823 | ; mov ebx,eax |
833 | ; mov ebx,eax |
824 | ; mov eax,edx |
834 | ; mov eax,edx |
825 | ; call cplimit |
835 | ; call cplimit |
826 | 836 | ||
827 | ; test ecx,ecx |
837 | ; test ecx,ecx |
828 | ; jne dbcpl1 |
838 | ; jne dbcpl1 |
829 | ; popa |
839 | ; popa |
830 | ; clc |
840 | ; clc |
831 | ; ret |
841 | ; ret |
832 | ; dbcpl1: |
842 | ; dbcpl1: |
833 | ; popa |
843 | ; popa |
834 | ; stc |
844 | ; stc |
835 | ; ret |
845 | ; ret |
836 | 846 | ||
837 | 847 | ||
838 | 848 | ||
839 | 849 | ||
840 | 850 | ||
841 | 851 | ||
842 | ;--------------vbe voodoo ------------------------------------------------ |
852 | ;--------------vbe voodoo ------------------------------------------------ |
843 | vesa20_drawbackground_tiled: |
853 | vesa20_drawbackground_tiled: |
844 | 854 | ||
845 | call [disable_mouse] |
855 | call [disable_mouse] |
846 | 856 | ||
847 | push ebp |
857 | push ebp |
848 | push eax |
858 | push eax |
849 | push ebx |
859 | push ebx |
850 | push ecx |
860 | push ecx |
851 | push edx |
861 | push edx |
852 | 862 | ||
853 | mov edx,dword [WinMapAddress-8] ; B |
863 | mov edx,dword [WinMapAddress-8] ; B |
854 | add edx,dword [WinMapAddress-8] ; +B |
864 | add edx,dword [WinMapAddress-8] ; +B |
855 | add edx,dword [WinMapAddress-8] ; +B |
865 | add edx,dword [WinMapAddress-8] ; +B |
856 | push edx |
866 | push edx |
857 | 867 | ||
858 | mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
868 | mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
859 | mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
869 | mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
860 | 870 | ||
861 | mov eax,[BytesPerScanLine] |
871 | mov eax,[BytesPerScanLine] |
862 | mul ebx |
872 | mul ebx |
863 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
873 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
864 | add ebp, eax ; +X |
874 | add ebp, eax ; +X |
865 | add ebp, eax ; +X |
875 | add ebp, eax ; +X |
866 | add ebp, eax ; +X |
876 | add ebp, eax ; +X |
867 | 877 | ||
868 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
878 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
869 | jz @f |
879 | jz @f |
870 | add ebp,eax ; +X |
880 | add ebp,eax ; +X |
871 | @@: |
881 | @@: |
872 | add ebp,[LFBAddress] ; +LFB |
882 | add ebp,[LFBAddress] ; +LFB |
873 | 883 | ||
874 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
884 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
875 | 885 | ||
876 | call calculate_edi |
886 | call calculate_edi |
877 | 887 | ||
878 | 888 | ||
879 | dp3: ; MAIN LOOP |
889 | dp3: ; MAIN LOOP |
880 | 890 | ||
881 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
891 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
882 | ; je ybgp |
892 | ; je ybgp |
883 | ; |
893 | ; |
884 | ; jmp nbgp |
894 | ; jmp nbgp |
885 | ; |
895 | ; |
886 | ; ybgp: |
896 | ; ybgp: |
887 | jne nbgp |
897 | jne nbgp |
888 | 898 | ||
889 | push eax |
899 | push eax |
890 | push ebx |
900 | push ebx |
891 | 901 | ||
892 | mov ecx,dword [WinMapAddress-8] ; B |
902 | mov ecx,dword [WinMapAddress-8] ; B |
893 | xor edx,edx ; edx:=0 |
903 | xor edx,edx ; edx:=0 |
894 | div ecx ; Xstart/B |
904 | div ecx ; Xstart/B |
895 | 905 | ||
896 | ; eax=Int(qn) edx:=Rem |
906 | ; eax=Int(qn) edx:=Rem |
897 | 907 | ||
898 | lea esi,[edx+edx*2] ; esi:=edx*3 |
908 | lea esi,[edx+edx*2] ; esi:=edx*3 |
899 | 909 | ||
900 | mov ecx,dword [WinMapAddress-4] ; ecx:=H |
910 | mov ecx,dword [WinMapAddress-4] ; ecx:=H |
901 | mov eax,[esp+0] ; eax:=Ystart |
911 | mov eax,[esp+0] ; eax:=Ystart |
902 | xor edx,edx ; |
912 | xor edx,edx ; |
903 | div ecx ; Ystart/H |
913 | div ecx ; Ystart/H |
904 | 914 | ||
905 | mov eax,edx ; eax:=Rem |
915 | mov eax,edx ; eax:=Rem |
906 | xor edx,edx ; |
916 | xor edx,edx ; |
907 | mov ebx,[esp+8] ; ebx:=B*3 |
917 | mov ebx,[esp+8] ; ebx:=B*3 |
908 | mul ebx ; |
918 | mul ebx ; |
909 | add esi,eax ; |
919 | add esi,eax ; |
910 | mov eax,[esi+0x300000] |
920 | mov eax,[esi+0x300000] |
911 | and eax,0xffffff |
921 | and eax,0xffffff |
912 | 922 | ||
913 | xchg edi, ebp |
923 | xchg edi, ebp |
914 | stosw |
924 | stosw |
915 | shr eax,16 |
925 | shr eax,16 |
916 | stosb |
926 | stosb |
917 | xchg ebp, edi ; ebp+=3 |
927 | xchg ebp, edi ; ebp+=3 |
918 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
928 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
919 | jz @f |
929 | jz @f |
920 | inc ebp ; +1 |
930 | inc ebp ; +1 |
921 | @@: |
931 | @@: |
922 | 932 | ||
923 | pop ebx |
933 | pop ebx |
924 | pop eax |
934 | pop eax |
925 | 935 | ||
926 | jmp hook1 |
936 | jmp hook1 |
927 | 937 | ||
928 | nbgp: |
938 | nbgp: |
929 | add ebp,3 ; +3 |
939 | add ebp,3 ; +3 |
930 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
940 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
931 | jz @f |
941 | jz @f |
932 | inc ebp ; +1 |
942 | inc ebp ; +1 |
933 | @@: |
943 | @@: |
934 | 944 | ||
935 | hook1: |
945 | hook1: |
936 | 946 | ||
937 | inc edi ; ptrBuffer++ |
947 | inc edi ; ptrBuffer++ |
938 | add esi,3 ; ptrImage+=3 |
948 | add esi,3 ; ptrImage+=3 |
939 | inc eax |
949 | inc eax |
940 | cmp eax,[draw_data+32+RECT.right] ; X > xend? |
950 | cmp eax,[draw_data+32+RECT.right] ; X > xend? |
941 | ; jg nodp3 |
951 | ; jg nodp3 |
942 | ; jmp dp3 |
952 | ; jmp dp3 |
943 | ; |
953 | ; |
944 | ; nodp3: |
954 | ; nodp3: |
945 | jle dp3 |
955 | jle dp3 |
946 | 956 | ||
947 | mov ebp,[draw_data+32+RECT.left] |
957 | mov ebp,[draw_data+32+RECT.left] |
948 | 958 | ||
949 | inc ebx |
959 | inc ebx |
950 | 960 | ||
951 | mov eax,[BytesPerScanLine] |
961 | mov eax,[BytesPerScanLine] |
952 | mul ebx |
962 | mul ebx |
953 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
963 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
954 | add ebp, eax ; +X |
964 | add ebp, eax ; +X |
955 | add ebp, eax ; +X=X*2 |
965 | add ebp, eax ; +X=X*2 |
956 | add ebp, eax ; +X=X*3 |
966 | add ebp, eax ; +X=X*3 |
957 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
967 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
958 | jz @f |
968 | jz @f |
959 | add ebp,eax ; +X=X*4 |
969 | add ebp,eax ; +X=X*4 |
960 | @@: |
970 | @@: |
961 | add ebp,[LFBAddress] ; +LFB |
971 | add ebp,[LFBAddress] ; +LFB |
962 | 972 | ||
963 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
973 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
964 | 974 | ||
965 | call calculate_edi |
975 | call calculate_edi |
966 | 976 | ||
967 | cmp ebx,[draw_data+32+RECT.bottom] |
977 | cmp ebx,[draw_data+32+RECT.bottom] |
968 | ; jg dp4 |
978 | ; jg dp4 |
969 | ; |
979 | ; |
970 | ; jmp dp3 |
980 | ; jmp dp3 |
971 | ; |
981 | ; |
972 | ; dp4: |
982 | ; dp4: |
973 | jle dp3 |
983 | jle dp3 |
974 | 984 | ||
975 | add esp,4 |
985 | add esp,4 |
976 | 986 | ||
977 | pop edx |
987 | pop edx |
978 | pop ecx |
988 | pop ecx |
979 | pop ebx |
989 | pop ebx |
980 | pop eax |
990 | pop eax |
981 | pop ebp |
991 | pop ebp |
982 | mov [EGA_counter],1 |
992 | mov [EGA_counter],1 |
983 | call VGA_drawbackground |
993 | call VGA_drawbackground |
984 | ret |
994 | ret |
985 | 995 | ||
986 | ; ---------- |
996 | ; ---------- |
987 | 997 | ||
988 | 998 | ||
989 | vesa20_drawbackground_stretch: |
999 | vesa20_drawbackground_stretch: |
990 | 1000 | ||
991 | call [disable_mouse] |
1001 | call [disable_mouse] |
992 | 1002 | ||
993 | push ebp |
1003 | push ebp |
994 | push eax |
1004 | push eax |
995 | push ebx |
1005 | push ebx |
996 | push ecx |
1006 | push ecx |
997 | push edx |
1007 | push edx |
998 | 1008 | ||
999 | mov edx,dword [WinMapAddress-8] ; B |
1009 | mov edx,dword [WinMapAddress-8] ; B |
1000 | add edx,dword [WinMapAddress-8] ; +B |
1010 | add edx,dword [WinMapAddress-8] ; +B |
1001 | add edx,dword [WinMapAddress-8] ; +B |
1011 | add edx,dword [WinMapAddress-8] ; +B |
1002 | push edx |
1012 | push edx |
1003 | 1013 | ||
1004 | mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
1014 | mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) |
1005 | mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
1015 | mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) |
1006 | 1016 | ||
1007 | mov eax,[BytesPerScanLine] |
1017 | mov eax,[BytesPerScanLine] |
1008 | mul ebx |
1018 | mul ebx |
1009 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
1019 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
1010 | add ebp, eax ; +X |
1020 | add ebp, eax ; +X |
1011 | add ebp, eax ; +X |
1021 | add ebp, eax ; +X |
1012 | add ebp, eax ; +X |
1022 | add ebp, eax ; +X |
1013 | 1023 | ||
1014 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1024 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1015 | jz @f |
1025 | jz @f |
1016 | add ebp,eax ; +X |
1026 | add ebp,eax ; +X |
1017 | @@: |
1027 | @@: |
1018 | add ebp,[LFBAddress] ; +LFB |
1028 | add ebp,[LFBAddress] ; +LFB |
1019 | 1029 | ||
1020 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
1030 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
1021 | 1031 | ||
1022 | call calculate_edi |
1032 | call calculate_edi |
1023 | 1033 | ||
1024 | 1034 | ||
1025 | sdp3: ; MAIN LOOP |
1035 | sdp3: ; MAIN LOOP |
1026 | 1036 | ||
1027 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
1037 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
1028 | jne snbgp |
1038 | jne snbgp |
1029 | 1039 | ||
1030 | push eax |
1040 | push eax |
1031 | push ebx |
1041 | push ebx |
1032 | 1042 | ||
1033 | mov eax,dword [WinMapAddress-8] |
1043 | mov eax,dword [WinMapAddress-8] |
1034 | imul eax, [esp+4] ;4 |
1044 | imul eax, [esp+4] ;4 |
1035 | xor edx,edx |
1045 | xor edx,edx |
1036 | mov ebx,[ScreenWidth] |
1046 | mov ebx,[ScreenWidth] |
1037 | div ebx |
1047 | div ebx |
1038 | lea esi,[eax+eax*2] |
1048 | lea esi,[eax+eax*2] |
1039 | mov eax,dword [WinMapAddress-4] |
1049 | mov eax,dword [WinMapAddress-4] |
1040 | imul eax, [esp+0] ;0 |
1050 | imul eax, [esp+0] ;0 |
1041 | xor edx,edx |
1051 | xor edx,edx |
1042 | mov ebx,[ScreenHeight] |
1052 | mov ebx,[ScreenHeight] |
1043 | div ebx |
1053 | div ebx |
1044 | imul eax, [esp+8] ;8 |
1054 | imul eax, [esp+8] ;8 |
1045 | add esi,eax |
1055 | add esi,eax |
1046 | 1056 | ||
1047 | mov eax,[esi+0x300000] |
1057 | mov eax,[esi+0x300000] |
1048 | and eax,0xffffff |
1058 | and eax,0xffffff |
1049 | 1059 | ||
1050 | xchg edi, ebp |
1060 | xchg edi, ebp |
1051 | stosw |
1061 | stosw |
1052 | shr eax,16 |
1062 | shr eax,16 |
1053 | stosb |
1063 | stosb |
1054 | xchg ebp, edi ; ebp+=3 |
1064 | xchg ebp, edi ; ebp+=3 |
1055 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1065 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1056 | jz @f |
1066 | jz @f |
1057 | inc ebp ; +1 |
1067 | inc ebp ; +1 |
1058 | @@: |
1068 | @@: |
1059 | 1069 | ||
1060 | pop ebx |
1070 | pop ebx |
1061 | pop eax |
1071 | pop eax |
1062 | 1072 | ||
1063 | jmp shook1 |
1073 | jmp shook1 |
1064 | 1074 | ||
1065 | snbgp: |
1075 | snbgp: |
1066 | add ebp,3 ; +3 |
1076 | add ebp,3 ; +3 |
1067 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1077 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1068 | jz @f |
1078 | jz @f |
1069 | inc ebp ; +1 |
1079 | inc ebp ; +1 |
1070 | @@: |
1080 | @@: |
1071 | 1081 | ||
1072 | shook1: |
1082 | shook1: |
1073 | 1083 | ||
1074 | inc edi ; ptrBuffer++ |
1084 | inc edi ; ptrBuffer++ |
1075 | add esi,3 ; ptrImage+=3 |
1085 | add esi,3 ; ptrImage+=3 |
1076 | inc eax |
1086 | inc eax |
1077 | cmp eax,[draw_data+32+RECT.right] ; X > xend? |
1087 | cmp eax,[draw_data+32+RECT.right] ; X > xend? |
1078 | jle sdp3 |
1088 | jle sdp3 |
1079 | 1089 | ||
1080 | mov ebp,[draw_data+32+RECT.left] |
1090 | mov ebp,[draw_data+32+RECT.left] |
1081 | 1091 | ||
1082 | inc ebx |
1092 | inc ebx |
1083 | 1093 | ||
1084 | mov eax,[BytesPerScanLine] |
1094 | mov eax,[BytesPerScanLine] |
1085 | mul ebx |
1095 | mul ebx |
1086 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
1096 | xchg ebp, eax ; BytesPerScanLine*(Ywin+y) |
1087 | add ebp, eax ; +X |
1097 | add ebp, eax ; +X |
1088 | add ebp, eax ; +X=X*2 |
1098 | add ebp, eax ; +X=X*2 |
1089 | add ebp, eax ; +X=X*3 |
1099 | add ebp, eax ; +X=X*3 |
1090 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1100 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1091 | jz @f |
1101 | jz @f |
1092 | add ebp,eax ; +X=X*4 |
1102 | add ebp,eax ; +X=X*4 |
1093 | @@: |
1103 | @@: |
1094 | add ebp,[LFBAddress] ; +LFB |
1104 | add ebp,[LFBAddress] ; +LFB |
1095 | 1105 | ||
1096 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
1106 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
1097 | 1107 | ||
1098 | call calculate_edi |
1108 | call calculate_edi |
1099 | 1109 | ||
1100 | cmp ebx,[draw_data+32+RECT.bottom] |
1110 | cmp ebx,[draw_data+32+RECT.bottom] |
1101 | jle sdp3 |
1111 | jle sdp3 |
1102 | 1112 | ||
1103 | add esp,4 |
1113 | add esp,4 |
1104 | 1114 | ||
1105 | pop edx |
1115 | pop edx |
1106 | pop ecx |
1116 | pop ecx |
1107 | pop ebx |
1117 | pop ebx |
1108 | pop eax |
1118 | pop eax |
1109 | pop ebp |
1119 | pop ebp |
1110 | mov [EGA_counter],1 |
1120 | mov [EGA_counter],1 |
1111 | call VGA_drawbackground |
1121 | call VGA_drawbackground |
1112 | ret>>><>16><16>> |
1122 | ret>>><>16><16>> |