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