Rev 485 | Rev 6352 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 485 | Rev 6342 | ||
---|---|---|---|
1 | ;----------------------------------------------------------- |
1 | ;----------------------------------------------------------- |
2 | ;-----instruments of panel(icon's instruments)-------------- |
2 | ;-----instruments of panel(icon's instruments)-------------- |
3 | ;----------------------------------------------------------- |
3 | ;----------------------------------------------------------- |
4 | TakeButtonInstruments: |
4 | TakeButtonInstruments: |
5 | 5 | ||
6 | mov eax,[Current_instrument] |
6 | mov eax,[Current_instrument] |
7 | 7 | ||
8 | ;*************************brush 1*********************** |
8 | ;*************************brush 1*********************** |
9 | cmp eax,40 |
9 | cmp eax,40 |
10 | jne no_brush1 |
10 | jne no_brush1 |
11 | 11 | ||
12 | mov [Brush_SizeX],4 |
12 | mov [Brush_SizeX],4 |
13 | mov [Brush_SizeY],4 |
13 | mov [Brush_SizeY],4 |
14 | mov [Number_Brush],0 |
14 | mov [Number_Brush],0 |
15 | mov ebx,[Last_instrument] |
15 | mov ebx,[Last_instrument] |
16 | mov [Current_instrument],ebx |
16 | mov [Current_instrument],ebx |
17 | 17 | ||
18 | mov [line_width],1 |
18 | mov [line_width],1 |
19 | 19 | ||
20 | jmp still |
20 | jmp still |
21 | no_brush1: |
21 | no_brush1: |
22 | 22 | ||
23 | ;*************************brush 2*********************** |
23 | ;*************************brush 2*********************** |
24 | cmp eax,41 |
24 | cmp eax,41 |
25 | jne no_brush2 |
25 | jne no_brush2 |
26 | 26 | ||
27 | mov [Brush_SizeX],6 |
27 | mov [Brush_SizeX],6 |
28 | mov [Brush_SizeY],4 |
28 | mov [Brush_SizeY],4 |
29 | mov [Number_Brush],1 |
29 | mov [Number_Brush],1 |
30 | mov ebx,[Last_instrument] |
30 | mov ebx,[Last_instrument] |
31 | mov [Current_instrument],ebx |
31 | mov [Current_instrument],ebx |
32 | 32 | ||
33 | mov [line_width],2 |
33 | mov [line_width],2 |
34 | 34 | ||
35 | jmp still |
35 | jmp still |
36 | no_brush2: |
36 | no_brush2: |
37 | 37 | ||
38 | ;*************************brush 3*********************** |
38 | ;*************************brush 3*********************** |
39 | cmp eax,42 |
39 | cmp eax,42 |
40 | jne no_brush3 |
40 | jne no_brush3 |
41 | 41 | ||
42 | mov [Brush_SizeX],8 |
42 | mov [Brush_SizeX],8 |
43 | mov [Brush_SizeY],7 |
43 | mov [Brush_SizeY],7 |
44 | mov [Number_Brush],2 |
44 | mov [Number_Brush],2 |
45 | mov ebx,[Last_instrument] |
45 | mov ebx,[Last_instrument] |
46 | mov [Current_instrument],ebx |
46 | mov [Current_instrument],ebx |
47 | 47 | ||
48 | mov [line_width],3 |
48 | mov [line_width],3 |
49 | 49 | ||
50 | jmp still |
50 | jmp still |
51 | no_brush3: |
51 | no_brush3: |
52 | 52 | ||
53 | ;************************brush 4************************ |
53 | ;************************brush 4************************ |
54 | cmp eax,43 |
54 | cmp eax,43 |
55 | jne no_brush4 |
55 | jne no_brush4 |
56 | 56 | ||
57 | mov [Brush_SizeX],14 |
57 | mov [Brush_SizeX],14 |
58 | mov [Brush_SizeY],14 |
58 | mov [Brush_SizeY],14 |
59 | mov [Number_Brush],3 |
59 | mov [Number_Brush],3 |
60 | mov ebx,[Last_instrument] |
60 | mov ebx,[Last_instrument] |
61 | mov [Current_instrument],ebx |
61 | mov [Current_instrument],ebx |
62 | 62 | ||
63 | mov [line_width],4 |
63 | mov [line_width],4 |
64 | 64 | ||
65 | jmp still |
65 | jmp still |
66 | no_brush4: |
66 | no_brush4: |
67 | 67 | ||
68 | ;************************brush 5************************ |
68 | ;************************brush 5************************ |
69 | cmp eax,44 |
69 | cmp eax,44 |
70 | jne no_brush5 |
70 | jne no_brush5 |
71 | 71 | ||
72 | mov [Brush_SizeX],6 |
72 | mov [Brush_SizeX],6 |
73 | mov [Brush_SizeY],6 |
73 | mov [Brush_SizeY],6 |
74 | mov [Number_Brush],4 |
74 | mov [Number_Brush],4 |
75 | mov ebx,[Last_instrument] |
75 | mov ebx,[Last_instrument] |
76 | mov [Current_instrument],ebx |
76 | mov [Current_instrument],ebx |
77 | 77 | ||
78 | mov [line_width],5 |
78 | mov [line_width],5 |
79 | 79 | ||
80 | jmp still |
80 | jmp still |
81 | no_brush5: |
81 | no_brush5: |
82 | 82 | ||
83 | ;*************************pensil************************ |
83 | ;*************************pensil************************ |
84 | cmp eax,10 |
84 | cmp eax,10 |
85 | jne no_pensil |
85 | jne no_pensil |
86 | 86 | ||
87 | mov al,[exit_from_work_arrea] |
87 | mov al,[exit_from_work_arrea] |
88 | 88 | ||
89 | test al,al |
89 | test al,al |
90 | jz no_exit_from_work_arrea |
90 | jz no_exit_from_work_arrea |
91 | 91 | ||
92 | and [Activate_instrument],0 |
92 | and [Activate_instrument],0 |
93 | and [exit_from_work_arrea],0 |
93 | and [exit_from_work_arrea],0 |
94 | 94 | ||
95 | no_exit_from_work_arrea: |
95 | no_exit_from_work_arrea: |
96 | 96 | ||
97 | mov al,[Activate_instrument] |
97 | mov al,[Activate_instrument] |
98 | 98 | ||
99 | test al,al |
99 | test al,al |
100 | jnz no_activated_later |
100 | jnz no_activated_later |
101 | 101 | ||
102 | call GetScreenCordinats |
102 | call GetScreenCordinats |
103 | mov eax,[ScreenX] |
103 | mov eax,[ScreenX] |
104 | mov ebx,[ScreenY] |
104 | mov ebx,[ScreenY] |
105 | add eax,[PosX] |
105 | add eax,[PosX] |
106 | add ebx,[PosY] |
106 | add ebx,[PosY] |
107 | mov [OldX],eax |
107 | mov [OldX],eax |
108 | mov [OldY],ebx |
108 | mov [OldY],ebx |
109 | 109 | ||
110 | no_activated_later: |
110 | no_activated_later: |
111 | 111 | ||
112 | mov eax,[MaxWorkScreen_SizeX] |
112 | mov eax,[MaxWorkScreen_SizeX] |
113 | mov ebx,[MaxWorkScreen_SizeY] |
113 | mov ebx,[MaxWorkScreen_SizeY] |
114 | 114 | ||
115 | mov eax,[PointerToPicture] |
115 | mov eax,[PointerToPicture] |
116 | mov ebx,[ReserveArray] |
116 | mov ebx,[ReserveArray] |
117 | mov ecx,[Picture_SizeX] |
117 | mov ecx,[Picture_SizeX] |
118 | mov edx,[OldX] |
118 | mov edx,[OldX] |
119 | shl edx,16 |
119 | shl edx,16 |
120 | add edx,[OldY] |
120 | add edx,[OldY] |
121 | mov esi,[ScreenX] |
121 | mov esi,[ScreenX] |
122 | mov edi,[ScreenY] |
122 | mov edi,[ScreenY] |
123 | add esi,[PosX] |
123 | add esi,[PosX] |
124 | add edi,[PosY] |
124 | add edi,[PosY] |
125 | call calculate_line |
125 | call calculate_line |
126 | 126 | ||
127 | mov ecx,eax |
127 | mov ecx,eax |
128 | mov edx,[Color] |
128 | mov edx,[Color] |
129 | mov esi,[Color] |
129 | mov esi,[Color] |
130 | shr edx,16 |
130 | shr edx,16 |
131 | xor ebx,ebx |
131 | xor ebx,ebx |
132 | mov eax,[ReserveArray] |
132 | mov eax,[ReserveArray] |
133 | 133 | ||
134 | pensil_next_pixel_draw: |
134 | pensil_next_pixel_draw: |
135 | 135 | ||
136 | mov ebx,[eax] |
136 | mov ebx,[eax] |
137 | mov [ebx],si |
137 | mov [ebx],si |
138 | mov [ebx+2],dl |
138 | mov [ebx+2],dl |
139 | add eax,4 |
139 | add eax,4 |
140 | 140 | ||
141 | dec ecx |
141 | dec ecx |
142 | jnz pensil_next_pixel_draw |
142 | jnz pensil_next_pixel_draw |
143 | 143 | ||
144 | mov eax,[ScreenX] |
144 | mov eax,[ScreenX] |
145 | mov ebx,[ScreenY] |
145 | mov ebx,[ScreenY] |
146 | add eax,[PosX] |
146 | add eax,[PosX] |
147 | add ebx,[PosY] |
147 | add ebx,[PosY] |
148 | mov [OldX],eax |
148 | mov [OldX],eax |
149 | mov [OldY],ebx |
149 | mov [OldY],ebx |
150 | 150 | ||
151 | call MovePictureToWorkScreen |
151 | call MovePictureToWorkScreen |
152 | mov [Activate_instrument],1 |
152 | mov [Activate_instrument],1 |
153 | jmp still |
153 | jmp still |
154 | no_pensil: |
154 | no_pensil: |
155 | 155 | ||
156 | ;**********************pipetka************************** |
156 | ;**********************pipetka************************** |
157 | cmp eax,15 |
157 | cmp eax,15 |
158 | jne no_pipetka |
158 | jne no_pipetka |
159 | 159 | ||
160 | mov eax,[ScreenY] |
160 | mov eax,[ScreenY] |
161 | mov ebx,[Picture_SizeX] |
161 | mov ebx,[Picture_SizeX] |
162 | add eax,[PosY] |
162 | add eax,[PosY] |
163 | imul eax,ebx |
163 | imul eax,ebx |
164 | add eax,[ScreenX] |
164 | add eax,[ScreenX] |
165 | add eax,[PosX] |
165 | add eax,[PosX] |
166 | lea eax,[eax+eax*2] |
166 | lea eax,[eax+eax*2] |
167 | add eax,[PointerToPicture] |
167 | add eax,[PointerToPicture] |
168 | mov ebx,[eax] |
168 | mov ebx,[eax] |
169 | and ebx,0xffffff |
169 | and ebx,0xffffff |
170 | mov [Color],ebx |
170 | mov [Color],ebx |
171 | - | ||
172 | mov eax,13 |
171 | |
173 | mov ebx,136*65536+20 |
- | |
174 | mov ecx,65*65536+21 |
- | |
175 | mov edx,[Color] |
- | |
176 | mcall |
172 | mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color] |
177 | 173 | ||
178 | jmp still |
174 | jmp still |
179 | no_pipetka: |
175 | no_pipetka: |
180 | 176 | ||
181 | ;**********************draw brush*********************** |
177 | ;**********************draw brush*********************** |
182 | cmp eax,11 |
178 | cmp eax,11 |
183 | jne no_brush |
179 | jne no_brush |
184 | 180 | ||
185 | mov [Last_instrument],eax |
181 | mov [Last_instrument],eax |
186 | 182 | ||
187 | jmp no_lastik_ |
183 | jmp no_lastik_ |
188 | 184 | ||
189 | lastik_in: |
185 | lastik_in: |
190 | mov eax,[Color] |
186 | mov eax,[Color] |
191 | mov [SColor],eax |
187 | mov [SColor],eax |
192 | mov [Color],0xffffff |
188 | mov [Color],0xffffff |
193 | no_lastik_: |
189 | no_lastik_: |
194 | 190 | ||
195 | mov eax,[ScreenX] |
191 | mov eax,[ScreenX] |
196 | mov ebx,[ScreenY] |
192 | mov ebx,[ScreenY] |
197 | mov ecx,[Brush_SizeX] |
193 | mov ecx,[Brush_SizeX] |
198 | mov edx,[Brush_SizeY] |
194 | mov edx,[Brush_SizeY] |
199 | add eax,[PosX] |
195 | add eax,[PosX] |
200 | add ebx,[PosY] |
196 | add ebx,[PosY] |
201 | add eax,ecx |
197 | add eax,ecx |
202 | add ebx,edx |
198 | add ebx,edx |
203 | 199 | ||
204 | cmp eax,[Picture_SizeX] |
200 | cmp eax,[Picture_SizeX] |
205 | jl no_max_pos_x |
201 | jl no_max_pos_x |
206 | mov eax,[Picture_SizeX] |
202 | mov eax,[Picture_SizeX] |
207 | no_max_pos_x: |
203 | no_max_pos_x: |
208 | 204 | ||
209 | cmp ebx,[Picture_SizeY] |
205 | cmp ebx,[Picture_SizeY] |
210 | jl no_max_pos_y |
206 | jl no_max_pos_y |
211 | mov ebx,[Picture_SizeY] |
207 | mov ebx,[Picture_SizeY] |
212 | no_max_pos_y: |
208 | no_max_pos_y: |
213 | 209 | ||
214 | cmp eax,ecx |
210 | cmp eax,ecx |
215 | ja no_min_pos_x |
211 | ja no_min_pos_x |
216 | mov eax,[Brush_SizeX] |
212 | mov eax,[Brush_SizeX] |
217 | no_min_pos_x: |
213 | no_min_pos_x: |
218 | 214 | ||
219 | cmp ebx,edx |
215 | cmp ebx,edx |
220 | ja no_min_pos_y |
216 | ja no_min_pos_y |
221 | mov ebx,[Brush_SizeY] |
217 | mov ebx,[Brush_SizeY] |
222 | no_min_pos_y: |
218 | no_min_pos_y: |
223 | 219 | ||
224 | sub eax,[Brush_SizeX] |
220 | sub eax,[Brush_SizeX] |
225 | sub ebx,[Brush_SizeY] |
221 | sub ebx,[Brush_SizeY] |
226 | 222 | ||
227 | mov [x],eax |
223 | mov [x],eax |
228 | mov [y],ebx |
224 | mov [y],ebx |
229 | 225 | ||
230 | mov al,[exit_from_work_arrea] |
226 | mov al,[exit_from_work_arrea] |
231 | test al,al |
227 | test al,al |
232 | jz no_exit_from_work_arrea_brush |
228 | jz no_exit_from_work_arrea_brush |
233 | and [Activate_instrument],0 |
229 | and [Activate_instrument],0 |
234 | and [exit_from_work_arrea],0 |
230 | and [exit_from_work_arrea],0 |
235 | no_exit_from_work_arrea_brush: |
231 | no_exit_from_work_arrea_brush: |
236 | 232 | ||
237 | mov al,[Activate_instrument] |
233 | mov al,[Activate_instrument] |
238 | test al,al |
234 | test al,al |
239 | jnz no_new_brush_xy |
235 | jnz no_new_brush_xy |
240 | mov eax,[x] |
236 | mov eax,[x] |
241 | mov ebx,[y] |
237 | mov ebx,[y] |
242 | mov [OldX],eax |
238 | mov [OldX],eax |
243 | mov [OldY],ebx |
239 | mov [OldY],ebx |
244 | mov [Activate_instrument],1 |
240 | mov [Activate_instrument],1 |
245 | no_new_brush_xy: |
241 | no_new_brush_xy: |
246 | 242 | ||
247 | mov eax,[PointerToPicture] |
243 | mov eax,[PointerToPicture] |
248 | mov ebx,[ReserveArray] |
244 | mov ebx,[ReserveArray] |
249 | add ebx,4 |
245 | add ebx,4 |
250 | mov ecx,[Picture_SizeX] |
246 | mov ecx,[Picture_SizeX] |
251 | mov edx,[OldX] |
247 | mov edx,[OldX] |
252 | shl edx,16 |
248 | shl edx,16 |
253 | add edx,[OldY] |
249 | add edx,[OldY] |
254 | mov esi,[x] |
250 | mov esi,[x] |
255 | mov edi,[y] |
251 | mov edi,[y] |
256 | 252 | ||
257 | call calculate_line |
253 | call calculate_line |
258 | 254 | ||
259 | mov ebx,[ReserveArray] |
255 | mov ebx,[ReserveArray] |
260 | mov [ebx],eax |
256 | mov [ebx],eax |
261 | 257 | ||
262 | ;procedure drawing of brush |
258 | ;procedure drawing of brush |
263 | mov ebx,[ReserveArray] |
259 | mov ebx,[ReserveArray] |
264 | mov ecx,[ebx] |
260 | mov ecx,[ebx] |
265 | mov edx,[Color] |
261 | mov edx,[Color] |
266 | mov esi,[Color] |
262 | mov esi,[Color] |
267 | shr edx,16 |
263 | shr edx,16 |
268 | add ebx,4 |
264 | add ebx,4 |
269 | mov edi,[Number_Brush] |
265 | mov edi,[Number_Brush] |
270 | imul edi,20*20 |
266 | imul edi,20*20 |
271 | 267 | ||
272 | next_pixel_put_brush: |
268 | next_pixel_put_brush: |
273 | 269 | ||
274 | mov eax,[ebx] |
270 | mov eax,[ebx] |
275 | push eax |
271 | push eax |
276 | push ecx |
272 | push ecx |
277 | xor ebp,ebp |
273 | xor ebp,ebp |
278 | and [counter2],0 |
274 | and [counter2],0 |
279 | 275 | ||
280 | vertical_width_brush: |
276 | vertical_width_brush: |
281 | and [counter],0 |
277 | and [counter],0 |
282 | 278 | ||
283 | horizontal_width_brush: |
279 | horizontal_width_brush: |
284 | xor ecx,ecx |
280 | xor ecx,ecx |
285 | mov cl,byte[Brush_color+edi+ebp] |
281 | mov cl,byte[Brush_color+edi+ebp] |
286 | test cl,cl |
282 | test cl,cl |
287 | jz no_draw_pixel_brush |
283 | jz no_draw_pixel_brush |
288 | mov [eax],si |
284 | mov [eax],si |
289 | mov [eax+2],dl |
285 | mov [eax+2],dl |
290 | no_draw_pixel_brush: |
286 | no_draw_pixel_brush: |
291 | add eax,3 |
287 | add eax,3 |
292 | inc ebp |
288 | inc ebp |
293 | inc [counter] |
289 | inc [counter] |
294 | cmp [counter],20 |
290 | cmp [counter],20 |
295 | jne horizontal_width_brush |
291 | jne horizontal_width_brush |
296 | 292 | ||
297 | mov ecx,[Picture_SizeX] |
293 | mov ecx,[Picture_SizeX] |
298 | sub ecx,20 |
294 | sub ecx,20 |
299 | lea ecx,[ecx+ecx*2] |
295 | lea ecx,[ecx+ecx*2] |
300 | add eax,ecx |
296 | add eax,ecx |
301 | inc [counter2] |
297 | inc [counter2] |
302 | cmp [counter2],20 |
298 | cmp [counter2],20 |
303 | jne vertical_width_brush |
299 | jne vertical_width_brush |
304 | 300 | ||
305 | pop ecx |
301 | pop ecx |
306 | pop eax |
302 | pop eax |
307 | add ebx,4 |
303 | add ebx,4 |
308 | dec ecx |
304 | dec ecx |
309 | jnz next_pixel_put_brush |
305 | jnz next_pixel_put_brush |
310 | 306 | ||
311 | mov eax,[x] |
307 | mov eax,[x] |
312 | mov ebx,[y] |
308 | mov ebx,[y] |
313 | mov [OldX],eax |
309 | mov [OldX],eax |
314 | mov [OldY],ebx |
310 | mov [OldY],ebx |
315 | 311 | ||
316 | mov al,[lastik_is_active] |
312 | mov al,[lastik_is_active] |
317 | test al,al |
313 | test al,al |
318 | jz no_lastik_active |
314 | jz no_lastik_active |
319 | 315 | ||
320 | mov eax,[SColor] |
316 | mov eax,[SColor] |
321 | mov [Color],eax |
317 | mov [Color],eax |
322 | and [lastik_is_active],0 |
318 | and [lastik_is_active],0 |
323 | no_lastik_active: |
319 | no_lastik_active: |
324 | 320 | ||
325 | call MovePictureToWorkScreen |
321 | call MovePictureToWorkScreen |
326 | mov eax,[Current_instrument] |
322 | mov eax,[Current_instrument] |
327 | mov [Last_instrument],eax |
323 | mov [Last_instrument],eax |
328 | 324 | ||
329 | jmp still |
325 | jmp still |
330 | no_brush: |
326 | no_brush: |
331 | 327 | ||
332 | ;************************Flood Fill******************* |
328 | ;************************Flood Fill******************* |
333 | cmp eax,14 |
329 | cmp eax,14 |
334 | jne no_FloodFill |
330 | jne no_FloodFill |
335 | 331 | ||
336 | mov eax,[PointerToPicture] |
332 | mov eax,[PointerToPicture] |
337 | mov ebx,[PointerToEditBufer] |
333 | mov ebx,[PointerToEditBufer] |
338 | 334 | ||
339 | mov ecx,[Picture_SizeX] |
335 | mov ecx,[Picture_SizeX] |
340 | imul ecx,[Picture_SizeY] |
336 | imul ecx,[Picture_SizeY] |
341 | lea ecx,[ecx+ecx*2] |
337 | lea ecx,[ecx+ecx*2] |
342 | shl ecx,1 |
338 | shl ecx,1 |
343 | 339 | ||
344 | cmp ecx,500000 |
340 | cmp ecx,mem_flood_f |
345 | ja normal_size_of_bufer |
341 | ja normal_size_of_bufer |
346 | 342 | ||
347 | mov ebx,[ReserveArray] |
343 | mov ebx,[ReserveArray] |
348 | 344 | ||
349 | normal_size_of_bufer: |
345 | normal_size_of_bufer: |
350 | 346 | ||
351 | add ebx,4 |
347 | add ebx,4 |
352 | mov ecx,[Picture_SizeX] |
348 | mov ecx,[Picture_SizeX] |
353 | mov edx,[ScreenX] |
349 | mov edx,[ScreenX] |
354 | add edx,[PosX] |
350 | add edx,[PosX] |
355 | shl edx,16 |
351 | shl edx,16 |
356 | add edx,[ScreenY] |
352 | add edx,[ScreenY] |
357 | add edx,[PosY] |
353 | add edx,[PosY] |
358 | mov esi,[Picture_SizeX] |
354 | mov esi,[Picture_SizeX] |
359 | dec esi |
355 | dec esi |
360 | shl esi,16 |
356 | shl esi,16 |
361 | add esi,[Picture_SizeY] |
357 | add esi,[Picture_SizeY] |
362 | dec esi |
358 | dec esi |
363 | mov edi,[Color] |
359 | mov edi,[Color] |
364 | 360 | ||
365 | call flood_fill |
361 | call flood_fill |
366 | call MovePictureToWorkScreen |
362 | call MovePictureToWorkScreen |
367 | 363 | ||
368 | jmp still |
364 | jmp still |
369 | no_FloodFill: |
365 | no_FloodFill: |
370 | 366 | ||
371 | ;************************lastik************************* |
367 | ;************************lastik************************* |
372 | cmp eax,13 |
368 | cmp eax,13 |
373 | jne no_lastik |
369 | jne no_lastik |
374 | 370 | ||
375 | mov [Last_instrument],eax |
371 | mov [Last_instrument],eax |
376 | mov [lastik_is_active],1 |
372 | mov [lastik_is_active],1 |
377 | jmp lastik_in |
373 | jmp lastik_in |
378 | 374 | ||
379 | no_lastik: |
375 | no_lastik: |
380 | 376 | ||
381 | ;****************************************************** |
377 | ;****************************************************** |
382 | cmp eax,12 |
378 | cmp eax,12 |
383 | jne no_spray |
379 | jne no_spray |
384 | 380 | ||
385 | cmp [Activate_instrument],0 |
381 | cmp [Activate_instrument],0 |
386 | jne no_null_spray |
382 | jne no_null_spray |
387 | mov [Activate_instrument],1 |
383 | mov [Activate_instrument],1 |
388 | jmp still |
384 | jmp still |
389 | no_null_spray: |
385 | no_null_spray: |
390 | 386 | ||
391 | mov eax,[ScreenX] |
387 | mov eax,[ScreenX] |
392 | mov ebx,[ScreenY] |
388 | mov ebx,[ScreenY] |
393 | mov ecx,[Brush_SizeX] |
389 | mov ecx,[Brush_SizeX] |
394 | mov edx,[Brush_SizeY] |
390 | mov edx,[Brush_SizeY] |
395 | add eax,[PosX] |
391 | add eax,[PosX] |
396 | add ebx,[PosY] |
392 | add ebx,[PosY] |
397 | add eax,ecx |
393 | add eax,ecx |
398 | add ebx,edx |
394 | add ebx,edx |
399 | 395 | ||
400 | cmp eax,[Picture_SizeX] |
396 | cmp eax,[Picture_SizeX] |
401 | jl no_max_pos_x_spray |
397 | jl no_max_pos_x_spray |
402 | mov eax,[Picture_SizeX] |
398 | mov eax,[Picture_SizeX] |
403 | no_max_pos_x_spray: |
399 | no_max_pos_x_spray: |
404 | 400 | ||
405 | cmp ebx,[Picture_SizeY] |
401 | cmp ebx,[Picture_SizeY] |
406 | jl no_max_pos_y_spray |
402 | jl no_max_pos_y_spray |
407 | mov ebx,[Picture_SizeY] |
403 | mov ebx,[Picture_SizeY] |
408 | no_max_pos_y_spray: |
404 | no_max_pos_y_spray: |
409 | 405 | ||
410 | cmp eax,ecx |
406 | cmp eax,ecx |
411 | ja no_min_pos_x_spray |
407 | ja no_min_pos_x_spray |
412 | mov eax,[Brush_SizeX] |
408 | mov eax,[Brush_SizeX] |
413 | no_min_pos_x_spray: |
409 | no_min_pos_x_spray: |
414 | 410 | ||
415 | cmp ebx,edx |
411 | cmp ebx,edx |
416 | ja no_min_pos_y_spray |
412 | ja no_min_pos_y_spray |
417 | mov ebx,[Brush_SizeY] |
413 | mov ebx,[Brush_SizeY] |
418 | no_min_pos_y_spray: |
414 | no_min_pos_y_spray: |
419 | 415 | ||
420 | sub eax,[Brush_SizeX] |
416 | sub eax,[Brush_SizeX] |
421 | sub ebx,[Brush_SizeY] |
417 | sub ebx,[Brush_SizeY] |
422 | mov edi,0;[Number_Brush] |
418 | mov edi,0;[Number_Brush] |
423 | imul edi,20*20 |
419 | imul edi,20*20 |
424 | 420 | ||
425 | mov [x],eax |
421 | mov [x],eax |
426 | mov [y],ebx |
422 | mov [y],ebx |
427 | mov ebp,[Picture_SizeX] |
423 | mov ebp,[Picture_SizeX] |
428 | xor edx,edx |
424 | xor edx,edx |
429 | brush_y_spray: |
425 | brush_y_spray: |
430 | xor ecx,ecx |
426 | xor ecx,ecx |
431 | brush_x_spray: |
427 | brush_x_spray: |
432 | ;calculate position in array of spray |
428 | ;calculate position in array of spray |
433 | mov esi,edx |
429 | mov esi,edx |
434 | lea esi,[esi+esi*4] ;esi=esi*5 |
430 | lea esi,[esi+esi*4] ;esi=esi*5 |
435 | shl esi,2 ;esi=(esi*3)*4 |
431 | shl esi,2 ;esi=(esi*3)*4 |
436 | add esi,ecx |
432 | add esi,ecx |
437 | add esi,edi |
433 | add esi,edi |
438 | ;read byte from array |
434 | ;read byte from array |
439 | xor eax,eax |
435 | xor eax,eax |
440 | mov al,[Spray_color+esi] |
436 | mov al,[Spray_color+esi] |
441 | test eax,eax |
437 | test eax,eax |
442 | jz no_color_spray |
438 | jz no_color_spray |
443 | mov eax,[x] |
439 | mov eax,[x] |
444 | mov ebx,[y] |
440 | mov ebx,[y] |
445 | add eax,ecx |
441 | add eax,ecx |
446 | add ebx,edx |
442 | add ebx,edx |
447 | imul ebx,ebp; ebp=[Picture_SizeX] |
443 | imul ebx,ebp; ebp=[Picture_SizeX] |
448 | add eax,ebx |
444 | add eax,ebx |
449 | lea eax,[eax+eax*2] |
445 | lea eax,[eax+eax*2] |
450 | add eax,[PointerToPicture] |
446 | add eax,[PointerToPicture] |
451 | mov ebx,[Color] |
447 | mov ebx,[Color] |
452 | mov [eax],bx |
448 | mov [eax],bx |
453 | shr ebx,16 |
449 | shr ebx,16 |
454 | mov [eax+2],bl |
450 | mov [eax+2],bl |
455 | no_color_spray: |
451 | no_color_spray: |
456 | inc ecx |
452 | inc ecx |
457 | cmp ecx,20 |
453 | cmp ecx,20 |
458 | jl brush_x_spray |
454 | jl brush_x_spray |
459 | inc edx |
455 | inc edx |
460 | cmp edx,20 |
456 | cmp edx,20 |
461 | jl brush_y_spray |
457 | jl brush_y_spray |
462 | 458 | ||
463 | call MovePictureToWorkScreen |
459 | call MovePictureToWorkScreen |
464 | jmp still |
460 | jmp still |
465 | 461 | ||
466 | no_spray: |
462 | no_spray: |
467 | 463 | ||
468 | ;***********************palette************************* |
464 | ;***********************palette************************* |
469 | cmp eax,51 |
465 | cmp eax,51 |
470 | jne no_palette |
466 | jne no_palette |
471 | 467 | ||
472 | mov eax,20 |
468 | mov eax,20 |
473 | mov ebx,100 |
469 | mov ebx,100 |
474 | mov ecx,32*10+32*5+7 |
470 | mov ecx,32*10+32*5+7 |
475 | mov edx,8*10+7*10 |
471 | mov edx,8*10+7*10 |
476 | mov esi,1 |
472 | mov esi,1 |
477 | call draw_volume_rectangle |
473 | call draw_volume_rectangle |
478 | mov [x],20+5 |
474 | mov [x],20+5 |
479 | mov [y],100+10 |
475 | mov [y],100+10 |
480 | mov edi,256 |
476 | mov edi,256 |
481 | xor esi,esi |
477 | xor esi,esi |
482 | next_rectangle: |
478 | next_rectangle: |
483 | mov eax,13 |
- | |
484 | mov ebx,[x] |
479 | mov ebx,[x] |
485 | mov ecx,[y] |
480 | mov ecx,[y] |
486 | mov edx,[palitra+esi] |
481 | mov edx,[palitra+esi] |
487 | and edx,0xffffff |
482 | and edx,0xffffff |
488 | shl ebx,16 |
483 | shl ebx,16 |
489 | shl ecx,16 |
484 | shl ecx,16 |
490 | add ebx,13 |
485 | add ebx,13 |
491 | add ecx,13 |
486 | add ecx,13 |
492 | mcall |
487 | mcall SF_DRAW_RECT |
493 | add [x],15 |
488 | add [x],15 |
494 | cmp [x],20+15*32 |
489 | cmp [x],20+15*32 |
495 | jl no_new_line |
490 | jl no_new_line |
496 | mov [x],20+5 |
491 | mov [x],20+5 |
497 | add [y],15 |
492 | add [y],15 |
498 | no_new_line: |
493 | no_new_line: |
499 | add esi,4 |
494 | add esi,4 |
500 | dec edi |
495 | dec edi |
501 | jnz next_rectangle |
496 | jnz next_rectangle |
502 | 497 | ||
503 | wait_events: |
498 | wait_events: |
504 | call event |
499 | call event |
505 | 500 | ||
506 | cmp eax,1 |
501 | cmp eax,1 |
507 | je still |
502 | je still |
508 | 503 | ||
509 | cmp eax,2 |
504 | cmp eax,2 |
510 | jne no_keys |
505 | jne no_keys |
511 | - | ||
512 | mov eax,2 |
506 | |
513 | mcall |
507 | mcall SF_GET_KEY |
514 | 508 | ||
515 | no_keys: |
509 | no_keys: |
516 | 510 | ||
517 | cmp eax,3 |
511 | cmp eax,3 |
518 | jne no_buttons |
512 | jne no_buttons |
519 | mov eax,17 |
- | |
520 | mcall |
513 | mcall SF_GET_BUTTON |
521 | 514 | ||
522 | no_buttons: |
515 | no_buttons: |
523 | 516 | ||
524 | cmp eax,6 |
517 | cmp eax,6 |
525 | jne wait_events |
518 | jne wait_events |
526 | 519 | ||
527 | call GetMouseClick |
520 | call GetMouseClick |
528 | 521 | ||
529 | test eax,eax |
522 | test eax,eax |
530 | jz wait_events |
523 | jz wait_events |
531 | call GetMouseCoordinats |
524 | call GetMouseCoordinats |
532 | mov [x],20+5 |
525 | mov [x],20+5 |
533 | mov [y],100+10 |
526 | mov [y],100+10 |
534 | mov [counter],0 |
527 | mov [counter],0 |
535 | next_rectangle_column: |
528 | next_rectangle_column: |
536 | mov eax,[x] |
529 | mov eax,[x] |
537 | mov ebx,[y] |
530 | mov ebx,[y] |
538 | mov ecx,[MouseX] |
531 | mov ecx,[MouseX] |
539 | mov edx,[MouseY] |
532 | mov edx,[MouseY] |
540 | mov esi,13 |
533 | mov esi,13 |
541 | mov edi,13 |
534 | mov edi,13 |
542 | call columnus |
535 | call columnus |
543 | test eax,eax |
536 | test eax,eax |
544 | jz no_columnus_color |
537 | jz no_columnus_color |
545 | 538 | ||
546 | mov eax,[counter] |
539 | mov eax,[counter] |
547 | shl eax,2 |
540 | shl eax,2 |
548 | mov ebx,[palitra+eax] |
541 | mov ebx,[palitra+eax] |
549 | and ebx,0xffffff |
542 | and ebx,0xffffff |
550 | mov [Color],ebx |
543 | mov [Color],ebx |
551 | no_columnus_color: |
544 | no_columnus_color: |
552 | 545 | ||
553 | add [x],15 |
546 | add [x],15 |
554 | 547 | ||
555 | cmp [x],20+15*32 |
548 | cmp [x],20+15*32 |
556 | jl no_new_line_column |
549 | jl no_new_line_column |
557 | 550 | ||
558 | mov [x],20+5 |
551 | mov [x],20+5 |
559 | add [y],15 |
552 | add [y],15 |
560 | no_new_line_column: |
553 | no_new_line_column: |
561 | 554 | ||
562 | inc [counter] |
555 | inc [counter] |
563 | 556 | ||
564 | cmp [counter],257 |
557 | cmp [counter],257 |
565 | jne next_rectangle_column |
558 | jne next_rectangle_column |
566 | - | ||
567 | mov eax,5 |
559 | |
568 | mov ebx,10 |
- | |
569 | mcall |
560 | mcall SF_SLEEP,10 |
570 | 561 | ||
571 | call drawwin |
562 | call drawwin |
572 | 563 | ||
573 | mov eax,[Last_instrument] |
564 | mov eax,[Last_instrument] |
574 | mov [Current_instrument],eax |
565 | mov [Current_instrument],eax |
575 | 566 | ||
576 | jmp still |
567 | jmp still |
577 | no_palette: |
568 | no_palette: |
578 | 569 | ||
579 | ;************************draw line********************** |
570 | ;************************draw line********************** |
580 | cmp eax,16 |
571 | cmp eax,16 |
581 | jne no_line |
572 | jne no_line |
582 | 573 | ||
583 | mov [Last_instrument],eax |
574 | mov [Last_instrument],eax |
584 | 575 | ||
585 | mov al,[Activate_instrument] |
576 | mov al,[Activate_instrument] |
586 | test al,al |
577 | test al,al |
587 | jnz no_new_line_xy |
578 | jnz no_new_line_xy |
588 | mov eax,[ScreenX] |
579 | mov eax,[ScreenX] |
589 | mov ebx,[ScreenY] |
580 | mov ebx,[ScreenY] |
590 | add eax,[PosX] |
581 | add eax,[PosX] |
591 | add ebx,[PosY] |
582 | add ebx,[PosY] |
592 | mov [OldX],eax |
583 | mov [OldX],eax |
593 | mov [OldY],ebx |
584 | mov [OldY],ebx |
594 | mov [Activate_instrument],1 |
585 | mov [Activate_instrument],1 |
595 | mov eax,[ReserveArray] |
586 | xor eax,eax |
596 | mov ecx,60000 |
587 | mov ecx,mem_flood_f/4 |
597 | clear_array_line: |
- | |
598 | mov [eax],dword 0 |
588 | mov edi,[ReserveArray] |
599 | add eax,4 |
- | |
600 | dec ecx |
589 | rep stosd |
601 | jnz clear_array_line |
- | |
602 | jmp still |
590 | jmp still |
603 | no_new_line_xy: |
591 | no_new_line_xy: |
604 | 592 | ||
605 | ;put saved pixels |
593 | ;put saved pixels |
606 | mov ebx,[ReserveArray] |
594 | mov ebx,[ReserveArray] |
607 | mov eax,[ebx] |
595 | mov eax,[ebx] |
608 | test eax,eax |
596 | test eax,eax |
609 | jz no_put_line_to_screen_line |
597 | jz no_put_line_to_screen_line |
610 | mov ecx,[ebx] |
598 | mov ecx,[ebx] |
611 | add ebx,4 |
599 | add ebx,4 |
612 | xor ebp,ebp |
600 | xor ebp,ebp |
613 | next_color_put_line: |
601 | next_color_put_line: |
614 | ;put saved pixels in ReserveArray |
602 | ;put saved pixels in ReserveArray |
615 | push ecx |
603 | push ecx |
616 | and [counter2],0 |
604 | and [counter2],0 |
617 | mov edi,[ebx] |
605 | mov edi,[ebx] |
618 | push edi |
606 | push edi |
619 | vertical_width_put: |
607 | vertical_width_put: |
620 | and [counter],0 |
608 | and [counter],0 |
621 | 609 | ||
622 | horizontal_width_put: |
610 | horizontal_width_put: |
623 | mov edx,[ebx+4807*4+ebp] |
611 | mov edx,[ebx+4807*4+ebp] |
624 | and edx,0xffffff |
612 | and edx,0xffffff |
625 | mov [edi],dx |
613 | mov [edi],dx |
626 | shr edx,16 |
614 | shr edx,16 |
627 | mov [edi+2],dl |
615 | mov [edi+2],dl |
628 | 616 | ||
629 | add edi,3 |
617 | add edi,3 |
630 | add ebp,4 |
618 | add ebp,4 |
631 | inc [counter] |
619 | inc [counter] |
632 | cmp [counter],5 |
620 | cmp [counter],5 |
633 | jne horizontal_width_put |
621 | jne horizontal_width_put |
634 | 622 | ||
635 | mov ecx,[Picture_SizeX] |
623 | mov ecx,[Picture_SizeX] |
636 | sub ecx,5 |
624 | sub ecx,5 |
637 | lea ecx,[ecx+ecx*2] |
625 | lea ecx,[ecx+ecx*2] |
638 | add edi,ecx |
626 | add edi,ecx |
639 | inc [counter2] |
627 | inc [counter2] |
640 | cmp [counter2],5 |
628 | cmp [counter2],5 |
641 | jne vertical_width_put |
629 | jne vertical_width_put |
642 | pop edi |
630 | pop edi |
643 | pop ecx |
631 | pop ecx |
644 | add ebx,4 |
632 | add ebx,4 |
645 | dec ecx |
633 | dec ecx |
646 | jnz next_color_put_line |
634 | jnz next_color_put_line |
647 | 635 | ||
648 | no_put_line_to_screen_line: |
636 | no_put_line_to_screen_line: |
649 | 637 | ||
650 | ;calculate line |
638 | ;calculate line |
651 | mov ebx,[ReserveArray] |
639 | mov ebx,[ReserveArray] |
652 | add ebx,4 |
640 | add ebx,4 |
653 | mov eax,[PointerToPicture] |
641 | mov eax,[PointerToPicture] |
654 | mov ecx,[Picture_SizeX] |
642 | mov ecx,[Picture_SizeX] |
655 | mov edx,[OldX] |
643 | mov edx,[OldX] |
656 | shl edx,16 |
644 | shl edx,16 |
657 | add edx,[OldY] |
645 | add edx,[OldY] |
658 | mov esi,[ScreenX] |
646 | mov esi,[ScreenX] |
659 | mov edi,[ScreenY] |
647 | mov edi,[ScreenY] |
660 | add esi,[PosX] |
648 | add esi,[PosX] |
661 | add edi,[PosY] |
649 | add edi,[PosY] |
662 | 650 | ||
663 | mov ebp,[Picture_SizeX] |
651 | mov ebp,[Picture_SizeX] |
664 | sub ebp,[line_width] |
652 | sub ebp,[line_width] |
665 | cmp esi,ebp |
653 | cmp esi,ebp |
666 | jl no_minimum_x_line |
654 | jl no_minimum_x_line |
667 | mov esi,ebp |
655 | mov esi,ebp |
668 | no_minimum_x_line: |
656 | no_minimum_x_line: |
669 | 657 | ||
670 | mov ebp,[Picture_SizeY] |
658 | mov ebp,[Picture_SizeY] |
671 | sub ebp,[line_width] |
659 | sub ebp,[line_width] |
672 | cmp edi,ebp |
660 | cmp edi,ebp |
673 | jl no_minimum_y_line |
661 | jl no_minimum_y_line |
674 | mov edi,ebp |
662 | mov edi,ebp |
675 | no_minimum_y_line: |
663 | no_minimum_y_line: |
676 | 664 | ||
677 | call calculate_line |
665 | call calculate_line |
678 | ;call calculate_rectangle |
666 | ;call calculate_rectangle |
679 | mov [counter],eax |
667 | mov [counter],eax |
680 | 668 | ||
681 | ;save color pixels in ReserveArray |
669 | ;save color pixels in ReserveArray |
682 | mov eax,[counter] |
670 | mov eax,[counter] |
683 | mov ebx,[ReserveArray] |
671 | mov ebx,[ReserveArray] |
684 | mov [ebx],eax |
672 | mov [ebx],eax |
685 | 673 | ||
686 | mov ecx,[ebx] |
674 | mov ecx,[ebx] |
687 | add ebx,4 |
675 | add ebx,4 |
688 | 676 | ||
689 | xor ebp,ebp |
677 | xor ebp,ebp |
690 | next_color_save_line: |
678 | next_color_save_line: |
691 | ;save color of pixel in ReserveArray |
679 | ;save color of pixel in ReserveArray |
692 | push ecx |
680 | push ecx |
693 | and [counter2],0 |
681 | and [counter2],0 |
694 | mov edi,[ebx] |
682 | mov edi,[ebx] |
695 | vertical_width_save: |
683 | vertical_width_save: |
696 | and [counter],0 |
684 | and [counter],0 |
697 | 685 | ||
698 | horizontal_width_save: |
686 | horizontal_width_save: |
699 | mov eax,edi |
687 | mov eax,edi |
700 | mov edx,[eax] |
688 | mov edx,[eax] |
701 | and edx,0xffffff |
689 | and edx,0xffffff |
702 | mov [ebx+4807*4+ebp],dx |
690 | mov [ebx+4807*4+ebp],dx |
703 | shr edx,16 |
691 | shr edx,16 |
704 | mov [ebx+4807*4+2+ebp],dl |
692 | mov [ebx+4807*4+2+ebp],dl |
705 | 693 | ||
706 | add edi,3 |
694 | add edi,3 |
707 | add ebp,4 |
695 | add ebp,4 |
708 | inc [counter] |
696 | inc [counter] |
709 | cmp [counter],5 |
697 | cmp [counter],5 |
710 | jne horizontal_width_save |
698 | jne horizontal_width_save |
711 | 699 | ||
712 | mov ecx,[Picture_SizeX] |
700 | mov ecx,[Picture_SizeX] |
713 | sub ecx,5 |
701 | sub ecx,5 |
714 | lea ecx,[ecx+ecx*2] |
702 | lea ecx,[ecx+ecx*2] |
715 | add edi,ecx |
703 | add edi,ecx |
716 | inc [counter2] |
704 | inc [counter2] |
717 | cmp [counter2],5 |
705 | cmp [counter2],5 |
718 | jne vertical_width_save |
706 | jne vertical_width_save |
719 | pop ecx |
707 | pop ecx |
720 | add ebx,4 |
708 | add ebx,4 |
721 | dec ecx |
709 | dec ecx |
722 | jnz next_color_save_line |
710 | jnz next_color_save_line |
723 | 711 | ||
724 | ;draw calculated pixels on work arrea |
712 | ;draw calculated pixels on work arrea |
725 | mov ebx,[ReserveArray] |
713 | mov ebx,[ReserveArray] |
726 | mov ecx,[ebx] |
714 | mov ecx,[ebx] |
727 | mov edx,[Color] |
715 | mov edx,[Color] |
728 | mov esi,[Color] |
716 | mov esi,[Color] |
729 | shr edx,16 |
717 | shr edx,16 |
730 | add ebx,4 |
718 | add ebx,4 |
731 | mov edi,[line_width] |
719 | mov edi,[line_width] |
732 | dec edi |
720 | dec edi |
733 | imul edi,25 |
721 | imul edi,25 |
734 | next_pixel_put_line: |
722 | next_pixel_put_line: |
735 | 723 | ||
736 | mov eax,[ebx] |
724 | mov eax,[ebx] |
737 | push eax |
725 | push eax |
738 | push ecx |
726 | push ecx |
739 | xor ebp,ebp |
727 | xor ebp,ebp |
740 | and [counter2],0 |
728 | and [counter2],0 |
741 | 729 | ||
742 | vertical_width: |
730 | vertical_width: |
743 | and [counter],0 |
731 | and [counter],0 |
744 | 732 | ||
745 | horizontal_width: |
733 | horizontal_width: |
746 | xor ecx,ecx |
734 | xor ecx,ecx |
747 | mov cl,byte[width_pixels+edi+ebp] |
735 | mov cl,byte[width_pixels+edi+ebp] |
748 | test cl,cl |
736 | test cl,cl |
749 | jz no_draw_pixel_line |
737 | jz no_draw_pixel_line |
750 | mov [eax],si |
738 | mov [eax],si |
751 | mov [eax+2],dl |
739 | mov [eax+2],dl |
752 | no_draw_pixel_line: |
740 | no_draw_pixel_line: |
753 | add eax,3 |
741 | add eax,3 |
754 | inc ebp |
742 | inc ebp |
755 | inc [counter] |
743 | inc [counter] |
756 | cmp [counter],5 |
744 | cmp [counter],5 |
757 | jne horizontal_width |
745 | jne horizontal_width |
758 | 746 | ||
759 | mov ecx,[Picture_SizeX] |
747 | mov ecx,[Picture_SizeX] |
760 | sub ecx,5 |
748 | sub ecx,5 |
761 | lea ecx,[ecx+ecx*2] |
749 | lea ecx,[ecx+ecx*2] |
762 | add eax,ecx |
750 | add eax,ecx |
763 | inc [counter2] |
751 | inc [counter2] |
764 | cmp [counter2],5 |
752 | cmp [counter2],5 |
765 | jne vertical_width |
753 | jne vertical_width |
766 | 754 | ||
767 | pop ecx |
755 | pop ecx |
768 | pop eax |
756 | pop eax |
769 | add ebx,4 |
757 | add ebx,4 |
770 | dec ecx |
758 | dec ecx |
771 | jnz next_pixel_put_line |
759 | jnz next_pixel_put_line |
772 | 760 | ||
773 | call MovePictureToWorkScreen |
761 | call MovePictureToWorkScreen |
774 | 762 | ||
775 | jmp still |
763 | jmp still |
776 | no_line: |
764 | no_line: |
777 | 765 | ||
778 | ;*********************************DRAW RECTANGLE**************************** |
766 | ;*********************************DRAW RECTANGLE**************************** |
779 | cmp eax,17 |
767 | cmp eax,17 |
780 | jne no_rectangle |
768 | jne no_rectangle |
781 | 769 | ||
782 | mov [Last_instrument],eax |
770 | mov [Last_instrument],eax |
783 | 771 | ||
784 | mov al,[Activate_instrument] |
772 | mov al,[Activate_instrument] |
785 | test al,al |
773 | test al,al |
786 | jnz no_new_rectangle_xy |
774 | jnz no_new_rectangle_xy |
787 | mov eax,[ScreenX] |
775 | mov eax,[ScreenX] |
788 | mov ebx,[ScreenY] |
776 | mov ebx,[ScreenY] |
789 | add eax,[PosX] |
777 | add eax,[PosX] |
790 | add ebx,[PosY] |
778 | add ebx,[PosY] |
791 | mov [OldX],eax |
779 | mov [OldX],eax |
792 | mov [OldY],ebx |
780 | mov [OldY],ebx |
793 | mov [Activate_instrument],1 |
781 | mov [Activate_instrument],1 |
794 | mov eax,[ReserveArray] |
782 | xor eax,eax |
795 | mov ecx,60000 |
783 | mov ecx,mem_flood_f/4 |
796 | clear_array_rectangle: |
- | |
797 | mov [eax],dword 0 |
784 | mov edi,[ReserveArray] |
798 | add eax,4 |
- | |
799 | dec ecx |
785 | rep stosd |
800 | jnz clear_array_rectangle |
- | |
801 | jmp still |
786 | jmp still |
802 | no_new_rectangle_xy: |
787 | no_new_rectangle_xy: |
803 | 788 | ||
804 | ;put saved pixels |
789 | ;put saved pixels |
805 | mov ebx,[ReserveArray] |
790 | mov ebx,[ReserveArray] |
806 | mov eax,[ebx] |
791 | mov eax,[ebx] |
807 | test eax,eax |
792 | test eax,eax |
808 | jz no_put_rectangle_to_screen_line |
793 | jz no_put_rectangle_to_screen_line |
809 | mov ecx,[ebx] |
794 | mov ecx,[ebx] |
810 | add ebx,4 |
795 | add ebx,4 |
811 | xor ebp,ebp |
796 | xor ebp,ebp |
812 | next_color_put_rectangle: |
797 | next_color_put_rectangle: |
813 | ;put saved pixels in ReserveArray |
798 | ;put saved pixels in ReserveArray |
814 | push ecx |
799 | push ecx |
815 | and [counter2],0 |
800 | and [counter2],0 |
816 | mov edi,[ebx] |
801 | mov edi,[ebx] |
817 | push edi |
802 | push edi |
818 | vertical_width_put_rectangle: |
803 | vertical_width_put_rectangle: |
819 | and [counter],0 |
804 | and [counter],0 |
820 | 805 | ||
821 | horizontal_width_put_rectangle: |
806 | horizontal_width_put_rectangle: |
822 | mov edx,[ebx+4807*4+ebp] |
807 | mov edx,[ebx+4807*4+ebp] |
823 | and edx,0xffffff |
808 | and edx,0xffffff |
824 | mov [edi],dx |
809 | mov [edi],dx |
825 | shr edx,16 |
810 | shr edx,16 |
826 | mov [edi+2],dl |
811 | mov [edi+2],dl |
827 | 812 | ||
828 | add edi,3 |
813 | add edi,3 |
829 | add ebp,4 |
814 | add ebp,4 |
830 | inc [counter] |
815 | inc [counter] |
831 | cmp [counter],5 |
816 | cmp [counter],5 |
832 | jne horizontal_width_put_rectangle |
817 | jne horizontal_width_put_rectangle |
833 | 818 | ||
834 | mov ecx,[Picture_SizeX] |
819 | mov ecx,[Picture_SizeX] |
835 | sub ecx,5 |
820 | sub ecx,5 |
836 | lea ecx,[ecx+ecx*2] |
821 | lea ecx,[ecx+ecx*2] |
837 | add edi,ecx |
822 | add edi,ecx |
838 | inc [counter2] |
823 | inc [counter2] |
839 | cmp [counter2],5 |
824 | cmp [counter2],5 |
840 | jne vertical_width_put_rectangle |
825 | jne vertical_width_put_rectangle |
841 | pop edi |
826 | pop edi |
842 | pop ecx |
827 | pop ecx |
843 | add ebx,4 |
828 | add ebx,4 |
844 | dec ecx |
829 | dec ecx |
845 | jnz next_color_put_rectangle |
830 | jnz next_color_put_rectangle |
846 | 831 | ||
847 | no_put_rectangle_to_screen_line: |
832 | no_put_rectangle_to_screen_line: |
848 | 833 | ||
849 | ;calculate line |
834 | ;calculate line |
850 | mov ebx,[ReserveArray] |
835 | mov ebx,[ReserveArray] |
851 | add ebx,4 |
836 | add ebx,4 |
852 | mov eax,[PointerToPicture] |
837 | mov eax,[PointerToPicture] |
853 | mov ecx,[Picture_SizeX] |
838 | mov ecx,[Picture_SizeX] |
854 | mov edx,[OldX] |
839 | mov edx,[OldX] |
855 | shl edx,16 |
840 | shl edx,16 |
856 | add edx,[OldY] |
841 | add edx,[OldY] |
857 | mov esi,[ScreenX] |
842 | mov esi,[ScreenX] |
858 | mov edi,[ScreenY] |
843 | mov edi,[ScreenY] |
859 | add esi,[PosX] |
844 | add esi,[PosX] |
860 | add edi,[PosY] |
845 | add edi,[PosY] |
861 | 846 | ||
862 | mov ebp,[Picture_SizeX] |
847 | mov ebp,[Picture_SizeX] |
863 | sub ebp,[line_width] |
848 | sub ebp,[line_width] |
864 | cmp esi,ebp |
849 | cmp esi,ebp |
865 | jl no_minimum_x_rectangle |
850 | jl no_minimum_x_rectangle |
866 | mov esi,ebp |
851 | mov esi,ebp |
867 | no_minimum_x_rectangle: |
852 | no_minimum_x_rectangle: |
868 | 853 | ||
869 | mov ebp,[Picture_SizeY] |
854 | mov ebp,[Picture_SizeY] |
870 | sub ebp,[line_width] |
855 | sub ebp,[line_width] |
871 | cmp edi,ebp |
856 | cmp edi,ebp |
872 | jl no_minimum_y_rectangle |
857 | jl no_minimum_y_rectangle |
873 | mov edi,ebp |
858 | mov edi,ebp |
874 | no_minimum_y_rectangle: |
859 | no_minimum_y_rectangle: |
875 | 860 | ||
876 | call calculate_rectangle |
861 | call calculate_rectangle |
877 | mov [counter],eax |
862 | mov [counter],eax |
878 | 863 | ||
879 | ;save color pixels in ReserveArray |
864 | ;save color pixels in ReserveArray |
880 | mov eax,[counter] |
865 | mov eax,[counter] |
881 | mov ebx,[ReserveArray] |
866 | mov ebx,[ReserveArray] |
882 | mov [ebx],eax |
867 | mov [ebx],eax |
883 | 868 | ||
884 | mov ecx,[ebx] |
869 | mov ecx,[ebx] |
885 | add ebx,4 |
870 | add ebx,4 |
886 | 871 | ||
887 | xor ebp,ebp |
872 | xor ebp,ebp |
888 | next_color_save_rectangle: |
873 | next_color_save_rectangle: |
889 | ;save color of pixel in ReserveArray |
874 | ;save color of pixel in ReserveArray |
890 | push ecx |
875 | push ecx |
891 | and [counter2],0 |
876 | and [counter2],0 |
892 | mov edi,[ebx] |
877 | mov edi,[ebx] |
893 | vertical_width_save_rectangle: |
878 | vertical_width_save_rectangle: |
894 | and [counter],0 |
879 | and [counter],0 |
895 | 880 | ||
896 | horizontal_width_save_rectangle: |
881 | horizontal_width_save_rectangle: |
897 | mov eax,edi |
882 | mov eax,edi |
898 | mov edx,[eax] |
883 | mov edx,[eax] |
899 | and edx,0xffffff |
884 | and edx,0xffffff |
900 | mov [ebx+4807*4+ebp],dx |
885 | mov [ebx+4807*4+ebp],dx |
901 | shr edx,16 |
886 | shr edx,16 |
902 | mov [ebx+4807*4+2+ebp],dl |
887 | mov [ebx+4807*4+2+ebp],dl |
903 | 888 | ||
904 | add edi,3 |
889 | add edi,3 |
905 | add ebp,4 |
890 | add ebp,4 |
906 | inc [counter] |
891 | inc [counter] |
907 | cmp [counter],5 |
892 | cmp [counter],5 |
908 | jne horizontal_width_save_rectangle |
893 | jne horizontal_width_save_rectangle |
909 | 894 | ||
910 | mov ecx,[Picture_SizeX] |
895 | mov ecx,[Picture_SizeX] |
911 | sub ecx,5 |
896 | sub ecx,5 |
912 | lea ecx,[ecx+ecx*2] |
897 | lea ecx,[ecx+ecx*2] |
913 | add edi,ecx |
898 | add edi,ecx |
914 | inc [counter2] |
899 | inc [counter2] |
915 | cmp [counter2],5 |
900 | cmp [counter2],5 |
916 | jne vertical_width_save_rectangle |
901 | jne vertical_width_save_rectangle |
917 | pop ecx |
902 | pop ecx |
918 | add ebx,4 |
903 | add ebx,4 |
919 | dec ecx |
904 | dec ecx |
920 | jnz next_color_save_rectangle |
905 | jnz next_color_save_rectangle |
921 | 906 | ||
922 | ;draw calculated pixels on work arrea |
907 | ;draw calculated pixels on work arrea |
923 | mov ebx,[ReserveArray] |
908 | mov ebx,[ReserveArray] |
924 | mov ecx,[ebx] |
909 | mov ecx,[ebx] |
925 | mov edx,[Color] |
910 | mov edx,[Color] |
926 | mov esi,[Color] |
911 | mov esi,[Color] |
927 | shr edx,16 |
912 | shr edx,16 |
928 | add ebx,4 |
913 | add ebx,4 |
929 | mov edi,[line_width] |
914 | mov edi,[line_width] |
930 | dec edi |
915 | dec edi |
931 | imul edi,25 |
916 | imul edi,25 |
932 | next_pixel_put_rectangle: |
917 | next_pixel_put_rectangle: |
933 | 918 | ||
934 | mov eax,[ebx] |
919 | mov eax,[ebx] |
935 | push eax |
920 | push eax |
936 | push ecx |
921 | push ecx |
937 | xor ebp,ebp |
922 | xor ebp,ebp |
938 | and [counter2],0 |
923 | and [counter2],0 |
939 | 924 | ||
940 | vertical_width_rectangle: |
925 | vertical_width_rectangle: |
941 | and [counter],0 |
926 | and [counter],0 |
942 | 927 | ||
943 | horizontal_width_rectangle: |
928 | horizontal_width_rectangle: |
944 | xor ecx,ecx |
929 | xor ecx,ecx |
945 | mov cl,byte[width_pixels_rectangle+edi+ebp] |
930 | mov cl,byte[width_pixels_rectangle+edi+ebp] |
946 | test cl,cl |
931 | test cl,cl |
947 | jz no_draw_pixel_rectangle |
932 | jz no_draw_pixel_rectangle |
948 | mov [eax],si |
933 | mov [eax],si |
949 | mov [eax+2],dl |
934 | mov [eax+2],dl |
950 | no_draw_pixel_rectangle: |
935 | no_draw_pixel_rectangle: |
951 | add eax,3 |
936 | add eax,3 |
952 | inc ebp |
937 | inc ebp |
953 | inc [counter] |
938 | inc [counter] |
954 | cmp [counter],5 |
939 | cmp [counter],5 |
955 | jne horizontal_width_rectangle |
940 | jne horizontal_width_rectangle |
956 | 941 | ||
957 | mov ecx,[Picture_SizeX] |
942 | mov ecx,[Picture_SizeX] |
958 | sub ecx,5 |
943 | sub ecx,5 |
959 | lea ecx,[ecx+ecx*2] |
944 | lea ecx,[ecx+ecx*2] |
960 | add eax,ecx |
945 | add eax,ecx |
961 | inc [counter2] |
946 | inc [counter2] |
962 | cmp [counter2],5 |
947 | cmp [counter2],5 |
963 | jne vertical_width_rectangle |
948 | jne vertical_width_rectangle |
964 | 949 | ||
965 | pop ecx |
950 | pop ecx |
966 | pop eax |
951 | pop eax |
967 | add ebx,4 |
952 | add ebx,4 |
968 | dec ecx |
953 | dec ecx |
969 | jnz next_pixel_put_rectangle |
954 | jnz next_pixel_put_rectangle |
970 | 955 | ||
971 | call MovePictureToWorkScreen |
956 | call MovePictureToWorkScreen |
972 | jmp still |
957 | jmp still |
973 | no_rectangle: |
958 | no_rectangle: |
974 | 959 | ||
975 | ;*********************************DRAW CIRCLE**************************** |
960 | ;*********************************DRAW CIRCLE**************************** |
976 | cmp eax,18 |
961 | cmp eax,18 |
977 | jne no_circle |
962 | jne no_circle |
978 | 963 | ||
979 | mov [Last_instrument],eax |
964 | mov [Last_instrument],eax |
980 | 965 | ||
981 | mov al,[Activate_instrument] |
966 | mov al,[Activate_instrument] |
982 | test al,al |
967 | test al,al |
983 | jnz no_new_circle_xy |
968 | jnz no_new_circle_xy |
984 | mov eax,[ScreenX] |
969 | mov eax,[ScreenX] |
985 | mov ebx,[ScreenY] |
970 | mov ebx,[ScreenY] |
986 | add eax,[PosX] |
971 | add eax,[PosX] |
987 | add ebx,[PosY] |
972 | add ebx,[PosY] |
988 | mov [OldX],eax |
973 | mov [OldX],eax |
989 | mov [OldY],ebx |
974 | mov [OldY],ebx |
990 | mov [Activate_instrument],1 |
975 | mov [Activate_instrument],1 |
991 | mov eax,[ReserveArray] |
976 | xor eax,eax |
992 | mov ecx,60000 |
977 | mov ecx,mem_flood_f/4 |
993 | clear_array_circle: |
- | |
994 | mov [eax],dword 0 |
978 | mov edi,[ReserveArray] |
995 | add eax,4 |
- | |
996 | dec ecx |
979 | rep stosd |
997 | jnz clear_array_circle |
- | |
998 | jmp still |
980 | jmp still |
999 | no_new_circle_xy: |
981 | no_new_circle_xy: |
1000 | 982 | ||
1001 | ;put saved pixels |
983 | ;put saved pixels |
1002 | mov ebx,[ReserveArray] |
984 | mov ebx,[ReserveArray] |
1003 | mov eax,[ebx] |
985 | mov eax,[ebx] |
1004 | test eax,eax |
986 | test eax,eax |
1005 | jz no_put_line_to_screen_circle |
987 | jz no_put_line_to_screen_circle |
1006 | mov ecx,[ebx] |
988 | mov ecx,[ebx] |
1007 | add ebx,4 |
989 | add ebx,4 |
1008 | xor ebp,ebp |
990 | xor ebp,ebp |
1009 | next_color_put_circle: |
991 | next_color_put_circle: |
1010 | ;put saved pixels in ReserveArray |
992 | ;put saved pixels in ReserveArray |
1011 | push ecx |
993 | push ecx |
1012 | and [counter2],0 |
994 | and [counter2],0 |
1013 | mov edi,[ebx] |
995 | mov edi,[ebx] |
1014 | push edi |
996 | push edi |
1015 | vertical_width_put_circle: |
997 | vertical_width_put_circle: |
1016 | and [counter],0 |
998 | and [counter],0 |
1017 | 999 | ||
1018 | horizontal_width_put_circle: |
1000 | horizontal_width_put_circle: |
1019 | mov edx,[ebx+4807*4+ebp] |
1001 | mov edx,[ebx+4807*4+ebp] |
1020 | and edx,0xffffff |
1002 | and edx,0xffffff |
1021 | mov [edi],dx |
1003 | mov [edi],dx |
1022 | shr edx,16 |
1004 | shr edx,16 |
1023 | mov [edi+2],dl |
1005 | mov [edi+2],dl |
1024 | 1006 | ||
1025 | add edi,3 |
1007 | add edi,3 |
1026 | add ebp,4 |
1008 | add ebp,4 |
1027 | inc [counter] |
1009 | inc [counter] |
1028 | cmp [counter],5 |
1010 | cmp [counter],5 |
1029 | jne horizontal_width_put_circle |
1011 | jne horizontal_width_put_circle |
1030 | 1012 | ||
1031 | mov ecx,[Picture_SizeX] |
1013 | mov ecx,[Picture_SizeX] |
1032 | sub ecx,5 |
1014 | sub ecx,5 |
1033 | lea ecx,[ecx+ecx*2] |
1015 | lea ecx,[ecx+ecx*2] |
1034 | add edi,ecx |
1016 | add edi,ecx |
1035 | inc [counter2] |
1017 | inc [counter2] |
1036 | cmp [counter2],5 |
1018 | cmp [counter2],5 |
1037 | jne vertical_width_put_circle |
1019 | jne vertical_width_put_circle |
1038 | pop edi |
1020 | pop edi |
1039 | pop ecx |
1021 | pop ecx |
1040 | add ebx,4 |
1022 | add ebx,4 |
1041 | dec ecx |
1023 | dec ecx |
1042 | jnz next_color_put_circle |
1024 | jnz next_color_put_circle |
1043 | 1025 | ||
1044 | no_put_line_to_screen_circle: |
1026 | no_put_line_to_screen_circle: |
1045 | 1027 | ||
1046 | mov esi,[ScreenX] |
1028 | mov esi,[ScreenX] |
1047 | mov edi,[ScreenY] |
1029 | mov edi,[ScreenY] |
1048 | add esi,[PosX] |
1030 | add esi,[PosX] |
1049 | add edi,[PosY] |
1031 | add edi,[PosY] |
1050 | 1032 | ||
1051 | sub esi,[OldX] |
1033 | sub esi,[OldX] |
1052 | jns no_sign_x_circle |
1034 | jns no_sign_x_circle |
1053 | neg esi |
1035 | neg esi |
1054 | shr esi,1 |
1036 | shr esi,1 |
1055 | neg esi |
1037 | neg esi |
1056 | add esi,[OldX] |
1038 | add esi,[OldX] |
1057 | jmp no_plus_sign_x_circle |
1039 | jmp no_plus_sign_x_circle |
1058 | no_sign_x_circle: |
1040 | no_sign_x_circle: |
1059 | 1041 | ||
1060 | shr esi,1 |
1042 | shr esi,1 |
1061 | add esi,[OldX] |
1043 | add esi,[OldX] |
1062 | no_plus_sign_x_circle: |
1044 | no_plus_sign_x_circle: |
1063 | 1045 | ||
1064 | sub edi,[OldY] |
1046 | sub edi,[OldY] |
1065 | jns no_sign_y_circle |
1047 | jns no_sign_y_circle |
1066 | neg edi |
1048 | neg edi |
1067 | shr edi,1 |
1049 | shr edi,1 |
1068 | neg edi |
1050 | neg edi |
1069 | add edi,[OldY] |
1051 | add edi,[OldY] |
1070 | jmp no_plus_sign_y_circle |
1052 | jmp no_plus_sign_y_circle |
1071 | no_sign_y_circle: |
1053 | no_sign_y_circle: |
1072 | 1054 | ||
1073 | shr edi,1 |
1055 | shr edi,1 |
1074 | add edi,[OldY] |
1056 | add edi,[OldY] |
1075 | no_plus_sign_y_circle: |
1057 | no_plus_sign_y_circle: |
1076 | 1058 | ||
1077 | mov [x],esi |
1059 | mov [x],esi |
1078 | mov [y],edi |
1060 | mov [y],edi |
1079 | 1061 | ||
1080 | mov esi,[ScreenX] |
1062 | mov esi,[ScreenX] |
1081 | mov edi,[ScreenY] |
1063 | mov edi,[ScreenY] |
1082 | add esi,[PosX] |
1064 | add esi,[PosX] |
1083 | add edi,[PosY] |
1065 | add edi,[PosY] |
1084 | 1066 | ||
1085 | sub esi,[OldX] |
1067 | sub esi,[OldX] |
1086 | jns no_sign_x_circle_r |
1068 | jns no_sign_x_circle_r |
1087 | neg esi |
1069 | neg esi |
1088 | no_sign_x_circle_r: |
1070 | no_sign_x_circle_r: |
1089 | 1071 | ||
1090 | sub edi,[OldY] |
1072 | sub edi,[OldY] |
1091 | jns no_sign_y_circle_r |
1073 | jns no_sign_y_circle_r |
1092 | neg edi |
1074 | neg edi |
1093 | no_sign_y_circle_r: |
1075 | no_sign_y_circle_r: |
1094 | 1076 | ||
1095 | mov [Dx_],esi |
1077 | mov [Dx_],esi |
1096 | mov [Dy_],edi |
1078 | mov [Dy_],edi |
1097 | 1079 | ||
1098 | ;finit |
1080 | ;finit |
1099 | fild [Dx_] |
1081 | fild [Dx_] |
1100 | fmul st0,st0 |
1082 | fmul st0,st0 |
1101 | fild [Dy_] |
1083 | fild [Dy_] |
1102 | fmul st0,st0 |
1084 | fmul st0,st0 |
1103 | fadd st0,st1 |
1085 | fadd st0,st1 |
1104 | fsqrt |
1086 | fsqrt |
1105 | fistp [Radius] |
1087 | fistp [Radius] |
1106 | fistp [Icon_X] |
1088 | fistp [Icon_X] |
1107 | mov esi,[Radius] |
1089 | mov esi,[Radius] |
1108 | shr esi,1 |
1090 | shr esi,1 |
1109 | cmp esi,0 |
1091 | cmp esi,0 |
1110 | jne no_null_radius |
1092 | jne no_null_radius |
1111 | mov [Radius],1 |
1093 | mov [Radius],1 |
1112 | no_null_radius: |
1094 | no_null_radius: |
1113 | 1095 | ||
1114 | mov [Radius],esi |
1096 | mov [Radius],esi |
1115 | 1097 | ||
1116 | mov edi,[x] |
1098 | mov edi,[x] |
1117 | mov ebp,[y] |
1099 | mov ebp,[y] |
1118 | add edi,esi |
1100 | add edi,esi |
1119 | add ebp,esi |
1101 | add ebp,esi |
1120 | 1102 | ||
1121 | mov edx,[Picture_SizeX] |
1103 | mov edx,[Picture_SizeX] |
1122 | sub edx,[line_width] |
1104 | sub edx,[line_width] |
1123 | cmp edi,edx |
1105 | cmp edi,edx |
1124 | jl no_limit_x_circle |
1106 | jl no_limit_x_circle |
1125 | sub edi,edx |
1107 | sub edi,edx |
1126 | sub [Radius],edi |
1108 | sub [Radius],edi |
1127 | no_limit_x_circle: |
1109 | no_limit_x_circle: |
1128 | 1110 | ||
1129 | mov edx,[Picture_SizeY] |
1111 | mov edx,[Picture_SizeY] |
1130 | sub edx,[line_width] |
1112 | sub edx,[line_width] |
1131 | cmp ebp,edx |
1113 | cmp ebp,edx |
1132 | jl no_limit_y_circle |
1114 | jl no_limit_y_circle |
1133 | sub ebp,edx |
1115 | sub ebp,edx |
1134 | sub [Radius],ebp |
1116 | sub [Radius],ebp |
1135 | no_limit_y_circle: |
1117 | no_limit_y_circle: |
1136 | 1118 | ||
1137 | 1119 | ||
1138 | mov edi,[x] |
1120 | mov edi,[x] |
1139 | mov ebp,[y] |
1121 | mov ebp,[y] |
1140 | 1122 | ||
1141 | sub edi,[Radius] |
1123 | sub edi,[Radius] |
1142 | jns no_minimum_x_circle |
1124 | jns no_minimum_x_circle |
1143 | add [Radius],edi |
1125 | add [Radius],edi |
1144 | no_minimum_x_circle: |
1126 | no_minimum_x_circle: |
1145 | 1127 | ||
1146 | sub ebp,[Radius] |
1128 | sub ebp,[Radius] |
1147 | jns no_minimum_y_circle |
1129 | jns no_minimum_y_circle |
1148 | add [Radius],ebp |
1130 | add [Radius],ebp |
1149 | no_minimum_y_circle: |
1131 | no_minimum_y_circle: |
1150 | 1132 | ||
1151 | ;calculate circle |
1133 | ;calculate circle |
1152 | mov ebx,[ReserveArray] |
1134 | mov ebx,[ReserveArray] |
1153 | add ebx,4 |
1135 | add ebx,4 |
1154 | mov eax,[PointerToPicture] |
1136 | mov eax,[PointerToPicture] |
1155 | mov ecx,[Picture_SizeX] |
1137 | mov ecx,[Picture_SizeX] |
1156 | mov edx,[x] |
1138 | mov edx,[x] |
1157 | shl edx,16 |
1139 | shl edx,16 |
1158 | add edx,[y] |
1140 | add edx,[y] |
1159 | mov esi,[Radius] |
1141 | mov esi,[Radius] |
1160 | call calculate_circle |
1142 | call calculate_circle |
1161 | 1143 | ||
1162 | mov [counter],eax |
1144 | mov [counter],eax |
1163 | 1145 | ||
1164 | ;save color pixels in ReserveArray |
1146 | ;save color pixels in ReserveArray |
1165 | mov eax,[counter] |
1147 | mov eax,[counter] |
1166 | mov ebx,[ReserveArray] |
1148 | mov ebx,[ReserveArray] |
1167 | mov [ebx],eax |
1149 | mov [ebx],eax |
1168 | 1150 | ||
1169 | mov ecx,[ebx] |
1151 | mov ecx,[ebx] |
1170 | add ebx,4 |
1152 | add ebx,4 |
1171 | 1153 | ||
1172 | xor ebp,ebp |
1154 | xor ebp,ebp |
1173 | next_color_save_circle: |
1155 | next_color_save_circle: |
1174 | ;save color of pixel in ReserveArray |
1156 | ;save color of pixel in ReserveArray |
1175 | push ecx |
1157 | push ecx |
1176 | and [counter2],0 |
1158 | and [counter2],0 |
1177 | mov edi,[ebx] |
1159 | mov edi,[ebx] |
1178 | vertical_width_save_circle: |
1160 | vertical_width_save_circle: |
1179 | and [counter],0 |
1161 | and [counter],0 |
1180 | 1162 | ||
1181 | horizontal_width_save_circle: |
1163 | horizontal_width_save_circle: |
1182 | mov eax,edi |
1164 | mov eax,edi |
1183 | mov edx,[eax] |
1165 | mov edx,[eax] |
1184 | and edx,0xffffff |
1166 | and edx,0xffffff |
1185 | mov [ebx+4807*4+ebp],dx |
1167 | mov [ebx+4807*4+ebp],dx |
1186 | shr edx,16 |
1168 | shr edx,16 |
1187 | mov [ebx+4807*4+2+ebp],dl |
1169 | mov [ebx+4807*4+2+ebp],dl |
1188 | 1170 | ||
1189 | add edi,3 |
1171 | add edi,3 |
1190 | add ebp,4 |
1172 | add ebp,4 |
1191 | inc [counter] |
1173 | inc [counter] |
1192 | cmp [counter],5 |
1174 | cmp [counter],5 |
1193 | jne horizontal_width_save_circle |
1175 | jne horizontal_width_save_circle |
1194 | 1176 | ||
1195 | mov ecx,[Picture_SizeX] |
1177 | mov ecx,[Picture_SizeX] |
1196 | sub ecx,5 |
1178 | sub ecx,5 |
1197 | lea ecx,[ecx+ecx*2] |
1179 | lea ecx,[ecx+ecx*2] |
1198 | add edi,ecx |
1180 | add edi,ecx |
1199 | inc [counter2] |
1181 | inc [counter2] |
1200 | cmp [counter2],5 |
1182 | cmp [counter2],5 |
1201 | jne vertical_width_save_circle |
1183 | jne vertical_width_save_circle |
1202 | pop ecx |
1184 | pop ecx |
1203 | add ebx,4 |
1185 | add ebx,4 |
1204 | dec ecx |
1186 | dec ecx |
1205 | jnz next_color_save_circle |
1187 | jnz next_color_save_circle |
1206 | 1188 | ||
1207 | ;draw calculated pixels on work arrea |
1189 | ;draw calculated pixels on work arrea |
1208 | mov ebx,[ReserveArray] |
1190 | mov ebx,[ReserveArray] |
1209 | mov ecx,[ebx] |
1191 | mov ecx,[ebx] |
1210 | mov edx,[Color] |
1192 | mov edx,[Color] |
1211 | mov esi,[Color] |
1193 | mov esi,[Color] |
1212 | shr edx,16 |
1194 | shr edx,16 |
1213 | add ebx,4 |
1195 | add ebx,4 |
1214 | mov edi,[line_width] |
1196 | mov edi,[line_width] |
1215 | dec edi |
1197 | dec edi |
1216 | imul edi,25 |
1198 | imul edi,25 |
1217 | next_pixel_put_circle: |
1199 | next_pixel_put_circle: |
1218 | 1200 | ||
1219 | mov eax,[ebx] |
1201 | mov eax,[ebx] |
1220 | push eax |
1202 | push eax |
1221 | push ecx |
1203 | push ecx |
1222 | xor ebp,ebp |
1204 | xor ebp,ebp |
1223 | and [counter2],0 |
1205 | and [counter2],0 |
1224 | 1206 | ||
1225 | vertical_width_circle: |
1207 | vertical_width_circle: |
1226 | and [counter],0 |
1208 | and [counter],0 |
1227 | 1209 | ||
1228 | horizontal_width_circle: |
1210 | horizontal_width_circle: |
1229 | xor ecx,ecx |
1211 | xor ecx,ecx |
1230 | mov cl,byte[width_pixels+edi+ebp] |
1212 | mov cl,byte[width_pixels+edi+ebp] |
1231 | test cl,cl |
1213 | test cl,cl |
1232 | jz no_draw_pixel_circle |
1214 | jz no_draw_pixel_circle |
1233 | mov [eax],si |
1215 | mov [eax],si |
1234 | mov [eax+2],dl |
1216 | mov [eax+2],dl |
1235 | no_draw_pixel_circle: |
1217 | no_draw_pixel_circle: |
1236 | add eax,3 |
1218 | add eax,3 |
1237 | inc ebp |
1219 | inc ebp |
1238 | inc [counter] |
1220 | inc [counter] |
1239 | cmp [counter],5 |
1221 | cmp [counter],5 |
1240 | jne horizontal_width_circle |
1222 | jne horizontal_width_circle |
1241 | 1223 | ||
1242 | mov ecx,[Picture_SizeX] |
1224 | mov ecx,[Picture_SizeX] |
1243 | sub ecx,5 |
1225 | sub ecx,5 |
1244 | lea ecx,[ecx+ecx*2] |
1226 | lea ecx,[ecx+ecx*2] |
1245 | add eax,ecx |
1227 | add eax,ecx |
1246 | inc [counter2] |
1228 | inc [counter2] |
1247 | cmp [counter2],5 |
1229 | cmp [counter2],5 |
1248 | jne vertical_width_circle |
1230 | jne vertical_width_circle |
1249 | 1231 | ||
1250 | pop ecx |
1232 | pop ecx |
1251 | pop eax |
1233 | pop eax |
1252 | add ebx,4 |
1234 | add ebx,4 |
1253 | dec ecx |
1235 | dec ecx |
1254 | jnz next_pixel_put_circle |
1236 | jnz next_pixel_put_circle |
1255 | 1237 | ||
1256 | call MovePictureToWorkScreen |
1238 | call MovePictureToWorkScreen |
1257 | jmp still |
1239 | jmp still |
1258 | no_circle: |
1240 | no_circle: |
1259 | 1241 | ||
1260 | ;************************zoom 1************************* |
1242 | ;************************zoom 1************************* |
1261 | cmp eax,45 |
1243 | cmp eax,45 |
1262 | jne no_1_ |
1244 | jne no_1_ |
1263 | mov [k],1 |
1245 | mov [k],1 |
1264 | mov [Scroll1CoordinatX],9 |
1246 | mov [Scroll1CoordinatX],9 |
1265 | mov [Scroll2CoordinatY],89 |
1247 | mov [Scroll2CoordinatY],89 |
1266 | and [Current_instrument],0 |
1248 | and [Current_instrument],0 |
1267 | call drawwin |
1249 | call drawwin |
1268 | jmp still |
1250 | jmp still |
1269 | no_1_: |
1251 | no_1_: |
1270 | 1252 | ||
1271 | ;*************************zoom 2************************ |
1253 | ;*************************zoom 2************************ |
1272 | cmp eax,46 |
1254 | cmp eax,46 |
1273 | jne no_2_ |
1255 | jne no_2_ |
1274 | mov [k],2 |
1256 | mov [k],2 |
1275 | call drawwin |
1257 | call drawwin |
1276 | mov [Scroll1CoordinatX],9 |
1258 | mov [Scroll1CoordinatX],9 |
1277 | mov [Scroll2CoordinatY],89 |
1259 | mov [Scroll2CoordinatY],89 |
1278 | and [Current_instrument],0 |
1260 | and [Current_instrument],0 |
1279 | jmp still |
1261 | jmp still |
1280 | no_2_: |
1262 | no_2_: |
1281 | 1263 | ||
1282 | 1264 | ||
1283 | ;*************************zoom 3************************ |
1265 | ;*************************zoom 3************************ |
1284 | cmp eax,47 |
1266 | cmp eax,47 |
1285 | jne no_3_ |
1267 | jne no_3_ |
1286 | mov [k],3 |
1268 | mov [k],3 |
1287 | call drawwin |
1269 | call drawwin |
1288 | mov [Scroll1CoordinatX],9 |
1270 | mov [Scroll1CoordinatX],9 |
1289 | mov [Scroll2CoordinatY],89 |
1271 | mov [Scroll2CoordinatY],89 |
1290 | and [Current_instrument],0 |
1272 | and [Current_instrument],0 |
1291 | jmp still |
1273 | jmp still |
1292 | no_3_: |
1274 | no_3_: |
1293 | 1275 | ||
1294 | ;*************************zoom 4************************ |
1276 | ;*************************zoom 4************************ |
1295 | cmp eax,48 |
1277 | cmp eax,48 |
1296 | jne no_4_ |
1278 | jne no_4_ |
1297 | mov [k],4 |
1279 | mov [k],4 |
1298 | call drawwin |
1280 | call drawwin |
1299 | mov [Scroll1CoordinatX],9 |
1281 | mov [Scroll1CoordinatX],9 |
1300 | mov [Scroll2CoordinatY],89 |
1282 | mov [Scroll2CoordinatY],89 |
1301 | and [Current_instrument],0 |
1283 | and [Current_instrument],0 |
1302 | jmp still |
1284 | jmp still |
1303 | no_4_: |
1285 | no_4_: |
1304 | 1286 | ||
1305 | ;************************zoom 8************************* |
1287 | ;************************zoom 8************************* |
1306 | cmp eax,49 |
1288 | cmp eax,49 |
1307 | jne no_8_ |
1289 | jne no_8_ |
1308 | mov [k],8 |
1290 | mov [k],8 |
1309 | call drawwin |
1291 | call drawwin |
1310 | mov [Scroll1CoordinatX],9 |
1292 | mov [Scroll1CoordinatX],9 |
1311 | mov [Scroll2CoordinatY],89 |
1293 | mov [Scroll2CoordinatY],89 |
1312 | and [Current_instrument],0 |
1294 | and [Current_instrument],0 |
1313 | jmp still |
1295 | jmp still |
1314 | no_8_: |
1296 | no_8_: |
1315 | 1297 | ||
1316 | ;************************zoom 16************************ |
1298 | ;************************zoom 16************************ |
1317 | cmp eax,50 |
1299 | cmp eax,50 |
1318 | jne no_16_ |
1300 | jne no_16_ |
1319 | mov [k],16 |
1301 | mov [k],16 |
1320 | call drawwin |
1302 | call drawwin |
1321 | mov [Scroll1CoordinatX],9 |
1303 | mov [Scroll1CoordinatX],9 |
1322 | mov [Scroll2CoordinatY],89 |
1304 | mov [Scroll2CoordinatY],89 |
1323 | and [Current_instrument],0 |
1305 | and [Current_instrument],0 |
1324 | jmp still |
1306 | jmp still |
1325 | no_16_: |
1307 | no_16_: |
1326 | 1308 | ||
1327 | ;***************allocation of a countour********************* |
1309 | ;***************allocation of a countour********************* |
1328 | cmp eax,21 |
1310 | cmp eax,21 |
1329 | jne no_allocation |
1311 | jne no_allocation |
1330 | 1312 | ||
1331 | cmp [instrument_used],0 |
1313 | cmp [instrument_used],0 |
1332 | jnz instrument_not_finished_work |
1314 | jnz instrument_not_finished_work |
1333 | 1315 | ||
1334 | mov al,[Activate_instrument] |
1316 | mov al,[Activate_instrument] |
1335 | test al,al |
1317 | test al,al |
1336 | jnz no_new_allocation_xy |
1318 | jnz no_new_allocation_xy |
1337 | mov eax,[ScreenX] |
1319 | mov eax,[ScreenX] |
1338 | mov ebx,[ScreenY] |
1320 | mov ebx,[ScreenY] |
1339 | add eax,[PosX] |
1321 | add eax,[PosX] |
1340 | add ebx,[PosY] |
1322 | add ebx,[PosY] |
1341 | mov [OldX],eax |
1323 | mov [OldX],eax |
1342 | mov [OldY],ebx |
1324 | mov [OldY],ebx |
1343 | inc eax |
1325 | inc eax |
1344 | inc ebx |
1326 | inc ebx |
1345 | mov [rectangular_shade_x],eax |
1327 | mov [rectangular_shade_x],eax |
1346 | mov [rectangular_shade_y],ebx |
1328 | mov [rectangular_shade_y],ebx |
1347 | mov [Activate_instrument],1 |
1329 | mov [Activate_instrument],1 |
1348 | mov [instrument_used],1 |
1330 | mov [instrument_used],1 |
1349 | and [crossing],0 |
1331 | and [crossing],0 |
1350 | and [finishing_crossing],0 |
1332 | and [finishing_crossing],0 |
1351 | mov eax,[ReserveArray] |
- | |
1352 | mov ecx,60000 |
1333 | xor eax,eax |
1353 | clear_array_allocation: |
1334 | mov ecx,mem_flood_f/4 |
1354 | mov [eax],dword 0 |
1335 | mov edi,[ReserveArray] |
1355 | add eax,4 |
- | |
1356 | dec ecx |
1336 | rep stosd |
1357 | jnz clear_array_allocation |
- | |
1358 | jmp still |
1337 | jmp still |
1359 | no_new_allocation_xy: |
1338 | no_new_allocation_xy: |
1360 | instrument_not_finished_work: |
1339 | instrument_not_finished_work: |
1361 | 1340 | ||
1362 | mov al,[instrument_used] |
1341 | mov al,[instrument_used] |
1363 | test al,al |
1342 | test al,al |
1364 | jz no_change_coordinats |
1343 | jz no_change_coordinats |
1365 | 1344 | ||
1366 | cmp [Activate_instrument],0 |
1345 | cmp [Activate_instrument],0 |
1367 | jnz no_change_coordinats |
1346 | jnz no_change_coordinats |
1368 | 1347 | ||
1369 | ;save coordinates as old if crossing=0 |
1348 | ;save coordinates as old if crossing=0 |
1370 | cmp [crossing],0 |
1349 | cmp [crossing],0 |
1371 | jnz no_save_coordinate_of_crossing |
1350 | jnz no_save_coordinate_of_crossing |
1372 | 1351 | ||
1373 | mov eax,[OldX] |
1352 | mov eax,[OldX] |
1374 | mov ebx,[OldY] |
1353 | mov ebx,[OldY] |
1375 | 1354 | ||
1376 | cmp eax,[rectangular_shade_x] |
1355 | cmp eax,[rectangular_shade_x] |
1377 | jl no_remove_x |
1356 | jl no_remove_x |
1378 | mov ecx,[rectangular_shade_x] |
1357 | mov ecx,[rectangular_shade_x] |
1379 | mov [OldX],ecx ; OldX <-----> rectangulare_shade_x |
1358 | mov [OldX],ecx ; OldX <-----> rectangulare_shade_x |
1380 | mov [rectangular_shade_x],eax |
1359 | mov [rectangular_shade_x],eax |
1381 | no_remove_x: |
1360 | no_remove_x: |
1382 | 1361 | ||
1383 | cmp ebx,[rectangular_shade_y] |
1362 | cmp ebx,[rectangular_shade_y] |
1384 | jl no_remove_y |
1363 | jl no_remove_y |
1385 | mov ecx,[rectangular_shade_y] |
1364 | mov ecx,[rectangular_shade_y] |
1386 | mov [OldY],ecx ; OldY <-----> rectangulare_shade_y |
1365 | mov [OldY],ecx ; OldY <-----> rectangulare_shade_y |
1387 | mov [rectangular_shade_y],ebx |
1366 | mov [rectangular_shade_y],ebx |
1388 | no_remove_y: |
1367 | no_remove_y: |
1389 | 1368 | ||
1390 | mov eax,[ScreenX] |
1369 | mov eax,[ScreenX] |
1391 | mov ebx,[ScreenY] |
1370 | mov ebx,[ScreenY] |
1392 | add eax,[PosX] |
1371 | add eax,[PosX] |
1393 | add ebx,[PosY] |
1372 | add ebx,[PosY] |
1394 | mov [crossing_old_x],eax |
1373 | mov [crossing_old_x],eax |
1395 | mov [crossing_old_y],ebx |
1374 | mov [crossing_old_y],ebx |
1396 | mov [crossing],1 |
1375 | mov [crossing],1 |
1397 | 1376 | ||
1398 | 1377 | ||
1399 | mov eax,[OldX] |
1378 | mov eax,[OldX] |
1400 | mov ebx,[OldY] |
1379 | mov ebx,[OldY] |
1401 | inc eax |
1380 | inc eax |
1402 | inc ebx |
1381 | inc ebx |
1403 | mov [SpriteCoordinatX],eax |
1382 | mov [SpriteCoordinatX],eax |
1404 | mov [SpriteCoordinatY],ebx |
1383 | mov [SpriteCoordinatY],ebx |
1405 | mov [SpriteOldCoordinatX],eax |
1384 | mov [SpriteOldCoordinatX],eax |
1406 | mov [SpriteOldCoordinatY],ebx |
1385 | mov [SpriteOldCoordinatY],ebx |
1407 | mov esi,[rectangular_shade_x] |
1386 | mov esi,[rectangular_shade_x] |
1408 | mov edi,[rectangular_shade_y] |
1387 | mov edi,[rectangular_shade_y] |
1409 | 1388 | ||
1410 | sub esi,eax |
1389 | sub esi,eax |
1411 | jns no_sign_sprite_size_x |
1390 | jns no_sign_sprite_size_x |
1412 | neg esi |
1391 | neg esi |
1413 | no_sign_sprite_size_x: |
1392 | no_sign_sprite_size_x: |
1414 | 1393 | ||
1415 | sub edi,ebx |
1394 | sub edi,ebx |
1416 | jns no_sign_sprite_size_y |
1395 | jns no_sign_sprite_size_y |
1417 | neg edi |
1396 | neg edi |
1418 | no_sign_sprite_size_y: |
1397 | no_sign_sprite_size_y: |
1419 | 1398 | ||
1420 | test esi,esi |
1399 | test esi,esi |
1421 | jnz no_null_sprite_x |
1400 | jnz no_null_sprite_x |
1422 | mov esi,1 |
1401 | mov esi,1 |
1423 | no_null_sprite_x: |
1402 | no_null_sprite_x: |
1424 | 1403 | ||
1425 | test edi,edi |
1404 | test edi,edi |
1426 | jnz no_null_sprite_y |
1405 | jnz no_null_sprite_y |
1427 | mov edi,1 |
1406 | mov edi,1 |
1428 | no_null_sprite_y: |
1407 | no_null_sprite_y: |
1429 | 1408 | ||
1430 | mov [SpriteSizeX],esi |
1409 | mov [SpriteSizeX],esi |
1431 | mov [SpriteSizeY],edi |
1410 | mov [SpriteSizeY],edi |
1432 | 1411 | ||
1433 | call SaveFonForSprite |
1412 | call SaveFonForSprite |
1434 | 1413 | ||
1435 | no_save_coordinate_of_crossing: |
1414 | no_save_coordinate_of_crossing: |
1436 | 1415 | ||
1437 | cmp [crossing],0 |
1416 | cmp [crossing],0 |
1438 | je no_test_crossing_with_work_arrea |
1417 | je no_test_crossing_with_work_arrea |
1439 | ;if mouse situatad after allocation than exit |
1418 | ;if mouse situatad after allocation than exit |
1440 | push [ScreenX] |
1419 | push [ScreenX] |
1441 | push [ScreenY] |
1420 | push [ScreenY] |
1442 | 1421 | ||
1443 | call GetScreenCordinats |
1422 | call GetScreenCordinats |
1444 | 1423 | ||
1445 | mov eax,[OldX] |
1424 | mov eax,[OldX] |
1446 | mov ebx,[OldY] |
1425 | mov ebx,[OldY] |
1447 | mov ecx,[ScreenX] |
1426 | mov ecx,[ScreenX] |
1448 | mov edx,[ScreenY] |
1427 | mov edx,[ScreenY] |
1449 | mov esi,[SpriteSizeX] |
1428 | mov esi,[SpriteSizeX] |
1450 | mov edi,[SpriteSizeY] |
1429 | mov edi,[SpriteSizeY] |
1451 | add ecx,[PosX] |
1430 | add ecx,[PosX] |
1452 | add edx,[PosY] |
1431 | add edx,[PosY] |
1453 | inc esi;eax |
1432 | inc esi;eax |
1454 | inc edi;ebx |
1433 | inc edi;ebx |
1455 | call columnus |
1434 | call columnus |
1456 | 1435 | ||
1457 | test eax,eax |
1436 | test eax,eax |
1458 | jnz crossing_with_work_area |
1437 | jnz crossing_with_work_area |
1459 | mov [finishing_crossing],1 |
1438 | mov [finishing_crossing],1 |
1460 | mov [register],1 |
1439 | mov [register],1 |
1461 | crossing_with_work_area: |
1440 | crossing_with_work_area: |
1462 | 1441 | ||
1463 | pop [ScreenY] |
1442 | pop [ScreenY] |
1464 | pop [ScreenX] |
1443 | pop [ScreenX] |
1465 | 1444 | ||
1466 | no_test_crossing_with_work_arrea: |
1445 | no_test_crossing_with_work_arrea: |
1467 | 1446 | ||
1468 | mov eax,[ScreenX] |
1447 | mov eax,[ScreenX] |
1469 | mov ebx,[ScreenY] |
1448 | mov ebx,[ScreenY] |
1470 | add eax,[PosX] |
1449 | add eax,[PosX] |
1471 | add ebx,[PosY] |
1450 | add ebx,[PosY] |
1472 | mov ecx,eax |
1451 | mov ecx,eax |
1473 | mov edx,ebx |
1452 | mov edx,ebx |
1474 | sub eax,[crossing_old_x] ;dx=(x-oldx) |
1453 | sub eax,[crossing_old_x] ;dx=(x-oldx) |
1475 | sub ebx,[crossing_old_y] ;dy=(y-oldy) |
1454 | sub ebx,[crossing_old_y] ;dy=(y-oldy) |
1476 | mov [crossing_old_x],ecx |
1455 | mov [crossing_old_x],ecx |
1477 | mov [crossing_old_y],edx |
1456 | mov [crossing_old_y],edx |
1478 | 1457 | ||
1479 | add [OldX],eax ;x1=x1+dx |
1458 | add [OldX],eax ;x1=x1+dx |
1480 | add [OldY],ebx ;y1=y1+dy |
1459 | add [OldY],ebx ;y1=y1+dy |
1481 | add [rectangular_shade_x],eax ;x2=x2+dx |
1460 | add [rectangular_shade_x],eax ;x2=x2+dx |
1482 | add [rectangular_shade_y],ebx ;y2+y2+dy |
1461 | add [rectangular_shade_y],ebx ;y2+y2+dy |
1483 | 1462 | ||
1484 | mov eax,[OldX] |
1463 | mov eax,[OldX] |
1485 | mov ebx,[OldY] |
1464 | mov ebx,[OldY] |
1486 | inc eax |
1465 | inc eax |
1487 | inc ebx |
1466 | inc ebx |
1488 | mov [SpriteCoordinatX],eax |
1467 | mov [SpriteCoordinatX],eax |
1489 | mov [SpriteCoordinatY],ebx |
1468 | mov [SpriteCoordinatY],ebx |
1490 | 1469 | ||
1491 | cmp [SpriteCoordinatX],0 |
1470 | cmp [SpriteCoordinatX],0 |
1492 | jns no_null_sprite_coordinat_x |
1471 | jns no_null_sprite_coordinat_x |
1493 | mov [SpriteCoordinatX],1 |
1472 | mov [SpriteCoordinatX],1 |
1494 | no_null_sprite_coordinat_x: |
1473 | no_null_sprite_coordinat_x: |
1495 | 1474 | ||
1496 | cmp [SpriteCoordinatY],0 |
1475 | cmp [SpriteCoordinatY],0 |
1497 | jns no_null_sprite_coordinat_y |
1476 | jns no_null_sprite_coordinat_y |
1498 | mov [SpriteCoordinatY],1 |
1477 | mov [SpriteCoordinatY],1 |
1499 | no_null_sprite_coordinat_y: |
1478 | no_null_sprite_coordinat_y: |
1500 | 1479 | ||
1501 | mov esi,[rectangular_shade_x] |
1480 | mov esi,[rectangular_shade_x] |
1502 | mov edi,[rectangular_shade_y] |
1481 | mov edi,[rectangular_shade_y] |
1503 | 1482 | ||
1504 | sub esi,[OldX] |
1483 | sub esi,[OldX] |
1505 | jns no_znak_size_of_rectangulare_crossing_x |
1484 | jns no_znak_size_of_rectangulare_crossing_x |
1506 | neg esi |
1485 | neg esi |
1507 | no_znak_size_of_rectangulare_crossing_x: |
1486 | no_znak_size_of_rectangulare_crossing_x: |
1508 | 1487 | ||
1509 | sub edi,[OldY] |
1488 | sub edi,[OldY] |
1510 | jns no_znak_size_of_rectangulare_crossing_y |
1489 | jns no_znak_size_of_rectangulare_crossing_y |
1511 | neg edi |
1490 | neg edi |
1512 | no_znak_size_of_rectangulare_crossing_y: |
1491 | no_znak_size_of_rectangulare_crossing_y: |
1513 | 1492 | ||
1514 | mov ecx,[OldX] |
1493 | mov ecx,[OldX] |
1515 | mov edx,[OldY] |
1494 | mov edx,[OldY] |
1516 | 1495 | ||
1517 | sub ecx,[PosX] |
1496 | sub ecx,[PosX] |
1518 | jns no_minimum_x_crossing |
1497 | jns no_minimum_x_crossing |
1519 | mov ecx,0 |
1498 | mov ecx,0 |
1520 | add ecx,[PosX] |
1499 | add ecx,[PosX] |
1521 | mov [OldX],ecx |
1500 | mov [OldX],ecx |
1522 | add ecx,esi |
1501 | add ecx,esi |
1523 | mov [rectangular_shade_x],ecx |
1502 | mov [rectangular_shade_x],ecx |
1524 | no_minimum_x_crossing: |
1503 | no_minimum_x_crossing: |
1525 | 1504 | ||
1526 | sub edx,[PosY] |
1505 | sub edx,[PosY] |
1527 | jns no_minimum_y_crossing |
1506 | jns no_minimum_y_crossing |
1528 | mov edx,0 |
1507 | mov edx,0 |
1529 | add edx,[PosY] |
1508 | add edx,[PosY] |
1530 | mov [OldY],edx |
1509 | mov [OldY],edx |
1531 | add edx,edi |
1510 | add edx,edi |
1532 | mov [rectangular_shade_y],edx |
1511 | mov [rectangular_shade_y],edx |
1533 | no_minimum_y_crossing: |
1512 | no_minimum_y_crossing: |
1534 | 1513 | ||
1535 | mov ecx,[Picture_SizeX] |
1514 | mov ecx,[Picture_SizeX] |
1536 | sub ecx,esi |
1515 | sub ecx,esi |
1537 | cmp [OldX],ecx |
1516 | cmp [OldX],ecx |
1538 | jl no_maximum_x_crossing |
1517 | jl no_maximum_x_crossing |
1539 | dec ecx |
1518 | dec ecx |
1540 | mov [OldX],ecx |
1519 | mov [OldX],ecx |
1541 | add ecx,esi |
1520 | add ecx,esi |
1542 | mov [rectangular_shade_x],ecx |
1521 | mov [rectangular_shade_x],ecx |
1543 | no_maximum_x_crossing: |
1522 | no_maximum_x_crossing: |
1544 | 1523 | ||
1545 | mov edx,[Picture_SizeY] |
1524 | mov edx,[Picture_SizeY] |
1546 | sub edx,edi |
1525 | sub edx,edi |
1547 | cmp [OldY],edx |
1526 | cmp [OldY],edx |
1548 | jl no_maximum_y_crossing |
1527 | jl no_maximum_y_crossing |
1549 | dec edx |
1528 | dec edx |
1550 | mov [OldY],edx |
1529 | mov [OldY],edx |
1551 | add edx,edi |
1530 | add edx,edi |
1552 | mov [rectangular_shade_y],edx |
1531 | mov [rectangular_shade_y],edx |
1553 | no_maximum_y_crossing: |
1532 | no_maximum_y_crossing: |
1554 | 1533 | ||
1555 | mov eax,[rectangular_shade_x] |
1534 | mov eax,[rectangular_shade_x] |
1556 | mov ebx,[rectangular_shade_y] |
1535 | mov ebx,[rectangular_shade_y] |
1557 | sub eax,[PosX] |
1536 | sub eax,[PosX] |
1558 | sub ebx,[PosY] |
1537 | sub ebx,[PosY] |
1559 | mov [ScreenX],eax |
1538 | mov [ScreenX],eax |
1560 | mov [ScreenY],ebx |
1539 | mov [ScreenY],ebx |
1561 | no_change_coordinats: |
1540 | no_change_coordinats: |
1562 | 1541 | ||
1563 | ;put saved pixels |
1542 | ;put saved pixels |
1564 | mov ebx,[ReserveArray] |
1543 | mov ebx,[ReserveArray] |
1565 | mov eax,[ebx] |
1544 | mov eax,[ebx] |
1566 | test eax,eax |
1545 | test eax,eax |
1567 | jz no_put_line_to_screen_allocation |
1546 | jz no_put_line_to_screen_allocation |
1568 | mov ecx,[ebx] |
1547 | mov ecx,[ebx] |
1569 | add ebx,4 |
1548 | add ebx,4 |
1570 | xor ebp,ebp |
1549 | xor ebp,ebp |
1571 | next_color_put_allocation: |
1550 | next_color_put_allocation: |
1572 | ;put saved pixels in ReserveArray |
1551 | ;put saved pixels in ReserveArray |
1573 | push ecx |
1552 | push ecx |
1574 | and [counter2],0 |
1553 | and [counter2],0 |
1575 | mov edi,[ebx] |
1554 | mov edi,[ebx] |
1576 | push edi |
1555 | push edi |
1577 | vertical_width_put_allocation: |
1556 | vertical_width_put_allocation: |
1578 | and [counter],0 |
1557 | and [counter],0 |
1579 | 1558 | ||
1580 | horizontal_width_put_allocation: |
1559 | horizontal_width_put_allocation: |
1581 | mov edx,[ebx+4807*4+ebp] |
1560 | mov edx,[ebx+4807*4+ebp] |
1582 | and edx,0xffffff |
1561 | and edx,0xffffff |
1583 | mov [edi],dx |
1562 | mov [edi],dx |
1584 | shr edx,16 |
1563 | shr edx,16 |
1585 | mov [edi+2],dl |
1564 | mov [edi+2],dl |
1586 | 1565 | ||
1587 | add edi,3 |
1566 | add edi,3 |
1588 | add ebp,4 |
1567 | add ebp,4 |
1589 | inc [counter] |
1568 | inc [counter] |
1590 | cmp [counter],1;5 |
1569 | cmp [counter],1;5 |
1591 | jne horizontal_width_put_allocation |
1570 | jne horizontal_width_put_allocation |
1592 | 1571 | ||
1593 | mov ecx,[Picture_SizeX] |
1572 | mov ecx,[Picture_SizeX] |
1594 | sub ecx,1;5 |
1573 | sub ecx,1;5 |
1595 | lea ecx,[ecx+ecx*2] |
1574 | lea ecx,[ecx+ecx*2] |
1596 | add edi,ecx |
1575 | add edi,ecx |
1597 | inc [counter2] |
1576 | inc [counter2] |
1598 | cmp [counter2],1;5 |
1577 | cmp [counter2],1;5 |
1599 | jne vertical_width_put_allocation |
1578 | jne vertical_width_put_allocation |
1600 | pop edi |
1579 | pop edi |
1601 | pop ecx |
1580 | pop ecx |
1602 | add ebx,4 |
1581 | add ebx,4 |
1603 | dec ecx |
1582 | dec ecx |
1604 | jnz next_color_put_allocation |
1583 | jnz next_color_put_allocation |
1605 | 1584 | ||
1606 | no_put_line_to_screen_allocation: |
1585 | no_put_line_to_screen_allocation: |
1607 | 1586 | ||
1608 | cmp [DrawSprite_flag],1 |
1587 | cmp [DrawSprite_flag],1 |
1609 | jne no_activate_put_fon_ |
1588 | jne no_activate_put_fon_ |
1610 | 1589 | ||
1611 | cmp [Paste_flag],1 |
1590 | cmp [Paste_flag],1 |
1612 | je no_put_fon___ |
1591 | je no_put_fon___ |
1613 | call PutFonForSprite |
1592 | call PutFonForSprite |
1614 | no_put_fon___: |
1593 | no_put_fon___: |
1615 | and [Paste_flag],0 |
1594 | and [Paste_flag],0 |
1616 | no_activate_put_fon_: |
1595 | no_activate_put_fon_: |
1617 | 1596 | ||
1618 | cmp [finishing_crossing],0 |
1597 | cmp [finishing_crossing],0 |
1619 | jz not_finish_from_instrument_crossing |
1598 | jz not_finish_from_instrument_crossing |
1620 | and [Activate_instrument],0 |
1599 | and [Activate_instrument],0 |
1621 | and [crossing],0 |
1600 | and [crossing],0 |
1622 | and [instrument_used],0 |
1601 | and [instrument_used],0 |
1623 | and [DrawSprite_flag],0 |
1602 | and [DrawSprite_flag],0 |
1624 | call MovePictureToWorkScreen |
1603 | call MovePictureToWorkScreen |
1625 | jmp still |
1604 | jmp still |
1626 | not_finish_from_instrument_crossing: |
1605 | not_finish_from_instrument_crossing: |
1627 | 1606 | ||
1628 | ;calculate line |
1607 | ;calculate line |
1629 | mov ebx,[ReserveArray] |
1608 | mov ebx,[ReserveArray] |
1630 | add ebx,4 |
1609 | add ebx,4 |
1631 | mov eax,[PointerToPicture] |
1610 | mov eax,[PointerToPicture] |
1632 | mov ecx,[Picture_SizeX] |
1611 | mov ecx,[Picture_SizeX] |
1633 | mov edx,[OldX] |
1612 | mov edx,[OldX] |
1634 | shl edx,16 |
1613 | shl edx,16 |
1635 | add edx,[OldY] |
1614 | add edx,[OldY] |
1636 | mov esi,[ScreenX] |
1615 | mov esi,[ScreenX] |
1637 | mov edi,[ScreenY] |
1616 | mov edi,[ScreenY] |
1638 | add esi,[PosX] |
1617 | add esi,[PosX] |
1639 | add edi,[PosY] |
1618 | add edi,[PosY] |
1640 | 1619 | ||
1641 | mov ebp,[Picture_SizeX] |
1620 | mov ebp,[Picture_SizeX] |
1642 | dec ebp |
1621 | dec ebp |
1643 | cmp esi,ebp |
1622 | cmp esi,ebp |
1644 | jl no_minimum_x_allocation |
1623 | jl no_minimum_x_allocation |
1645 | mov esi,ebp |
1624 | mov esi,ebp |
1646 | no_minimum_x_allocation: |
1625 | no_minimum_x_allocation: |
1647 | 1626 | ||
1648 | mov ebp,[Picture_SizeY] |
1627 | mov ebp,[Picture_SizeY] |
1649 | dec ebp |
1628 | dec ebp |
1650 | cmp edi,ebp |
1629 | cmp edi,ebp |
1651 | jl no_minimum_y_allocation |
1630 | jl no_minimum_y_allocation |
1652 | mov edi,ebp |
1631 | mov edi,ebp |
1653 | no_minimum_y_allocation: |
1632 | no_minimum_y_allocation: |
1654 | 1633 | ||
1655 | call calculate_rectangle |
1634 | call calculate_rectangle |
1656 | mov [counter],eax |
1635 | mov [counter],eax |
1657 | 1636 | ||
1658 | ;save color pixels in ReserveArray |
1637 | ;save color pixels in ReserveArray |
1659 | mov eax,[counter] |
1638 | mov eax,[counter] |
1660 | mov ebx,[ReserveArray] |
1639 | mov ebx,[ReserveArray] |
1661 | mov [ebx],eax |
1640 | mov [ebx],eax |
1662 | 1641 | ||
1663 | mov ecx,[ebx] |
1642 | mov ecx,[ebx] |
1664 | add ebx,4 |
1643 | add ebx,4 |
1665 | 1644 | ||
1666 | xor ebp,ebp |
1645 | xor ebp,ebp |
1667 | next_color_save_allocation: |
1646 | next_color_save_allocation: |
1668 | ;save color of pixel in ReserveArray |
1647 | ;save color of pixel in ReserveArray |
1669 | push ecx |
1648 | push ecx |
1670 | and [counter2],0 |
1649 | and [counter2],0 |
1671 | mov edi,[ebx] |
1650 | mov edi,[ebx] |
1672 | vertical_width_save_allocation: |
1651 | vertical_width_save_allocation: |
1673 | and [counter],0 |
1652 | and [counter],0 |
1674 | 1653 | ||
1675 | horizontal_width_save_allocation: |
1654 | horizontal_width_save_allocation: |
1676 | mov eax,edi |
1655 | mov eax,edi |
1677 | mov edx,[eax] |
1656 | mov edx,[eax] |
1678 | and edx,0xffffff |
1657 | and edx,0xffffff |
1679 | mov [ebx+4807*4+ebp],dx |
1658 | mov [ebx+4807*4+ebp],dx |
1680 | shr edx,16 |
1659 | shr edx,16 |
1681 | mov [ebx+4807*4+2+ebp],dl |
1660 | mov [ebx+4807*4+2+ebp],dl |
1682 | 1661 | ||
1683 | add edi,3 |
1662 | add edi,3 |
1684 | add ebp,4 |
1663 | add ebp,4 |
1685 | inc [counter] |
1664 | inc [counter] |
1686 | cmp [counter],1;5 |
1665 | cmp [counter],1;5 |
1687 | jne horizontal_width_save_allocation |
1666 | jne horizontal_width_save_allocation |
1688 | 1667 | ||
1689 | mov ecx,[Picture_SizeX] |
1668 | mov ecx,[Picture_SizeX] |
1690 | sub ecx,1;5 |
1669 | sub ecx,1;5 |
1691 | lea ecx,[ecx+ecx*2] |
1670 | lea ecx,[ecx+ecx*2] |
1692 | add edi,ecx |
1671 | add edi,ecx |
1693 | inc [counter2] |
1672 | inc [counter2] |
1694 | cmp [counter2],1;5 |
1673 | cmp [counter2],1;5 |
1695 | jne vertical_width_save_allocation |
1674 | jne vertical_width_save_allocation |
1696 | pop ecx |
1675 | pop ecx |
1697 | add ebx,4 |
1676 | add ebx,4 |
1698 | dec ecx |
1677 | dec ecx |
1699 | jnz next_color_save_allocation |
1678 | jnz next_color_save_allocation |
1700 | 1679 | ||
1701 | cmp [DrawSprite_flag],1 |
1680 | cmp [DrawSprite_flag],1 |
1702 | jne no_save_fon_for_sprite_ |
1681 | jne no_save_fon_for_sprite_ |
1703 | ;save current coordinats as old |
1682 | ;save current coordinats as old |
1704 | mov eax,[SpriteCoordinatX] |
1683 | mov eax,[SpriteCoordinatX] |
1705 | mov ebx,[SpriteCoordinatY] |
1684 | mov ebx,[SpriteCoordinatY] |
1706 | mov [SpriteOldCoordinatX],eax |
1685 | mov [SpriteOldCoordinatX],eax |
1707 | mov [SpriteOldCoordinatY],ebx |
1686 | mov [SpriteOldCoordinatY],ebx |
1708 | 1687 | ||
1709 | call SaveFonForSprite |
1688 | call SaveFonForSprite |
1710 | 1689 | ||
1711 | no_save_fon_for_sprite_: |
1690 | no_save_fon_for_sprite_: |
1712 | 1691 | ||
1713 | ;draw calculated pixels on work arrea |
1692 | ;draw calculated pixels on work arrea |
1714 | mov ebx,[ReserveArray] |
1693 | mov ebx,[ReserveArray] |
1715 | mov ecx,[ebx] |
1694 | mov ecx,[ebx] |
1716 | add ebx,4 |
1695 | add ebx,4 |
1717 | next_pixel_put_allocation: |
1696 | next_pixel_put_allocation: |
1718 | 1697 | ||
1719 | mov edx,0x1f3fff |
1698 | mov edx,0x1f3fff |
1720 | mov esi,edx |
1699 | mov esi,edx |
1721 | shr edx,16 |
1700 | shr edx,16 |
1722 | 1701 | ||
1723 | mov ebp,ecx |
1702 | mov ebp,ecx |
1724 | and ebp,8 |
1703 | and ebp,8 |
1725 | cmp ebp,8 |
1704 | cmp ebp,8 |
1726 | jne black_color |
1705 | jne black_color |
1727 | mov si,0xffff |
1706 | mov si,0xffff |
1728 | mov dl,0xff |
1707 | mov dl,0xff |
1729 | black_color: |
1708 | black_color: |
1730 | 1709 | ||
1731 | mov eax,[ebx] |
1710 | mov eax,[ebx] |
1732 | mov [eax],si |
1711 | mov [eax],si |
1733 | mov [eax+2],dl |
1712 | mov [eax+2],dl |
1734 | 1713 | ||
1735 | add ebx,4 |
1714 | add ebx,4 |
1736 | dec ecx |
1715 | dec ecx |
1737 | jnz next_pixel_put_allocation |
1716 | jnz next_pixel_put_allocation |
1738 | 1717 | ||
1739 | cmp [DrawSprite_flag],1 |
1718 | cmp [DrawSprite_flag],1 |
1740 | jne no_activate_draw_sprite_ |
1719 | jne no_activate_draw_sprite_ |
1741 | 1720 | ||
1742 | call DrawSprite |
1721 | call DrawSprite |
1743 | 1722 | ||
1744 | no_activate_draw_sprite_: |
1723 | no_activate_draw_sprite_: |
1745 | 1724 | ||
1746 | mov al,[instrument_used] |
1725 | mov al,[instrument_used] |
1747 | test al,al |
1726 | test al,al |
1748 | jz no_change_coordinats |
1727 | jz no_change_coordinats |
1749 | cmp [Activate_instrument],0 |
1728 | cmp [Activate_instrument],0 |
1750 | jz no_save_shades |
1729 | jz no_save_shades |
1751 | mov eax,[ScreenX] |
1730 | mov eax,[ScreenX] |
1752 | mov ebx,[ScreenY] |
1731 | mov ebx,[ScreenY] |
1753 | add eax,[PosX] |
1732 | add eax,[PosX] |
1754 | add ebx,[PosY] |
1733 | add ebx,[PosY] |
1755 | mov [rectangular_shade_x],eax |
1734 | mov [rectangular_shade_x],eax |
1756 | mov [rectangular_shade_y],ebx |
1735 | mov [rectangular_shade_y],ebx |
1757 | no_save_shades: |
1736 | no_save_shades: |
1758 | 1737 | ||
1759 | call MovePictureToWorkScreen |
1738 | call MovePictureToWorkScreen |
1760 | jmp still |
1739 | jmp still |
1761 | no_allocation: |
1740 | no_allocation: |
1762 | 1741 | ||
1763 | ;*************reflection from left to right****************** |
1742 | ;*************reflection from left to right****************** |
1764 | cmp eax,23 |
1743 | cmp eax,23 |
1765 | jne no_reflection_from_left_to_right |
1744 | jne no_reflection_from_left_to_right |
1766 | 1745 | ||
1767 | mov ebp,[PointerToPicture] |
1746 | mov ebp,[PointerToPicture] |
1768 | mov edx,[ReserveArray] |
1747 | mov edx,[ReserveArray] |
1769 | mov esi,[Picture_SizeX] |
1748 | mov esi,[Picture_SizeX] |
1770 | mov ebx,[Picture_SizeX] |
1749 | mov ebx,[Picture_SizeX] |
1771 | lea ebx,[ebx+ebx*2] |
1750 | lea ebx,[ebx+ebx*2] |
1772 | shr esi,1 |
1751 | shr esi,1 |
1773 | next_line_reflection_x: |
1752 | next_line_reflection_x: |
1774 | ;copy vertical line to array |
1753 | ;copy vertical line to array |
1775 | mov ecx,[Picture_SizeX] |
1754 | mov ecx,[Picture_SizeX] |
1776 | shr ecx,1 |
1755 | shr ecx,1 |
1777 | sub ecx,esi |
1756 | sub ecx,esi |
1778 | lea ecx,[ecx+ecx*2] |
1757 | lea ecx,[ecx+ecx*2] |
1779 | add ecx,[PointerToPicture] |
1758 | add ecx,[PointerToPicture] |
1780 | mov edx,[ReserveArray] |
1759 | mov edx,[ReserveArray] |
1781 | and edi,0 |
1760 | and edi,0 |
1782 | copy_to_array_line_reflection_y: |
1761 | copy_to_array_line_reflection_y: |
1783 | xor eax,eax |
1762 | xor eax,eax |
1784 | mov eax,[ecx] |
1763 | mov eax,[ecx] |
1785 | mov ebp,edi |
1764 | mov ebp,edi |
1786 | lea ebp,[ebp+ebp*2] |
1765 | lea ebp,[ebp+ebp*2] |
1787 | mov [edx+ebp],ax |
1766 | mov [edx+ebp],ax |
1788 | shr eax,16 |
1767 | shr eax,16 |
1789 | mov [edx+ebp+2],al |
1768 | mov [edx+ebp+2],al |
1790 | add ecx,ebx |
1769 | add ecx,ebx |
1791 | inc edi |
1770 | inc edi |
1792 | cmp edi,[Picture_SizeY] |
1771 | cmp edi,[Picture_SizeY] |
1793 | jne copy_to_array_line_reflection_y |
1772 | jne copy_to_array_line_reflection_y |
1794 | 1773 | ||
1795 | mov ecx,[Picture_SizeX] |
1774 | mov ecx,[Picture_SizeX] |
1796 | shr ecx,1 |
1775 | shr ecx,1 |
1797 | mov ebp,ecx |
1776 | mov ebp,ecx |
1798 | add ecx,esi |
1777 | add ecx,esi |
1799 | dec ecx |
1778 | dec ecx |
1800 | lea ecx,[ecx+ecx*2] |
1779 | lea ecx,[ecx+ecx*2] |
1801 | add ecx,[PointerToPicture] |
1780 | add ecx,[PointerToPicture] |
1802 | sub ebp,esi |
1781 | sub ebp,esi |
1803 | lea ebp,[ebp+ebp*2] |
1782 | lea ebp,[ebp+ebp*2] |
1804 | add ebp,[PointerToPicture] |
1783 | add ebp,[PointerToPicture] |
1805 | and edi,0 |
1784 | and edi,0 |
1806 | next_line_reflection_y: |
1785 | next_line_reflection_y: |
1807 | mov eax,[ecx] |
1786 | mov eax,[ecx] |
1808 | and eax,0xffffff |
1787 | and eax,0xffffff |
1809 | mov [ebp],ax |
1788 | mov [ebp],ax |
1810 | shr eax,16 |
1789 | shr eax,16 |
1811 | mov [ebp+2],al |
1790 | mov [ebp+2],al |
1812 | add ebp,ebx |
1791 | add ebp,ebx |
1813 | add ecx,ebx |
1792 | add ecx,ebx |
1814 | inc edi |
1793 | inc edi |
1815 | cmp edi,[Picture_SizeY] |
1794 | cmp edi,[Picture_SizeY] |
1816 | jnz next_line_reflection_y |
1795 | jnz next_line_reflection_y |
1817 | 1796 | ||
1818 | ;copy vertical line from array to screen |
1797 | ;copy vertical line from array to screen |
1819 | mov ecx,[Picture_SizeX] |
1798 | mov ecx,[Picture_SizeX] |
1820 | shr ecx,1 |
1799 | shr ecx,1 |
1821 | add ecx,esi |
1800 | add ecx,esi |
1822 | dec ecx |
1801 | dec ecx |
1823 | lea ecx,[ecx+ecx*2] |
1802 | lea ecx,[ecx+ecx*2] |
1824 | add ecx,[PointerToPicture] |
1803 | add ecx,[PointerToPicture] |
1825 | mov edx,[ReserveArray] |
1804 | mov edx,[ReserveArray] |
1826 | and edi,0 |
1805 | and edi,0 |
1827 | copy_from_array_to_screen_reflection_y: |
1806 | copy_from_array_to_screen_reflection_y: |
1828 | mov ebp,edi |
1807 | mov ebp,edi |
1829 | lea ebp,[ebp+ebp*2] |
1808 | lea ebp,[ebp+ebp*2] |
1830 | xor eax,eax |
1809 | xor eax,eax |
1831 | mov eax,[edx+ebp] |
1810 | mov eax,[edx+ebp] |
1832 | mov [ecx],ax |
1811 | mov [ecx],ax |
1833 | shr eax,16 |
1812 | shr eax,16 |
1834 | mov [ecx+2],al |
1813 | mov [ecx+2],al |
1835 | add ecx,ebx |
1814 | add ecx,ebx |
1836 | inc edi |
1815 | inc edi |
1837 | cmp edi,[Picture_SizeY] |
1816 | cmp edi,[Picture_SizeY] |
1838 | jne copy_from_array_to_screen_reflection_y |
1817 | jne copy_from_array_to_screen_reflection_y |
1839 | 1818 | ||
1840 | dec esi |
1819 | dec esi |
1841 | jnz next_line_reflection_x |
1820 | jnz next_line_reflection_x |
1842 | 1821 | ||
1843 | call MovePictureToWorkScreen |
1822 | call MovePictureToWorkScreen |
1844 | jmp still |
1823 | jmp still |
1845 | no_reflection_from_left_to_right: |
1824 | no_reflection_from_left_to_right: |
1846 | 1825 | ||
1847 | ;*************reflection from up to down****************** |
1826 | ;*************reflection from up to down****************** |
1848 | cmp eax,24 |
1827 | cmp eax,24 |
1849 | jne no_reflection_from_up_to_down |
1828 | jne no_reflection_from_up_to_down |
1850 | mov esi,[Picture_SizeX] |
1829 | mov esi,[Picture_SizeX] |
1851 | mov edi,esi |
1830 | mov edi,esi |
1852 | lea esi,[esi+esi*2] |
1831 | lea esi,[esi+esi*2] |
1853 | lea edi,[edi+edi*2] |
1832 | lea edi,[edi+edi*2] |
1854 | imul edi,[Picture_SizeY] |
1833 | imul edi,[Picture_SizeY] |
1855 | mov edx,[ReserveArray] |
1834 | mov edx,[ReserveArray] |
1856 | mov ecx,[Picture_SizeY] |
1835 | mov ecx,[Picture_SizeY] |
1857 | shr ecx,1 |
1836 | shr ecx,1 |
1858 | add edi,[PointerToPicture] |
1837 | add edi,[PointerToPicture] |
1859 | sub edi,esi |
1838 | sub edi,esi |
1860 | mov ebp,[PointerToPicture] |
1839 | mov ebp,[PointerToPicture] |
1861 | next_lines_reflection: |
1840 | next_lines_reflection: |
1862 | ;copy line |
1841 | ;copy line |
1863 | xor ebx,ebx |
1842 | xor ebx,ebx |
1864 | copy_line_1: |
1843 | copy_line_1: |
1865 | xor eax,eax |
1844 | xor eax,eax |
1866 | mov al,[edi+ebx] |
1845 | mov al,[edi+ebx] |
1867 | mov [edx+ebx],al |
1846 | mov [edx+ebx],al |
1868 | inc ebx |
1847 | inc ebx |
1869 | cmp ebx,esi |
1848 | cmp ebx,esi |
1870 | jne copy_line_1 |
1849 | jne copy_line_1 |
1871 | 1850 | ||
1872 | xor ebx,ebx |
1851 | xor ebx,ebx |
1873 | copy_line_2: |
1852 | copy_line_2: |
1874 | xor eax,eax |
1853 | xor eax,eax |
1875 | mov al,[ebp+ebx] |
1854 | mov al,[ebp+ebx] |
1876 | mov [edi+ebx],al |
1855 | mov [edi+ebx],al |
1877 | inc ebx |
1856 | inc ebx |
1878 | cmp ebx,esi |
1857 | cmp ebx,esi |
1879 | jne copy_line_2 |
1858 | jne copy_line_2 |
1880 | 1859 | ||
1881 | xor ebx,ebx |
1860 | xor ebx,ebx |
1882 | copy_line_3: |
1861 | copy_line_3: |
1883 | xor eax,eax |
1862 | xor eax,eax |
1884 | mov al,[edx+ebx] |
1863 | mov al,[edx+ebx] |
1885 | mov [ebp+ebx],al |
1864 | mov [ebp+ebx],al |
1886 | inc ebx |
1865 | inc ebx |
1887 | cmp ebx,esi |
1866 | cmp ebx,esi |
1888 | jne copy_line_3 |
1867 | jne copy_line_3 |
1889 | 1868 | ||
1890 | add ebp,esi |
1869 | add ebp,esi |
1891 | sub edi,esi |
1870 | sub edi,esi |
1892 | dec ecx |
1871 | dec ecx |
1893 | jnz next_lines_reflection |
1872 | jnz next_lines_reflection |
1894 | 1873 | ||
1895 | call MovePictureToWorkScreen |
1874 | call MovePictureToWorkScreen |
1896 | jmp still |
1875 | jmp still |
1897 | no_reflection_from_up_to_down: |
1876 | no_reflection_from_up_to_down: |
1898 | 1877 | ||
1899 | ;*********************draw hard contour******************* |
1878 | ;*********************draw hard contour******************* |
1900 | cmp eax,20 |
1879 | cmp eax,20 |
1901 | jne no_kontur_ |
1880 | jne no_kontur_ |
1902 | 1881 | ||
1903 | mov [Last_instrument],eax |
1882 | mov [Last_instrument],eax |
1904 | 1883 | ||
1905 | mov al,[Activate_instrument] |
1884 | mov al,[Activate_instrument] |
1906 | test al,al |
1885 | test al,al |
1907 | jnz no_new_konture_xy |
1886 | jnz no_new_konture_xy |
1908 | 1887 | ||
1909 | mov al,[instrument_used] |
1888 | mov al,[instrument_used] |
1910 | test al,al |
1889 | test al,al |
1911 | jz instrument_not_used |
1890 | jz instrument_not_used |
1912 | mov eax,[used_OldX] |
1891 | mov eax,[used_OldX] |
1913 | mov ebx,[used_OldY] |
1892 | mov ebx,[used_OldY] |
1914 | mov [OldX],eax |
1893 | mov [OldX],eax |
1915 | mov [OldY],ebx |
1894 | mov [OldY],ebx |
1916 | jmp exit_used_instrument |
1895 | jmp exit_used_instrument |
1917 | instrument_not_used: |
1896 | instrument_not_used: |
1918 | 1897 | ||
1919 | mov eax,[ScreenX] |
1898 | mov eax,[ScreenX] |
1920 | mov ebx,[ScreenY] |
1899 | mov ebx,[ScreenY] |
1921 | add eax,[PosX] |
1900 | add eax,[PosX] |
1922 | add ebx,[PosY] |
1901 | add ebx,[PosY] |
1923 | mov [OldX],eax |
1902 | mov [OldX],eax |
1924 | mov [OldY],ebx |
1903 | mov [OldY],ebx |
1925 | exit_used_instrument: |
1904 | exit_used_instrument: |
1926 | 1905 | ||
1927 | mov al,[instrument_used] |
1906 | mov al,[instrument_used] |
1928 | test al,al |
1907 | test al,al |
1929 | jnz instrument_used_true |
1908 | jnz instrument_used_true |
1930 | mov [instrument_used],byte 1 |
1909 | mov [instrument_used],byte 1 |
1931 | instrument_used_true: |
1910 | instrument_used_true: |
1932 | 1911 | ||
1933 | mov [Activate_instrument],1 |
1912 | mov [Activate_instrument],1 |
1934 | mov eax,[ReserveArray] |
- | |
1935 | mov ecx,60000 |
1913 | xor eax,eax |
1936 | clear_array_konture: |
1914 | mov ecx,mem_flood_f/4 |
1937 | mov [eax],dword 0 |
1915 | mov edi,[ReserveArray] |
1938 | add eax,4 |
- | |
1939 | dec ecx |
1916 | rep stosd |
1940 | jnz clear_array_line |
- | |
1941 | 1917 | ||
1942 | no_new_konture_xy: |
1918 | no_new_konture_xy: |
1943 | 1919 | ||
1944 | ;put saved pixels |
1920 | ;put saved pixels |
1945 | mov ebx,[ReserveArray] |
1921 | mov ebx,[ReserveArray] |
1946 | mov eax,[ebx] |
1922 | mov eax,[ebx] |
1947 | test eax,eax |
1923 | test eax,eax |
1948 | jz no_put_line_to_screen_konture |
1924 | jz no_put_line_to_screen_konture |
1949 | mov ecx,[ebx] |
1925 | mov ecx,[ebx] |
1950 | add ebx,4 |
1926 | add ebx,4 |
1951 | xor ebp,ebp |
1927 | xor ebp,ebp |
1952 | next_color_put_konture: |
1928 | next_color_put_konture: |
1953 | ;put saved pixels in ReserveArray |
1929 | ;put saved pixels in ReserveArray |
1954 | push ecx |
1930 | push ecx |
1955 | and [counter2],0 |
1931 | and [counter2],0 |
1956 | mov edi,[ebx] |
1932 | mov edi,[ebx] |
1957 | push edi |
1933 | push edi |
1958 | vertical_width_put_konture: |
1934 | vertical_width_put_konture: |
1959 | and [counter],0 |
1935 | and [counter],0 |
1960 | 1936 | ||
1961 | horizontal_width_put_konture: |
1937 | horizontal_width_put_konture: |
1962 | mov edx,[ebx+4807*4+ebp] |
1938 | mov edx,[ebx+4807*4+ebp] |
1963 | and edx,0xffffff |
1939 | and edx,0xffffff |
1964 | mov [edi],dx |
1940 | mov [edi],dx |
1965 | shr edx,16 |
1941 | shr edx,16 |
1966 | mov [edi+2],dl |
1942 | mov [edi+2],dl |
1967 | 1943 | ||
1968 | add edi,3 |
1944 | add edi,3 |
1969 | add ebp,4 |
1945 | add ebp,4 |
1970 | inc [counter] |
1946 | inc [counter] |
1971 | cmp [counter],5 |
1947 | cmp [counter],5 |
1972 | jne horizontal_width_put_konture |
1948 | jne horizontal_width_put_konture |
1973 | 1949 | ||
1974 | mov ecx,[Picture_SizeX] |
1950 | mov ecx,[Picture_SizeX] |
1975 | sub ecx,5 |
1951 | sub ecx,5 |
1976 | lea ecx,[ecx+ecx*2] |
1952 | lea ecx,[ecx+ecx*2] |
1977 | add edi,ecx |
1953 | add edi,ecx |
1978 | inc [counter2] |
1954 | inc [counter2] |
1979 | cmp [counter2],5 |
1955 | cmp [counter2],5 |
1980 | jne vertical_width_put_konture |
1956 | jne vertical_width_put_konture |
1981 | pop edi |
1957 | pop edi |
1982 | pop ecx |
1958 | pop ecx |
1983 | add ebx,4 |
1959 | add ebx,4 |
1984 | dec ecx |
1960 | dec ecx |
1985 | jnz next_color_put_konture |
1961 | jnz next_color_put_konture |
1986 | 1962 | ||
1987 | no_put_line_to_screen_konture: |
1963 | no_put_line_to_screen_konture: |
1988 | 1964 | ||
1989 | ;calculate line |
1965 | ;calculate line |
1990 | mov ebx,[ReserveArray] |
1966 | mov ebx,[ReserveArray] |
1991 | add ebx,4 |
1967 | add ebx,4 |
1992 | mov eax,[PointerToPicture] |
1968 | mov eax,[PointerToPicture] |
1993 | mov ecx,[Picture_SizeX] |
1969 | mov ecx,[Picture_SizeX] |
1994 | mov edx,[OldX] |
1970 | mov edx,[OldX] |
1995 | shl edx,16 |
1971 | shl edx,16 |
1996 | add edx,[OldY] |
1972 | add edx,[OldY] |
1997 | mov esi,[ScreenX] |
1973 | mov esi,[ScreenX] |
1998 | mov edi,[ScreenY] |
1974 | mov edi,[ScreenY] |
1999 | add esi,[PosX] |
1975 | add esi,[PosX] |
2000 | add edi,[PosY] |
1976 | add edi,[PosY] |
2001 | 1977 | ||
2002 | mov ebp,[Picture_SizeX] |
1978 | mov ebp,[Picture_SizeX] |
2003 | sub ebp,[line_width] |
1979 | sub ebp,[line_width] |
2004 | cmp esi,ebp |
1980 | cmp esi,ebp |
2005 | jl no_minimum_x_konture |
1981 | jl no_minimum_x_konture |
2006 | mov esi,ebp |
1982 | mov esi,ebp |
2007 | no_minimum_x_konture: |
1983 | no_minimum_x_konture: |
2008 | 1984 | ||
2009 | mov ebp,[Picture_SizeY] |
1985 | mov ebp,[Picture_SizeY] |
2010 | sub ebp,[line_width] |
1986 | sub ebp,[line_width] |
2011 | cmp edi,ebp |
1987 | cmp edi,ebp |
2012 | jl no_minimum_y_konture |
1988 | jl no_minimum_y_konture |
2013 | mov edi,ebp |
1989 | mov edi,ebp |
2014 | no_minimum_y_konture: |
1990 | no_minimum_y_konture: |
2015 | 1991 | ||
2016 | call calculate_line |
1992 | call calculate_line |
2017 | ;call calculate_rectangle |
1993 | ;call calculate_rectangle |
2018 | mov [counter],eax |
1994 | mov [counter],eax |
2019 | 1995 | ||
2020 | ;save color pixels in ReserveArray |
1996 | ;save color pixels in ReserveArray |
2021 | mov eax,[counter] |
1997 | mov eax,[counter] |
2022 | mov ebx,[ReserveArray] |
1998 | mov ebx,[ReserveArray] |
2023 | mov [ebx],eax |
1999 | mov [ebx],eax |
2024 | 2000 | ||
2025 | mov ecx,[ebx] |
2001 | mov ecx,[ebx] |
2026 | add ebx,4 |
2002 | add ebx,4 |
2027 | 2003 | ||
2028 | xor ebp,ebp |
2004 | xor ebp,ebp |
2029 | next_color_save_konture: |
2005 | next_color_save_konture: |
2030 | ;save color of pixel in ReserveArray |
2006 | ;save color of pixel in ReserveArray |
2031 | push ecx |
2007 | push ecx |
2032 | and [counter2],0 |
2008 | and [counter2],0 |
2033 | mov edi,[ebx] |
2009 | mov edi,[ebx] |
2034 | vertical_width_save_konture: |
2010 | vertical_width_save_konture: |
2035 | and [counter],0 |
2011 | and [counter],0 |
2036 | 2012 | ||
2037 | horizontal_width_save_konture: |
2013 | horizontal_width_save_konture: |
2038 | mov eax,edi |
2014 | mov eax,edi |
2039 | mov edx,[eax] |
2015 | mov edx,[eax] |
2040 | and edx,0xffffff |
2016 | and edx,0xffffff |
2041 | mov [ebx+4807*4+ebp],dx |
2017 | mov [ebx+4807*4+ebp],dx |
2042 | shr edx,16 |
2018 | shr edx,16 |
2043 | mov [ebx+4807*4+2+ebp],dl |
2019 | mov [ebx+4807*4+2+ebp],dl |
2044 | 2020 | ||
2045 | add edi,3 |
2021 | add edi,3 |
2046 | add ebp,4 |
2022 | add ebp,4 |
2047 | inc [counter] |
2023 | inc [counter] |
2048 | cmp [counter],5 |
2024 | cmp [counter],5 |
2049 | jne horizontal_width_save_konture |
2025 | jne horizontal_width_save_konture |
2050 | 2026 | ||
2051 | mov ecx,[Picture_SizeX] |
2027 | mov ecx,[Picture_SizeX] |
2052 | sub ecx,5 |
2028 | sub ecx,5 |
2053 | lea ecx,[ecx+ecx*2] |
2029 | lea ecx,[ecx+ecx*2] |
2054 | add edi,ecx |
2030 | add edi,ecx |
2055 | inc [counter2] |
2031 | inc [counter2] |
2056 | cmp [counter2],5 |
2032 | cmp [counter2],5 |
2057 | jne vertical_width_save_konture |
2033 | jne vertical_width_save_konture |
2058 | pop ecx |
2034 | pop ecx |
2059 | add ebx,4 |
2035 | add ebx,4 |
2060 | dec ecx |
2036 | dec ecx |
2061 | jnz next_color_save_konture |
2037 | jnz next_color_save_konture |
2062 | 2038 | ||
2063 | ;draw calculated pixels on work arrea |
2039 | ;draw calculated pixels on work arrea |
2064 | mov ebx,[ReserveArray] |
2040 | mov ebx,[ReserveArray] |
2065 | mov ecx,[ebx] |
2041 | mov ecx,[ebx] |
2066 | mov edx,[Color] |
2042 | mov edx,[Color] |
2067 | mov esi,[Color] |
2043 | mov esi,[Color] |
2068 | shr edx,16 |
2044 | shr edx,16 |
2069 | add ebx,4 |
2045 | add ebx,4 |
2070 | mov edi,[line_width] |
2046 | mov edi,[line_width] |
2071 | dec edi |
2047 | dec edi |
2072 | imul edi,25 |
2048 | imul edi,25 |
2073 | next_pixel_put_konture: |
2049 | next_pixel_put_konture: |
2074 | 2050 | ||
2075 | mov eax,[ebx] |
2051 | mov eax,[ebx] |
2076 | push eax |
2052 | push eax |
2077 | push ecx |
2053 | push ecx |
2078 | xor ebp,ebp |
2054 | xor ebp,ebp |
2079 | and [counter2],0 |
2055 | and [counter2],0 |
2080 | 2056 | ||
2081 | vertical_width_konture: |
2057 | vertical_width_konture: |
2082 | and [counter],0 |
2058 | and [counter],0 |
2083 | 2059 | ||
2084 | horizontal_width_konture: |
2060 | horizontal_width_konture: |
2085 | xor ecx,ecx |
2061 | xor ecx,ecx |
2086 | mov cl,byte[width_pixels+edi+ebp] |
2062 | mov cl,byte[width_pixels+edi+ebp] |
2087 | test cl,cl |
2063 | test cl,cl |
2088 | jz no_draw_pixel_konture |
2064 | jz no_draw_pixel_konture |
2089 | mov [eax],si |
2065 | mov [eax],si |
2090 | mov [eax+2],dl |
2066 | mov [eax+2],dl |
2091 | no_draw_pixel_konture: |
2067 | no_draw_pixel_konture: |
2092 | add eax,3 |
2068 | add eax,3 |
2093 | inc ebp |
2069 | inc ebp |
2094 | inc [counter] |
2070 | inc [counter] |
2095 | cmp [counter],5 |
2071 | cmp [counter],5 |
2096 | jne horizontal_width_konture |
2072 | jne horizontal_width_konture |
2097 | 2073 | ||
2098 | mov ecx,[Picture_SizeX] |
2074 | mov ecx,[Picture_SizeX] |
2099 | sub ecx,5 |
2075 | sub ecx,5 |
2100 | lea ecx,[ecx+ecx*2] |
2076 | lea ecx,[ecx+ecx*2] |
2101 | add eax,ecx |
2077 | add eax,ecx |
2102 | inc [counter2] |
2078 | inc [counter2] |
2103 | cmp [counter2],5 |
2079 | cmp [counter2],5 |
2104 | jne vertical_width_konture |
2080 | jne vertical_width_konture |
2105 | 2081 | ||
2106 | pop ecx |
2082 | pop ecx |
2107 | pop eax |
2083 | pop eax |
2108 | add ebx,4 |
2084 | add ebx,4 |
2109 | dec ecx |
2085 | dec ecx |
2110 | jnz next_pixel_put_konture |
2086 | jnz next_pixel_put_konture |
2111 | 2087 | ||
2112 | mov eax,[ScreenX] |
2088 | mov eax,[ScreenX] |
2113 | mov ebx,[ScreenY] |
2089 | mov ebx,[ScreenY] |
2114 | add eax,[PosX] |
2090 | add eax,[PosX] |
2115 | add ebx,[PosY] |
2091 | add ebx,[PosY] |
2116 | mov [used_OldX],eax |
2092 | mov [used_OldX],eax |
2117 | mov [used_OldY],ebx |
2093 | mov [used_OldY],ebx |
2118 | 2094 | ||
2119 | call MovePictureToWorkScreen |
2095 | call MovePictureToWorkScreen |
2120 | 2096 | ||
2121 | jmp still |
2097 | jmp still |
2122 | 2098 | ||
2123 | no_kontur_: |
2099 | no_kontur_: |
2124 | ;************************Draw ellips*********************** |
2100 | ;************************Draw ellips*********************** |
2125 | cmp eax,19 |
2101 | cmp eax,19 |
2126 | jne no_ellips |
2102 | jne no_ellips |
2127 | 2103 | ||
2128 | mov [Last_instrument],eax |
2104 | mov [Last_instrument],eax |
2129 | 2105 | ||
2130 | mov al,[Activate_instrument] |
2106 | mov al,[Activate_instrument] |
2131 | test al,al |
2107 | test al,al |
2132 | jnz no_new_ellips_xy |
2108 | jnz no_new_ellips_xy |
2133 | mov eax,[ScreenX] |
2109 | mov eax,[ScreenX] |
2134 | mov ebx,[ScreenY] |
2110 | mov ebx,[ScreenY] |
2135 | add eax,[PosX] |
2111 | add eax,[PosX] |
2136 | add ebx,[PosY] |
2112 | add ebx,[PosY] |
2137 | mov [OldX],eax |
2113 | mov [OldX],eax |
2138 | mov [OldY],ebx |
2114 | mov [OldY],ebx |
2139 | mov [Activate_instrument],1 |
2115 | mov [Activate_instrument],1 |
2140 | mov eax,[ReserveArray] |
- | |
2141 | mov ecx,60000 |
2116 | xor eax,eax |
2142 | clear_array_ellips: |
2117 | mov ecx,mem_flood_f/4 |
2143 | mov [eax],dword 0 |
2118 | mov edi,[ReserveArray] |
2144 | add eax,4 |
- | |
2145 | dec ecx |
2119 | rep stosd |
2146 | jnz clear_array_ellips |
- | |
2147 | jmp still |
2120 | jmp still |
2148 | no_new_ellips_xy: |
2121 | no_new_ellips_xy: |
2149 | 2122 | ||
2150 | ;put saved pixels |
2123 | ;put saved pixels |
2151 | mov ebx,[ReserveArray] |
2124 | mov ebx,[ReserveArray] |
2152 | mov eax,[ebx] |
2125 | mov eax,[ebx] |
2153 | test eax,eax |
2126 | test eax,eax |
2154 | jz no_put_line_to_screen_ellips |
2127 | jz no_put_line_to_screen_ellips |
2155 | mov ecx,[ebx] |
2128 | mov ecx,[ebx] |
2156 | add ebx,4 |
2129 | add ebx,4 |
2157 | xor ebp,ebp |
2130 | xor ebp,ebp |
2158 | next_color_put_ellips: |
2131 | next_color_put_ellips: |
2159 | ;put saved pixels in ReserveArray |
2132 | ;put saved pixels in ReserveArray |
2160 | push ecx |
2133 | push ecx |
2161 | and [counter2],0 |
2134 | and [counter2],0 |
2162 | mov edi,[ebx] |
2135 | mov edi,[ebx] |
2163 | push edi |
2136 | push edi |
2164 | vertical_width_put_ellips: |
2137 | vertical_width_put_ellips: |
2165 | and [counter],0 |
2138 | and [counter],0 |
2166 | 2139 | ||
2167 | horizontal_width_put_ellips: |
2140 | horizontal_width_put_ellips: |
2168 | mov edx,[ebx+4807*4+ebp] |
2141 | mov edx,[ebx+4807*4+ebp] |
2169 | and edx,0xffffff |
2142 | and edx,0xffffff |
2170 | mov [edi],dx |
2143 | mov [edi],dx |
2171 | shr edx,16 |
2144 | shr edx,16 |
2172 | mov [edi+2],dl |
2145 | mov [edi+2],dl |
2173 | 2146 | ||
2174 | add edi,3 |
2147 | add edi,3 |
2175 | add ebp,4 |
2148 | add ebp,4 |
2176 | inc [counter] |
2149 | inc [counter] |
2177 | cmp [counter],5 |
2150 | cmp [counter],5 |
2178 | jne horizontal_width_put_ellips |
2151 | jne horizontal_width_put_ellips |
2179 | 2152 | ||
2180 | mov ecx,[Picture_SizeX] |
2153 | mov ecx,[Picture_SizeX] |
2181 | sub ecx,5 |
2154 | sub ecx,5 |
2182 | lea ecx,[ecx+ecx*2] |
2155 | lea ecx,[ecx+ecx*2] |
2183 | add edi,ecx |
2156 | add edi,ecx |
2184 | inc [counter2] |
2157 | inc [counter2] |
2185 | cmp [counter2],5 |
2158 | cmp [counter2],5 |
2186 | jne vertical_width_put_ellips |
2159 | jne vertical_width_put_ellips |
2187 | pop edi |
2160 | pop edi |
2188 | pop ecx |
2161 | pop ecx |
2189 | add ebx,4 |
2162 | add ebx,4 |
2190 | dec ecx |
2163 | dec ecx |
2191 | jnz next_color_put_ellips |
2164 | jnz next_color_put_ellips |
2192 | 2165 | ||
2193 | no_put_line_to_screen_ellips: |
2166 | no_put_line_to_screen_ellips: |
2194 | 2167 | ||
2195 | mov esi,[ScreenX] |
2168 | mov esi,[ScreenX] |
2196 | mov edi,[ScreenY] |
2169 | mov edi,[ScreenY] |
2197 | add esi,[PosX] |
2170 | add esi,[PosX] |
2198 | add edi,[PosY] |
2171 | add edi,[PosY] |
2199 | 2172 | ||
2200 | sub esi,[OldX] |
2173 | sub esi,[OldX] |
2201 | jns no_sign_x_ellips |
2174 | jns no_sign_x_ellips |
2202 | neg esi |
2175 | neg esi |
2203 | shr esi,1 |
2176 | shr esi,1 |
2204 | neg esi |
2177 | neg esi |
2205 | add esi,[OldX] |
2178 | add esi,[OldX] |
2206 | jmp no_plus_sign_x_ellips |
2179 | jmp no_plus_sign_x_ellips |
2207 | no_sign_x_ellips: |
2180 | no_sign_x_ellips: |
2208 | 2181 | ||
2209 | shr esi,1 |
2182 | shr esi,1 |
2210 | add esi,[OldX] |
2183 | add esi,[OldX] |
2211 | no_plus_sign_x_ellips: |
2184 | no_plus_sign_x_ellips: |
2212 | 2185 | ||
2213 | sub edi,[OldY] |
2186 | sub edi,[OldY] |
2214 | jns no_sign_y_ellips |
2187 | jns no_sign_y_ellips |
2215 | neg edi |
2188 | neg edi |
2216 | shr edi,1 |
2189 | shr edi,1 |
2217 | neg edi |
2190 | neg edi |
2218 | add edi,[OldY] |
2191 | add edi,[OldY] |
2219 | jmp no_plus_sign_y_ellips |
2192 | jmp no_plus_sign_y_ellips |
2220 | no_sign_y_ellips: |
2193 | no_sign_y_ellips: |
2221 | 2194 | ||
2222 | shr edi,1 |
2195 | shr edi,1 |
2223 | add edi,[OldY] |
2196 | add edi,[OldY] |
2224 | no_plus_sign_y_ellips: |
2197 | no_plus_sign_y_ellips: |
2225 | 2198 | ||
2226 | mov [x],esi |
2199 | mov [x],esi |
2227 | mov [y],edi |
2200 | mov [y],edi |
2228 | 2201 | ||
2229 | mov esi,[ScreenX] |
2202 | mov esi,[ScreenX] |
2230 | mov edi,[ScreenY] |
2203 | mov edi,[ScreenY] |
2231 | add esi,[PosX] |
2204 | add esi,[PosX] |
2232 | add edi,[PosY] |
2205 | add edi,[PosY] |
2233 | 2206 | ||
2234 | sub esi,[OldX] |
2207 | sub esi,[OldX] |
2235 | jns no_sign_x_ellips_r |
2208 | jns no_sign_x_ellips_r |
2236 | neg esi |
2209 | neg esi |
2237 | no_sign_x_ellips_r: |
2210 | no_sign_x_ellips_r: |
2238 | 2211 | ||
2239 | sub edi,[OldY] |
2212 | sub edi,[OldY] |
2240 | jns no_sign_y_ellips_r |
2213 | jns no_sign_y_ellips_r |
2241 | neg edi |
2214 | neg edi |
2242 | no_sign_y_ellips_r: |
2215 | no_sign_y_ellips_r: |
2243 | 2216 | ||
2244 | cmp edi,0 |
2217 | cmp edi,0 |
2245 | jnz no_null_a_ellips |
2218 | jnz no_null_a_ellips |
2246 | mov edi,1 |
2219 | mov edi,1 |
2247 | no_null_a_ellips: |
2220 | no_null_a_ellips: |
2248 | 2221 | ||
2249 | shr esi,1 |
2222 | shr esi,1 |
2250 | shr edi,1 |
2223 | shr edi,1 |
2251 | mov [a_ellips],esi |
2224 | mov [a_ellips],esi |
2252 | mov [b_ellips],edi |
2225 | mov [b_ellips],edi |
2253 | 2226 | ||
2254 | mov edi,[x] |
2227 | mov edi,[x] |
2255 | mov ebp,[y] |
2228 | mov ebp,[y] |
2256 | add edi,esi |
2229 | add edi,esi |
2257 | add ebp,esi |
2230 | add ebp,esi |
2258 | 2231 | ||
2259 | mov edx,[Picture_SizeX] |
2232 | mov edx,[Picture_SizeX] |
2260 | sub edx,[line_width] |
2233 | sub edx,[line_width] |
2261 | cmp edi,edx |
2234 | cmp edi,edx |
2262 | jl no_limit_x_ellips |
2235 | jl no_limit_x_ellips |
2263 | sub edi,edx |
2236 | sub edi,edx |
2264 | sub [a_ellips],edi |
2237 | sub [a_ellips],edi |
2265 | no_limit_x_ellips: |
2238 | no_limit_x_ellips: |
2266 | 2239 | ||
2267 | mov edx,[Picture_SizeY] |
2240 | mov edx,[Picture_SizeY] |
2268 | sub edx,[line_width] |
2241 | sub edx,[line_width] |
2269 | cmp ebp,edx |
2242 | cmp ebp,edx |
2270 | jl no_limit_y_ellips |
2243 | jl no_limit_y_ellips |
2271 | sub ebp,edx |
2244 | sub ebp,edx |
2272 | sub [b_ellips],ebp |
2245 | sub [b_ellips],ebp |
2273 | no_limit_y_ellips: |
2246 | no_limit_y_ellips: |
2274 | 2247 | ||
2275 | 2248 | ||
2276 | mov edi,[x] |
2249 | mov edi,[x] |
2277 | mov ebp,[y] |
2250 | mov ebp,[y] |
2278 | 2251 | ||
2279 | sub edi,[a_ellips] |
2252 | sub edi,[a_ellips] |
2280 | jns no_minimum_x_ellips |
2253 | jns no_minimum_x_ellips |
2281 | add [a_ellips],edi |
2254 | add [a_ellips],edi |
2282 | no_minimum_x_ellips: |
2255 | no_minimum_x_ellips: |
2283 | 2256 | ||
2284 | sub ebp,[b_ellips] |
2257 | sub ebp,[b_ellips] |
2285 | jns no_minimum_y_ellips |
2258 | jns no_minimum_y_ellips |
2286 | add [b_ellips],ebp |
2259 | add [b_ellips],ebp |
2287 | no_minimum_y_ellips: |
2260 | no_minimum_y_ellips: |
2288 | 2261 | ||
2289 | ;calculate circle |
2262 | ;calculate circle |
2290 | mov ebx,[ReserveArray] |
2263 | mov ebx,[ReserveArray] |
2291 | add ebx,4 |
2264 | add ebx,4 |
2292 | mov eax,[PointerToPicture] |
2265 | mov eax,[PointerToPicture] |
2293 | mov ecx,[Picture_SizeX] |
2266 | mov ecx,[Picture_SizeX] |
2294 | mov edx,[x] |
2267 | mov edx,[x] |
2295 | shl edx,16 |
2268 | shl edx,16 |
2296 | add edx,[y] |
2269 | add edx,[y] |
2297 | mov esi,[a_ellips] |
2270 | mov esi,[a_ellips] |
2298 | shl esi,16 |
2271 | shl esi,16 |
2299 | add esi,[b_ellips] |
2272 | add esi,[b_ellips] |
2300 | call calculate_ellips |
2273 | call calculate_ellips |
2301 | 2274 | ||
2302 | mov [counter],eax |
2275 | mov [counter],eax |
2303 | 2276 | ||
2304 | ;save color pixels in ReserveArray |
2277 | ;save color pixels in ReserveArray |
2305 | mov eax,[counter] |
2278 | mov eax,[counter] |
2306 | mov ebx,[ReserveArray] |
2279 | mov ebx,[ReserveArray] |
2307 | mov [ebx],eax |
2280 | mov [ebx],eax |
2308 | 2281 | ||
2309 | mov ecx,[ebx] |
2282 | mov ecx,[ebx] |
2310 | add ebx,4 |
2283 | add ebx,4 |
2311 | 2284 | ||
2312 | xor ebp,ebp |
2285 | xor ebp,ebp |
2313 | next_color_save_ellips: |
2286 | next_color_save_ellips: |
2314 | ;save color of pixel in ReserveArray |
2287 | ;save color of pixel in ReserveArray |
2315 | push ecx |
2288 | push ecx |
2316 | and [counter2],0 |
2289 | and [counter2],0 |
2317 | mov edi,[ebx] |
2290 | mov edi,[ebx] |
2318 | vertical_width_save_ellips: |
2291 | vertical_width_save_ellips: |
2319 | and [counter],0 |
2292 | and [counter],0 |
2320 | 2293 | ||
2321 | horizontal_width_save_ellips: |
2294 | horizontal_width_save_ellips: |
2322 | mov eax,edi |
2295 | mov eax,edi |
2323 | mov edx,[eax] |
2296 | mov edx,[eax] |
2324 | and edx,0xffffff |
2297 | and edx,0xffffff |
2325 | mov [ebx+4807*4+ebp],dx |
2298 | mov [ebx+4807*4+ebp],dx |
2326 | shr edx,16 |
2299 | shr edx,16 |
2327 | mov [ebx+4807*4+2+ebp],dl |
2300 | mov [ebx+4807*4+2+ebp],dl |
2328 | 2301 | ||
2329 | add edi,3 |
2302 | add edi,3 |
2330 | add ebp,4 |
2303 | add ebp,4 |
2331 | inc [counter] |
2304 | inc [counter] |
2332 | cmp [counter],5 |
2305 | cmp [counter],5 |
2333 | jne horizontal_width_save_ellips |
2306 | jne horizontal_width_save_ellips |
2334 | 2307 | ||
2335 | mov ecx,[Picture_SizeX] |
2308 | mov ecx,[Picture_SizeX] |
2336 | sub ecx,5 |
2309 | sub ecx,5 |
2337 | lea ecx,[ecx+ecx*2] |
2310 | lea ecx,[ecx+ecx*2] |
2338 | add edi,ecx |
2311 | add edi,ecx |
2339 | inc [counter2] |
2312 | inc [counter2] |
2340 | cmp [counter2],5 |
2313 | cmp [counter2],5 |
2341 | jne vertical_width_save_ellips |
2314 | jne vertical_width_save_ellips |
2342 | pop ecx |
2315 | pop ecx |
2343 | add ebx,4 |
2316 | add ebx,4 |
2344 | dec ecx |
2317 | dec ecx |
2345 | jnz next_color_save_ellips |
2318 | jnz next_color_save_ellips |
2346 | 2319 | ||
2347 | ;draw calculated pixels on work arrea |
2320 | ;draw calculated pixels on work arrea |
2348 | mov ebx,[ReserveArray] |
2321 | mov ebx,[ReserveArray] |
2349 | mov ecx,[ebx] |
2322 | mov ecx,[ebx] |
2350 | mov edx,[Color] |
2323 | mov edx,[Color] |
2351 | mov esi,[Color] |
2324 | mov esi,[Color] |
2352 | shr edx,16 |
2325 | shr edx,16 |
2353 | add ebx,4 |
2326 | add ebx,4 |
2354 | mov edi,[line_width] |
2327 | mov edi,[line_width] |
2355 | dec edi |
2328 | dec edi |
2356 | imul edi,25 |
2329 | imul edi,25 |
2357 | next_pixel_put_ellips: |
2330 | next_pixel_put_ellips: |
2358 | 2331 | ||
2359 | mov eax,[ebx] |
2332 | mov eax,[ebx] |
2360 | push eax |
2333 | push eax |
2361 | push ecx |
2334 | push ecx |
2362 | xor ebp,ebp |
2335 | xor ebp,ebp |
2363 | and [counter2],0 |
2336 | and [counter2],0 |
2364 | 2337 | ||
2365 | vertical_width_ellips: |
2338 | vertical_width_ellips: |
2366 | and [counter],0 |
2339 | and [counter],0 |
2367 | 2340 | ||
2368 | horizontal_width_ellips: |
2341 | horizontal_width_ellips: |
2369 | xor ecx,ecx |
2342 | xor ecx,ecx |
2370 | mov cl,byte[width_pixels+edi+ebp] |
2343 | mov cl,byte[width_pixels+edi+ebp] |
2371 | test cl,cl |
2344 | test cl,cl |
2372 | jz no_draw_pixel_ellips |
2345 | jz no_draw_pixel_ellips |
2373 | mov [eax],si |
2346 | mov [eax],si |
2374 | mov [eax+2],dl |
2347 | mov [eax+2],dl |
2375 | no_draw_pixel_ellips: |
2348 | no_draw_pixel_ellips: |
2376 | add eax,3 |
2349 | add eax,3 |
2377 | inc ebp |
2350 | inc ebp |
2378 | inc [counter] |
2351 | inc [counter] |
2379 | cmp [counter],5 |
2352 | cmp [counter],5 |
2380 | jne horizontal_width_ellips |
2353 | jne horizontal_width_ellips |
2381 | 2354 | ||
2382 | mov ecx,[Picture_SizeX] |
2355 | mov ecx,[Picture_SizeX] |
2383 | sub ecx,5 |
2356 | sub ecx,5 |
2384 | lea ecx,[ecx+ecx*2] |
2357 | lea ecx,[ecx+ecx*2] |
2385 | add eax,ecx |
2358 | add eax,ecx |
2386 | inc [counter2] |
2359 | inc [counter2] |
2387 | cmp [counter2],5 |
2360 | cmp [counter2],5 |
2388 | jne vertical_width_ellips |
2361 | jne vertical_width_ellips |
2389 | 2362 | ||
2390 | pop ecx |
2363 | pop ecx |
2391 | pop eax |
2364 | pop eax |
2392 | add ebx,4 |
2365 | add ebx,4 |
2393 | dec ecx |
2366 | dec ecx |
2394 | jnz next_pixel_put_ellips |
2367 | jnz next_pixel_put_ellips |
2395 | 2368 | ||
2396 | call MovePictureToWorkScreen |
2369 | call MovePictureToWorkScreen |
2397 | jmp still |
2370 | jmp still |
2398 | no_ellips: |
2371 | no_ellips: |
2399 | 2372 | ||
2400 | 2373 | ||
2401 | jmp still |
2374 | jmp still |
2402 | ret----->-----> |
2375 | ret----->-----> |