Rev 9925 | Rev 9941 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9925 | Rev 9930 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2023. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2023. 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 | ;; VESA20.INC ;; |
6 | ;; VESA20.INC ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Vesa 2.0 functions for MenuetOS ;; |
8 | ;; Vesa 2.0 functions for MenuetOS ;; |
9 | ;; ;; |
9 | ;; ;; |
10 | ;; Copyright 2002 Ville Turjanmaa ;; |
10 | ;; Copyright 2002 Ville Turjanmaa ;; |
11 | ;; Alexey, kgaz@crosswindws.net ;; |
11 | ;; Alexey, kgaz@crosswindws.net ;; |
12 | ;; - Voodoo compatible graphics ;; |
12 | ;; - Voodoo compatible graphics ;; |
13 | ;; Juan M. Caravaca ;; |
13 | ;; Juan M. Caravaca ;; |
14 | ;; - Graphics optimimizations eg. drawline ;; |
14 | ;; - Graphics optimimizations eg. drawline ;; |
15 | ;; ;; |
15 | ;; ;; |
16 | ;; See file COPYING for details ;; |
16 | ;; See file COPYING for details ;; |
17 | ;; ;; |
17 | ;; ;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
19 | 19 | ||
20 | $Revision: 9925 $ |
20 | $Revision: 9930 $ |
21 | 21 | ||
22 | uglobal |
22 | uglobal |
23 | align 4 |
23 | align 4 |
24 | bgr_cur_line rd MAX_SCREEN_WIDTH |
24 | bgr_cur_line rd MAX_SCREEN_WIDTH |
25 | bgr_next_line rd MAX_SCREEN_WIDTH |
25 | bgr_next_line rd MAX_SCREEN_WIDTH |
26 | endg |
26 | endg |
27 | 27 | ||
28 | iglobal |
28 | iglobal |
29 | align 4 |
29 | align 4 |
30 | overlapping_of_points_ptr dd overlapping_of_points |
30 | overlapping_of_points_ptr dd overlapping_of_points |
31 | endg |
31 | endg |
32 | 32 | ||
33 | 33 | ||
34 | ;----------------------------------------------------------------------------- |
34 | ;----------------------------------------------------------------------------- |
35 | ; eax = x |
35 | ; eax = x |
36 | ; ebx = y |
36 | ; ebx = y |
37 | 37 | ||
38 | align 4 |
38 | align 4 |
39 | Vesa20_getpixel16: |
39 | Vesa20_getpixel16: |
40 | 40 | ||
41 | ; check for hardware cursor |
41 | ; check for hardware cursor |
42 | cmp [_display.select_cursor], select_cursor |
42 | cmp [_display.select_cursor], select_cursor |
43 | je @f |
43 | je @f |
44 | cmp [_display.select_cursor], 0 |
44 | cmp [_display.select_cursor], 0 |
45 | jne .no_mouseunder |
45 | jne .no_mouseunder |
46 | @@: |
46 | @@: |
47 | 47 | ||
48 | ; check mouse area for putpixel |
48 | ; check mouse area for putpixel |
49 | test ecx, 0x04000000 ; don't load to mouseunder area |
49 | test ecx, 0x04000000 ; don't load to mouseunder area |
50 | jnz .no_mouseunder |
50 | jnz .no_mouseunder |
51 | call [_display.check_m_pixel] |
51 | call [_display.check_m_pixel] |
52 | test ecx, ecx ; 0xff000000 |
52 | test ecx, ecx ; 0xff000000 |
53 | jnz @f |
53 | jnz @f |
54 | 54 | ||
55 | .no_mouseunder: |
55 | .no_mouseunder: |
56 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
56 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
57 | mov ebx, [BPSLine_calc_area + ebx*4] |
57 | mov ebx, [BPSLine_calc_area + ebx*4] |
58 | lea edi, [eax*2] ; edi = x*2 |
58 | lea edi, [eax*2] ; edi = x*2 |
59 | add edi, ebx ; edi = x*2+(y*y multiplier) |
59 | add edi, ebx ; edi = x*2+(y*y multiplier) |
60 | 60 | ||
61 | movzx ecx, word[LFB_BASE + edi] |
61 | movzx ecx, word[LFB_BASE + edi] |
62 | shl ecx, 3 |
62 | shl ecx, 3 |
63 | ror ecx, 8 |
63 | ror ecx, 8 |
64 | shl cx, 2 |
64 | shl cx, 2 |
65 | ror ecx, 8 |
65 | ror ecx, 8 |
66 | shl cl, 3 |
66 | shl cl, 3 |
67 | rol ecx, 16 |
67 | rol ecx, 16 |
68 | @@: |
68 | @@: |
69 | and ecx, 0x00ffffff |
69 | and ecx, 0x00ffffff |
70 | ret |
70 | ret |
71 | 71 | ||
72 | ;----------------------------------------------------------------------------- |
72 | ;----------------------------------------------------------------------------- |
73 | ; eax = x |
73 | ; eax = x |
74 | ; ebx = y |
74 | ; ebx = y |
75 | 75 | ||
76 | align 4 |
76 | align 4 |
77 | Vesa20_getpixel24: |
77 | Vesa20_getpixel24: |
78 | 78 | ||
79 | ; check for hardware cursor |
79 | ; check for hardware cursor |
80 | cmp [_display.select_cursor], select_cursor |
80 | cmp [_display.select_cursor], select_cursor |
81 | je @f |
81 | je @f |
82 | cmp [_display.select_cursor], 0 |
82 | cmp [_display.select_cursor], 0 |
83 | jne .no_mouseunder |
83 | jne .no_mouseunder |
84 | @@: |
84 | @@: |
85 | 85 | ||
86 | ; check mouse area for putpixel |
86 | ; check mouse area for putpixel |
87 | test ecx, 0x04000000 ; don't load to mouseunder area |
87 | test ecx, 0x04000000 ; don't load to mouseunder area |
88 | jnz .no_mouseunder |
88 | jnz .no_mouseunder |
89 | call [_display.check_m_pixel] |
89 | call [_display.check_m_pixel] |
90 | test ecx, ecx ; 0xff000000 |
90 | test ecx, ecx ; 0xff000000 |
91 | jnz @f |
91 | jnz @f |
92 | 92 | ||
93 | .no_mouseunder: |
93 | .no_mouseunder: |
94 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
94 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
95 | mov ebx, [BPSLine_calc_area + ebx*4] |
95 | mov ebx, [BPSLine_calc_area + ebx*4] |
96 | lea edi, [eax + eax*2] ; edi = x*3 |
96 | lea edi, [eax + eax*2] ; edi = x*3 |
97 | add edi, ebx ; edi = x*3+(y*y multiplier) |
97 | add edi, ebx ; edi = x*3+(y*y multiplier) |
98 | 98 | ||
99 | mov ecx, [LFB_BASE + edi] |
99 | mov ecx, [LFB_BASE + edi] |
100 | @@: |
100 | @@: |
101 | and ecx, 0x00ffffff |
101 | and ecx, 0x00ffffff |
102 | ret |
102 | ret |
103 | 103 | ||
104 | ;----------------------------------------------------------------------------- |
104 | ;----------------------------------------------------------------------------- |
105 | ; eax = x |
105 | ; eax = x |
106 | ; ebx = y |
106 | ; ebx = y |
107 | 107 | ||
108 | align 4 |
108 | align 4 |
109 | Vesa20_getpixel32: |
109 | Vesa20_getpixel32: |
110 | 110 | ||
111 | ; check for hardware cursor |
111 | ; check for hardware cursor |
112 | cmp [_display.select_cursor], select_cursor |
112 | cmp [_display.select_cursor], select_cursor |
113 | je @f |
113 | je @f |
114 | cmp [_display.select_cursor], 0 |
114 | cmp [_display.select_cursor], 0 |
115 | jne .no_mouseunder |
115 | jne .no_mouseunder |
116 | @@: |
116 | @@: |
117 | 117 | ||
118 | ; check mouse area for putpixel |
118 | ; check mouse area for putpixel |
119 | test ecx, 0x04000000 ; don't load to mouseunder area |
119 | test ecx, 0x04000000 ; don't load to mouseunder area |
120 | jnz .no_mouseunder |
120 | jnz .no_mouseunder |
121 | call [_display.check_m_pixel] |
121 | call [_display.check_m_pixel] |
122 | test ecx, ecx ; 0xff000000 |
122 | test ecx, ecx ; 0xff000000 |
123 | jnz @f |
123 | jnz @f |
124 | 124 | ||
125 | .no_mouseunder: |
125 | .no_mouseunder: |
126 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
126 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
127 | mov ebx, [BPSLine_calc_area + ebx*4] |
127 | mov ebx, [BPSLine_calc_area + ebx*4] |
128 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
128 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
129 | 129 | ||
130 | mov ecx, [LFB_BASE + edi] |
130 | mov ecx, [LFB_BASE + edi] |
131 | @@: |
131 | @@: |
132 | and ecx, 0x00ffffff |
132 | and ecx, 0x00ffffff |
133 | ret |
133 | ret |
134 | 134 | ||
135 | ;----------------------------------------------------------------------------- |
135 | ;----------------------------------------------------------------------------- |
136 | ; ebx = pointer |
136 | ; ebx = pointer |
137 | ; ecx = size [x|y] |
137 | ; ecx = size [x|y] |
138 | ; edx = coordinates [x|y] |
138 | ; edx = coordinates [x|y] |
139 | ; ebp = pointer to 'get' function |
139 | ; ebp = pointer to 'get' function |
140 | ; esi = pointer to 'init' function |
140 | ; esi = pointer to 'init' function |
141 | ; edi = parameter for 'get' function |
141 | ; edi = parameter for 'get' function |
142 | 142 | ||
143 | align 16 |
143 | align 16 |
144 | vesa20_putimage: |
144 | vesa20_putimage: |
145 | 145 | ||
146 | virtual at esp |
146 | virtual at esp |
147 | putimg: |
147 | putimg: |
148 | .real_sx dd ? |
148 | .real_sx dd ? |
149 | .real_sy dd ? |
149 | .real_sy dd ? |
150 | .image_sx dd ? |
150 | .image_sx dd ? |
151 | .image_sy dd ? |
151 | .image_sy dd ? |
152 | .image_cx dd ? |
152 | .image_cx dd ? |
153 | .image_cy dd ? |
153 | .image_cy dd ? |
154 | .pti dd ? |
154 | .pti dd ? |
155 | .abs_cx dd ? |
155 | .abs_cx dd ? |
156 | .abs_cy dd ? |
156 | .abs_cy dd ? |
157 | .line_increment dd ? |
157 | .line_increment dd ? |
158 | .winmap_newline dd ? |
158 | .winmap_newline dd ? |
159 | .screen_newline dd ? |
159 | .screen_newline dd ? |
160 | .real_sx_and_abs_cx dd ? |
160 | .real_sx_and_abs_cx dd ? |
161 | .real_sy_and_abs_cy dd ? |
161 | .real_sy_and_abs_cy dd ? |
162 | .stack_data = 4*14 |
162 | .stack_data = 4*14 |
163 | .edi dd ? |
163 | .edi dd ? |
164 | .esi dd ? |
164 | .esi dd ? |
165 | .ebp dd ? |
165 | .ebp dd ? |
166 | .esp dd ? |
166 | .esp dd ? |
167 | .ebx dd ? |
167 | .ebx dd ? |
168 | .edx dd ? |
168 | .edx dd ? |
169 | .ecx dd ? |
169 | .ecx dd ? |
170 | .eax dd ? |
170 | .eax dd ? |
171 | .ret_addr dd ? |
171 | .ret_addr dd ? |
172 | .arg_0 dd ? |
172 | .arg_0 dd ? |
173 | end virtual |
173 | end virtual |
174 | 174 | ||
175 | pushad |
175 | pushad |
176 | sub esp, putimg.stack_data |
176 | sub esp, putimg.stack_data |
177 | ; save pointer to image |
177 | ; save pointer to image |
178 | mov [putimg.pti], ebx |
178 | mov [putimg.pti], ebx |
179 | ; unpack the size |
179 | ; unpack the size |
180 | mov eax, ecx |
180 | mov eax, ecx |
181 | and ecx, 0xFFFF |
181 | and ecx, 0xFFFF |
182 | shr eax, 16 |
182 | shr eax, 16 |
183 | mov [putimg.image_sx], eax |
183 | mov [putimg.image_sx], eax |
184 | mov [putimg.image_sy], ecx |
184 | mov [putimg.image_sy], ecx |
185 | ; unpack the coordinates |
185 | ; unpack the coordinates |
186 | mov eax, edx |
186 | mov eax, edx |
187 | and edx, 0xFFFF |
187 | and edx, 0xFFFF |
188 | shr eax, 16 |
188 | shr eax, 16 |
189 | mov [putimg.image_cx], eax |
189 | mov [putimg.image_cx], eax |
190 | mov [putimg.image_cy], edx |
190 | mov [putimg.image_cy], edx |
191 | ; calculate absolute (i.e. screen) coordinates |
191 | ; calculate absolute (i.e. screen) coordinates |
192 | mov eax, [current_slot_idx] |
192 | mov eax, [current_slot_idx] |
193 | shl eax, BSF sizeof.WDATA |
193 | shl eax, BSF sizeof.WDATA |
194 | mov ebx, [eax + window_data + WDATA.box.left] |
194 | mov ebx, [eax + window_data + WDATA.box.left] |
195 | add ebx, [putimg.image_cx] |
195 | add ebx, [putimg.image_cx] |
196 | mov [putimg.abs_cx], ebx |
196 | mov [putimg.abs_cx], ebx |
197 | mov ebx, [eax +window_data + WDATA.box.top] |
197 | mov ebx, [eax +window_data + WDATA.box.top] |
198 | add ebx, [putimg.image_cy] |
198 | add ebx, [putimg.image_cy] |
199 | mov [putimg.abs_cy], ebx |
199 | mov [putimg.abs_cy], ebx |
200 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
200 | ; real_sx = MIN(wnd_sx-image_cx, image_sx); |
201 | mov ebx, [eax + window_data + WDATA.box.width] ; ebx = wnd_sx |
201 | mov ebx, [eax + window_data + WDATA.box.width] ; ebx = wnd_sx |
202 | inc ebx ; WDATA.box.width is one pixel less than real window x-size |
202 | inc ebx ; WDATA.box.width is one pixel less than real window x-size |
203 | sub ebx, [putimg.image_cx] |
203 | sub ebx, [putimg.image_cx] |
204 | ja @f |
204 | ja @f |
205 | add esp, putimg.stack_data |
205 | add esp, putimg.stack_data |
206 | popad |
206 | popad |
207 | ret |
207 | ret |
208 | 208 | ||
209 | @@: |
209 | @@: |
210 | cmp ebx, [putimg.image_sx] |
210 | cmp ebx, [putimg.image_sx] |
211 | jbe .end_x |
211 | jbe .end_x |
212 | mov ebx, [putimg.image_sx] |
212 | mov ebx, [putimg.image_sx] |
213 | .end_x: |
213 | .end_x: |
214 | mov [putimg.real_sx], ebx |
214 | mov [putimg.real_sx], ebx |
215 | ; init real_sy |
215 | ; init real_sy |
216 | mov ebx, [eax + window_data + WDATA.box.height] ; ebx = wnd_sy |
216 | mov ebx, [eax + window_data + WDATA.box.height] ; ebx = wnd_sy |
217 | inc ebx |
217 | inc ebx |
218 | sub ebx, [putimg.image_cy] |
218 | sub ebx, [putimg.image_cy] |
219 | ja @f |
219 | ja @f |
220 | add esp, putimg.stack_data |
220 | add esp, putimg.stack_data |
221 | popad |
221 | popad |
222 | ret |
222 | ret |
223 | 223 | ||
224 | @@: |
224 | @@: |
225 | cmp ebx, [putimg.image_sy] |
225 | cmp ebx, [putimg.image_sy] |
226 | jbe .end_y |
226 | jbe .end_y |
227 | mov ebx, [putimg.image_sy] |
227 | mov ebx, [putimg.image_sy] |
228 | .end_y: |
228 | .end_y: |
229 | mov [putimg.real_sy], ebx |
229 | mov [putimg.real_sy], ebx |
230 | ; line increment |
230 | ; line increment |
231 | mov eax, [putimg.image_sx] |
231 | mov eax, [putimg.image_sx] |
232 | mov ecx, [putimg.real_sx] |
232 | mov ecx, [putimg.real_sx] |
233 | sub eax, ecx |
233 | sub eax, ecx |
234 | ;; imul eax, [putimg.source_bpp] |
234 | ;; imul eax, [putimg.source_bpp] |
235 | ; lea eax, [eax + eax * 2] |
235 | ; lea eax, [eax + eax * 2] |
236 | call esi |
236 | call esi |
237 | add eax, [putimg.arg_0] |
237 | add eax, [putimg.arg_0] |
238 | mov [putimg.line_increment], eax |
238 | mov [putimg.line_increment], eax |
239 | ; winmap new line increment |
239 | ; winmap new line increment |
240 | mov eax, [_display.width] |
240 | mov eax, [_display.width] |
241 | sub eax, [putimg.real_sx] |
241 | sub eax, [putimg.real_sx] |
242 | mov [putimg.winmap_newline], eax |
242 | mov [putimg.winmap_newline], eax |
243 | ; screen new line increment |
243 | ; screen new line increment |
244 | mov eax, [_display.lfb_pitch] |
244 | mov eax, [_display.lfb_pitch] |
245 | mov ebx, [_display.bytes_per_pixel] |
245 | mov ebx, [_display.bytes_per_pixel] |
246 | imul ecx, ebx |
246 | imul ecx, ebx |
247 | sub eax, ecx |
247 | sub eax, ecx |
248 | mov [putimg.screen_newline], eax |
248 | mov [putimg.screen_newline], eax |
249 | ; pointer to image |
249 | ; pointer to image |
250 | mov esi, [putimg.pti] |
250 | mov esi, [putimg.pti] |
251 | ; pointer to screen |
251 | ; pointer to screen |
252 | mov edx, [putimg.abs_cy] |
252 | mov edx, [putimg.abs_cy] |
253 | ; imul edx, [BytesPerScanLine] |
253 | ; imul edx, [BytesPerScanLine] |
254 | mov edx, [BPSLine_calc_area + edx*4] |
254 | mov edx, [BPSLine_calc_area + edx*4] |
255 | mov eax, [putimg.abs_cx] |
255 | mov eax, [putimg.abs_cx] |
256 | imul eax, ebx |
256 | imul eax, ebx |
257 | add edx, eax |
257 | add edx, eax |
258 | ; pointer to pixel map |
258 | ; pointer to pixel map |
259 | mov eax, [putimg.abs_cy] |
259 | mov eax, [putimg.abs_cy] |
260 | ; imul eax, [Screen_Max_X] |
260 | ; imul eax, [Screen_Max_X] |
261 | ; add eax, [putimg.abs_cy] |
261 | ; add eax, [putimg.abs_cy] |
262 | mov eax, [d_width_calc_area + eax*4] |
262 | mov eax, [d_width_calc_area + eax*4] |
263 | 263 | ||
264 | add eax, [putimg.abs_cx] |
264 | add eax, [putimg.abs_cx] |
265 | add eax, [_display.win_map] |
265 | add eax, [_display.win_map] |
266 | xchg eax, ebp |
266 | xchg eax, ebp |
267 | 267 | ||
268 | mov ecx, [putimg.real_sx] |
268 | mov ecx, [putimg.real_sx] |
269 | add ecx, [putimg.abs_cx] |
269 | add ecx, [putimg.abs_cx] |
270 | mov [putimg.real_sx_and_abs_cx], ecx |
270 | mov [putimg.real_sx_and_abs_cx], ecx |
271 | mov ecx, [putimg.real_sy] |
271 | mov ecx, [putimg.real_sy] |
272 | add ecx, [putimg.abs_cy] |
272 | add ecx, [putimg.abs_cy] |
273 | mov [putimg.real_sy_and_abs_cy], ecx |
273 | mov [putimg.real_sy_and_abs_cy], ecx |
274 | 274 | ||
275 | ; get process number |
275 | ; get process number |
276 | mov ebx, [current_slot_idx] |
276 | mov ebx, [current_slot_idx] |
277 | 277 | ||
278 | cmp byte [_display.bits_per_pixel], 16 |
278 | cmp byte [_display.bits_per_pixel], 16 |
279 | je put_image_end_16 |
279 | je put_image_end_16 |
280 | cmp byte [_display.bits_per_pixel], 24 |
280 | cmp byte [_display.bits_per_pixel], 24 |
281 | je put_image_end_24 |
281 | je put_image_end_24 |
282 | cmp byte [_display.bits_per_pixel], 32 |
282 | cmp byte [_display.bits_per_pixel], 32 |
283 | je put_image_end_32 |
283 | je put_image_end_32 |
284 | 284 | ||
285 | ;------------------------------------------------------------------------------ |
285 | ;------------------------------------------------------------------------------ |
286 | 286 | ||
287 | put_image_end_16: |
287 | put_image_end_16: |
288 | 288 | ||
289 | mov edi, [putimg.real_sy] |
289 | mov edi, [putimg.real_sy] |
290 | 290 | ||
291 | ; check for hardware cursor |
291 | ; check for hardware cursor |
292 | mov ecx, [_display.select_cursor] |
292 | mov ecx, [_display.select_cursor] |
293 | cmp ecx, select_cursor |
293 | cmp ecx, select_cursor |
294 | je put_image_end_16_new |
294 | je put_image_end_16_new |
295 | cmp ecx, 0 |
295 | cmp ecx, 0 |
296 | je put_image_end_16_old |
296 | je put_image_end_16_old |
297 | .new_line: |
297 | .new_line: |
298 | mov ecx, [putimg.real_sx] |
298 | mov ecx, [putimg.real_sx] |
299 | .new_x: |
299 | .new_x: |
300 | push [putimg.edi] |
300 | push [putimg.edi] |
301 | mov eax, [putimg.ebp + 4] |
301 | mov eax, [putimg.ebp + 4] |
302 | call eax |
302 | call eax |
303 | cmp [ebp], bl |
303 | cmp [ebp], bl |
304 | jne .skip |
304 | jne .skip |
305 | ; convert to 16 bpp and store to LFB |
305 | ; convert to 16 bpp and store to LFB |
306 | and eax, 00000000111110001111110011111000b |
306 | and eax, 00000000111110001111110011111000b |
307 | shr ah, 2 |
307 | shr ah, 2 |
308 | shr ax, 3 |
308 | shr ax, 3 |
309 | ror eax, 8 |
309 | ror eax, 8 |
310 | add al, ah |
310 | add al, ah |
311 | rol eax, 8 |
311 | rol eax, 8 |
312 | mov [LFB_BASE + edx], ax |
312 | mov [LFB_BASE + edx], ax |
313 | .skip: |
313 | .skip: |
314 | add edx, 2 |
314 | add edx, 2 |
315 | inc ebp |
315 | inc ebp |
316 | dec ecx |
316 | dec ecx |
317 | jnz .new_x |
317 | jnz .new_x |
318 | 318 | ||
319 | add esi, [putimg.line_increment] |
319 | add esi, [putimg.line_increment] |
320 | add edx, [putimg.screen_newline] |
320 | add edx, [putimg.screen_newline] |
321 | add ebp, [putimg.winmap_newline] |
321 | add ebp, [putimg.winmap_newline] |
322 | 322 | ||
323 | cmp [putimg.ebp], putimage_get1bpp |
323 | cmp [putimg.ebp], putimage_get1bpp |
324 | jz .correct |
324 | jz .correct |
325 | cmp [putimg.ebp], putimage_get2bpp |
325 | cmp [putimg.ebp], putimage_get2bpp |
326 | jz .correct |
326 | jz .correct |
327 | cmp [putimg.ebp], putimage_get4bpp |
327 | cmp [putimg.ebp], putimage_get4bpp |
328 | jnz @f |
328 | jnz @f |
329 | .correct: |
329 | .correct: |
330 | mov eax, [putimg.edi] |
330 | mov eax, [putimg.edi] |
331 | mov byte [eax], 80h |
331 | mov byte [eax], 80h |
332 | @@: |
332 | @@: |
333 | dec edi |
333 | dec edi |
334 | jnz .new_line |
334 | jnz .new_line |
335 | .finish: |
335 | .finish: |
336 | add esp, putimg.stack_data |
336 | add esp, putimg.stack_data |
337 | popad |
337 | popad |
338 | ret |
338 | ret |
339 | 339 | ||
340 | ;------------------------------------------------------------------------------ |
340 | ;------------------------------------------------------------------------------ |
341 | 341 | ||
342 | align 4 |
342 | align 4 |
343 | put_image_end_16_old: |
343 | put_image_end_16_old: |
344 | 344 | ||
345 | .new_line: |
345 | .new_line: |
346 | mov ecx, [putimg.real_sx] |
346 | mov ecx, [putimg.real_sx] |
347 | .new_x: |
347 | .new_x: |
348 | push [putimg.edi] |
348 | push [putimg.edi] |
349 | mov eax, [putimg.ebp + 4] |
349 | mov eax, [putimg.ebp + 4] |
350 | call eax |
350 | call eax |
351 | cmp [ebp], bl |
351 | cmp [ebp], bl |
352 | jne .skip |
352 | jne .skip |
353 | 353 | ||
354 | push ecx |
354 | push ecx |
355 | neg ecx |
355 | neg ecx |
356 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
356 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
357 | shl ecx, 16 |
357 | shl ecx, 16 |
358 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
358 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
359 | sub ecx, edi |
359 | sub ecx, edi |
360 | 360 | ||
361 | ; check mouse area for putpixel |
361 | ; check mouse area for putpixel |
362 | call check_mouse_area_for_putpixel |
362 | call check_mouse_area_for_putpixel |
363 | pop ecx |
363 | pop ecx |
364 | 364 | ||
365 | ; convert to 16 bpp and store to LFB |
365 | ; convert to 16 bpp and store to LFB |
366 | ;; and eax, 00000000111110001111110011111000b |
366 | ;; and eax, 00000000111110001111110011111000b |
367 | ;; shr ah, 2 |
367 | ;; shr ah, 2 |
368 | ;; shr ax, 3 |
368 | ;; shr ax, 3 |
369 | ;; ror eax, 8 |
369 | ;; ror eax, 8 |
370 | ;; add al, ah |
370 | ;; add al, ah |
371 | ;; rol eax, 8 |
371 | ;; rol eax, 8 |
372 | mov [LFB_BASE + edx], ax |
372 | mov [LFB_BASE + edx], ax |
373 | .skip: |
373 | .skip: |
374 | inc edx |
374 | inc edx |
375 | inc edx |
375 | inc edx |
376 | inc ebp |
376 | inc ebp |
377 | dec ecx |
377 | dec ecx |
378 | jnz .new_x |
378 | jnz .new_x |
379 | 379 | ||
380 | add esi, [putimg.line_increment] |
380 | add esi, [putimg.line_increment] |
381 | add edx, [putimg.screen_newline] |
381 | add edx, [putimg.screen_newline] |
382 | add ebp, [putimg.winmap_newline] |
382 | add ebp, [putimg.winmap_newline] |
383 | 383 | ||
384 | cmp [putimg.ebp], putimage_get1bpp |
384 | cmp [putimg.ebp], putimage_get1bpp |
385 | jz .correct |
385 | jz .correct |
386 | cmp [putimg.ebp], putimage_get2bpp |
386 | cmp [putimg.ebp], putimage_get2bpp |
387 | jz .correct |
387 | jz .correct |
388 | cmp [putimg.ebp], putimage_get4bpp |
388 | cmp [putimg.ebp], putimage_get4bpp |
389 | jnz @f |
389 | jnz @f |
390 | .correct: |
390 | .correct: |
391 | mov eax, [putimg.edi] |
391 | mov eax, [putimg.edi] |
392 | mov byte [eax], 80h |
392 | mov byte [eax], 80h |
393 | @@: |
393 | @@: |
394 | dec edi |
394 | dec edi |
395 | jnz .new_line |
395 | jnz .new_line |
396 | jmp put_image_end_16.finish |
396 | jmp put_image_end_16.finish |
397 | 397 | ||
398 | ;------------------------------------------------------------------------------ |
398 | ;------------------------------------------------------------------------------ |
399 | 399 | ||
400 | align 4 |
400 | align 4 |
401 | put_image_end_16_new: |
401 | put_image_end_16_new: |
402 | 402 | ||
403 | .new_line: |
403 | .new_line: |
404 | mov ecx, [putimg.real_sx] |
404 | mov ecx, [putimg.real_sx] |
405 | 405 | ||
406 | .new_x: |
406 | .new_x: |
407 | push [putimg.edi] |
407 | push [putimg.edi] |
408 | mov eax, [putimg.ebp + 4] |
408 | mov eax, [putimg.ebp + 4] |
409 | call eax |
409 | call eax |
410 | 410 | ||
411 | cmp [ebp], bl |
411 | cmp [ebp], bl |
412 | jne .skip |
412 | jne .skip |
413 | 413 | ||
414 | push ecx |
414 | push ecx |
415 | .sh: |
415 | .sh: |
416 | neg ecx |
416 | neg ecx |
417 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
417 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
418 | 418 | ||
419 | ; check for X |
419 | ; check for X |
420 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
420 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
421 | jae .no_mouse_area |
421 | jae .no_mouse_area |
422 | 422 | ||
423 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
423 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
424 | jb .no_mouse_area |
424 | jb .no_mouse_area |
425 | 425 | ||
426 | shl ecx, 16 |
426 | shl ecx, 16 |
427 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
427 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
428 | sub ecx, edi |
428 | sub ecx, edi |
429 | 429 | ||
430 | ; check for Y |
430 | ; check for Y |
431 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
431 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
432 | jae .no_mouse_area |
432 | jae .no_mouse_area |
433 | 433 | ||
434 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
434 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
435 | jb .no_mouse_area |
435 | jb .no_mouse_area |
436 | 436 | ||
437 | ; check mouse area for putpixel |
437 | ; check mouse area for putpixel |
438 | call check_mouse_area_for_putpixel_new.1 |
438 | call check_mouse_area_for_putpixel_new.1 |
439 | cmp ecx, -1 ; SHIT HAPPENS? |
439 | cmp ecx, -1 ; SHIT HAPPENS? |
440 | jne .no_mouse_area |
440 | jne .no_mouse_area |
441 | 441 | ||
442 | mov ecx, [esp] |
442 | mov ecx, [esp] |
443 | jmp .sh |
443 | jmp .sh |
444 | 444 | ||
445 | .no_mouse_area: |
445 | .no_mouse_area: |
446 | pop ecx |
446 | pop ecx |
447 | ; convert to 16 bpp and store to LFB |
447 | ; convert to 16 bpp and store to LFB |
448 | and eax, 00000000111110001111110011111000b |
448 | and eax, 00000000111110001111110011111000b |
449 | shr ah, 2 |
449 | shr ah, 2 |
450 | shr ax, 3 |
450 | shr ax, 3 |
451 | ror eax, 8 |
451 | ror eax, 8 |
452 | add al, ah |
452 | add al, ah |
453 | rol eax, 8 |
453 | rol eax, 8 |
454 | mov [LFB_BASE+edx], ax |
454 | mov [LFB_BASE+edx], ax |
455 | 455 | ||
456 | .skip: |
456 | .skip: |
457 | add edx, 2 |
457 | add edx, 2 |
458 | inc ebp |
458 | inc ebp |
459 | dec ecx |
459 | dec ecx |
460 | jnz .new_x |
460 | jnz .new_x |
461 | 461 | ||
462 | add esi, [putimg.line_increment] |
462 | add esi, [putimg.line_increment] |
463 | add edx, [putimg.screen_newline] |
463 | add edx, [putimg.screen_newline] |
464 | add ebp, [putimg.winmap_newline] |
464 | add ebp, [putimg.winmap_newline] |
465 | 465 | ||
466 | cmp [putimg.ebp], putimage_get1bpp |
466 | cmp [putimg.ebp], putimage_get1bpp |
467 | jz .correct |
467 | jz .correct |
468 | cmp [putimg.ebp], putimage_get2bpp |
468 | cmp [putimg.ebp], putimage_get2bpp |
469 | jz .correct |
469 | jz .correct |
470 | cmp [putimg.ebp], putimage_get4bpp |
470 | cmp [putimg.ebp], putimage_get4bpp |
471 | jnz @f |
471 | jnz @f |
472 | 472 | ||
473 | .correct: |
473 | .correct: |
474 | mov eax, [putimg.edi] |
474 | mov eax, [putimg.edi] |
475 | mov byte [eax], 80h |
475 | mov byte [eax], 80h |
476 | 476 | ||
477 | @@: |
477 | @@: |
478 | dec edi |
478 | dec edi |
479 | jnz .new_line |
479 | jnz .new_line |
480 | jmp put_image_end_16.finish |
480 | jmp put_image_end_16.finish |
481 | 481 | ||
482 | ;------------------------------------------------------------------------------ |
482 | ;------------------------------------------------------------------------------ |
483 | 483 | ||
484 | align 4 |
484 | align 4 |
485 | put_image_end_24: |
485 | put_image_end_24: |
486 | 486 | ||
487 | mov edi, [putimg.real_sy] |
487 | mov edi, [putimg.real_sy] |
488 | 488 | ||
489 | ; check for hardware cursor |
489 | ; check for hardware cursor |
490 | mov ecx, [_display.select_cursor] |
490 | mov ecx, [_display.select_cursor] |
491 | cmp ecx, select_cursor |
491 | cmp ecx, select_cursor |
492 | je put_image_end_24_new |
492 | je put_image_end_24_new |
493 | cmp ecx, 0 |
493 | cmp ecx, 0 |
494 | je put_image_end_24_old |
494 | je put_image_end_24_old |
495 | .new_line: |
495 | .new_line: |
496 | mov ecx, [putimg.real_sx] |
496 | mov ecx, [putimg.real_sx] |
497 | .new_x: |
497 | .new_x: |
498 | push [putimg.edi] |
498 | push [putimg.edi] |
499 | mov eax, [putimg.ebp + 4] |
499 | mov eax, [putimg.ebp + 4] |
500 | call eax |
500 | call eax |
501 | cmp [ebp], bl |
501 | cmp [ebp], bl |
502 | jne .skip |
502 | jne .skip |
503 | 503 | ||
504 | ; store to LFB |
504 | ; store to LFB |
505 | mov [LFB_BASE + edx], ax |
505 | mov [LFB_BASE + edx], ax |
506 | shr eax, 16 |
506 | shr eax, 16 |
507 | mov [LFB_BASE + edx + 2], al |
507 | mov [LFB_BASE + edx + 2], al |
508 | 508 | ||
509 | .skip: |
509 | .skip: |
510 | add edx, 3 |
510 | add edx, 3 |
511 | inc ebp |
511 | inc ebp |
512 | dec ecx |
512 | dec ecx |
513 | jnz .new_x |
513 | jnz .new_x |
514 | 514 | ||
515 | add esi, [putimg.line_increment] |
515 | add esi, [putimg.line_increment] |
516 | add edx, [putimg.screen_newline] |
516 | add edx, [putimg.screen_newline] |
517 | add ebp, [putimg.winmap_newline] |
517 | add ebp, [putimg.winmap_newline] |
518 | 518 | ||
519 | cmp [putimg.ebp], putimage_get1bpp |
519 | cmp [putimg.ebp], putimage_get1bpp |
520 | jz .correct |
520 | jz .correct |
521 | cmp [putimg.ebp], putimage_get2bpp |
521 | cmp [putimg.ebp], putimage_get2bpp |
522 | jz .correct |
522 | jz .correct |
523 | cmp [putimg.ebp], putimage_get4bpp |
523 | cmp [putimg.ebp], putimage_get4bpp |
524 | jnz @f |
524 | jnz @f |
525 | .correct: |
525 | .correct: |
526 | mov eax, [putimg.edi] |
526 | mov eax, [putimg.edi] |
527 | mov byte [eax], 80h |
527 | mov byte [eax], 80h |
528 | @@: |
528 | @@: |
529 | dec edi |
529 | dec edi |
530 | jnz .new_line |
530 | jnz .new_line |
531 | .finish: |
531 | .finish: |
532 | add esp, putimg.stack_data |
532 | add esp, putimg.stack_data |
533 | popad |
533 | popad |
534 | ret |
534 | ret |
535 | 535 | ||
536 | ;------------------------------------------------------------------------------ |
536 | ;------------------------------------------------------------------------------ |
537 | 537 | ||
538 | align 4 |
538 | align 4 |
539 | put_image_end_24_old: |
539 | put_image_end_24_old: |
540 | 540 | ||
541 | .new_line: |
541 | .new_line: |
542 | mov ecx, [putimg.real_sx] |
542 | mov ecx, [putimg.real_sx] |
543 | ;-------------------------------------- |
543 | ;-------------------------------------- |
544 | align 4 |
544 | align 4 |
545 | .new_x: |
545 | .new_x: |
546 | push [putimg.edi] |
546 | push [putimg.edi] |
547 | mov eax, [putimg.ebp + 4] |
547 | mov eax, [putimg.ebp + 4] |
548 | call eax |
548 | call eax |
549 | cmp [ebp], bl |
549 | cmp [ebp], bl |
550 | jne .skip |
550 | jne .skip |
551 | 551 | ||
552 | push ecx |
552 | push ecx |
553 | neg ecx |
553 | neg ecx |
554 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
554 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
555 | shl ecx, 16 |
555 | shl ecx, 16 |
556 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
556 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
557 | sub ecx, edi |
557 | sub ecx, edi |
558 | 558 | ||
559 | ; check mouse area for putpixel |
559 | ; check mouse area for putpixel |
560 | call check_mouse_area_for_putpixel |
560 | call check_mouse_area_for_putpixel |
561 | pop ecx |
561 | pop ecx |
562 | ; store to LFB |
562 | ; store to LFB |
563 | mov [LFB_BASE + edx], ax |
563 | mov [LFB_BASE + edx], ax |
564 | shr eax, 16 |
564 | shr eax, 16 |
565 | mov [LFB_BASE + edx + 2], al |
565 | mov [LFB_BASE + edx + 2], al |
566 | 566 | ||
567 | .skip: |
567 | .skip: |
568 | add edx, 3 |
568 | add edx, 3 |
569 | inc ebp |
569 | inc ebp |
570 | dec ecx |
570 | dec ecx |
571 | jnz .new_x |
571 | jnz .new_x |
572 | 572 | ||
573 | add esi, [putimg.line_increment] |
573 | add esi, [putimg.line_increment] |
574 | add edx, [putimg.screen_newline] |
574 | add edx, [putimg.screen_newline] |
575 | add ebp, [putimg.winmap_newline] |
575 | add ebp, [putimg.winmap_newline] |
576 | 576 | ||
577 | cmp [putimg.ebp], putimage_get1bpp |
577 | cmp [putimg.ebp], putimage_get1bpp |
578 | jz .correct |
578 | jz .correct |
579 | cmp [putimg.ebp], putimage_get2bpp |
579 | cmp [putimg.ebp], putimage_get2bpp |
580 | jz .correct |
580 | jz .correct |
581 | cmp [putimg.ebp], putimage_get4bpp |
581 | cmp [putimg.ebp], putimage_get4bpp |
582 | jnz @f |
582 | jnz @f |
583 | 583 | ||
584 | .correct: |
584 | .correct: |
585 | mov eax, [putimg.edi] |
585 | mov eax, [putimg.edi] |
586 | mov byte [eax], 80h |
586 | mov byte [eax], 80h |
587 | 587 | ||
588 | @@: |
588 | @@: |
589 | dec edi |
589 | dec edi |
590 | jnz .new_line |
590 | jnz .new_line |
591 | jmp put_image_end_24.finish |
591 | jmp put_image_end_24.finish |
592 | 592 | ||
593 | ;------------------------------------------------------------------------------ |
593 | ;------------------------------------------------------------------------------ |
594 | 594 | ||
595 | align 4 |
595 | align 4 |
596 | put_image_end_24_new: |
596 | put_image_end_24_new: |
597 | 597 | ||
598 | .new_line: |
598 | .new_line: |
599 | mov ecx, [putimg.real_sx] |
599 | mov ecx, [putimg.real_sx] |
600 | 600 | ||
601 | .new_x: |
601 | .new_x: |
602 | push [putimg.edi] |
602 | push [putimg.edi] |
603 | mov eax, [putimg.ebp + 4] |
603 | mov eax, [putimg.ebp + 4] |
604 | call eax |
604 | call eax |
605 | cmp [ebp], bl |
605 | cmp [ebp], bl |
606 | jne .skip |
606 | jne .skip |
607 | 607 | ||
608 | push ecx |
608 | push ecx |
609 | .sh: |
609 | .sh: |
610 | neg ecx |
610 | neg ecx |
611 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
611 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
612 | 612 | ||
613 | ; check for X |
613 | ; check for X |
614 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
614 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
615 | jae .no_mouse_area |
615 | jae .no_mouse_area |
616 | 616 | ||
617 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
617 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
618 | jb .no_mouse_area |
618 | jb .no_mouse_area |
619 | 619 | ||
620 | shl ecx, 16 |
620 | shl ecx, 16 |
621 | 621 | ||
622 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
622 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
623 | sub ecx, edi |
623 | sub ecx, edi |
624 | 624 | ||
625 | ; check for Y |
625 | ; check for Y |
626 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
626 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
627 | jae .no_mouse_area |
627 | jae .no_mouse_area |
628 | 628 | ||
629 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
629 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
630 | jb .no_mouse_area |
630 | jb .no_mouse_area |
631 | 631 | ||
632 | ; check mouse area for putpixel |
632 | ; check mouse area for putpixel |
633 | call check_mouse_area_for_putpixel_new.1 |
633 | call check_mouse_area_for_putpixel_new.1 |
634 | cmp ecx, -1 ; SHIT HAPPENS? |
634 | cmp ecx, -1 ; SHIT HAPPENS? |
635 | jne .no_mouse_area |
635 | jne .no_mouse_area |
636 | 636 | ||
637 | mov ecx, [esp] |
637 | mov ecx, [esp] |
638 | jmp .sh |
638 | jmp .sh |
639 | 639 | ||
640 | .no_mouse_area: |
640 | .no_mouse_area: |
641 | pop ecx |
641 | pop ecx |
642 | 642 | ||
643 | ; store to LFB |
643 | ; store to LFB |
644 | mov [LFB_BASE + edx], ax |
644 | mov [LFB_BASE + edx], ax |
645 | shr eax, 16 |
645 | shr eax, 16 |
646 | mov [LFB_BASE + edx + 2], al |
646 | mov [LFB_BASE + edx + 2], al |
647 | 647 | ||
648 | .skip: |
648 | .skip: |
649 | add edx, 3 |
649 | add edx, 3 |
650 | inc ebp |
650 | inc ebp |
651 | dec ecx |
651 | dec ecx |
652 | jnz .new_x |
652 | jnz .new_x |
653 | 653 | ||
654 | add esi, [putimg.line_increment] |
654 | add esi, [putimg.line_increment] |
655 | add edx, [putimg.screen_newline] |
655 | add edx, [putimg.screen_newline] |
656 | add ebp, [putimg.winmap_newline] |
656 | add ebp, [putimg.winmap_newline] |
657 | 657 | ||
658 | cmp [putimg.ebp], putimage_get1bpp |
658 | cmp [putimg.ebp], putimage_get1bpp |
659 | jz .correct |
659 | jz .correct |
660 | cmp [putimg.ebp], putimage_get2bpp |
660 | cmp [putimg.ebp], putimage_get2bpp |
661 | jz .correct |
661 | jz .correct |
662 | cmp [putimg.ebp], putimage_get4bpp |
662 | cmp [putimg.ebp], putimage_get4bpp |
663 | jnz @f |
663 | jnz @f |
664 | 664 | ||
665 | .correct: |
665 | .correct: |
666 | mov eax, [putimg.edi] |
666 | mov eax, [putimg.edi] |
667 | mov byte [eax], 80h |
667 | mov byte [eax], 80h |
668 | 668 | ||
669 | @@: |
669 | @@: |
670 | dec edi |
670 | dec edi |
671 | jnz .new_line |
671 | jnz .new_line |
672 | jmp put_image_end_24.finish |
672 | jmp put_image_end_24.finish |
673 | 673 | ||
674 | ;------------------------------------------------------------------------------ |
674 | ;------------------------------------------------------------------------------ |
675 | 675 | ||
676 | align 4 |
676 | align 4 |
677 | put_image_end_32: |
677 | put_image_end_32: |
678 | 678 | ||
679 | mov edi, [putimg.real_sy] |
679 | mov edi, [putimg.real_sy] |
680 | 680 | ||
681 | ; check for hardware cursor |
681 | ; check for hardware cursor |
682 | mov ecx, [_display.select_cursor] |
682 | mov ecx, [_display.select_cursor] |
683 | cmp ecx, select_cursor |
683 | cmp ecx, select_cursor |
684 | je put_image_end_32_new |
684 | je put_image_end_32_new |
685 | cmp ecx, 0 |
685 | cmp ecx, 0 |
686 | je put_image_end_32_old |
686 | je put_image_end_32_old |
687 | 687 | ||
688 | .new_line: |
688 | .new_line: |
689 | mov ecx, [putimg.real_sx] |
689 | mov ecx, [putimg.real_sx] |
690 | 690 | ||
691 | .new_x: |
691 | .new_x: |
692 | push [putimg.edi] |
692 | push [putimg.edi] |
693 | mov eax, [putimg.ebp + 4] |
693 | mov eax, [putimg.ebp + 4] |
694 | call eax |
694 | call eax |
695 | cmp [ebp], bl |
695 | cmp [ebp], bl |
696 | jne .skip |
696 | jne .skip |
697 | 697 | ||
698 | ; store to LFB |
698 | ; store to LFB |
699 | mov [LFB_BASE + edx], eax |
699 | mov [LFB_BASE + edx], eax |
700 | 700 | ||
701 | .skip: |
701 | .skip: |
702 | add edx, 4 |
702 | add edx, 4 |
703 | inc ebp |
703 | inc ebp |
704 | dec ecx |
704 | dec ecx |
705 | jnz .new_x |
705 | jnz .new_x |
706 | 706 | ||
707 | add esi, [putimg.line_increment] |
707 | add esi, [putimg.line_increment] |
708 | add edx, [putimg.screen_newline] |
708 | add edx, [putimg.screen_newline] |
709 | add ebp, [putimg.winmap_newline] |
709 | add ebp, [putimg.winmap_newline] |
710 | 710 | ||
711 | cmp [putimg.ebp], putimage_get1bpp |
711 | cmp [putimg.ebp], putimage_get1bpp |
712 | jz .correct |
712 | jz .correct |
713 | cmp [putimg.ebp], putimage_get2bpp |
713 | cmp [putimg.ebp], putimage_get2bpp |
714 | jz .correct |
714 | jz .correct |
715 | cmp [putimg.ebp], putimage_get4bpp |
715 | cmp [putimg.ebp], putimage_get4bpp |
716 | jnz @f |
716 | jnz @f |
717 | 717 | ||
718 | .correct: |
718 | .correct: |
719 | mov eax, [putimg.edi] |
719 | mov eax, [putimg.edi] |
720 | mov byte [eax], 80h |
720 | mov byte [eax], 80h |
721 | 721 | ||
722 | @@: |
722 | @@: |
723 | dec edi |
723 | dec edi |
724 | jnz .new_line |
724 | jnz .new_line |
725 | 725 | ||
726 | .finish: |
726 | .finish: |
727 | add esp, putimg.stack_data |
727 | add esp, putimg.stack_data |
728 | popad |
728 | popad |
729 | cmp [SCR_MODE], 0x12 |
729 | cmp [SCR_MODE], 0x12 |
730 | jne @f |
730 | jne @f |
731 | call VGA__putimage |
731 | call VGA__putimage |
732 | @@: |
732 | @@: |
733 | mov [EGA_counter], 1 |
733 | mov [EGA_counter], 1 |
734 | ret |
734 | ret |
735 | 735 | ||
736 | ;------------------------------------------------------------------------------ |
736 | ;------------------------------------------------------------------------------ |
737 | 737 | ||
738 | align 4 |
738 | align 4 |
739 | put_image_end_32_old: |
739 | put_image_end_32_old: |
740 | 740 | ||
741 | .new_line: |
741 | .new_line: |
742 | mov ecx, [putimg.real_sx] |
742 | mov ecx, [putimg.real_sx] |
743 | .new_x: |
743 | .new_x: |
744 | push [putimg.edi] |
744 | push [putimg.edi] |
745 | mov eax, [putimg.ebp + 4] |
745 | mov eax, [putimg.ebp + 4] |
746 | call eax |
746 | call eax |
747 | cmp [ebp], bl |
747 | cmp [ebp], bl |
748 | jne .skip |
748 | jne .skip |
749 | 749 | ||
750 | push ecx |
750 | push ecx |
751 | neg ecx |
751 | neg ecx |
752 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
752 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
753 | shl ecx, 16 |
753 | shl ecx, 16 |
754 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
754 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
755 | sub ecx, edi |
755 | sub ecx, edi |
756 | 756 | ||
757 | ; check mouse area for putpixel |
757 | ; check mouse area for putpixel |
758 | call check_mouse_area_for_putpixel |
758 | call check_mouse_area_for_putpixel |
759 | pop ecx |
759 | pop ecx |
760 | ; store to LFB |
760 | ; store to LFB |
761 | mov [LFB_BASE+edx], eax |
761 | mov [LFB_BASE+edx], eax |
762 | 762 | ||
763 | .skip: |
763 | .skip: |
764 | add edx, 4 |
764 | add edx, 4 |
765 | inc ebp |
765 | inc ebp |
766 | dec ecx |
766 | dec ecx |
767 | jnz .new_x |
767 | jnz .new_x |
768 | 768 | ||
769 | add esi, [putimg.line_increment] |
769 | add esi, [putimg.line_increment] |
770 | add edx, [putimg.screen_newline] |
770 | add edx, [putimg.screen_newline] |
771 | add ebp, [putimg.winmap_newline] |
771 | add ebp, [putimg.winmap_newline] |
772 | 772 | ||
773 | cmp [putimg.ebp], putimage_get1bpp |
773 | cmp [putimg.ebp], putimage_get1bpp |
774 | jz .correct |
774 | jz .correct |
775 | cmp [putimg.ebp], putimage_get2bpp |
775 | cmp [putimg.ebp], putimage_get2bpp |
776 | jz .correct |
776 | jz .correct |
777 | cmp [putimg.ebp], putimage_get4bpp |
777 | cmp [putimg.ebp], putimage_get4bpp |
778 | jnz @f |
778 | jnz @f |
779 | 779 | ||
780 | .correct: |
780 | .correct: |
781 | mov eax, [putimg.edi] |
781 | mov eax, [putimg.edi] |
782 | mov byte [eax], 80h |
782 | mov byte [eax], 80h |
783 | 783 | ||
784 | @@: |
784 | @@: |
785 | dec edi |
785 | dec edi |
786 | jnz .new_line |
786 | jnz .new_line |
787 | jmp put_image_end_32.finish |
787 | jmp put_image_end_32.finish |
788 | 788 | ||
789 | ;------------------------------------------------------------------------------ |
789 | ;------------------------------------------------------------------------------ |
790 | 790 | ||
791 | align 4 |
791 | align 4 |
792 | put_image_end_32_new: |
792 | put_image_end_32_new: |
793 | 793 | ||
794 | .new_line: |
794 | .new_line: |
795 | mov ecx, [putimg.real_sx] |
795 | mov ecx, [putimg.real_sx] |
796 | 796 | ||
797 | .new_x: |
797 | .new_x: |
798 | push [putimg.edi] |
798 | push [putimg.edi] |
799 | mov eax, [putimg.ebp + 4] |
799 | mov eax, [putimg.ebp + 4] |
800 | call eax |
800 | call eax |
801 | cmp [ebp], bl |
801 | cmp [ebp], bl |
802 | jne .skip |
802 | jne .skip |
803 | 803 | ||
804 | push ecx |
804 | push ecx |
805 | 805 | ||
806 | .sh: |
806 | .sh: |
807 | neg ecx |
807 | neg ecx |
808 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
808 | add ecx, [putimg.real_sx_and_abs_cx + 4] |
809 | 809 | ||
810 | ; check for X |
810 | ; check for X |
811 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
811 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
812 | jae .no_mouse_area |
812 | jae .no_mouse_area |
813 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
813 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
814 | jb .no_mouse_area |
814 | jb .no_mouse_area |
815 | shl ecx, 16 |
815 | shl ecx, 16 |
816 | 816 | ||
817 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
817 | add ecx, [putimg.real_sy_and_abs_cy + 4] |
818 | sub ecx, edi |
818 | sub ecx, edi |
819 | 819 | ||
820 | ; check for Y |
820 | ; check for Y |
821 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
821 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
822 | jae .no_mouse_area |
822 | jae .no_mouse_area |
823 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
823 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
824 | jb .no_mouse_area |
824 | jb .no_mouse_area |
825 | 825 | ||
826 | ; check mouse area for putpixel |
826 | ; check mouse area for putpixel |
827 | call check_mouse_area_for_putpixel_new.1 |
827 | call check_mouse_area_for_putpixel_new.1 |
828 | cmp ecx, -1 ; SHIT HAPPENS? |
828 | cmp ecx, -1 ; SHIT HAPPENS? |
829 | jne .no_mouse_area |
829 | jne .no_mouse_area |
830 | 830 | ||
831 | mov ecx, [esp] |
831 | mov ecx, [esp] |
832 | jmp .sh |
832 | jmp .sh |
833 | 833 | ||
834 | .no_mouse_area: |
834 | .no_mouse_area: |
835 | pop ecx |
835 | pop ecx |
836 | 836 | ||
837 | ; store to LFB |
837 | ; store to LFB |
838 | mov [LFB_BASE+edx], eax |
838 | mov [LFB_BASE+edx], eax |
839 | 839 | ||
840 | .skip: |
840 | .skip: |
841 | add edx, 4 |
841 | add edx, 4 |
842 | inc ebp |
842 | inc ebp |
843 | dec ecx |
843 | dec ecx |
844 | jnz .new_x |
844 | jnz .new_x |
845 | 845 | ||
846 | add esi, [putimg.line_increment] |
846 | add esi, [putimg.line_increment] |
847 | add edx, [putimg.screen_newline] |
847 | add edx, [putimg.screen_newline] |
848 | add ebp, [putimg.winmap_newline] |
848 | add ebp, [putimg.winmap_newline] |
849 | 849 | ||
850 | cmp [putimg.ebp], putimage_get1bpp |
850 | cmp [putimg.ebp], putimage_get1bpp |
851 | jz .correct |
851 | jz .correct |
852 | cmp [putimg.ebp], putimage_get2bpp |
852 | cmp [putimg.ebp], putimage_get2bpp |
853 | jz .correct |
853 | jz .correct |
854 | cmp [putimg.ebp], putimage_get4bpp |
854 | cmp [putimg.ebp], putimage_get4bpp |
855 | jnz @f |
855 | jnz @f |
856 | 856 | ||
857 | .correct: |
857 | .correct: |
858 | mov eax, [putimg.edi] |
858 | mov eax, [putimg.edi] |
859 | mov byte [eax], 80h |
859 | mov byte [eax], 80h |
860 | 860 | ||
861 | @@: |
861 | @@: |
862 | dec edi |
862 | dec edi |
863 | jnz .new_line |
863 | jnz .new_line |
864 | jmp put_image_end_32.finish |
864 | jmp put_image_end_32.finish |
865 | 865 | ||
866 | ;------------------------------------------------------------------------------ |
866 | ;------------------------------------------------------------------------------ |
867 | ; eax = x coordinate |
867 | ; eax = x coordinate |
868 | ; ebx = y coordinate |
868 | ; ebx = y coordinate |
869 | ; ecx = xx RR GG BB |
869 | ; ecx = xx RR GG BB |
870 | ; xx flags: |
870 | ; xx flags: |
871 | ; 0x01000000 color inversion |
871 | ; 0x01000000 color inversion |
872 | ; 0x02000000 used for draw_rectangle without top line (for drawwindow_III and drawwindow_IV) |
872 | ; 0x02000000 used for draw_rectangle without top line (for drawwindow_III and drawwindow_IV) |
873 | ; edi = 0x00000001 force |
873 | ; edi = 0x00000001 force |
874 | 874 | ||
875 | align 4 |
875 | align 4 |
876 | __sys_putpixel: |
876 | __sys_putpixel: |
877 | 877 | ||
878 | pushad |
878 | pushad |
879 | cmp eax, [_display.width] |
879 | cmp eax, [_display.width] |
880 | jge .exit |
880 | jge .exit |
881 | cmp ebx, [_display.height] |
881 | cmp ebx, [_display.height] |
882 | jge .exit |
882 | jge .exit |
883 | test edi, 1 ; force ? |
883 | test edi, 1 ; force ? |
884 | jnz .forced |
884 | jnz .forced |
885 | 885 | ||
886 | ; not forced |
886 | ; not forced |
887 | mov edx, [d_width_calc_area + ebx*4] |
887 | mov edx, [d_width_calc_area + ebx*4] |
888 | add edx, [_display.win_map] |
888 | add edx, [_display.win_map] |
889 | movzx edx, byte [eax+edx] |
889 | movzx edx, byte [eax+edx] |
890 | cmp edx, [current_slot_idx] |
890 | cmp edx, [current_slot_idx] |
891 | jne .exit |
891 | jne .exit |
892 | 892 | ||
893 | .forced: |
893 | .forced: |
894 | ; check for color inversion |
894 | ; check for color inversion |
895 | test ecx, 0x01000000 |
895 | test ecx, 0x01000000 |
896 | jz .no_inv |
896 | jz .no_inv |
897 | 897 | ||
898 | push eax ebx edx edi |
898 | push eax ebx edx edi |
899 | call [GETPIXEL] |
899 | call [GETPIXEL] |
900 | pop edi edx ebx eax |
900 | pop edi edx ebx eax |
901 | 901 | ||
902 | not ecx |
902 | not ecx |
903 | rol ecx, 8 |
903 | rol ecx, 8 |
904 | mov cl, [esp + 32-8+3] |
904 | mov cl, [esp + 32-8+3] |
905 | ror ecx, 8 |
905 | ror ecx, 8 |
906 | mov [esp + 32-8], ecx |
906 | mov [esp + 32-8], ecx |
907 | .no_inv: |
907 | .no_inv: |
908 | call [PUTPIXEL] ; call the real put_pixel function |
908 | call [PUTPIXEL] ; call the real put_pixel function |
909 | .exit: |
909 | .exit: |
910 | popad |
910 | popad |
911 | ret |
911 | ret |
912 | 912 | ||
913 | ;----------------------------------------------------------------------------- |
913 | ;----------------------------------------------------------------------------- |
914 | ; eax = x |
914 | ; eax = x |
915 | ; ebx = y |
915 | ; ebx = y |
916 | 916 | ||
917 | align 4 |
917 | align 4 |
918 | Vesa20_putpixel16: |
918 | Vesa20_putpixel16: |
919 | 919 | ||
920 | mov ecx, eax |
920 | mov ecx, eax |
921 | shl ecx, 16 |
921 | shl ecx, 16 |
922 | mov cx, bx |
922 | mov cx, bx |
923 | 923 | ||
924 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
924 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
925 | mov ebx, [BPSLine_calc_area + ebx*4] |
925 | mov ebx, [BPSLine_calc_area + ebx*4] |
926 | lea edi, [eax*2]; edi = x*2 |
926 | lea edi, [eax*2]; edi = x*2 |
927 | mov eax, [esp + 32-8+4] |
927 | mov eax, [esp + 32-8+4] |
928 | 928 | ||
929 | ; check for hardware cursor |
929 | ; check for hardware cursor |
930 | cmp [_display.select_cursor], 0 |
930 | cmp [_display.select_cursor], 0 |
931 | jne @f |
931 | jne @f |
932 | ; check mouse area for putpixel |
932 | ; check mouse area for putpixel |
933 | test eax, 0x04000000 |
933 | test eax, 0x04000000 |
934 | jnz @f |
934 | jnz @f |
935 | call check_mouse_area_for_putpixel |
935 | call check_mouse_area_for_putpixel |
936 | @@: |
936 | @@: |
937 | ; store to LFB |
937 | ; store to LFB |
938 | and eax, 00000000111110001111110011111000b |
938 | and eax, 00000000111110001111110011111000b |
939 | shr ah, 2 |
939 | shr ah, 2 |
940 | shr ax, 3 |
940 | shr ax, 3 |
941 | ror eax, 8 |
941 | ror eax, 8 |
942 | add al, ah |
942 | add al, ah |
943 | rol eax, 8 |
943 | rol eax, 8 |
944 | 944 | ||
945 | mov [LFB_BASE + ebx + edi], ax |
945 | mov [LFB_BASE + ebx + edi], ax |
946 | ret |
946 | ret |
947 | 947 | ||
948 | ;----------------------------------------------------------------------------- |
948 | ;----------------------------------------------------------------------------- |
949 | ; eax = x |
949 | ; eax = x |
950 | ; ebx = y |
950 | ; ebx = y |
951 | 951 | ||
952 | align 4 |
952 | align 4 |
953 | Vesa20_putpixel16_new: |
953 | Vesa20_putpixel16_new: |
954 | 954 | ||
955 | mov ecx, eax |
955 | mov ecx, eax |
956 | shl ecx, 16 |
956 | shl ecx, 16 |
957 | mov cx, bx |
957 | mov cx, bx |
958 | 958 | ||
959 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
959 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
960 | mov ebx, [BPSLine_calc_area + ebx*4] |
960 | mov ebx, [BPSLine_calc_area + ebx*4] |
961 | lea edi, [eax*2]; edi = x*2 |
961 | lea edi, [eax*2]; edi = x*2 |
962 | mov eax, [esp + 32-8+4] |
962 | mov eax, [esp + 32-8+4] |
963 | 963 | ||
964 | ; check for hardware cursor |
964 | ; check for hardware cursor |
965 | cmp [_display.select_cursor], select_cursor |
965 | cmp [_display.select_cursor], select_cursor |
966 | jne @f |
966 | jne @f |
967 | ; check mouse area for putpixel |
967 | ; check mouse area for putpixel |
968 | test eax, 0x04000000 |
968 | test eax, 0x04000000 |
969 | jnz @f |
969 | jnz @f |
970 | 970 | ||
971 | ; check for Y |
971 | ; check for Y |
972 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
972 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
973 | jae @f |
973 | jae @f |
974 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
974 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
975 | jb @f |
975 | jb @f |
976 | rol ecx, 16 |
976 | rol ecx, 16 |
977 | 977 | ||
978 | ; check for X |
978 | ; check for X |
979 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
979 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
980 | jae @f |
980 | jae @f |
981 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
981 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
982 | jb @f |
982 | jb @f |
983 | ror ecx, 16 |
983 | ror ecx, 16 |
984 | 984 | ||
985 | call check_mouse_area_for_putpixel_new.1 |
985 | call check_mouse_area_for_putpixel_new.1 |
986 | @@: |
986 | @@: |
987 | ; store to LFB |
987 | ; store to LFB |
988 | and eax, 00000000111110001111110011111000b |
988 | and eax, 00000000111110001111110011111000b |
989 | shr ah, 2 |
989 | shr ah, 2 |
990 | shr ax, 3 |
990 | shr ax, 3 |
991 | ror eax, 8 |
991 | ror eax, 8 |
992 | add al, ah |
992 | add al, ah |
993 | rol eax, 8 |
993 | rol eax, 8 |
994 | 994 | ||
995 | mov [LFB_BASE + ebx + edi], ax |
995 | mov [LFB_BASE + ebx + edi], ax |
996 | ret |
996 | ret |
997 | 997 | ||
998 | ;----------------------------------------------------------------------------- |
998 | ;----------------------------------------------------------------------------- |
999 | ; eax = x |
999 | ; eax = x |
1000 | ; ebx = y |
1000 | ; ebx = y |
1001 | 1001 | ||
1002 | align 4 |
1002 | align 4 |
1003 | Vesa20_putpixel24: |
1003 | Vesa20_putpixel24: |
1004 | 1004 | ||
1005 | mov ecx, eax |
1005 | mov ecx, eax |
1006 | shl ecx, 16 |
1006 | shl ecx, 16 |
1007 | mov cx, bx |
1007 | mov cx, bx |
1008 | 1008 | ||
1009 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1009 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1010 | mov ebx, [BPSLine_calc_area + ebx*4] |
1010 | mov ebx, [BPSLine_calc_area + ebx*4] |
1011 | lea edi, [eax + eax*2]; edi = x*3 |
1011 | lea edi, [eax + eax*2]; edi = x*3 |
1012 | mov eax, [esp + 32-8+4] |
1012 | mov eax, [esp + 32-8+4] |
1013 | 1013 | ||
1014 | ; check for hardware cursor |
1014 | ; check for hardware cursor |
1015 | cmp [_display.select_cursor], 0 |
1015 | cmp [_display.select_cursor], 0 |
1016 | jne @f |
1016 | jne @f |
1017 | ; check mouse area for putpixel |
1017 | ; check mouse area for putpixel |
1018 | test eax, 0x04000000 |
1018 | test eax, 0x04000000 |
1019 | jnz @f |
1019 | jnz @f |
1020 | call check_mouse_area_for_putpixel |
1020 | call check_mouse_area_for_putpixel |
1021 | @@: |
1021 | @@: |
1022 | 1022 | ||
1023 | ; store to LFB |
1023 | ; store to LFB |
1024 | mov [LFB_BASE + ebx + edi], ax |
1024 | mov [LFB_BASE + ebx + edi], ax |
1025 | shr eax, 16 |
1025 | shr eax, 16 |
1026 | mov [LFB_BASE + ebx + edi + 2], al |
1026 | mov [LFB_BASE + ebx + edi + 2], al |
1027 | ret |
1027 | ret |
1028 | 1028 | ||
1029 | ;----------------------------------------------------------------------------- |
1029 | ;----------------------------------------------------------------------------- |
1030 | ; eax = x |
1030 | ; eax = x |
1031 | ; ebx = y |
1031 | ; ebx = y |
1032 | 1032 | ||
1033 | align 4 |
1033 | align 4 |
1034 | Vesa20_putpixel24_new: |
1034 | Vesa20_putpixel24_new: |
1035 | 1035 | ||
1036 | mov ecx, eax |
1036 | mov ecx, eax |
1037 | shl ecx, 16 |
1037 | shl ecx, 16 |
1038 | mov cx, bx |
1038 | mov cx, bx |
1039 | 1039 | ||
1040 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1040 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1041 | mov ebx, [BPSLine_calc_area+ebx*4] |
1041 | mov ebx, [BPSLine_calc_area+ebx*4] |
1042 | lea edi, [eax + eax*2]; edi = x*3 |
1042 | lea edi, [eax + eax*2]; edi = x*3 |
1043 | mov eax, [esp + 32-8+4] |
1043 | mov eax, [esp + 32-8+4] |
1044 | 1044 | ||
1045 | ; check for hardware cursor |
1045 | ; check for hardware cursor |
1046 | cmp [_display.select_cursor], select_cursor |
1046 | cmp [_display.select_cursor], select_cursor |
1047 | jne @f |
1047 | jne @f |
1048 | ; check mouse area for putpixel |
1048 | ; check mouse area for putpixel |
1049 | test eax, 0x04000000 |
1049 | test eax, 0x04000000 |
1050 | jnz @f |
1050 | jnz @f |
1051 | 1051 | ||
1052 | ; check for Y |
1052 | ; check for Y |
1053 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1053 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1054 | jae @f |
1054 | jae @f |
1055 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1055 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1056 | jb @f |
1056 | jb @f |
1057 | rol ecx, 16 |
1057 | rol ecx, 16 |
1058 | 1058 | ||
1059 | ; check for X |
1059 | ; check for X |
1060 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1060 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1061 | jae @f |
1061 | jae @f |
1062 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1062 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1063 | jb @f |
1063 | jb @f |
1064 | ror ecx, 16 |
1064 | ror ecx, 16 |
1065 | 1065 | ||
1066 | call check_mouse_area_for_putpixel_new.1 |
1066 | call check_mouse_area_for_putpixel_new.1 |
1067 | @@: |
1067 | @@: |
1068 | ; store to LFB |
1068 | ; store to LFB |
1069 | mov [LFB_BASE + ebx + edi], ax |
1069 | mov [LFB_BASE + ebx + edi], ax |
1070 | shr eax, 16 |
1070 | shr eax, 16 |
1071 | mov [LFB_BASE + ebx + edi + 2], al |
1071 | mov [LFB_BASE + ebx + edi + 2], al |
1072 | ret |
1072 | ret |
1073 | 1073 | ||
1074 | ;----------------------------------------------------------------------------- |
1074 | ;----------------------------------------------------------------------------- |
1075 | ; eax = x |
1075 | ; eax = x |
1076 | ; ebx = y |
1076 | ; ebx = y |
1077 | 1077 | ||
1078 | align 4 |
1078 | align 4 |
1079 | Vesa20_putpixel32: |
1079 | Vesa20_putpixel32: |
1080 | 1080 | ||
1081 | mov ecx, eax |
1081 | mov ecx, eax |
1082 | shl ecx, 16 |
1082 | shl ecx, 16 |
1083 | mov cx, bx |
1083 | mov cx, bx |
1084 | 1084 | ||
1085 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1085 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1086 | mov ebx, [BPSLine_calc_area+ebx*4] |
1086 | mov ebx, [BPSLine_calc_area+ebx*4] |
1087 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
1087 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
1088 | mov eax, [esp + 32-8+4] ; eax = color |
1088 | mov eax, [esp + 32-8+4] ; eax = color |
1089 | 1089 | ||
1090 | ; check for hardware cursor |
1090 | ; check for hardware cursor |
1091 | cmp [_display.select_cursor], 0 |
1091 | cmp [_display.select_cursor], 0 |
1092 | jne @f |
1092 | jne @f |
1093 | ; check mouse area for putpixel |
1093 | ; check mouse area for putpixel |
1094 | test eax, 0x04000000 |
1094 | test eax, 0x04000000 |
1095 | jnz @f |
1095 | jnz @f |
1096 | call check_mouse_area_for_putpixel |
1096 | call check_mouse_area_for_putpixel |
1097 | @@: |
1097 | @@: |
1098 | and eax, 0xffffff |
1098 | and eax, 0xffffff |
1099 | ; store to LFB |
1099 | ; store to LFB |
1100 | mov [LFB_BASE + edi], eax |
1100 | mov [LFB_BASE + edi], eax |
1101 | ret |
1101 | ret |
1102 | 1102 | ||
1103 | ;----------------------------------------------------------------------------- |
1103 | ;----------------------------------------------------------------------------- |
1104 | ; eax = x |
1104 | ; eax = x |
1105 | ; ebx = y |
1105 | ; ebx = y |
1106 | 1106 | ||
1107 | align 4 |
1107 | align 4 |
1108 | Vesa20_putpixel32_new: |
1108 | Vesa20_putpixel32_new: |
1109 | 1109 | ||
1110 | mov ecx, eax |
1110 | mov ecx, eax |
1111 | shl ecx, 16 |
1111 | shl ecx, 16 |
1112 | mov cx, bx |
1112 | mov cx, bx |
1113 | 1113 | ||
1114 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1114 | ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier |
1115 | mov ebx, [BPSLine_calc_area+ebx*4] |
1115 | mov ebx, [BPSLine_calc_area+ebx*4] |
1116 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
1116 | lea edi, [ebx + eax*4] ; edi = x*4+(y*y multiplier) |
1117 | mov eax, [esp + 32-8+4] ; eax = color |
1117 | mov eax, [esp + 32-8+4] ; eax = color |
1118 | 1118 | ||
1119 | ; check for hardware cursor |
1119 | ; check for hardware cursor |
1120 | cmp [_display.select_cursor], select_cursor |
1120 | cmp [_display.select_cursor], select_cursor |
1121 | jne @f |
1121 | jne @f |
1122 | ; check mouse area for putpixel |
1122 | ; check mouse area for putpixel |
1123 | test eax, 0x04000000 |
1123 | test eax, 0x04000000 |
1124 | jnz @f |
1124 | jnz @f |
1125 | 1125 | ||
1126 | ; check for Y |
1126 | ; check for Y |
1127 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1127 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1128 | jae @f |
1128 | jae @f |
1129 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1129 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1130 | jb @f |
1130 | jb @f |
1131 | rol ecx, 16 |
1131 | rol ecx, 16 |
1132 | 1132 | ||
1133 | ; check for X |
1133 | ; check for X |
1134 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1134 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1135 | jae @f |
1135 | jae @f |
1136 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1136 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1137 | jb @f |
1137 | jb @f |
1138 | ror ecx, 16 |
1138 | ror ecx, 16 |
1139 | 1139 | ||
1140 | call check_mouse_area_for_putpixel_new.1 |
1140 | call check_mouse_area_for_putpixel_new.1 |
1141 | @@: |
1141 | @@: |
1142 | and eax, 0x00ffffff |
1142 | and eax, 0x00ffffff |
1143 | ; store to LFB |
1143 | ; store to LFB |
1144 | mov [LFB_BASE + edi], eax |
1144 | mov [LFB_BASE + edi], eax |
1145 | ret |
1145 | ret |
1146 | 1146 | ||
1147 | ;----------------------------------------------------------------------------- |
1147 | ;----------------------------------------------------------------------------- |
1148 | 1148 | ||
1149 | align 4 |
1149 | align 4 |
1150 | calculate_edi: |
1150 | calculate_edi: |
1151 | ; mov edi, ebx |
1151 | ; mov edi, ebx |
1152 | ; imul edi, [Screen_Max_X] |
1152 | ; imul edi, [Screen_Max_X] |
1153 | ; add edi, ebx |
1153 | ; add edi, ebx |
1154 | mov edi, [d_width_calc_area + ebx*4] |
1154 | mov edi, [d_width_calc_area + ebx*4] |
1155 | add edi, eax |
1155 | add edi, eax |
1156 | ret |
1156 | ret |
1157 | 1157 | ||
1158 | 1158 | ||
1159 | ;----------------------------------------------------------------------------- |
1159 | ;----------------------------------------------------------------------------- |
1160 | ; DRAWLINE |
1160 | ; DRAWLINE |
1161 | ;----------------------------------------------------------------------------- |
1161 | ;----------------------------------------------------------------------------- |
1162 | ; eax = x1 shl 16 + x2 |
1162 | ; eax = x1 shl 16 + x2 |
1163 | ; ebx = y1 shl 16 + y2 |
1163 | ; ebx = y1 shl 16 + y2 |
1164 | ; ecx = color |
1164 | ; ecx = color |
1165 | ; edi = force ? |
1165 | ; edi = force ? |
1166 | 1166 | ||
1167 | align 4 |
1167 | align 4 |
1168 | __sys_draw_line: |
1168 | __sys_draw_line: |
1169 | 1169 | ||
1170 | dl_x1 equ esp+20 |
1170 | dl_x1 equ esp+20 |
1171 | dl_y1 equ esp+16 |
1171 | dl_y1 equ esp+16 |
1172 | dl_x2 equ esp+12 |
1172 | dl_x2 equ esp+12 |
1173 | dl_y2 equ esp+8 |
1173 | dl_y2 equ esp+8 |
1174 | dl_dx equ esp+4 |
1174 | dl_dx equ esp+4 |
1175 | dl_dy equ esp+0 |
1175 | dl_dy equ esp+0 |
1176 | 1176 | ||
1177 | pusha |
1177 | pusha |
1178 | 1178 | ||
1179 | xor edx, edx ; clear edx |
1179 | xor edx, edx ; clear edx |
1180 | xor esi, esi ; unpack arguments |
1180 | xor esi, esi ; unpack arguments |
1181 | xor ebp, ebp |
1181 | xor ebp, ebp |
1182 | mov si, ax ; esi = x2 |
1182 | mov si, ax ; esi = x2 |
1183 | mov bp, bx ; ebp = y2 |
1183 | mov bp, bx ; ebp = y2 |
1184 | shr eax, 16 ; eax = x1 |
1184 | shr eax, 16 ; eax = x1 |
1185 | shr ebx, 16 ; ebx = y1 |
1185 | shr ebx, 16 ; ebx = y1 |
1186 | push eax ; save x1 |
1186 | push eax ; save x1 |
1187 | push ebx ; save y1 |
1187 | push ebx ; save y1 |
1188 | push esi ; save x2 |
1188 | push esi ; save x2 |
1189 | push ebp ; save y2 |
1189 | push ebp ; save y2 |
1190 | ; checking x-axis... |
1190 | ; checking x-axis... |
1191 | sub esi, eax ; esi = x2-x1 |
1191 | sub esi, eax ; esi = x2-x1 |
1192 | push esi ; save y2-y1 |
1192 | push esi ; save y2-y1 |
1193 | jl .x2lx1 ; is x2 less than x1 ? |
1193 | jl .x2lx1 ; is x2 less than x1 ? |
1194 | jg .no_vline ; x1 > x2 ? |
1194 | jg .no_vline ; x1 > x2 ? |
1195 | mov edx, ebp ; else (if x1=x2) |
1195 | mov edx, ebp ; else (if x1=x2) |
1196 | call vline |
1196 | call vline |
1197 | push edx ; necessary to rightly restore stack frame at .exit |
1197 | push edx ; necessary to rightly restore stack frame at .exit |
1198 | jmp .exit |
1198 | jmp .exit |
1199 | 1199 | ||
1200 | .x2lx1: |
1200 | .x2lx1: |
1201 | neg esi ; get esi absolute value |
1201 | neg esi ; get esi absolute value |
1202 | 1202 | ||
1203 | .no_vline: |
1203 | .no_vline: |
1204 | ; checking y-axis... |
1204 | ; checking y-axis... |
1205 | sub ebp, ebx ; ebp = y2-y1 |
1205 | sub ebp, ebx ; ebp = y2-y1 |
1206 | push ebp ; save y2-y1 |
1206 | push ebp ; save y2-y1 |
1207 | jl .y2ly1 ; is y2 less than y1 ? |
1207 | jl .y2ly1 ; is y2 less than y1 ? |
1208 | jg .no_hline ; y1 > y2 ? |
1208 | jg .no_hline ; y1 > y2 ? |
1209 | mov edx, [dl_x2] ; else (if y1=y2) |
1209 | mov edx, [dl_x2] ; else (if y1=y2) |
1210 | call hline |
1210 | call hline |
1211 | jmp .exit |
1211 | jmp .exit |
1212 | 1212 | ||
1213 | .y2ly1: |
1213 | .y2ly1: |
1214 | neg ebp ; get ebp absolute value |
1214 | neg ebp ; get ebp absolute value |
1215 | 1215 | ||
1216 | .no_hline: |
1216 | .no_hline: |
1217 | cmp ebp, esi |
1217 | cmp ebp, esi |
1218 | jle .x_rules ; |y2-y1| < |x2-x1| ? |
1218 | jle .x_rules ; |y2-y1| < |x2-x1| ? |
1219 | cmp [dl_y2], ebx ; make sure y1 is at the begining |
1219 | cmp [dl_y2], ebx ; make sure y1 is at the begining |
1220 | jge .no_reverse1 |
1220 | jge .no_reverse1 |
1221 | neg dword [dl_dx] |
1221 | neg dword [dl_dx] |
1222 | mov edx, [dl_x2] |
1222 | mov edx, [dl_x2] |
1223 | mov [dl_x2], eax |
1223 | mov [dl_x2], eax |
1224 | mov [dl_x1], edx |
1224 | mov [dl_x1], edx |
1225 | mov edx, [dl_y2] |
1225 | mov edx, [dl_y2] |
1226 | mov [dl_y2], ebx |
1226 | mov [dl_y2], ebx |
1227 | mov [dl_y1], edx |
1227 | mov [dl_y1], edx |
1228 | 1228 | ||
1229 | .no_reverse1: |
1229 | .no_reverse1: |
1230 | mov eax, [dl_dx] |
1230 | mov eax, [dl_dx] |
1231 | cdq ; extend eax sing to edx |
1231 | cdq ; extend eax sing to edx |
1232 | shl eax, 16 ; using 16bit fix-point maths |
1232 | shl eax, 16 ; using 16bit fix-point maths |
1233 | idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
1233 | idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1) |
1234 | 1234 | ||
1235 | ; correction for the remainder of the division |
1235 | ; correction for the remainder of the division |
1236 | shl edx, 1 |
1236 | shl edx, 1 |
1237 | cmp ebp, edx |
1237 | cmp ebp, edx |
1238 | jb @f |
1238 | jb @f |
1239 | inc eax |
1239 | inc eax |
1240 | @@: |
1240 | @@: |
1241 | mov edx, ebp ; edx = counter (number of pixels to draw) |
1241 | mov edx, ebp ; edx = counter (number of pixels to draw) |
1242 | mov ebp, 1 shl 16 ; ebp = dy = 1.0 |
1242 | mov ebp, 1 shl 16 ; ebp = dy = 1.0 |
1243 | mov esi, eax ; esi = dx |
1243 | mov esi, eax ; esi = dx |
1244 | jmp .y_rules |
1244 | jmp .y_rules |
1245 | .x_rules: |
1245 | .x_rules: |
1246 | cmp [dl_x2], eax ; make sure x1 is at the begining |
1246 | cmp [dl_x2], eax ; make sure x1 is at the begining |
1247 | jge .no_reverse2 |
1247 | jge .no_reverse2 |
1248 | neg dword [dl_dy] |
1248 | neg dword [dl_dy] |
1249 | mov edx, [dl_x2] |
1249 | mov edx, [dl_x2] |
1250 | mov [dl_x2], eax |
1250 | mov [dl_x2], eax |
1251 | mov [dl_x1], edx |
1251 | mov [dl_x1], edx |
1252 | mov edx, [dl_y2] |
1252 | mov edx, [dl_y2] |
1253 | mov [dl_y2], ebx |
1253 | mov [dl_y2], ebx |
1254 | mov [dl_y1], edx |
1254 | mov [dl_y1], edx |
1255 | .no_reverse2: |
1255 | .no_reverse2: |
1256 | xor edx, edx |
1256 | xor edx, edx |
1257 | mov eax, [dl_dy] |
1257 | mov eax, [dl_dy] |
1258 | cdq ; extend eax sing to edx |
1258 | cdq ; extend eax sing to edx |
1259 | shl eax, 16 ; using 16bit fix-point maths |
1259 | shl eax, 16 ; using 16bit fix-point maths |
1260 | idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
1260 | idiv esi ; eax = ((y2-y1)*65536)/(x2-x1) |
1261 | ; correction for the remainder of the division |
1261 | ; correction for the remainder of the division |
1262 | shl edx, 1 |
1262 | shl edx, 1 |
1263 | cmp esi, edx |
1263 | cmp esi, edx |
1264 | jb @f |
1264 | jb @f |
1265 | inc eax |
1265 | inc eax |
1266 | @@: |
1266 | @@: |
1267 | mov edx, esi ; edx = counter (number of pixels to draw) |
1267 | mov edx, esi ; edx = counter (number of pixels to draw) |
1268 | mov esi, 1 shl 16 ; esi = dx = 1.0 |
1268 | mov esi, 1 shl 16 ; esi = dx = 1.0 |
1269 | mov ebp, eax ; ebp = dy |
1269 | mov ebp, eax ; ebp = dy |
1270 | 1270 | ||
1271 | .y_rules: |
1271 | .y_rules: |
1272 | mov eax, [dl_x1] |
1272 | mov eax, [dl_x1] |
1273 | mov ebx, [dl_y1] |
1273 | mov ebx, [dl_y1] |
1274 | shl eax, 16 |
1274 | shl eax, 16 |
1275 | shl ebx, 16 |
1275 | shl ebx, 16 |
1276 | 1276 | ||
1277 | and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area |
1277 | and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area |
1278 | .draw: |
1278 | .draw: |
1279 | push eax ebx |
1279 | push eax ebx |
1280 | 1280 | ||
1281 | ; correction for the remainder of the division |
1281 | ; correction for the remainder of the division |
1282 | test ah, 0x80 |
1282 | test ah, 0x80 |
1283 | jz @f |
1283 | jz @f |
1284 | add eax, 1 shl 16 |
1284 | add eax, 1 shl 16 |
1285 | @@: |
1285 | @@: |
1286 | shr eax, 16 |
1286 | shr eax, 16 |
1287 | ; correction for the remainder of the division |
1287 | ; correction for the remainder of the division |
1288 | test bh, 0x80 |
1288 | test bh, 0x80 |
1289 | jz @f |
1289 | jz @f |
1290 | add ebx, 1 shl 16 |
1290 | add ebx, 1 shl 16 |
1291 | @@: |
1291 | @@: |
1292 | shr ebx, 16 |
1292 | shr ebx, 16 |
1293 | ; and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area |
1293 | ; and ecx, 0xFBFFFFFF ; negate 0x04000000 save to mouseunder area |
1294 | ; call [putpixel] |
1294 | ; call [putpixel] |
1295 | call __sys_putpixel |
1295 | call __sys_putpixel |
1296 | pop ebx eax |
1296 | pop ebx eax |
1297 | add ebx, ebp ; y = y+dy |
1297 | add ebx, ebp ; y = y+dy |
1298 | add eax, esi ; x = x+dx |
1298 | add eax, esi ; x = x+dx |
1299 | dec edx |
1299 | dec edx |
1300 | jnz .draw |
1300 | jnz .draw |
1301 | ; force last drawn pixel to be at (x2,y2) |
1301 | ; force last drawn pixel to be at (x2,y2) |
1302 | mov eax, [dl_x2] |
1302 | mov eax, [dl_x2] |
1303 | mov ebx, [dl_y2] |
1303 | mov ebx, [dl_y2] |
1304 | ; and ecx, 0xFBFFFFFF ;n egate 0x04000000 save to mouseunder area |
1304 | ; and ecx, 0xFBFFFFFF ;n egate 0x04000000 save to mouseunder area |
1305 | ; call [putpixel] |
1305 | ; call [putpixel] |
1306 | call __sys_putpixel |
1306 | call __sys_putpixel |
1307 | 1307 | ||
1308 | .exit: |
1308 | .exit: |
1309 | add esp, 6*4 |
1309 | add esp, 6*4 |
1310 | popa |
1310 | popa |
1311 | ; call [draw_pointer] |
1311 | ; call [draw_pointer] |
1312 | ret |
1312 | ret |
1313 | 1313 | ||
1314 | ;------------------------------------------------------------------------------ |
1314 | ;------------------------------------------------------------------------------ |
1315 | ; draw an horizontal line |
1315 | ; draw an horizontal line |
1316 | ; eax = x1 |
1316 | ; eax = x1 |
1317 | ; edx = x2 |
1317 | ; edx = x2 |
1318 | ; ebx = y |
1318 | ; ebx = y |
1319 | ; ecx = color |
1319 | ; ecx = color |
1320 | ; edi = force ? |
1320 | ; edi = force ? |
1321 | 1321 | ||
1322 | align 4 |
1322 | align 4 |
1323 | hline: |
1323 | hline: |
1324 | 1324 | ||
1325 | push eax edx |
1325 | push eax edx |
1326 | cmp edx, eax ; make sure x2 is above x1 |
1326 | cmp edx, eax ; make sure x2 is above x1 |
1327 | jge @f |
1327 | jge @f |
1328 | xchg eax, edx |
1328 | xchg eax, edx |
1329 | @@: |
1329 | @@: |
1330 | and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
1330 | and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
1331 | @@: |
1331 | @@: |
1332 | ; call [putpixel] |
1332 | ; call [putpixel] |
1333 | call __sys_putpixel |
1333 | call __sys_putpixel |
1334 | inc eax |
1334 | inc eax |
1335 | cmp eax, edx |
1335 | cmp eax, edx |
1336 | jle @b |
1336 | jle @b |
1337 | pop edx eax |
1337 | pop edx eax |
1338 | ret |
1338 | ret |
1339 | 1339 | ||
1340 | ;------------------------------------------------------------------------------ |
1340 | ;------------------------------------------------------------------------------ |
1341 | ; draw a vertical line |
1341 | ; draw a vertical line |
1342 | ; eax = x |
1342 | ; eax = x |
1343 | ; ebx = y1 |
1343 | ; ebx = y1 |
1344 | ; edx = y2 |
1344 | ; edx = y2 |
1345 | ; ecx = color |
1345 | ; ecx = color |
1346 | ; edi = force ? |
1346 | ; edi = force ? |
1347 | 1347 | ||
1348 | align 4 |
1348 | align 4 |
1349 | vline: |
1349 | vline: |
1350 | 1350 | ||
1351 | push ebx edx |
1351 | push ebx edx |
1352 | cmp edx, ebx ; make sure y2 is above y1 |
1352 | cmp edx, ebx ; make sure y2 is above y1 |
1353 | jge @f |
1353 | jge @f |
1354 | xchg ebx, edx |
1354 | xchg ebx, edx |
1355 | @@: |
1355 | @@: |
1356 | and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
1356 | and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area |
1357 | @@: |
1357 | @@: |
1358 | ; call [putpixel] |
1358 | ; call [putpixel] |
1359 | call __sys_putpixel |
1359 | call __sys_putpixel |
1360 | inc ebx |
1360 | inc ebx |
1361 | cmp ebx, edx |
1361 | cmp ebx, edx |
1362 | jle @b |
1362 | jle @b |
1363 | pop edx ebx |
1363 | pop edx ebx |
1364 | ret |
1364 | ret |
1365 | 1365 | ||
1366 | ;------------------------------------------------------------------------------ |
1366 | ;------------------------------------------------------------------------------ |
1367 | ; eax cx |
1367 | ; eax cx |
1368 | ; ebx cy |
1368 | ; ebx cy |
1369 | ; ecx xe |
1369 | ; ecx xe |
1370 | ; edx ye |
1370 | ; edx ye |
1371 | ; edi color |
1371 | ; edi color |
1372 | 1372 | ||
1373 | align 4 |
1373 | align 4 |
1374 | vesa20_drawbar: |
1374 | vesa20_drawbar: |
1375 | 1375 | ||
1376 | virtual at esp |
1376 | virtual at esp |
1377 | drbar: |
1377 | drbar: |
1378 | .bar_sx dd ? |
1378 | .bar_sx dd ? |
1379 | .bar_sy dd ? |
1379 | .bar_sy dd ? |
1380 | .bar_cx dd ? |
1380 | .bar_cx dd ? |
1381 | .bar_cy dd ? |
1381 | .bar_cy dd ? |
1382 | .abs_cx dd ? |
1382 | .abs_cx dd ? |
1383 | .abs_cy dd ? |
1383 | .abs_cy dd ? |
1384 | .real_sx dd ? |
1384 | .real_sx dd ? |
1385 | .real_sy dd ? |
1385 | .real_sy dd ? |
1386 | .color dd ? |
1386 | .color dd ? |
1387 | .line_inc_scr dd ? |
1387 | .line_inc_scr dd ? |
1388 | .line_inc_map dd ? |
1388 | .line_inc_map dd ? |
1389 | .real_sx_and_abs_cx dd ? |
1389 | .real_sx_and_abs_cx dd ? |
1390 | .real_sy_and_abs_cy dd ? |
1390 | .real_sy_and_abs_cy dd ? |
1391 | .stack_data = 4*13 |
1391 | .stack_data = 4*13 |
1392 | end virtual |
1392 | end virtual |
1393 | 1393 | ||
1394 | pushad |
1394 | pushad |
1395 | sub esp, drbar.stack_data |
1395 | sub esp, drbar.stack_data |
1396 | mov [drbar.color], edi |
1396 | mov [drbar.color], edi |
1397 | sub edx, ebx |
1397 | sub edx, ebx |
1398 | jle .exit |
1398 | jle .exit |
1399 | sub ecx, eax |
1399 | sub ecx, eax |
1400 | jle .exit |
1400 | jle .exit |
1401 | mov [drbar.bar_sy], edx |
1401 | mov [drbar.bar_sy], edx |
1402 | mov [drbar.bar_sx], ecx |
1402 | mov [drbar.bar_sx], ecx |
1403 | mov [drbar.bar_cx], eax |
1403 | mov [drbar.bar_cx], eax |
1404 | mov [drbar.bar_cy], ebx |
1404 | mov [drbar.bar_cy], ebx |
1405 | mov edi, [current_slot_idx] |
1405 | mov edi, [current_slot_idx] |
1406 | shl edi, BSF sizeof.WDATA |
1406 | shl edi, BSF sizeof.WDATA |
1407 | add eax, [edi + window_data + WDATA.box.left] ; win_cx |
1407 | add eax, [edi + window_data + WDATA.box.left] ; win_cx |
1408 | add ebx, [edi + window_data + WDATA.box.top] ; win_cy |
1408 | add ebx, [edi + window_data + WDATA.box.top] ; win_cy |
1409 | mov [drbar.abs_cx], eax |
1409 | mov [drbar.abs_cx], eax |
1410 | mov [drbar.abs_cy], ebx |
1410 | mov [drbar.abs_cy], ebx |
1411 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
1411 | ; real_sx = MIN(wnd_sx-bar_cx, bar_sx); |
1412 | mov ebx, [edi + window_data + WDATA.box.width] ; ebx = wnd_sx |
1412 | mov ebx, [edi + window_data + WDATA.box.width] ; ebx = wnd_sx |
1413 | inc ebx ; WDATA.box.width is one pixel less than real window x-size |
1413 | inc ebx ; WDATA.box.width is one pixel less than real window x-size |
1414 | sub ebx, [drbar.bar_cx] |
1414 | sub ebx, [drbar.bar_cx] |
1415 | ja @f |
1415 | ja @f |
1416 | .exit: |
1416 | .exit: |
1417 | add esp, drbar.stack_data |
1417 | add esp, drbar.stack_data |
1418 | popad |
1418 | popad |
1419 | xor eax, eax |
1419 | xor eax, eax |
1420 | inc eax |
1420 | inc eax |
1421 | ret |
1421 | ret |
1422 | @@: |
1422 | @@: |
1423 | cmp ebx, [drbar.bar_sx] |
1423 | cmp ebx, [drbar.bar_sx] |
1424 | jbe .end_x |
1424 | jbe .end_x |
1425 | mov ebx, [drbar.bar_sx] |
1425 | mov ebx, [drbar.bar_sx] |
1426 | .end_x: |
1426 | .end_x: |
1427 | mov [drbar.real_sx], ebx |
1427 | mov [drbar.real_sx], ebx |
1428 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
1428 | ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); |
1429 | mov ebx, [edi + window_data + WDATA.box.height] ; ebx = wnd_sy |
1429 | mov ebx, [edi + window_data + WDATA.box.height] ; ebx = wnd_sy |
1430 | inc ebx |
1430 | inc ebx |
1431 | sub ebx, [drbar.bar_cy] |
1431 | sub ebx, [drbar.bar_cy] |
1432 | ja @f |
1432 | ja @f |
1433 | add esp, drbar.stack_data |
1433 | add esp, drbar.stack_data |
1434 | popad |
1434 | popad |
1435 | xor eax, eax |
1435 | xor eax, eax |
1436 | inc eax |
1436 | inc eax |
1437 | ret |
1437 | ret |
1438 | @@: |
1438 | @@: |
1439 | cmp ebx, [drbar.bar_sy] |
1439 | cmp ebx, [drbar.bar_sy] |
1440 | jbe .end_y |
1440 | jbe .end_y |
1441 | mov ebx, [drbar.bar_sy] |
1441 | mov ebx, [drbar.bar_sy] |
1442 | .end_y: |
1442 | .end_y: |
1443 | mov [drbar.real_sy], ebx |
1443 | mov [drbar.real_sy], ebx |
1444 | ; line_inc_map |
1444 | ; line_inc_map |
1445 | mov eax, [_display.width] |
1445 | mov eax, [_display.width] |
1446 | sub eax, [drbar.real_sx] |
1446 | sub eax, [drbar.real_sx] |
1447 | mov [drbar.line_inc_map], eax |
1447 | mov [drbar.line_inc_map], eax |
1448 | ; line_inc_scr |
1448 | ; line_inc_scr |
1449 | mov eax, [drbar.real_sx] |
1449 | mov eax, [drbar.real_sx] |
1450 | mov ebx, [_display.bytes_per_pixel] |
1450 | mov ebx, [_display.bytes_per_pixel] |
1451 | imul eax, ebx |
1451 | imul eax, ebx |
1452 | neg eax |
1452 | neg eax |
1453 | add eax, [_display.lfb_pitch] |
1453 | add eax, [_display.lfb_pitch] |
1454 | mov [drbar.line_inc_scr], eax |
1454 | mov [drbar.line_inc_scr], eax |
1455 | ; pointer to screen |
1455 | ; pointer to screen |
1456 | mov edx, [drbar.abs_cy] |
1456 | mov edx, [drbar.abs_cy] |
1457 | ; imul edx, [BytesPerScanLine] |
1457 | ; imul edx, [BytesPerScanLine] |
1458 | mov edx, [BPSLine_calc_area+edx*4] |
1458 | mov edx, [BPSLine_calc_area+edx*4] |
1459 | mov eax, [drbar.abs_cx] |
1459 | mov eax, [drbar.abs_cx] |
1460 | imul eax, ebx |
1460 | imul eax, ebx |
1461 | add edx, eax |
1461 | add edx, eax |
1462 | ; pointer to pixel map |
1462 | ; pointer to pixel map |
1463 | mov eax, [drbar.abs_cy] |
1463 | mov eax, [drbar.abs_cy] |
1464 | ; imul eax, [Screen_Max_X] |
1464 | ; imul eax, [Screen_Max_X] |
1465 | ; add eax, [drbar.abs_cy] |
1465 | ; add eax, [drbar.abs_cy] |
1466 | mov eax, [d_width_calc_area + eax*4] |
1466 | mov eax, [d_width_calc_area + eax*4] |
1467 | 1467 | ||
1468 | add eax, [drbar.abs_cx] |
1468 | add eax, [drbar.abs_cx] |
1469 | add eax, [_display.win_map] |
1469 | add eax, [_display.win_map] |
1470 | xchg eax, ebp |
1470 | xchg eax, ebp |
1471 | 1471 | ||
1472 | mov ebx, [drbar.real_sx] |
1472 | mov ebx, [drbar.real_sx] |
1473 | add ebx, [drbar.abs_cx] |
1473 | add ebx, [drbar.abs_cx] |
1474 | mov [drbar.real_sx_and_abs_cx], ebx |
1474 | mov [drbar.real_sx_and_abs_cx], ebx |
1475 | mov ebx, [drbar.real_sy] |
1475 | mov ebx, [drbar.real_sy] |
1476 | add ebx, [drbar.abs_cy] |
1476 | add ebx, [drbar.abs_cy] |
1477 | mov [drbar.real_sy_and_abs_cy], ebx |
1477 | mov [drbar.real_sy_and_abs_cy], ebx |
1478 | 1478 | ||
1479 | add edx, LFB_BASE |
1479 | add edx, LFB_BASE |
1480 | 1480 | ||
1481 | ; get process number |
1481 | ; get process number |
1482 | mov ebx, [current_slot_idx] ; bl - process num |
1482 | mov ebx, [current_slot_idx] ; bl - process num |
1483 | mov esi, [drbar.real_sy] |
1483 | mov esi, [drbar.real_sy] |
1484 | mov eax, [drbar.color] ; BBGGRR00 |
1484 | mov eax, [drbar.color] ; BBGGRR00 |
1485 | rol eax, 8 |
1485 | rol eax, 8 |
1486 | mov bh, al ; 0x80 drawing gradient bars |
1486 | mov bh, al ; 0x80 drawing gradient bars |
1487 | ror eax, 8 |
1487 | ror eax, 8 |
1488 | 1488 | ||
1489 | cmp byte [_display.bits_per_pixel], 16 |
1489 | cmp byte [_display.bits_per_pixel], 16 |
1490 | je draw_bar_end_16 |
1490 | je draw_bar_end_16 |
1491 | cmp byte [_display.bits_per_pixel], 24 |
1491 | cmp byte [_display.bits_per_pixel], 24 |
1492 | je draw_bar_end_24 |
1492 | je draw_bar_end_24 |
1493 | cmp byte [_display.bits_per_pixel], 32 |
1493 | cmp byte [_display.bits_per_pixel], 32 |
1494 | je draw_bar_end_32 |
1494 | je draw_bar_end_32 |
1495 | 1495 | ||
1496 | ;-------------------------------------- |
1496 | ;-------------------------------------- |
1497 | ; eax - color high RRGGBB |
1497 | ; eax - color high RRGGBB |
1498 | ; bl - process num |
1498 | ; bl - process num |
1499 | ; ecx - temp |
1499 | ; ecx - temp |
1500 | ; edx - pointer to screen |
1500 | ; edx - pointer to screen |
1501 | ; esi - counter |
1501 | ; esi - counter |
1502 | ; edi - counter |
1502 | ; edi - counter |
1503 | 1503 | ||
1504 | align 4 |
1504 | align 4 |
1505 | draw_bar_end_24: |
1505 | draw_bar_end_24: |
1506 | 1506 | ||
1507 | ; check for hardware cursor |
1507 | ; check for hardware cursor |
1508 | mov ecx, [_display.select_cursor] |
1508 | mov ecx, [_display.select_cursor] |
1509 | cmp ecx, select_cursor |
1509 | cmp ecx, select_cursor |
1510 | je draw_bar_end_24_new |
1510 | je draw_bar_end_24_new |
1511 | cmp ecx, 0 |
1511 | cmp ecx, 0 |
1512 | je draw_bar_end_24_old |
1512 | je draw_bar_end_24_old |
1513 | .new_y: |
1513 | .new_y: |
1514 | mov edi, [drbar.real_sx] |
1514 | mov edi, [drbar.real_sx] |
1515 | .new_x: |
1515 | .new_x: |
1516 | cmp byte [ebp], bl |
1516 | cmp byte [ebp], bl |
1517 | jne .skip |
1517 | jne .skip |
1518 | 1518 | ||
1519 | ; store to LFB |
1519 | ; store to LFB |
1520 | mov [edx], ax |
1520 | mov [edx], ax |
1521 | shr eax, 16 |
1521 | shr eax, 16 |
1522 | mov [edx + 2], al |
1522 | mov [edx + 2], al |
1523 | .skip: |
1523 | .skip: |
1524 | ; add pixel |
1524 | ; add pixel |
1525 | add edx, 3 |
1525 | add edx, 3 |
1526 | inc ebp |
1526 | inc ebp |
1527 | dec edi |
1527 | dec edi |
1528 | jnz .new_x |
1528 | jnz .new_x |
1529 | ; add line |
1529 | ; add line |
1530 | add edx, [drbar.line_inc_scr] |
1530 | add edx, [drbar.line_inc_scr] |
1531 | add ebp, [drbar.line_inc_map] |
1531 | add ebp, [drbar.line_inc_map] |
1532 | ; drawing gradient bars |
1532 | ; drawing gradient bars |
1533 | test bh, 0x80 |
1533 | test bh, 0x80 |
1534 | jz @f |
1534 | jz @f |
1535 | test al, al |
1535 | test al, al |
1536 | jz @f |
1536 | jz @f |
1537 | dec al |
1537 | dec al |
1538 | @@: |
1538 | @@: |
1539 | dec esi |
1539 | dec esi |
1540 | jnz .new_y |
1540 | jnz .new_y |
1541 | .end: |
1541 | .end: |
1542 | add esp, drbar.stack_data |
1542 | add esp, drbar.stack_data |
1543 | popad |
1543 | popad |
1544 | xor eax, eax |
1544 | xor eax, eax |
1545 | ret |
1545 | ret |
1546 | 1546 | ||
1547 | ;------------------------------------------------------------------------------ |
1547 | ;------------------------------------------------------------------------------ |
1548 | 1548 | ||
1549 | align 4 |
1549 | align 4 |
1550 | draw_bar_end_24_old: |
1550 | draw_bar_end_24_old: |
1551 | 1551 | ||
1552 | .new_y: |
1552 | .new_y: |
1553 | mov edi, [drbar.real_sx] |
1553 | mov edi, [drbar.real_sx] |
1554 | .new_x: |
1554 | .new_x: |
1555 | cmp byte [ebp], bl |
1555 | cmp byte [ebp], bl |
1556 | jne .skip |
1556 | jne .skip |
1557 | 1557 | ||
1558 | mov ecx, [drbar.real_sx_and_abs_cx] |
1558 | mov ecx, [drbar.real_sx_and_abs_cx] |
1559 | sub ecx, edi |
1559 | sub ecx, edi |
1560 | shl ecx, 16 |
1560 | shl ecx, 16 |
1561 | add ecx, [drbar.real_sy_and_abs_cy] |
1561 | add ecx, [drbar.real_sy_and_abs_cy] |
1562 | sub ecx, esi |
1562 | sub ecx, esi |
1563 | ; check mouse area for putpixel |
1563 | ; check mouse area for putpixel |
1564 | call check_mouse_area_for_putpixel |
1564 | call check_mouse_area_for_putpixel |
1565 | ; store to LFB |
1565 | ; store to LFB |
1566 | mov [edx], ax |
1566 | mov [edx], ax |
1567 | shr eax, 16 |
1567 | shr eax, 16 |
1568 | mov [edx + 2], al |
1568 | mov [edx + 2], al |
1569 | mov eax, [drbar.color] |
1569 | mov eax, [drbar.color] |
1570 | .skip: |
1570 | .skip: |
1571 | ; add pixel |
1571 | ; add pixel |
1572 | add edx, 3 |
1572 | add edx, 3 |
1573 | inc ebp |
1573 | inc ebp |
1574 | dec edi |
1574 | dec edi |
1575 | jnz .new_x |
1575 | jnz .new_x |
1576 | ; add line |
1576 | ; add line |
1577 | add edx, [drbar.line_inc_scr] |
1577 | add edx, [drbar.line_inc_scr] |
1578 | add ebp, [drbar.line_inc_map] |
1578 | add ebp, [drbar.line_inc_map] |
1579 | ; drawing gradient bars |
1579 | ; drawing gradient bars |
1580 | test bh, 0x80 |
1580 | test bh, 0x80 |
1581 | jz @f |
1581 | jz @f |
1582 | test al, al |
1582 | test al, al |
1583 | jz @f |
1583 | jz @f |
1584 | dec al |
1584 | dec al |
1585 | @@: |
1585 | @@: |
1586 | dec esi |
1586 | dec esi |
1587 | jnz .new_y |
1587 | jnz .new_y |
1588 | jmp draw_bar_end_24.end |
1588 | jmp draw_bar_end_24.end |
1589 | 1589 | ||
1590 | ;------------------------------------------------------------------------------ |
1590 | ;------------------------------------------------------------------------------ |
1591 | 1591 | ||
1592 | align 4 |
1592 | align 4 |
1593 | draw_bar_end_24_new: |
1593 | draw_bar_end_24_new: |
1594 | 1594 | ||
1595 | .new_y: |
1595 | .new_y: |
1596 | mov edi, [drbar.real_sx] |
1596 | mov edi, [drbar.real_sx] |
1597 | .new_x: |
1597 | .new_x: |
1598 | cmp byte [ebp], bl |
1598 | cmp byte [ebp], bl |
1599 | jne .skip |
1599 | jne .skip |
1600 | 1600 | ||
1601 | mov ecx, [drbar.real_sy_and_abs_cy] |
1601 | mov ecx, [drbar.real_sy_and_abs_cy] |
1602 | sub ecx, esi |
1602 | sub ecx, esi |
1603 | 1603 | ||
1604 | ; check for Y |
1604 | ; check for Y |
1605 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1605 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1606 | jae .no_mouse_area |
1606 | jae .no_mouse_area |
1607 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1607 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1608 | jb .no_mouse_area |
1608 | jb .no_mouse_area |
1609 | rol ecx, 16 |
1609 | rol ecx, 16 |
1610 | add ecx, [drbar.real_sx_and_abs_cx] |
1610 | add ecx, [drbar.real_sx_and_abs_cx] |
1611 | sub ecx, edi |
1611 | sub ecx, edi |
1612 | 1612 | ||
1613 | ; check for X |
1613 | ; check for X |
1614 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1614 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1615 | jae .no_mouse_area |
1615 | jae .no_mouse_area |
1616 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1616 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1617 | jb .no_mouse_area |
1617 | jb .no_mouse_area |
1618 | ror ecx, 16 |
1618 | ror ecx, 16 |
1619 | 1619 | ||
1620 | ; check mouse area for putpixel |
1620 | ; check mouse area for putpixel |
1621 | push eax |
1621 | push eax |
1622 | call check_mouse_area_for_putpixel_new.1 |
1622 | call check_mouse_area_for_putpixel_new.1 |
1623 | mov [edx], ax |
1623 | mov [edx], ax |
1624 | shr eax, 16 |
1624 | shr eax, 16 |
1625 | mov [edx + 2], al |
1625 | mov [edx + 2], al |
1626 | pop eax |
1626 | pop eax |
1627 | jmp .skip |
1627 | jmp .skip |
1628 | 1628 | ||
1629 | .no_mouse_area: |
1629 | .no_mouse_area: |
1630 | ; store to LFB |
1630 | ; store to LFB |
1631 | mov [edx], ax |
1631 | mov [edx], ax |
1632 | ror eax, 16 |
1632 | ror eax, 16 |
1633 | mov [edx + 2], al |
1633 | mov [edx + 2], al |
1634 | rol eax, 16 |
1634 | rol eax, 16 |
1635 | .skip: |
1635 | .skip: |
1636 | 1636 | ||
1637 | ; add pixel |
1637 | ; add pixel |
1638 | add edx, 3 |
1638 | add edx, 3 |
1639 | inc ebp |
1639 | inc ebp |
1640 | dec edi |
1640 | dec edi |
1641 | jnz .new_x |
1641 | jnz .new_x |
1642 | 1642 | ||
1643 | ; add line |
1643 | ; add line |
1644 | add edx, [drbar.line_inc_scr] |
1644 | add edx, [drbar.line_inc_scr] |
1645 | add ebp, [drbar.line_inc_map] |
1645 | add ebp, [drbar.line_inc_map] |
1646 | 1646 | ||
1647 | ; drawing gradient bars |
1647 | ; drawing gradient bars |
1648 | test bh, 0x80 |
1648 | test bh, 0x80 |
1649 | jz @f |
1649 | jz @f |
1650 | test al, al |
1650 | test al, al |
1651 | jz @f |
1651 | jz @f |
1652 | dec al |
1652 | dec al |
1653 | @@: |
1653 | @@: |
1654 | dec esi |
1654 | dec esi |
1655 | jnz .new_y |
1655 | jnz .new_y |
1656 | jmp draw_bar_end_24.end |
1656 | jmp draw_bar_end_24.end |
1657 | 1657 | ||
1658 | ;------------------------------------------------------------------------------ |
1658 | ;------------------------------------------------------------------------------ |
1659 | ; eax - color high RRGGBB |
1659 | ; eax - color high RRGGBB |
1660 | ; bl - process num |
1660 | ; bl - process num |
1661 | ; ecx - temp |
1661 | ; ecx - temp |
1662 | ; edx - pointer to screen |
1662 | ; edx - pointer to screen |
1663 | ; esi - counter |
1663 | ; esi - counter |
1664 | ; edi - counter |
1664 | ; edi - counter |
1665 | 1665 | ||
1666 | draw_bar_end_32: |
1666 | draw_bar_end_32: |
1667 | 1667 | ||
1668 | ; check for hardware cursor |
1668 | ; check for hardware cursor |
1669 | mov ecx, [_display.select_cursor] |
1669 | mov ecx, [_display.select_cursor] |
1670 | cmp ecx, select_cursor |
1670 | cmp ecx, select_cursor |
1671 | je draw_bar_end_32_new |
1671 | je draw_bar_end_32_new |
1672 | cmp ecx, 0 |
1672 | cmp ecx, 0 |
1673 | je draw_bar_end_32_old |
1673 | je draw_bar_end_32_old |
1674 | 1674 | ||
1675 | .new_y: |
1675 | .new_y: |
1676 | mov edi, [drbar.real_sx] |
1676 | mov edi, [drbar.real_sx] |
1677 | .new_x: |
1677 | .new_x: |
1678 | cmp byte [ebp], bl |
1678 | cmp byte [ebp], bl |
1679 | jne .skip |
1679 | jne .skip |
1680 | 1680 | ||
1681 | ; store to LFB |
1681 | ; store to LFB |
1682 | mov [edx], eax |
1682 | mov [edx], eax |
1683 | mov eax, [drbar.color] |
1683 | mov eax, [drbar.color] |
1684 | .skip: |
1684 | .skip: |
1685 | 1685 | ||
1686 | ; add pixel |
1686 | ; add pixel |
1687 | add edx, 4 |
1687 | add edx, 4 |
1688 | inc ebp |
1688 | inc ebp |
1689 | dec edi |
1689 | dec edi |
1690 | jnz .new_x |
1690 | jnz .new_x |
1691 | 1691 | ||
1692 | ; add line |
1692 | ; add line |
1693 | add edx, [drbar.line_inc_scr] |
1693 | add edx, [drbar.line_inc_scr] |
1694 | add ebp, [drbar.line_inc_map] |
1694 | add ebp, [drbar.line_inc_map] |
1695 | 1695 | ||
1696 | ; drawing gradient bars |
1696 | ; drawing gradient bars |
1697 | test bh, 0x80 |
1697 | test bh, 0x80 |
1698 | jz @f |
1698 | jz @f |
1699 | test al, al |
1699 | test al, al |
1700 | jz @f |
1700 | jz @f |
1701 | dec al |
1701 | dec al |
1702 | @@: |
1702 | @@: |
1703 | dec esi |
1703 | dec esi |
1704 | jnz .new_y |
1704 | jnz .new_y |
1705 | .end: |
1705 | .end: |
1706 | add esp, drbar.stack_data |
1706 | add esp, drbar.stack_data |
1707 | popad |
1707 | popad |
1708 | cmp [SCR_MODE], 0x12 |
1708 | cmp [SCR_MODE], 0x12 |
1709 | jne @f |
1709 | jne @f |
1710 | call VGA_draw_bar |
1710 | call VGA_draw_bar |
1711 | @@: |
1711 | @@: |
1712 | xor eax, eax |
1712 | xor eax, eax |
1713 | mov [EGA_counter], 1 |
1713 | mov [EGA_counter], 1 |
1714 | ret |
1714 | ret |
1715 | 1715 | ||
1716 | draw_bar_end_32_old: |
1716 | draw_bar_end_32_old: |
1717 | 1717 | ||
1718 | .new_y: |
1718 | .new_y: |
1719 | mov edi, [drbar.real_sx] |
1719 | mov edi, [drbar.real_sx] |
1720 | .new_x: |
1720 | .new_x: |
1721 | cmp byte [ebp], bl |
1721 | cmp byte [ebp], bl |
1722 | jne .skip |
1722 | jne .skip |
1723 | 1723 | ||
1724 | mov ecx, [drbar.real_sx_and_abs_cx] |
1724 | mov ecx, [drbar.real_sx_and_abs_cx] |
1725 | sub ecx, edi |
1725 | sub ecx, edi |
1726 | shl ecx, 16 |
1726 | shl ecx, 16 |
1727 | add ecx, [drbar.real_sy_and_abs_cy] |
1727 | add ecx, [drbar.real_sy_and_abs_cy] |
1728 | sub ecx, esi |
1728 | sub ecx, esi |
1729 | 1729 | ||
1730 | ; check mouse area for putpixel |
1730 | ; check mouse area for putpixel |
1731 | call check_mouse_area_for_putpixel |
1731 | call check_mouse_area_for_putpixel |
1732 | ; store to LFB |
1732 | ; store to LFB |
1733 | mov [edx], eax |
1733 | mov [edx], eax |
1734 | mov eax, [drbar.color] |
1734 | mov eax, [drbar.color] |
1735 | .skip: |
1735 | .skip: |
1736 | ; add pixel |
1736 | ; add pixel |
1737 | add edx, 4 |
1737 | add edx, 4 |
1738 | inc ebp |
1738 | inc ebp |
1739 | dec edi |
1739 | dec edi |
1740 | jnz .new_x |
1740 | jnz .new_x |
1741 | ; add line |
1741 | ; add line |
1742 | add edx, [drbar.line_inc_scr] |
1742 | add edx, [drbar.line_inc_scr] |
1743 | add ebp, [drbar.line_inc_map] |
1743 | add ebp, [drbar.line_inc_map] |
1744 | ; drawing gradient bars |
1744 | ; drawing gradient bars |
1745 | test bh, 0x80 |
1745 | test bh, 0x80 |
1746 | jz @f |
1746 | jz @f |
1747 | test al, al |
1747 | test al, al |
1748 | jz @f |
1748 | jz @f |
1749 | dec al |
1749 | dec al |
1750 | @@: |
1750 | @@: |
1751 | dec esi |
1751 | dec esi |
1752 | jnz .new_y |
1752 | jnz .new_y |
1753 | jmp draw_bar_end_32.end |
1753 | jmp draw_bar_end_32.end |
1754 | 1754 | ||
1755 | ;------------------------------------------------------------------------------ |
1755 | ;------------------------------------------------------------------------------ |
1756 | 1756 | ||
1757 | align 4 |
1757 | align 4 |
1758 | draw_bar_end_32_new: |
1758 | draw_bar_end_32_new: |
1759 | 1759 | ||
1760 | .new_y: |
1760 | .new_y: |
1761 | mov edi, [drbar.real_sx] |
1761 | mov edi, [drbar.real_sx] |
1762 | .new_x: |
1762 | .new_x: |
1763 | cmp byte [ebp], bl |
1763 | cmp byte [ebp], bl |
1764 | jne .skip |
1764 | jne .skip |
1765 | 1765 | ||
1766 | mov ecx, [drbar.real_sy_and_abs_cy] |
1766 | mov ecx, [drbar.real_sy_and_abs_cy] |
1767 | sub ecx, esi |
1767 | sub ecx, esi |
1768 | 1768 | ||
1769 | ; check for Y |
1769 | ; check for Y |
1770 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1770 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1771 | jae .no_mouse_area |
1771 | jae .no_mouse_area |
1772 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1772 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1773 | jb .no_mouse_area |
1773 | jb .no_mouse_area |
1774 | rol ecx, 16 |
1774 | rol ecx, 16 |
1775 | add ecx, [drbar.real_sx_and_abs_cx] |
1775 | add ecx, [drbar.real_sx_and_abs_cx] |
1776 | sub ecx, edi |
1776 | sub ecx, edi |
1777 | 1777 | ||
1778 | ; check for X |
1778 | ; check for X |
1779 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1779 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1780 | jae .no_mouse_area |
1780 | jae .no_mouse_area |
1781 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1781 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1782 | jb .no_mouse_area |
1782 | jb .no_mouse_area |
1783 | ror ecx, 16 |
1783 | ror ecx, 16 |
1784 | 1784 | ||
1785 | ; check mouse area for putpixel |
1785 | ; check mouse area for putpixel |
1786 | push eax |
1786 | push eax |
1787 | call check_mouse_area_for_putpixel_new.1 |
1787 | call check_mouse_area_for_putpixel_new.1 |
1788 | mov [edx], eax |
1788 | mov [edx], eax |
1789 | pop eax |
1789 | pop eax |
1790 | jmp .skip |
1790 | jmp .skip |
1791 | .no_mouse_area: |
1791 | .no_mouse_area: |
1792 | 1792 | ||
1793 | ; store to LFB |
1793 | ; store to LFB |
1794 | mov [edx], eax |
1794 | mov [edx], eax |
1795 | .skip: |
1795 | .skip: |
1796 | 1796 | ||
1797 | ; add pixel |
1797 | ; add pixel |
1798 | add edx, 4 |
1798 | add edx, 4 |
1799 | inc ebp |
1799 | inc ebp |
1800 | dec edi |
1800 | dec edi |
1801 | jnz .new_x |
1801 | jnz .new_x |
1802 | 1802 | ||
1803 | ; add line |
1803 | ; add line |
1804 | add edx, [drbar.line_inc_scr] |
1804 | add edx, [drbar.line_inc_scr] |
1805 | add ebp, [drbar.line_inc_map] |
1805 | add ebp, [drbar.line_inc_map] |
1806 | 1806 | ||
1807 | ; drawing gradient bars |
1807 | ; drawing gradient bars |
1808 | test bh, 0x80 |
1808 | test bh, 0x80 |
1809 | jz @f |
1809 | jz @f |
1810 | test al, al |
1810 | test al, al |
1811 | jz @f |
1811 | jz @f |
1812 | dec al |
1812 | dec al |
1813 | @@: |
1813 | @@: |
1814 | dec esi |
1814 | dec esi |
1815 | jnz .new_y |
1815 | jnz .new_y |
1816 | jmp draw_bar_end_32.end |
1816 | jmp draw_bar_end_32.end |
1817 | 1817 | ||
1818 | ;------------------------------------------------------------------------------ |
1818 | ;------------------------------------------------------------------------------ |
1819 | ; eax - color high RRGGBB |
1819 | ; eax - color high RRGGBB |
1820 | ; bl - process num |
1820 | ; bl - process num |
1821 | ; ecx - temp |
1821 | ; ecx - temp |
1822 | ; edx - pointer to screen |
1822 | ; edx - pointer to screen |
1823 | ; esi - counter |
1823 | ; esi - counter |
1824 | ; edi - counter |
1824 | ; edi - counter |
1825 | 1825 | ||
1826 | align 4 |
1826 | align 4 |
1827 | draw_bar_end_16: |
1827 | draw_bar_end_16: |
1828 | 1828 | ||
1829 | ; check for hardware cursor |
1829 | ; check for hardware cursor |
1830 | mov ecx, [_display.select_cursor] |
1830 | mov ecx, [_display.select_cursor] |
1831 | cmp ecx, select_cursor |
1831 | cmp ecx, select_cursor |
1832 | je draw_bar_end_16_new |
1832 | je draw_bar_end_16_new |
1833 | cmp ecx, 0 |
1833 | cmp ecx, 0 |
1834 | je draw_bar_end_16_old |
1834 | je draw_bar_end_16_old |
1835 | .new_y: |
1835 | .new_y: |
1836 | mov edi, [drbar.real_sx] |
1836 | mov edi, [drbar.real_sx] |
1837 | .new_x: |
1837 | .new_x: |
1838 | cmp byte [ebp], bl |
1838 | cmp byte [ebp], bl |
1839 | jne .skip |
1839 | jne .skip |
1840 | ; convert to 16 bpp and store to LFB |
1840 | ; convert to 16 bpp and store to LFB |
1841 | and eax, 00000000111110001111110011111000b |
1841 | and eax, 00000000111110001111110011111000b |
1842 | shr ah, 2 |
1842 | shr ah, 2 |
1843 | shr ax, 3 |
1843 | shr ax, 3 |
1844 | ror eax, 8 |
1844 | ror eax, 8 |
1845 | add al, ah |
1845 | add al, ah |
1846 | rol eax, 8 |
1846 | rol eax, 8 |
1847 | mov [edx], ax |
1847 | mov [edx], ax |
1848 | mov eax, [drbar.color] |
1848 | mov eax, [drbar.color] |
1849 | .skip: |
1849 | .skip: |
1850 | 1850 | ||
1851 | ; add pixel |
1851 | ; add pixel |
1852 | add edx, 2 |
1852 | add edx, 2 |
1853 | inc ebp |
1853 | inc ebp |
1854 | dec edi |
1854 | dec edi |
1855 | jnz .new_x |
1855 | jnz .new_x |
1856 | ; add line |
1856 | ; add line |
1857 | add edx, [drbar.line_inc_scr] |
1857 | add edx, [drbar.line_inc_scr] |
1858 | add ebp, [drbar.line_inc_map] |
1858 | add ebp, [drbar.line_inc_map] |
1859 | ; drawing gradient bars |
1859 | ; drawing gradient bars |
1860 | test bh, 0x80 |
1860 | test bh, 0x80 |
1861 | jz @f |
1861 | jz @f |
1862 | test al, al |
1862 | test al, al |
1863 | jz @f |
1863 | jz @f |
1864 | dec al |
1864 | dec al |
1865 | @@: |
1865 | @@: |
1866 | dec esi |
1866 | dec esi |
1867 | jnz .new_y |
1867 | jnz .new_y |
1868 | .end: |
1868 | .end: |
1869 | add esp, drbar.stack_data |
1869 | add esp, drbar.stack_data |
1870 | popad |
1870 | popad |
1871 | cmp [SCR_MODE], 0x12 |
1871 | cmp [SCR_MODE], 0x12 |
1872 | jne @f |
1872 | jne @f |
1873 | call VGA_draw_bar |
1873 | call VGA_draw_bar |
1874 | @@: |
1874 | @@: |
1875 | xor eax, eax |
1875 | xor eax, eax |
1876 | mov [EGA_counter], 1 |
1876 | mov [EGA_counter], 1 |
1877 | ret |
1877 | ret |
1878 | 1878 | ||
1879 | ;------------------------------------------------------------------------------ |
1879 | ;------------------------------------------------------------------------------ |
1880 | 1880 | ||
1881 | align 4 |
1881 | align 4 |
1882 | draw_bar_end_16_old: |
1882 | draw_bar_end_16_old: |
1883 | 1883 | ||
1884 | .new_y: |
1884 | .new_y: |
1885 | mov edi, [drbar.real_sx] |
1885 | mov edi, [drbar.real_sx] |
1886 | .new_x: |
1886 | .new_x: |
1887 | cmp byte [ebp], bl |
1887 | cmp byte [ebp], bl |
1888 | jne .skip |
1888 | jne .skip |
1889 | 1889 | ||
1890 | mov ecx, [drbar.real_sx_and_abs_cx] |
1890 | mov ecx, [drbar.real_sx_and_abs_cx] |
1891 | sub ecx, edi |
1891 | sub ecx, edi |
1892 | shl ecx, 16 |
1892 | shl ecx, 16 |
1893 | add ecx, [drbar.real_sy_and_abs_cy] |
1893 | add ecx, [drbar.real_sy_and_abs_cy] |
1894 | sub ecx, esi |
1894 | sub ecx, esi |
1895 | 1895 | ||
1896 | ; check mouse area for putpixel |
1896 | ; check mouse area for putpixel |
1897 | call check_mouse_area_for_putpixel |
1897 | call check_mouse_area_for_putpixel |
1898 | ; convert to 16 bpp and store to LFB |
1898 | ; convert to 16 bpp and store to LFB |
1899 | and eax, 00000000111110001111110011111000b |
1899 | and eax, 00000000111110001111110011111000b |
1900 | shr ah, 2 |
1900 | shr ah, 2 |
1901 | shr ax, 3 |
1901 | shr ax, 3 |
1902 | ror eax, 8 |
1902 | ror eax, 8 |
1903 | add al, ah |
1903 | add al, ah |
1904 | rol eax, 8 |
1904 | rol eax, 8 |
1905 | mov [edx], ax |
1905 | mov [edx], ax |
1906 | mov eax, [drbar.color] |
1906 | mov eax, [drbar.color] |
1907 | .skip: |
1907 | .skip: |
1908 | 1908 | ||
1909 | ; add pixel |
1909 | ; add pixel |
1910 | add edx, 2 |
1910 | add edx, 2 |
1911 | inc ebp |
1911 | inc ebp |
1912 | dec edi |
1912 | dec edi |
1913 | jnz .new_x |
1913 | jnz .new_x |
1914 | 1914 | ||
1915 | ; add line |
1915 | ; add line |
1916 | add edx, [drbar.line_inc_scr] |
1916 | add edx, [drbar.line_inc_scr] |
1917 | add ebp, [drbar.line_inc_map] |
1917 | add ebp, [drbar.line_inc_map] |
1918 | 1918 | ||
1919 | ; drawing gradient bars |
1919 | ; drawing gradient bars |
1920 | test bh, 0x80 |
1920 | test bh, 0x80 |
1921 | jz @f |
1921 | jz @f |
1922 | test al, al |
1922 | test al, al |
1923 | jz @f |
1923 | jz @f |
1924 | dec al |
1924 | dec al |
1925 | @@: |
1925 | @@: |
1926 | dec esi |
1926 | dec esi |
1927 | jnz .new_y |
1927 | jnz .new_y |
1928 | jmp draw_bar_end_16.end |
1928 | jmp draw_bar_end_16.end |
1929 | 1929 | ||
1930 | ;------------------------------------------------------------------------------ |
1930 | ;------------------------------------------------------------------------------ |
1931 | 1931 | ||
1932 | align 4 |
1932 | align 4 |
1933 | draw_bar_end_16_new: |
1933 | draw_bar_end_16_new: |
1934 | 1934 | ||
1935 | .new_y: |
1935 | .new_y: |
1936 | mov edi, [drbar.real_sx] |
1936 | mov edi, [drbar.real_sx] |
1937 | .new_x: |
1937 | .new_x: |
1938 | cmp byte [ebp], bl |
1938 | cmp byte [ebp], bl |
1939 | jne .skip |
1939 | jne .skip |
1940 | 1940 | ||
1941 | mov ecx, [drbar.real_sy_and_abs_cy] |
1941 | mov ecx, [drbar.real_sy_and_abs_cy] |
1942 | sub ecx, esi |
1942 | sub ecx, esi |
1943 | 1943 | ||
1944 | ; check for Y |
1944 | ; check for Y |
1945 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1945 | cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] |
1946 | jae .no_mouse_area |
1946 | jae .no_mouse_area |
1947 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1947 | sub cx, [Y_UNDER_subtraction_CUR_hot_y] |
1948 | jb .no_mouse_area |
1948 | jb .no_mouse_area |
1949 | rol ecx, 16 |
1949 | rol ecx, 16 |
1950 | add ecx, [drbar.real_sx_and_abs_cx] |
1950 | add ecx, [drbar.real_sx_and_abs_cx] |
1951 | sub ecx, edi |
1951 | sub ecx, edi |
1952 | 1952 | ||
1953 | ; check for X |
1953 | ; check for X |
1954 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1954 | cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] |
1955 | jae .no_mouse_area |
1955 | jae .no_mouse_area |
1956 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1956 | sub cx, [X_UNDER_subtraction_CUR_hot_x] |
1957 | jb .no_mouse_area |
1957 | jb .no_mouse_area |
1958 | ror ecx, 16 |
1958 | ror ecx, 16 |
1959 | 1959 | ||
1960 | ; check mouse area for putpixel |
1960 | ; check mouse area for putpixel |
1961 | push eax |
1961 | push eax |
1962 | call check_mouse_area_for_putpixel_new.1 |
1962 | call check_mouse_area_for_putpixel_new.1 |
1963 | push eax |
1963 | push eax |
1964 | and eax, 00000000111110001111110011111000b |
1964 | and eax, 00000000111110001111110011111000b |
1965 | shr ah, 2 |
1965 | shr ah, 2 |
1966 | shr ax, 3 |
1966 | shr ax, 3 |
1967 | ror eax, 8 |
1967 | ror eax, 8 |
1968 | add al, ah |
1968 | add al, ah |
1969 | rol eax, 8 |
1969 | rol eax, 8 |
1970 | mov [edx], ax |
1970 | mov [edx], ax |
1971 | pop eax |
1971 | pop eax |
1972 | pop eax |
1972 | pop eax |
1973 | jmp .skip |
1973 | jmp .skip |
1974 | 1974 | ||
1975 | .no_mouse_area: |
1975 | .no_mouse_area: |
1976 | ; convert to 16 bpp and store to LFB |
1976 | ; convert to 16 bpp and store to LFB |
1977 | push eax |
1977 | push eax |
1978 | and eax, 00000000111110001111110011111000b |
1978 | and eax, 00000000111110001111110011111000b |
1979 | shr ah, 2 |
1979 | shr ah, 2 |
1980 | shr ax, 3 |
1980 | shr ax, 3 |
1981 | ror eax, 8 |
1981 | ror eax, 8 |
1982 | add al, ah |
1982 | add al, ah |
1983 | rol eax, 8 |
1983 | rol eax, 8 |
1984 | mov [edx], ax |
1984 | mov [edx], ax |
1985 | pop eax |
1985 | pop eax |
1986 | .skip: |
1986 | .skip: |
1987 | 1987 | ||
1988 | ; add pixel |
1988 | ; add pixel |
1989 | add edx, 2 |
1989 | add edx, 2 |
1990 | inc ebp |
1990 | inc ebp |
1991 | dec edi |
1991 | dec edi |
1992 | jnz .new_x |
1992 | jnz .new_x |
1993 | 1993 | ||
1994 | ; add line |
1994 | ; add line |
1995 | add edx, [drbar.line_inc_scr] |
1995 | add edx, [drbar.line_inc_scr] |
1996 | add ebp, [drbar.line_inc_map] |
1996 | add ebp, [drbar.line_inc_map] |
1997 | 1997 | ||
1998 | ; drawing gradient bars |
1998 | ; drawing gradient bars |
1999 | test bh, 0x80 |
1999 | test bh, 0x80 |
2000 | jz @f |
2000 | jz @f |
2001 | test al, al |
2001 | test al, al |
2002 | jz @f |
2002 | jz @f |
2003 | dec al |
2003 | dec al |
2004 | @@: |
2004 | @@: |
2005 | dec esi |
2005 | dec esi |
2006 | jnz .new_y |
2006 | jnz .new_y |
2007 | jmp draw_bar_end_16.end |
2007 | jmp draw_bar_end_16.end |
2008 | 2008 | ||
2009 | ;------------------------------------------------------------------------------ |
2009 | ;------------------------------------------------------------------------------ |
2010 | 2010 | ||
2011 | align 4 |
2011 | align 4 |
2012 | vesa20_drawbackground_tiled: |
2012 | vesa20_drawbackground_tiled: |
2013 | 2013 | ||
2014 | pushad |
2014 | pushad |
2015 | ; External loop for all y from start to end |
2015 | ; External loop for all y from start to end |
2016 | mov ebx, [draw_data + sizeof.WDATA + RECT.top] ; y start |
2016 | mov ebx, [background_window + WDATA.draw_data.top] ; y start |
2017 | dp2: |
2017 | dp2: |
2018 | mov ebp, [draw_data + sizeof.WDATA + RECT.left] ; x start |
2018 | mov ebp, [background_window + WDATA.draw_data.left] ; x start |
2019 | ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] |
2019 | ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] |
2020 | ; and LFB data (output for our function) [edi] |
2020 | ; and LFB data (output for our function) [edi] |
2021 | ; mov eax, [BytesPerScanLine] |
2021 | ; mov eax, [BytesPerScanLine] |
2022 | ; mul ebx |
2022 | ; mul ebx |
2023 | mov eax, [BPSLine_calc_area+ebx*4] |
2023 | mov eax, [BPSLine_calc_area+ebx*4] |
2024 | xchg ebp, eax |
2024 | xchg ebp, eax |
2025 | add ebp, eax |
2025 | add ebp, eax |
2026 | add ebp, eax |
2026 | add ebp, eax |
2027 | cmp byte [_display.bytes_per_pixel], 2 |
2027 | cmp byte [_display.bytes_per_pixel], 2 |
2028 | je @f |
2028 | je @f |
2029 | add ebp, eax |
2029 | add ebp, eax |
2030 | cmp byte [_display.bytes_per_pixel], 3 |
2030 | cmp byte [_display.bytes_per_pixel], 3 |
2031 | je @f |
2031 | je @f |
2032 | add ebp, eax |
2032 | add ebp, eax |
2033 | 2033 | ||
2034 | @@: |
2034 | @@: |
2035 | add ebp, LFB_BASE |
2035 | add ebp, LFB_BASE |
2036 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
2036 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
2037 | call calculate_edi |
2037 | call calculate_edi |
2038 | xchg edi, ebp |
2038 | xchg edi, ebp |
2039 | add ebp, [_display.win_map] |
2039 | add ebp, [_display.win_map] |
2040 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
2040 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
2041 | ; 2) Calculate offset in background memory block |
2041 | ; 2) Calculate offset in background memory block |
2042 | push eax |
2042 | push eax |
2043 | xor edx, edx |
2043 | xor edx, edx |
2044 | mov eax, ebx |
2044 | mov eax, ebx |
2045 | div dword [BgrDataHeight] ; edx := y mod BgrDataHeight |
2045 | div dword [BgrDataHeight] ; edx := y mod BgrDataHeight |
2046 | pop eax |
2046 | pop eax |
2047 | push eax |
2047 | push eax |
2048 | mov ecx, [BgrDataWidth] |
2048 | mov ecx, [BgrDataWidth] |
2049 | mov esi, edx |
2049 | mov esi, edx |
2050 | imul esi, ecx ; esi := (y mod BgrDataHeight) * BgrDataWidth |
2050 | imul esi, ecx ; esi := (y mod BgrDataHeight) * BgrDataWidth |
2051 | xor edx, edx |
2051 | xor edx, edx |
2052 | div ecx ; edx := x mod BgrDataWidth |
2052 | div ecx ; edx := x mod BgrDataWidth |
2053 | sub ecx, edx |
2053 | sub ecx, edx |
2054 | add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth) |
2054 | add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth) |
2055 | pop eax |
2055 | pop eax |
2056 | lea esi, [esi*3] |
2056 | lea esi, [esi*3] |
2057 | add esi, [img_background] |
2057 | add esi, [img_background] |
2058 | xor edx, edx |
2058 | xor edx, edx |
2059 | inc edx |
2059 | inc edx |
2060 | ; 3) Loop through redraw rectangle and copy background data |
2060 | ; 3) Loop through redraw rectangle and copy background data |
2061 | ; Registers meaning: |
2061 | ; Registers meaning: |
2062 | ; eax = x, ebx = y (screen coordinates) |
2062 | ; eax = x, ebx = y (screen coordinates) |
2063 | ; ecx = deltax - number of pixels left in current tile block |
2063 | ; ecx = deltax - number of pixels left in current tile block |
2064 | ; edx = 1 |
2064 | ; edx = 1 |
2065 | ; esi -> bgr memory, edi -> output |
2065 | ; esi -> bgr memory, edi -> output |
2066 | ; ebp = offset in WinMapAddress |
2066 | ; ebp = offset in WinMapAddress |
2067 | dp3: |
2067 | dp3: |
2068 | cmp [ebp], dl |
2068 | cmp [ebp], dl |
2069 | jnz .next_pix |
2069 | jnz .next_pix |
2070 | 2070 | ||
2071 | push eax ecx |
2071 | push eax ecx |
2072 | mov ecx, eax |
2072 | mov ecx, eax |
2073 | shl ecx, 16 |
2073 | shl ecx, 16 |
2074 | add ecx, ebx |
2074 | add ecx, ebx |
2075 | 2075 | ||
2076 | mov eax, [esi] |
2076 | mov eax, [esi] |
2077 | 2077 | ||
2078 | ; check for hardware cursor |
2078 | ; check for hardware cursor |
2079 | cmp [_display.select_cursor], select_cursor |
2079 | cmp [_display.select_cursor], select_cursor |
2080 | je @f |
2080 | je @f |
2081 | cmp [_display.select_cursor], 0 |
2081 | cmp [_display.select_cursor], 0 |
2082 | jne .no_mouseunder |
2082 | jne .no_mouseunder |
2083 | @@: |
2083 | @@: |
2084 | and eax, 0xffffff |
2084 | and eax, 0xffffff |
2085 | ; check mouse area for putpixel |
2085 | ; check mouse area for putpixel |
2086 | call [_display.check_mouse] |
2086 | call [_display.check_mouse] |
2087 | .no_mouseunder: |
2087 | .no_mouseunder: |
2088 | 2088 | ||
2089 | cmp byte [_display.bits_per_pixel], 16 |
2089 | cmp byte [_display.bits_per_pixel], 16 |
2090 | je .16bpp |
2090 | je .16bpp |
2091 | ; store to LFB |
2091 | ; store to LFB |
2092 | mov [edi], ax |
2092 | mov [edi], ax |
2093 | shr eax, 16 |
2093 | shr eax, 16 |
2094 | mov [edi+2], al |
2094 | mov [edi+2], al |
2095 | pop ecx eax |
2095 | pop ecx eax |
2096 | jmp .next_pix |
2096 | jmp .next_pix |
2097 | 2097 | ||
2098 | .16bpp: |
2098 | .16bpp: |
2099 | ; convert to 16 bpp and store to LFB |
2099 | ; convert to 16 bpp and store to LFB |
2100 | and eax, 00000000111110001111110011111000b |
2100 | and eax, 00000000111110001111110011111000b |
2101 | shr ah, 2 |
2101 | shr ah, 2 |
2102 | shr ax, 3 |
2102 | shr ax, 3 |
2103 | ror eax, 8 |
2103 | ror eax, 8 |
2104 | add al, ah |
2104 | add al, ah |
2105 | rol eax, 8 |
2105 | rol eax, 8 |
2106 | mov [edi], ax |
2106 | mov [edi], ax |
2107 | pop ecx eax |
2107 | pop ecx eax |
2108 | 2108 | ||
2109 | ; Advance to next pixel |
2109 | ; Advance to next pixel |
2110 | .next_pix: |
2110 | .next_pix: |
2111 | add esi, 3 |
2111 | add esi, 3 |
2112 | add edi, [_display.bytes_per_pixel] |
2112 | add edi, [_display.bytes_per_pixel] |
2113 | 2113 | ||
2114 | add ebp, edx |
2114 | add ebp, edx |
2115 | add eax, edx |
2115 | add eax, edx |
2116 | cmp eax, [draw_data + sizeof.WDATA + RECT.right] |
2116 | cmp eax, [background_window + WDATA.draw_data.right] |
2117 | ja dp4 |
2117 | ja dp4 |
2118 | sub ecx, edx |
2118 | sub ecx, edx |
2119 | jnz dp3 |
2119 | jnz dp3 |
2120 | 2120 | ||
2121 | ; next tile block on x-axis |
2121 | ; next tile block on x-axis |
2122 | mov ecx, [BgrDataWidth] |
2122 | mov ecx, [BgrDataWidth] |
2123 | sub esi, ecx |
2123 | sub esi, ecx |
2124 | sub esi, ecx |
2124 | sub esi, ecx |
2125 | sub esi, ecx |
2125 | sub esi, ecx |
2126 | jmp dp3 |
2126 | jmp dp3 |
2127 | 2127 | ||
2128 | dp4: |
2128 | dp4: |
2129 | ; next scan line |
2129 | ; next scan line |
2130 | inc ebx |
2130 | inc ebx |
2131 | cmp ebx, [draw_data + sizeof.WDATA + RECT.bottom] |
2131 | cmp ebx, [background_window + WDATA.draw_data.bottom] |
2132 | jbe dp2 |
2132 | jbe dp2 |
2133 | popad |
2133 | popad |
2134 | mov [EGA_counter], 1 |
2134 | mov [EGA_counter], 1 |
2135 | cmp [SCR_MODE], 0x12 |
2135 | cmp [SCR_MODE], 0x12 |
2136 | jne @f |
2136 | jne @f |
2137 | call VGA_drawbackground |
2137 | call VGA_drawbackground |
2138 | @@: |
2138 | @@: |
2139 | ret |
2139 | ret |
2140 | 2140 | ||
2141 | ;------------------------------------------------------------------------------ |
2141 | ;------------------------------------------------------------------------------ |
2142 | 2142 | ||
2143 | align 4 |
2143 | align 4 |
2144 | vesa20_drawbackground_stretch: |
2144 | vesa20_drawbackground_stretch: |
2145 | 2145 | ||
2146 | pushad |
2146 | pushad |
2147 | ; Helper variables |
2147 | ; Helper variables |
2148 | ; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1) |
2148 | ; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1) |
2149 | mov eax, [BgrDataWidth] |
2149 | mov eax, [BgrDataWidth] |
2150 | dec eax |
2150 | dec eax |
2151 | xor edx, edx |
2151 | xor edx, edx |
2152 | div dword [_display.width] |
2152 | div dword [_display.width] |
2153 | push eax ; high |
2153 | push eax ; high |
2154 | xor eax, eax |
2154 | xor eax, eax |
2155 | div dword [_display.width] |
2155 | div dword [_display.width] |
2156 | push eax ; low |
2156 | push eax ; low |
2157 | 2157 | ||
2158 | ; the same for height |
2158 | ; the same for height |
2159 | mov eax, [BgrDataHeight] |
2159 | mov eax, [BgrDataHeight] |
2160 | dec eax |
2160 | dec eax |
2161 | xor edx, edx |
2161 | xor edx, edx |
2162 | div dword [_display.height] |
2162 | div dword [_display.height] |
2163 | push eax ; high |
2163 | push eax ; high |
2164 | xor eax, eax |
2164 | xor eax, eax |
2165 | div dword [_display.height] |
2165 | div dword [_display.height] |
2166 | push eax ; low |
2166 | push eax ; low |
2167 | 2167 | ||
2168 | ; External loop for all y from start to end |
2168 | ; External loop for all y from start to end |
2169 | mov ebx, [draw_data + sizeof.WDATA + RECT.top] ; y start |
2169 | mov ebx, [background_window + WDATA.draw_data.top] ; y start |
2170 | mov ebp, [draw_data + sizeof.WDATA + RECT.left] ; x start |
2170 | mov ebp, [background_window + WDATA.draw_data.left] ; x start |
2171 | ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] |
2171 | ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] |
2172 | ; and LFB data (output for our function) [edi] |
2172 | ; and LFB data (output for our function) [edi] |
2173 | ; mov eax, [BytesPerScanLine] |
2173 | ; mov eax, [BytesPerScanLine] |
2174 | ; mul ebx |
2174 | ; mul ebx |
2175 | mov eax, [BPSLine_calc_area+ebx*4] |
2175 | mov eax, [BPSLine_calc_area+ebx*4] |
2176 | xchg ebp, eax |
2176 | xchg ebp, eax |
2177 | add ebp, eax |
2177 | add ebp, eax |
2178 | add ebp, eax |
2178 | add ebp, eax |
2179 | cmp byte [_display.bytes_per_pixel], 2 |
2179 | cmp byte [_display.bytes_per_pixel], 2 |
2180 | jz @f |
2180 | jz @f |
2181 | add ebp, eax |
2181 | add ebp, eax |
2182 | cmp byte [_display.bytes_per_pixel], 3 |
2182 | cmp byte [_display.bytes_per_pixel], 3 |
2183 | jz @f |
2183 | jz @f |
2184 | add ebp, eax |
2184 | add ebp, eax |
2185 | @@: |
2185 | @@: |
2186 | 2186 | ||
2187 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
2187 | ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB |
2188 | call calculate_edi |
2188 | call calculate_edi |
2189 | xchg edi, ebp |
2189 | xchg edi, ebp |
2190 | 2190 | ||
2191 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
2191 | ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress |
2192 | push ebx |
2192 | push ebx |
2193 | push eax |
2193 | push eax |
2194 | ; 2) Calculate offset in background memory block |
2194 | ; 2) Calculate offset in background memory block |
2195 | mov eax, ebx |
2195 | mov eax, ebx |
2196 | imul ebx, dword [esp+12] |
2196 | imul ebx, dword [esp+12] |
2197 | mul dword [esp+8] |
2197 | mul dword [esp+8] |
2198 | add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1) |
2198 | add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1) |
2199 | mov esi, edx |
2199 | mov esi, edx |
2200 | imul esi, [BgrDataWidth] |
2200 | imul esi, [BgrDataWidth] |
2201 | push edx |
2201 | push edx |
2202 | push eax |
2202 | push eax |
2203 | mov eax, [esp+8] |
2203 | mov eax, [esp+8] |
2204 | mul dword [esp+28] |
2204 | mul dword [esp+28] |
2205 | push eax |
2205 | push eax |
2206 | mov eax, [esp+12] |
2206 | mov eax, [esp+12] |
2207 | mul dword [esp+28] |
2207 | mul dword [esp+28] |
2208 | add [esp], edx |
2208 | add [esp], edx |
2209 | pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1) |
2209 | pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1) |
2210 | add esi, edx |
2210 | add esi, edx |
2211 | lea esi, [esi*3] |
2211 | lea esi, [esi*3] |
2212 | add esi, [img_background] |
2212 | add esi, [img_background] |
2213 | push eax |
2213 | push eax |
2214 | push edx |
2214 | push edx |
2215 | push esi |
2215 | push esi |
2216 | 2216 | ||
2217 | ; 3) Smooth horizontal |
2217 | ; 3) Smooth horizontal |
2218 | bgr_resmooth0: |
2218 | bgr_resmooth0: |
2219 | mov ecx, [esp+8] |
2219 | mov ecx, [esp+8] |
2220 | mov edx, [esp+4] |
2220 | mov edx, [esp+4] |
2221 | mov esi, [esp] |
2221 | mov esi, [esp] |
2222 | push edi |
2222 | push edi |
2223 | mov edi, bgr_cur_line |
2223 | mov edi, bgr_cur_line |
2224 | call smooth_line |
2224 | call smooth_line |
2225 | 2225 | ||
2226 | bgr_resmooth1: |
2226 | bgr_resmooth1: |
2227 | mov eax, [esp+16+4] |
2227 | mov eax, [esp+16+4] |
2228 | inc eax |
2228 | inc eax |
2229 | cmp eax, [BgrDataHeight] |
2229 | cmp eax, [BgrDataHeight] |
2230 | jae bgr.no2nd |
2230 | jae bgr.no2nd |
2231 | mov ecx, [esp+8+4] |
2231 | mov ecx, [esp+8+4] |
2232 | mov edx, [esp+4+4] |
2232 | mov edx, [esp+4+4] |
2233 | mov esi, [esp+4] |
2233 | mov esi, [esp+4] |
2234 | add esi, [BgrDataWidth] |
2234 | add esi, [BgrDataWidth] |
2235 | add esi, [BgrDataWidth] |
2235 | add esi, [BgrDataWidth] |
2236 | add esi, [BgrDataWidth] |
2236 | add esi, [BgrDataWidth] |
2237 | mov edi, bgr_next_line |
2237 | mov edi, bgr_next_line |
2238 | call smooth_line |
2238 | call smooth_line |
2239 | 2239 | ||
2240 | bgr.no2nd: |
2240 | bgr.no2nd: |
2241 | pop edi |
2241 | pop edi |
2242 | 2242 | ||
2243 | sdp3: |
2243 | sdp3: |
2244 | xor esi, esi |
2244 | xor esi, esi |
2245 | mov ecx, [esp+12] |
2245 | mov ecx, [esp+12] |
2246 | 2246 | ||
2247 | ; 4) Loop through redraw rectangle and copy background data |
2247 | ; 4) Loop through redraw rectangle and copy background data |
2248 | ; Registers meaning: |
2248 | ; Registers meaning: |
2249 | ; esi = offset in current line, edi -> output |
2249 | ; esi = offset in current line, edi -> output |
2250 | ; ebp = offset in WinMapAddress |
2250 | ; ebp = offset in WinMapAddress |
2251 | ; dword [esp] = offset in bgr data |
2251 | ; dword [esp] = offset in bgr data |
2252 | ; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1) |
2252 | ; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1) |
2253 | ; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1) |
2253 | ; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1) |
2254 | ; dword [esp+20] = x |
2254 | ; dword [esp+20] = x |
2255 | ; dword [esp+24] = y |
2255 | ; dword [esp+24] = y |
2256 | ; precalculated constants: |
2256 | ; precalculated constants: |
2257 | ; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) |
2257 | ; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) |
2258 | ; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) |
2258 | ; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) |
2259 | 2259 | ||
2260 | sdp3a: |
2260 | sdp3a: |
2261 | mov eax, [_display.win_map] |
2261 | mov eax, [_display.win_map] |
2262 | cmp [ebp+eax], byte 1 |
2262 | cmp [ebp+eax], byte 1 |
2263 | jnz snbgp |
2263 | jnz snbgp |
2264 | mov eax, [bgr_cur_line+esi] |
2264 | mov eax, [bgr_cur_line+esi] |
2265 | test ecx, ecx |
2265 | test ecx, ecx |
2266 | jz .novert |
2266 | jz .novert |
2267 | mov ebx, [bgr_next_line+esi] |
2267 | mov ebx, [bgr_next_line+esi] |
2268 | call [overlapping_of_points_ptr] |
2268 | call [overlapping_of_points_ptr] |
2269 | 2269 | ||
2270 | .novert: |
2270 | .novert: |
2271 | push ecx |
2271 | push ecx |
2272 | ; check for hardware cursor |
2272 | ; check for hardware cursor |
2273 | cmp [_display.select_cursor], select_cursor |
2273 | cmp [_display.select_cursor], select_cursor |
2274 | je @f |
2274 | je @f |
2275 | cmp [_display.select_cursor], 0 |
2275 | cmp [_display.select_cursor], 0 |
2276 | jne .no_mouseunder |
2276 | jne .no_mouseunder |
2277 | @@: |
2277 | @@: |
2278 | mov ecx, [esp+20+4] ;x |
2278 | mov ecx, [esp+20+4] ;x |
2279 | shl ecx, 16 |
2279 | shl ecx, 16 |
2280 | add ecx, [esp+24+4] ;y |
2280 | add ecx, [esp+24+4] ;y |
2281 | ; check mouse area for putpixel |
2281 | ; check mouse area for putpixel |
2282 | call [_display.check_mouse] |
2282 | call [_display.check_mouse] |
2283 | .no_mouseunder: |
2283 | .no_mouseunder: |
2284 | 2284 | ||
2285 | cmp [_display.bits_per_pixel], 16 |
2285 | cmp [_display.bits_per_pixel], 16 |
2286 | jne .not_16bpp |
2286 | jne .not_16bpp |
2287 | ; convert to 16 bpp and store to LFB |
2287 | ; convert to 16 bpp and store to LFB |
2288 | and eax, 00000000111110001111110011111000b |
2288 | and eax, 00000000111110001111110011111000b |
2289 | shr ah, 2 |
2289 | shr ah, 2 |
2290 | shr ax, 3 |
2290 | shr ax, 3 |
2291 | ror eax, 8 |
2291 | ror eax, 8 |
2292 | add al, ah |
2292 | add al, ah |
2293 | rol eax, 8 |
2293 | rol eax, 8 |
2294 | mov [LFB_BASE+edi], ax |
2294 | mov [LFB_BASE+edi], ax |
2295 | pop ecx |
2295 | pop ecx |
2296 | jmp snbgp |
2296 | jmp snbgp |
2297 | .not_16bpp: |
2297 | .not_16bpp: |
2298 | 2298 | ||
2299 | ; store to LFB |
2299 | ; store to LFB |
2300 | mov [LFB_BASE+edi], ax |
2300 | mov [LFB_BASE+edi], ax |
2301 | shr eax, 16 |
2301 | shr eax, 16 |
2302 | mov [LFB_BASE+edi+2], al |
2302 | mov [LFB_BASE+edi+2], al |
2303 | pop ecx |
2303 | pop ecx |
2304 | 2304 | ||
2305 | snbgp: |
2305 | snbgp: |
2306 | add edi, [_display.bytes_per_pixel] |
2306 | add edi, [_display.bytes_per_pixel] |
2307 | add ebp, 1 |
2307 | add ebp, 1 |
2308 | mov eax, [esp+20] |
2308 | mov eax, [esp+20] |
2309 | add eax, 1 |
2309 | add eax, 1 |
2310 | mov [esp+20], eax |
2310 | mov [esp+20], eax |
2311 | add esi, 4 |
2311 | add esi, 4 |
2312 | cmp eax, [draw_data + sizeof.WDATA + RECT.right] |
2312 | cmp eax, [background_window + WDATA.draw_data.right] |
2313 | jbe sdp3a |
2313 | jbe sdp3a |
2314 | 2314 | ||
2315 | sdp4: |
2315 | sdp4: |
2316 | ; next y |
2316 | ; next y |
2317 | mov ebx, [esp+24] |
2317 | mov ebx, [esp+24] |
2318 | add ebx, 1 |
2318 | add ebx, 1 |
2319 | mov [esp+24], ebx |
2319 | mov [esp+24], ebx |
2320 | cmp ebx, [draw_data + sizeof.WDATA + RECT.bottom] |
2320 | cmp ebx, [background_window + WDATA.draw_data.bottom] |
2321 | ja sdpdone |
2321 | ja sdpdone |
2322 | 2322 | ||
2323 | ; advance edi, ebp to next scan line |
2323 | ; advance edi, ebp to next scan line |
2324 | sub eax, [draw_data + sizeof.WDATA + RECT.left] |
2324 | sub eax, [background_window + WDATA.draw_data.left] |
2325 | sub ebp, eax |
2325 | sub ebp, eax |
2326 | add ebp, [_display.width] |
2326 | add ebp, [_display.width] |
2327 | sub edi, eax |
2327 | sub edi, eax |
2328 | sub edi, eax |
2328 | sub edi, eax |
2329 | cmp byte [_display.bytes_per_pixel], 2 |
2329 | cmp byte [_display.bytes_per_pixel], 2 |
2330 | jz @f |
2330 | jz @f |
2331 | sub edi, eax |
2331 | sub edi, eax |
2332 | cmp byte [_display.bytes_per_pixel], 3 |
2332 | cmp byte [_display.bytes_per_pixel], 3 |
2333 | jz @f |
2333 | jz @f |
2334 | sub edi, eax |
2334 | sub edi, eax |
2335 | 2335 | ||
2336 | @@: |
2336 | @@: |
2337 | add edi, [_display.lfb_pitch] |
2337 | add edi, [_display.lfb_pitch] |
2338 | ; restore ecx,edx; advance esi to next background line |
2338 | ; restore ecx,edx; advance esi to next background line |
2339 | mov eax, [esp+28] |
2339 | mov eax, [esp+28] |
2340 | mov ebx, [esp+32] |
2340 | mov ebx, [esp+32] |
2341 | add [esp+12], eax |
2341 | add [esp+12], eax |
2342 | mov eax, [esp+16] |
2342 | mov eax, [esp+16] |
2343 | adc [esp+16], ebx |
2343 | adc [esp+16], ebx |
2344 | sub eax, [esp+16] |
2344 | sub eax, [esp+16] |
2345 | mov ebx, eax |
2345 | mov ebx, eax |
2346 | lea eax, [eax*3] |
2346 | lea eax, [eax*3] |
2347 | imul eax, [BgrDataWidth] |
2347 | imul eax, [BgrDataWidth] |
2348 | sub [esp], eax |
2348 | sub [esp], eax |
2349 | mov eax, [draw_data + sizeof.WDATA + RECT.left] |
2349 | mov eax, [background_window + WDATA.draw_data.left] |
2350 | mov [esp+20], eax |
2350 | mov [esp+20], eax |
2351 | test ebx, ebx |
2351 | test ebx, ebx |
2352 | jz sdp3 |
2352 | jz sdp3 |
2353 | cmp ebx, -1 |
2353 | cmp ebx, -1 |
2354 | jnz bgr_resmooth0 |
2354 | jnz bgr_resmooth0 |
2355 | push edi |
2355 | push edi |
2356 | mov esi, bgr_next_line |
2356 | mov esi, bgr_next_line |
2357 | mov edi, bgr_cur_line |
2357 | mov edi, bgr_cur_line |
2358 | mov ecx, [_display.width] |
2358 | mov ecx, [_display.width] |
2359 | rep movsd |
2359 | rep movsd |
2360 | jmp bgr_resmooth1 |
2360 | jmp bgr_resmooth1 |
2361 | 2361 | ||
2362 | sdpdone: |
2362 | sdpdone: |
2363 | add esp, 44 |
2363 | add esp, 44 |
2364 | popad |
2364 | popad |
2365 | mov [EGA_counter], 1 |
2365 | mov [EGA_counter], 1 |
2366 | cmp [SCR_MODE], 0x12 |
2366 | cmp [SCR_MODE], 0x12 |
2367 | jne @f |
2367 | jne @f |
2368 | call VGA_drawbackground |
2368 | call VGA_drawbackground |
2369 | @@: |
2369 | @@: |
2370 | ret |
2370 | ret |
2371 | 2371 | ||
2372 | ;-------------------------------------- |
2372 | ;-------------------------------------- |
2373 | 2373 | ||
2374 | align 4 |
2374 | align 4 |
2375 | smooth_line: |
2375 | smooth_line: |
2376 | mov al, [esi+2] |
2376 | mov al, [esi+2] |
2377 | shl eax, 16 |
2377 | shl eax, 16 |
2378 | mov ax, [esi] |
2378 | mov ax, [esi] |
2379 | test ecx, ecx |
2379 | test ecx, ecx |
2380 | jz @f |
2380 | jz @f |
2381 | mov ebx, [esi+2] |
2381 | mov ebx, [esi+2] |
2382 | shr ebx, 8 |
2382 | shr ebx, 8 |
2383 | call [overlapping_of_points_ptr] |
2383 | call [overlapping_of_points_ptr] |
2384 | @@: |
2384 | @@: |
2385 | stosd |
2385 | stosd |
2386 | mov eax, [esp+20+8] |
2386 | mov eax, [esp+20+8] |
2387 | add eax, 1 |
2387 | add eax, 1 |
2388 | mov [esp+20+8], eax |
2388 | mov [esp+20+8], eax |
2389 | cmp eax, [draw_data + sizeof.WDATA + RECT.right] |
2389 | cmp eax, [background_window + WDATA.draw_data.right] |
2390 | ja @f |
2390 | ja @f |
2391 | add ecx, [esp+36+8] |
2391 | add ecx, [esp+36+8] |
2392 | mov eax, edx |
2392 | mov eax, edx |
2393 | adc edx, [esp+40+8] |
2393 | adc edx, [esp+40+8] |
2394 | sub eax, edx |
2394 | sub eax, edx |
2395 | lea eax, [eax*3] |
2395 | lea eax, [eax*3] |
2396 | sub esi, eax |
2396 | sub esi, eax |
2397 | jmp smooth_line |
2397 | jmp smooth_line |
2398 | @@: |
2398 | @@: |
2399 | mov eax, [draw_data + sizeof.WDATA + RECT.left] |
2399 | mov eax, [background_window + WDATA.draw_data.left] |
2400 | mov [esp+20+8], eax |
2400 | mov [esp+20+8], eax |
2401 | ret |
2401 | ret |
2402 | 2402 | ||
2403 | ;------------------------------------------------------------------------------ |
2403 | ;------------------------------------------------------------------------------ |
2404 | 2404 | ||
2405 | align 16 |
2405 | align 16 |
2406 | overlapping_of_points: |
2406 | overlapping_of_points: |
2407 | if 0 |
2407 | if 0 |
2408 | ; this version of procedure works, but is slower than next version |
2408 | ; this version of procedure works, but is slower than next version |
2409 | push ecx edx |
2409 | push ecx edx |
2410 | mov edx, eax |
2410 | mov edx, eax |
2411 | push esi |
2411 | push esi |
2412 | shr ecx, 24 |
2412 | shr ecx, 24 |
2413 | mov esi, ecx |
2413 | mov esi, ecx |
2414 | mov ecx, ebx |
2414 | mov ecx, ebx |
2415 | movzx ebx, dl |
2415 | movzx ebx, dl |
2416 | movzx eax, cl |
2416 | movzx eax, cl |
2417 | sub eax, ebx |
2417 | sub eax, ebx |
2418 | movzx ebx, dh |
2418 | movzx ebx, dh |
2419 | imul eax, esi |
2419 | imul eax, esi |
2420 | add dl, ah |
2420 | add dl, ah |
2421 | movzx eax, ch |
2421 | movzx eax, ch |
2422 | sub eax, ebx |
2422 | sub eax, ebx |
2423 | imul eax, esi |
2423 | imul eax, esi |
2424 | add dh, ah |
2424 | add dh, ah |
2425 | ror ecx, 16 |
2425 | ror ecx, 16 |
2426 | ror edx, 16 |
2426 | ror edx, 16 |
2427 | movzx eax, cl |
2427 | movzx eax, cl |
2428 | movzx ebx, dl |
2428 | movzx ebx, dl |
2429 | sub eax, ebx |
2429 | sub eax, ebx |
2430 | imul eax, esi |
2430 | imul eax, esi |
2431 | pop esi |
2431 | pop esi |
2432 | add dl, ah |
2432 | add dl, ah |
2433 | mov eax, edx |
2433 | mov eax, edx |
2434 | pop edx |
2434 | pop edx |
2435 | ror eax, 16 |
2435 | ror eax, 16 |
2436 | pop ecx |
2436 | pop ecx |
2437 | ret |
2437 | ret |
2438 | else |
2438 | else |
2439 | push ecx edx |
2439 | push ecx edx |
2440 | mov edx, eax |
2440 | mov edx, eax |
2441 | push esi |
2441 | push esi |
2442 | shr ecx, 26 |
2442 | shr ecx, 26 |
2443 | mov esi, ecx |
2443 | mov esi, ecx |
2444 | mov ecx, ebx |
2444 | mov ecx, ebx |
2445 | shl esi, 9 |
2445 | shl esi, 9 |
2446 | movzx ebx, dl |
2446 | movzx ebx, dl |
2447 | movzx eax, cl |
2447 | movzx eax, cl |
2448 | sub eax, ebx |
2448 | sub eax, ebx |
2449 | movzx ebx, dh |
2449 | movzx ebx, dh |
2450 | add dl, [BgrAuxTable + (eax + 0x100) + esi] |
2450 | add dl, [BgrAuxTable + (eax + 0x100) + esi] |
2451 | movzx eax, ch |
2451 | movzx eax, ch |
2452 | sub eax, ebx |
2452 | sub eax, ebx |
2453 | add dh, [BgrAuxTable + (eax+0x100) + esi] |
2453 | add dh, [BgrAuxTable + (eax+0x100) + esi] |
2454 | ror ecx, 16 |
2454 | ror ecx, 16 |
2455 | ror edx, 16 |
2455 | ror edx, 16 |
2456 | movzx eax, cl |
2456 | movzx eax, cl |
2457 | movzx ebx, dl |
2457 | movzx ebx, dl |
2458 | sub eax, ebx |
2458 | sub eax, ebx |
2459 | add dl, [BgrAuxTable + (eax + 0x100) + esi] |
2459 | add dl, [BgrAuxTable + (eax + 0x100) + esi] |
2460 | pop esi |
2460 | pop esi |
2461 | mov eax, edx |
2461 | mov eax, edx |
2462 | pop edx |
2462 | pop edx |
2463 | ror eax, 16 |
2463 | ror eax, 16 |
2464 | pop ecx |
2464 | pop ecx |
2465 | ret |
2465 | ret |
2466 | end if |
2466 | end if |
2467 | 2467 | ||
2468 | 2468 | ||
2469 | ;------------------------------------------------------------------------------ |
2469 | ;------------------------------------------------------------------------------ |
2470 | 2470 | ||
2471 | align 4 |
2471 | align 4 |
2472 | init_background: |
2472 | init_background: |
2473 | 2473 | ||
2474 | mov edi, BgrAuxTable |
2474 | mov edi, BgrAuxTable |
2475 | xor edx, edx |
2475 | xor edx, edx |
2476 | 2476 | ||
2477 | .loop2: |
2477 | .loop2: |
2478 | mov eax, edx |
2478 | mov eax, edx |
2479 | shl eax, 8 |
2479 | shl eax, 8 |
2480 | neg eax |
2480 | neg eax |
2481 | mov ecx, 0x200 |
2481 | mov ecx, 0x200 |
2482 | 2482 | ||
2483 | .loop1: |
2483 | .loop1: |
2484 | mov byte [edi], ah |
2484 | mov byte [edi], ah |
2485 | inc edi |
2485 | inc edi |
2486 | add eax, edx |
2486 | add eax, edx |
2487 | loop .loop1 |
2487 | loop .loop1 |
2488 | add dl, 4 |
2488 | add dl, 4 |
2489 | jnz .loop2 |
2489 | jnz .loop2 |
2490 | test byte [cpu_caps + (CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8) |
2490 | test byte [cpu_caps + (CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8) |
2491 | jz @f |
2491 | jz @f |
2492 | mov [overlapping_of_points_ptr], overlapping_of_points_mmx |
2492 | mov [overlapping_of_points_ptr], overlapping_of_points_mmx |
2493 | @@: |
2493 | @@: |
2494 | ret |
2494 | ret |
2495 | 2495 | ||
2496 | ;------------------------------------------------------------------------------ |
2496 | ;------------------------------------------------------------------------------ |
2497 | 2497 | ||
2498 | align 16 |
2498 | align 16 |
2499 | overlapping_of_points_mmx: |
2499 | overlapping_of_points_mmx: |
2500 | 2500 | ||
2501 | movd mm0, eax |
2501 | movd mm0, eax |
2502 | movd mm4, eax |
2502 | movd mm4, eax |
2503 | movd mm1, ebx |
2503 | movd mm1, ebx |
2504 | pxor mm2, mm2 |
2504 | pxor mm2, mm2 |
2505 | punpcklbw mm0, mm2 |
2505 | punpcklbw mm0, mm2 |
2506 | punpcklbw mm1, mm2 |
2506 | punpcklbw mm1, mm2 |
2507 | psubw mm1, mm0 |
2507 | psubw mm1, mm0 |
2508 | movd mm3, ecx |
2508 | movd mm3, ecx |
2509 | psrld mm3, 24 |
2509 | psrld mm3, 24 |
2510 | packuswb mm3, mm3 |
2510 | packuswb mm3, mm3 |
2511 | packuswb mm3, mm3 |
2511 | packuswb mm3, mm3 |
2512 | pmullw mm1, mm3 |
2512 | pmullw mm1, mm3 |
2513 | psrlw mm1, 8 |
2513 | psrlw mm1, 8 |
2514 | packuswb mm1, mm2 |
2514 | packuswb mm1, mm2 |
2515 | paddb mm4, mm1 |
2515 | paddb mm4, mm1 |
2516 | movd eax, mm4 |
2516 | movd eax, mm4 |
2517 | 2517 | ||
2518 | ret |
2518 | ret |
2519 | 2519 | ||
2520 | ;------------------------------------------------------------------------------> |
2520 | ;------------------------------------------------------------------------------> |